paramStash Icon

paramStash

By Corey Hinshaw (electrickite)

paramStash first screenshot

Usage

The package will install a plugin set to trigger when initializing a web page. By default, this will place any URL parameters in the current query string into an array in the user session. Each parameter in the stash will persist for a specified lifetime, by default for one hour. If the value for a parameter in the query string is different than the value in the stash, the stash will be updated to reflect the new value and the lifetime for that parameter will be reset.

Two system settings control the behavior of the plugin:

  • paramstash.params: A comma separated list of paramters to allow in the stash. Default: all paramters (except 'q') will be stored.
  • paramstash.lifetime: The amount of time (in seconds) a parameter will remain in the stash. Default: 3600
  • paramstash.case_sensitive: Determines if parameter names are case sensitive. If true, 'Foo' and 'foo' will be treated as distinct parameters. Default: Yes

To retrieve parameters from the stash, use the paramStash snippet. [[!paramStash]] will return everything in the stash in key=value format. If mulltiple paramters are stashed, they are separated by an ampersand. paramStash has the following options:

  • params: A comma separated list of paramters to fetch. If no paramters are specified, they are all retrieved. Default: all parameters
  • separator: If set, a URL query string separator (?) will be prepended to the snippet output. Default: 0
  • valueOnly: Only return the parameter values, do not display names. Default: 0
  • pre: If set, an ampersand will be prepended to the snippet output if any parameters are returned. Default: 0
  • post: If set, an ampersand will be appended to the snippet output if any parameters are returned. Default: 0

Examples

URL: http://example.com/about.html?foo=bar&baz=boo

[[!paramStash]] returns foo=bar&baz=boo

[[!paramStash? params=`foo` &separator=`1`]] returns ?foo=bar

[[!paramStash? params=`foo` &valueOnly=`1`]] returns bar

[[!paramStash? &post=`1`]] returns foo=bar&baz=boo&

[[!paramStash? ¶ms=`notset` &separator=`1` &post=`1`]] returns nothing

Issues?

Report any issues on GitHub: https://github.com/electrickite/paramStash

Corey Hinshaw


New in paramStash 1.3.0

paramStash 1.3.0-pl

  • Added case sensitivity option

paramStash 1.2.2-pl

  • Fix documentation errors

paramStash 1.2.1-pl

  • Bug fixes

paramStash 1.2.0

  • Added pre and post options to add ampersands to output

paramStash 1.1.0

  • Now repects requestparamalias system setting
  • Code cleanup

paramStash 1.0.0

  • First stable release

paramStash 0.1.0

  • Initial Version

More

Information

Released
November 5, 2014
Supported Versions
2.1 – Current
Downloads
1,761
License
GPLv2

More from Corey Hinshaw

Shibboleth

Adds Shibboleth authentication to MODX Revolution. Shibboleth is…

View
GeoTV

Adds several geographic template variable types to MODX Revolution.…

View