Links for entries without category on sidebar

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
medienluemmel
Posts: 4
Joined: Fri Jul 25, 2008 12:36 pm

Links for entries without category on sidebar

Post by medienluemmel »

On my site I have about five entries with additional informations about the site/blog - all those entries do not belong to any category.

Now: Is it possible to show up a menu on the sidebar containing links to those entries? If I do this by hand in the sidebar.tpl this would look like:

Code: Select all

<h3>Information</h3>
<ul>
<li><a href="/linktopage1.html" title="Page 1">Page 1</a></li>
<li><a href="/linktopage2.html" title="Page 2">Page 2</a></li>
<li><a href="/linktopage3.html" title="Page 3">Page 3</a></li>
<li><a href="/linktopage4.html" title="Page 4">Page 4</a></li>
</ul>
Is there a way to automize this by smarty code?

Thanks for any help!
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Links for entries without category on sidebar

Post by garvinhicking »

Hi!

You can do that with smarty, but first you need PHP code that fetches those entries. To do that, you need the SQL code to get those entry that do not have categories.

So if you know your PHP, you can easily create the SQL join on the entrycat table and fetch all entries that do not have an association, and then prepare an array with those entries which you pass on to smarty by a custom smarty function that you can register in your template's config.inc.php file or through a custom s9y event plugin.

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply