--- marc <[EMAIL PROTECTED]> wrote:
> marc said...
> > Dropdown widget that persists its selected value
> between pages
> >
> > http://www.pmwiki.org/wiki/Cookbook/AuxSelect
> >
> > This recipe allows you to create a dropdown form
> that is populated with
> > values from a PHP array. The dropdown can be
> preceded by a text label.
> > The current value is set by the site visitor via a
> button; a default
> > value can be set by the admin. The current value
> is stored in a session
> > variable.
> >
> > In more simple language: it's easy to create a
> currency selector with
> > this recipe. For example:
> >
> > $AuxSelectData['currencies'] =
> array('EUR','GBP','USD');
> > (:auxSelect currency currencies default=GBP
> text='Currency: ':)
> >
> > It might be useful to extend this recipe to
> provide some conditional
> > markup for use within a page. I'm happy to do that
> if folk think it will
> > be useful.
>
> In fact, by using the httpvariables.php recipes, the
> conditional markup
> is already available.
>
> Using the previous example:
>
> In config.php
>
> $AuxSelectData['currencies'] =
> array('EUR','GBP','USD');
>
> In page:
>
> (:auxSelect currency currencies default=GBP
> text='Currency: ':)
> (:if equal {$~currency} 'EUR':)fred(:if:)
> (:if equal {$~currency} 'GBP':)barney(:if:)
> (:if equal {$~currency} 'USD':)dino(:if:)
It seems like it would be possible to implement more
of this recipe with the httpvariables recipe using
(untested):
(:session currencies[] EUR:)
(:session currencies[] GBP:)
(:session currencies[] USD:)
You may need to use indexes for that to work. This
leads me to the idea of adding a new shorthand to help
set arrays with the httpvariables recipe making it
even easier? Maybe something like:
(:session currencies[] EUR GPB USD :)
Apply that to cookie assignment also. What do you
think?
Now, I think that your recipe could be implemented
with just a bunch of select statements:
(:input default currency {$~currency}:)
(:input select name=currency value={$~currencies[1]}:)
(:input select name=currency value={$~currencies[2]}:)
(:input select name=currency value={$~currencies[3]}:)
Maybe then a new form of select markup that would make
this easier would be something like:
(:input default currency {$~currency}:)
(:input selectlist name=currency
values={$~currencies[1]},{$~currencies[1]},{$~currencies[1]}:)
I could then see expanding the httpvariables recipe
again, this time to perform array expansion with a
separator so that you could now write:
(:input default currency {$~currency}:)
(:input selectlist name=currency
values={$~currencies[(,)]}:)
Not to hard to fathom is it?
-Martin
____________________________________________________________________________________
Finding fabulous fares is fun.
Let Yahoo! FareChase search your favorite travel sites to find flight and hotel
bargains.
http://farechase.yahoo.com/promo-generic-14795097
_______________________________________________
pmwiki-users mailing list
[email protected]
http://www.pmichaud.com/mailman/listinfo/pmwiki-users