|
Cookbook /
AuxSelectSummary: Dropdown widget that persists its selected value between pages
Version: 1.1.0
Prerequisites: PmWiki 2.2.0-beta27
Status: Stable
Maintainer: Marc Cooper -> mailto:gmane [snail] auxbuss [period] com
Categories:
Questions answered by this recipeHow do I allow a casual browser to make a selection on my site that persists from page to page? How do I allow my site visitors to select their currency, so that I can display prices in that currency? DescriptionThis 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 value. 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. To install
To use
Example:
(:auxSelect currency currencies default=GBP text='Currency: '
submittext='set' id=changecurrency:)
Additional featuresAuxSelectDataYou can populate an AuxSelect array via markup: (:auxselectdata arrayname [value1 [value2 ...]] :) e.g. (:auxselectdata somearray fred barney 'dino dog':) and immediately use it: (:auxselect test somearray text='Somearray: ':)
For security reasons, you cannot overwrite an array with NotesTo use the selected value within conditional markup, you can exploit the HttpVariables recipe, thus:
(: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:)
Note that a dropdown can be applied site-wide via the skin within its <div style='float:right;'>
<!--markup:(:auxSelect currency currencies
default=GBP text='Currency: ' -->
</div>
You can display a session variable on a page via the HttpVariables recipe. For example: {$~currency}
Release Notes
CommentsSee AlsoContributorsMarc Cooper -> mailto:gmane [snail] auxbuss [period] com User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki. |