fetchPrintEntries - skip?

Skinning and designing Serendipity (CSS, HTML, Smarty)
Post Reply
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

fetchPrintEntries - skip?

Post by yellowled »

For an individual start page I need to pull:

a) the latest entry from a selected category (I know how to do that)
b) the latest entry from any category but that selected category

I seem to remember serendipity_fetchPrintEntries getting some kind of "skip" option to realize this, but I can't find it in either the documentation or the forums. Did I dream this or do we actually have it? (A hint on which s9y version implemented this would also be very welcome.)

YL
onli
Regular
Posts: 2828
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: fetchPrintEntries - skip?

Post by onli »

Hi
Don't know if thats' the easiest way, but serendipity_fetchEntries (which get called by the smarty-function) has a $filter_sql-parameter. With that, you can specifiy a WHERE in sql like you want it, excluding a category somewhat like "ec.categoryid <> x", where x is the category to be excluded.
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Re: fetchPrintEntries - skip?

Post by Don Chambers »

Yes, serendipity_fetchPrintEntries also has an optional parameter filter_sql="$filter", so you could do something like:

Code: Select all

{assign var=filter value="e.category <> `x`"}
{serendipity_fetchPrintEntries limit="0,1" filter_sql="$filter"}
Not sure I have that perfect, but perhaps someone better informed will come along fine tune it.
=Don=
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: fetchPrintEntries - skip?

Post by yellowled »

Thanks guys. Works like a charm after combining your codes into one "best-of-both-worlds" code :wink:

Code: Select all

{assign var=filter value="ec.categoryid <> `$template_option.specialcat`"}
{serendipity_fetchPrintEntries full=true fetchDrafts=false noSticky=true limit="0,1" filter_sql="$filter" template="teaser.tpl"}
$template_option.specialcat needs to be selected using a theme option.

YL
Post Reply