[(search group=item if="inlist {p2} {info.categories::{+p}}"
template="title")]
for every page in group 'item', if the second part of the current
pagename is in the cvs list '{info.categories::{+p}}', apply the
template "title".
'title' is a built in template
{info.categories::{+p}}
is a page-variable. See documentation and example below.
Let us have the following pages:
category.fruit
category.mammals
item.dog <empty>
item.cat <empty>
item.apple <empty>
item.pear <empty>
info.categories
<code>
item.dog: mammals
item.cat: mammals
item.apple: fruit
item.pear: fruit
</code>
if you open the page categories.fruit, the search function will find
all the item pages, and find that:
'fruit' is not inlist info.categories::item.dog
'fruit' is not inlist info.categories::item.cat
'fruit' is inlist info.categories::item.apple
'fruit' is inlist info.categories::item.pear
and will thus return 'item.apple,item.pear' formatted with template
'title'.
On May 18, 10:39 am, Allister Jenks <[email protected]> wrote:
> OK, this gives me a lot to get going with! Should take me a while.
>
> As a first step, I'm looking at the below with a coder's eye and have added
> where I think I see what it's doing. This without looking at much
> documentation yet to fully understand the syntax.
>
>
>
> On Mon, May 18, 2009 at 04:01, The Editor <[email protected]> wrote:
>
> > 1) Create a page called action.storeitem with content like this:
>
> > [if equal {p1} item] > if the first element of the page name is "item".
> > [form]
> > name: [text title "{:title}"] > "title" is the field on this page,
> > ":title" is the infovar, which populates the field here.
> > price: [text price "{:price}"] > ditto.
> > size: [text size "{:size}"] > ditto.
> > categories: [text categories "{info.categories::{p}}"] > I can't figure
> > this one out.
> > description:
> > [box content][(source {p})][box] > gets the description from the page
> > content.
> > [submit] > button.
> > [session savedata name,price,size] > saves the three fields as info vars.
> > [session edit {=content}] > sets the page text to the value of the content
> > box, so it shows when viewing page.
> > [session info "field={p} value='{=categories}' target=info.categories"] >
> > this is the other half of the bit I don't get.
> > [form]
> > [else]
> > <(search group=item template=[[{+p}&action=storeitem|{+:name}]])> > lists
> > valid pages to run storeitem against if this isn't one.
> > [if]
>
> > 2) Put this on item.footer:
>
> > [if admin][[{p}&action=storeitem|EDIT]][if] > put storeitem action on page
> > for admins.
>
> > To create a new item, just create a blank page item.1231231
>
> > > 2) How to deal with multiple categories?
>
> > 3) Put this on categories.header (or footer).
>
> > [(search group=item if="inlist {p2} {info.categories::{+p}}"
> > template="title")] > searches item.* pages using that syntax I don't get
> > again. Looks for second part of page name (category name) in each
> > item.page's categories.
>
> > This will generate a list of all the pages that have the category.
> > Note your categories should be saved as a csv list, if there are more
> > than one, like
> > cars,clothes,food. You will also want to create a custom template
> > based on how you want to display the pages. You will want to also
>
> > 4) Create a blank page for each category (categories.car,
> > categories.clothes). To generate a list of all available categories,
> > just do [(search group=categories)]
>
> So there's predominantly one bit I don't get:
>
> info.cateogories in three of the lines above, plus the other syntax used
> around it.
>
> --
> Allister
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---