[pmwiki-users] how to pass values to edit template?

Tegan Dowling tmdowling at gmail.com
Sat Mar 10 09:32:48 CST 2007


On 3/10/07, Petko Yotov <5ko at free.fr> wrote:
> On Saturday 10 March 2007 12:08, SteP wrote:
> > Is there a way to pass values to an edit template?
> >
> > What I have in mind is something like (I made up the syntax), say that
> > EditTemplate includes
> >
> > field:{$$Value}
> >
> > then n=NewPage?action=edit?template=Group.EditTemplate?field=This would
> > open NewPage in edit mode with
> >
> > field:This
> >
> > I'm not attached to the above syntax, I'm just looking for a simple way to
> > expand values in edit templates, if there's a way.
>
> You can use my modified version of NewPageBoxPlus:
>
> http://galleries.accent-bg.com/pub/newpageboxplus.txt
>
> It is more difficult to create a form, but after this, it is much more easier
> and flexible to create new pages.
>
> A typical form will be:
>
> (:input form "{$PageUrl}":)(:input hidden n {$FullName}:)
> (:input hidden action new:)(:input hidden save true:)
> (:input hidden template Main.Template:)
> : Group : (:input select base SvilenEnev.SvilenEnev label="Svilen Enev":)
> (:input select base SergeEgikyan.SergeEgikyan label="Serge Egikyan":)
> (:input select base PetkoYotov.PetkoYotov label="Petko Yotov":)
> : Page name : (:input text name:)
> : Description : (:input text description:)
> (:input submit ok "Create new page":)
> (:input end:)
>
>
> Here is the template Main.Template:
>
> (:title {name}:)
> Here you can see some photos from {name}, taken by {$Groupspaced}.
>
> {description}
> (:thumblist:)
>
>
> You have here two expanded fields {name} and {description}, but you can have
> any number, and even arrays:
> (:input checkbox "category[]" "[[!Home]]":) Home
> (:input checkbox "category[]" "[[!Office]]":) Office
>
> The "{category}" string from the template will be expanded to
> "[[!Home]], [[!Office]]" if both are checked (comma-separated).
>
> You can have any "field" in the create form, to expand it, the template must
> have a string "{field}" (only latin letters, numbers and _). You can escape
> variables or things in curly brackets by writing {field\} which will be
> printed in the page {field} and not expanded.
>
> The "input hidden save true", and what is before it, are required; other are
> customizable.
>
> I am using this for some months now and it works for me. I sent these
> modifications to the recipe author November 14-15 2006 but as he did not
> implement them, I believe he didn't like them much or didn't find them as
> usefull as I did.
>
> If you find it usefull, tell me.
>
> There is also the beta version of the recipe AddDeleteLine2 that can achieve
> similar things.
>
> Cheers,
> Petko

Could you create a new recipe page for this -
"NewPageBoxPlus-GalleryTemplate" (or whatever name would be accurate)?
 Maybe link to it in the "See also:" section of the  NewPageBoxPlus
recipe page?

I don't "read" any programming language very easily - even PmWiki's,
so screenshots or links to pages where something is being used, with
annotation, make a huge difference in my understanding of what a
recipe is and does.

Thanks!



More information about the pmwiki-users mailing list