Fetching Entry titles from category

Skinning and designing Serendipity (CSS, HTML, Smarty)
Post Reply
lordcoffee
Regular
Posts: 308
Joined: Tue Nov 29, 2005 10:22 pm
Location: Munich - Germany
Contact:

Fetching Entry titles from category

Post 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
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Fetching Entry titles from category

Post 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
# 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/
lordcoffee
Regular
Posts: 308
Joined: Tue Nov 29, 2005 10:22 pm
Location: Munich - Germany
Contact:

Re: Fetching Entry titles from category

Post 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 ;-)
Post Reply