• MODX.com

    3,102 downloads

paramStash

paramStash is an extra by electrickite, first released on 2014-11-05.

Package Description

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

Usage/Installation Instructions

Install using package management.

Details

Developer(s)
electrickite
Released
2014-11-05
First seen
2014-11-05
License
GPLv2
Supported databases
Minimum MODX Requirement
2.1

paramStash Releases

Vendor Signature Released on
MODX.com 1.3.0-pl 2014-11-05 (9 years ago)

We've also seen 2 unverified versions of paramStash in use, but don't list those as we've been unable of confirming they are official releases from an official source.