Page 1 of 1

Links for entries without category on sidebar

Posted: Fri Jul 25, 2008 12:48 pm
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!

Re: Links for entries without category on sidebar

Posted: Fri Jul 25, 2008 1:16 pm
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