Page 1 of 1

fetchPrintEntries - skip?

Posted: Sat May 01, 2010 1:53 pm
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

Re: fetchPrintEntries - skip?

Posted: Sat May 01, 2010 2:25 pm
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.

Re: fetchPrintEntries - skip?

Posted: Sun May 02, 2010 11:52 pm
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.

Re: fetchPrintEntries - skip?

Posted: Mon May 03, 2010 1:11 pm
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