You got this just about right. Two things...  I use title instead of name
because it shows up in special cases, like [[some.page|+]] and breadcrumbs,
etc.
Second thing is title, price, and size are stored as DATA vars. Categories
is stored as an INFO var. Data vars are stored on the same page as the
content, but it is invisible when editing. When doing a long search though,
it requires BoltWire to open and parse large amounts of data (in the index,
actually, but it's still a lot...). Info vars are special info pages (in
this case info.categories) and the data is store as simple text vars (like
PmWiki's PTV's). It's great for data you need to retrieve quickly and search
or sort. Because only one relatively small page needs to be read and
retrieved. More notes below...

On Mon, May 18, 2009 at 4: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.
>>
>
(data vars, not info vars)


> price: [text price "{:price}"] > ditto.
>> size: [text size "{:size}"] > ditto.
>> categories: [text categories "{info.categories::{p}}"] > I can't figure
>> this one out.
>>
>
This retrieves the text var (PTV) on page info.categories that corresponds
with the current page. Essentially the list of categories.


> 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.
>
>
Data 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.
>>
>
This saves the value you entered into the category field {=categories) onto
page info.categories, with the label of the current page. That is, it adds a
new line, or updates an existing line on that page something like:

item.12321: my,categories,here


> [form]
>> [else]
>> <(search group=item template=[[{+p}&action=storeitem|{+:name}]])> > lists
>> valid pages to run storeitem against if this isn't one.
>>
>
Right, so go to action.storeitem, and it will list all item. Click one, and
then it brings up the action form for that page. Kind of cool...  The idea
came to me as I was typing up the email. I'll need to remember that trick.
Double use for an action.

[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 generates a list of all the pages in group item. To get grandchild
pages, etc., change it to item*, otherwise it's just second level kids. Then
it runs each of those pages through a quick check using the conditional
engine.  Remember, you are on page  categories.clothes. So it checks to see
if clothes {p2} is in the info var (PTV) on info vars for the current page
in the pagelist {+p}. If it is it returns the title of the page. You'll
change the template of course.

Read the documentation tutorial page on var's for details about the
distinctions between the syntax of system, data, and info vars.  (On the
BoltWire site). The + in the {var} mean it's relative to the current page in
the search list, rather than the actual page the search function is on.  I
can't remember the exact parallels in PmWiki.

>
>>
>> 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.
>
> Yeah, it's pretty easy to get the hang of things. The syntax is generally
simpler than PmWiki. Just get a grasp of the different kinds of variables
and your all set to go.

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