Page 1 of 1

Fetching Entry titles from category

Posted: Tue Feb 24, 2009 9:44 am
by lordcoffee
Hi and Good morning!

I'm porting a new WP-Theme (magazeen) to s9y and I need some features wich I don't know how to realize.

I need to fetch the last 3 entries of the same category from an entry inside entries.tpl. The result should be (watch the demo) a dropdown with the latest entries of the same category. Is that possible?

Thaks for any help!
Greetings, Lordcoffee

Re: Fetching Entry titles from category

Posted: Tue Feb 24, 2009 10:02 am
by garvinhicking
Hi!

Yeah, that's possible by accessing the Smarty API, use the {serendipity_fetchPrintEntries} smarty function (see s9y.org for documentation) and specify the category parameter. I believe other magazine template like Mimbo also make use of this, so you could have a look?

Regards,
Garvin

Re: Fetching Entry titles from category

Posted: Tue Feb 24, 2009 11:47 am
by lordcoffee
Thanks!

One small problem left. I'm using this code:

Code: Select all

{serendipity_fetchPrintEntries category="2" full=false fetchDrafts=false noSticky=true limit="0,3" template="entries_titles.tpl"}
I want to fetch the category id automatic with this:

Code: Select all

{$entry_category.categoryid}
But when I just insert it, it results in an empty page:

Code: Select all

{serendipity_fetchPrintEntries category="{$entry_category.categoryid}" full=false fetchDrafts=false noSticky=true limit="0,3" template="entries_titles.tpl"}
I know that I've made something wrong but I can't figure out how to handl this.

Thanks in advance,
lordcoffee

EDIT:
Sorry, found the problem. Now I'm using:

Code: Select all

{serendipity_fetchPrintEntries category=$entry_category.categoryid full=false fetchDrafts=false noSticky=true limit="0,3" template="entries_titles.tpl"}
and it works like a charm ;-)