URL Parameters enable pages to capture and utilize parameters set dynamically in their URLs.
URL Parameters are parameters whose values are set dynamically in a page’s URL, and can be accessed by its template and its data sources. This makes pages incredibly dynamic, enabling a single page to power an endless number of views.
This very page, for example, sets a parameter in the last bit of its URL (url-parameters
), which is then used to filter a data source that fetches the appropriate entry from the “Concepts” section. Every individual Concept view on this site is thus powered by a single page.
URL Parameters are defined in the admin interface, using the page editor (Blueprints > Pages > New
or Blueprints > Pages > {Page Title}
). Any number of URL parameters may be entered in the “URL Parameters” field, referenced by name and separated by forward slashes:
param1/param2/param3
Parameter values are set dynamically when the page is called with additional values in its URL:
http://yoursite.com/yourpage/value1/value2/value3
Within the context of that page, the parameters are then available to be used like any other parameter. See Parameters, Usage for details.
Symphony will add GET parameters to a page's parameter pool as well, though they are given a prefix. Appending ?greeting=hello
to a page's URL will add a parameter called $url-greeting
to the parameter pool, with a value of 'hello'.
Note that subpage handles will override URL parameters, so in the example above, if a subpage of yourpage
were created and given the URL handle page2
, Symphony would interpret http://symphony.demo/yourpage/page2
as a request for the subpage, and not as an assignment of the string page2
to the URL parameter param1
.
URL parameters are sanitized when they're pulled into the system. Spaces, for instance, are replaced with plus signs (and not trimmed, so consecutive spaces will result in multiple plus signs). Also, case is preserved.
URL parameters are an integral part of building dynamic interfaces with Symphony.