On Sat, Oct 18, 2008 at 6:25 PM, alinome.net <[EMAIL PROTECTED]> wrote:
>
> I'm porting a simple pseudo blog section. The page hierarchy is:
>
> news.yyyy.mmdd
>
> where "yyyy" is the year and "mmdd", month and day, is the page name
> of every individual new.
>
> It's easy to include into "news.2008" all that year news:
>
> [(search group=news.2008.* template="new")]
>
> The template includes the pages content in a blog-like way. It works
> fine. But I need to include in the root page, "news", the most recent
> news from all years. I have to get all "news.*.page" (third level
> pages) without getting also "news.*" (second level) because If I
> included the second level pages, they would include again all the news
> of that year.
>
> These tries didn't work:
>
> [(search group=news.*.* template="new" count=10)]
> [(search group=news.*.* exclude=news.* template="new" count=10)]
> [(search group=news.* exclude=news.* template="new" count=10)]
>
> Of course I can exclude the individual pages:
>
> [(search group=news.* exclude=news.2005,news.2006,news.2007,news.2008
> template="new" count=10)]
>
> But then the code has to be updated every year and I'd rather a
> maintenance free solution.
>
> Another solution could be to mark those pages with a special data
> field by modifying action.create to make it automatically, and
> excluding them with the "data" parameter in the search, but it would
> be a complex solution for a simple problem.
>
> Then I had a better idea: to put a simple condition around the
> template:
>
> [if equal {+:p0} 3]
> ...my template...
> [if]
>
> It works! And it's maintenance free [:-)].
>
> Anyway, is it possible to achieve the same in the search itself?

Yep.  Try

[(search group=news.2008.* template="new" if="equal {+p0} 3")]

You can use any conditional in a search template and it's faster.

Cheers,
Dan

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"BoltWire" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/boltwire?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to