[pmwiki-users] horribly confused on ZAP create and pagetemplate

The Editor editor at fast.st
Mon Dec 18 03:44:51 CST 2006


Hi Brian, sorry the documentation is not as clear as I'd like.  I'll
be working on it some to try and get it updated today.  As I was also
away yesterday as I had a big graduation service at the training
school I run...

On 12/18/06, Jiri Hladůvka / OBUTEX <admin at obutex.com> wrote:
> Helo Brian,
> your command
>
> (:input text create "<Stocks>"."<{symbol}>">:)
>
> looks very strange. Try
>
> (:input hidden create "Stocks.Symbol":)
> to create Stocks.Symbol page
>
> or
>
> (:input text symbol:)
> (:input hidden create "Stocks.{$symbol}":)
> to create (in the group Stocks) a page with name you entered into the textbox

This is close.  To insert the value of one field in another however
you should write it without the dollar sign:

(:input text symbol:)
(:input hidden create "Stocks.{symbol}":)

Leaving out the $ distinguishes it from a page variable.

> May there must be something like
> (:input hidden savedata :)

When using the create command, the savedata value is not used.  If you
want to store hidden data values on the new page, you can use the
createdata command.

> Brian napsal(a):
> > My goal is to create pages with ZAP using a form and template. I
> > decided to start small by just learning to create simple pages using
> > ZAP, but failed miserably. Here is my snippet:
> >
> > My site is related to the stock market, so I want the pages to be named as a stock
> > symbol, in the group "Stocks".
> >
> > (:zapform `symbol` :)
> > (:input text create "<Stocks>"."<{symbol}>">:)
> > (:input submit value="create page":)
> > (:zapend:)

Here are a few other tips.

1) Make sure you have zap working by using something like this snippet
on a page:

(:zapform:)(:zapget:)
(:input hidden Install="Installation Successful":)
(:input hidden passdata="Install":)
(:input submit value="Test Install":) {$Install}
(:zapend:)

You should be able to click the button and it will tell you if zap is
installed properly.

2) To use the create command you must have both zap and zapfiles
installed and enabled in your config file.  zap is the main engine,
zapfiles contains the create function.  Also, if you do not have
authuser enabled, and you are not logged in, you will need to set the
page attributes to allow for form submissions on your form.

3) By default, you set up your template at Group.Name-template for
your page, but in this case you don't know what the actual create page
name will be, so you must assign a page template location.  Like this:

(:input hidden pagetemplate=Stocks.MyTemplate:)

Make sure, of course, you create that page to look however you want.
If you want to insert fields from the form into the page, use the
regular field insertion syntax, as above.  For example you might put a
line on Stocks.MyTemplate like this:

!!Stock Page for  {symbol}

When the page is created, {symbol} will be replaced with whatever you
type into that field.

4) When creating a page, you must have a lockpattern in the zapform
command for any fields in the form you submit, something more like the
following (complete snippet, I think):

(:zapform `symbol`create`pagetemplate` :)
(:input text symbol:)
(:input hidden create "Stocks.{symbol}":)
(:input hidden pagetemplate=Stocks.MyTemplate:)
(:input submit value="create page":)
(:zapend:)

I should point out, some of this is going to change in the new zap
coming out very soon. It will be mostly downward compatible, but not
completely.  The main thing I'm hoping is it will be much easier to
configure and use.

Hope this helps.

Cheers,
Dan

PS.  Thanks to everyone that helped to answer Brian's question while I was away!


More information about the pmwiki-users mailing list