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
fetchPrintEntries - skip?
Re: fetchPrintEntries - skip?
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'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.
-
- Regular
- Posts: 3652
- Joined: Mon Feb 13, 2006 2:40 am
- Location: Chicago, IL, USA
- Contact:
Re: fetchPrintEntries - skip?
Yes, serendipity_fetchPrintEntries also has an optional parameter filter_sql="$filter", so you could do something like:
Not sure I have that perfect, but perhaps someone better informed will come along fine tune it.
Code: Select all
{assign var=filter value="e.category <> `x`"}
{serendipity_fetchPrintEntries limit="0,1" filter_sql="$filter"}
=Don=
Re: fetchPrintEntries - skip?
Thanks guys. Works like a charm after combining your codes into one "best-of-both-worlds" code
$template_option.specialcat needs to be selected using a theme option.
YL
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"}
YL