Parameters are generally transferred directly in a URL or sent to a server by means of forms. If we need to pass some parameters with their value in every link or form, it would be necessary to add these parameters manually for each link or form within the Web site. Automatic parameters are available in Visual PHP™ just for these situations. On entering the name of a parameter into automatic parameters, the system itself will add it, if it has some value, to all links and forms leading to the proper presentation.
Default Automatic Parameters
Some parameters are already set as automatic in Visual PHP™. Here is their specification:
| style |
The parameter that determines the name of the CSS style (Presentation -> Styles) that will be used for a page. |
| sid |
A session identifier (it is added in an URL only if the browser does not allow cookies and is not transferred for browser robots at the same time). |
| language |
The identifier of a page language. |
| blindFriendly |
An automatically optimized page output for the visually impaired. |
You can add your own parameters to these default ones by means of automatic parameters.
Adding an Automatic Parameter
- Go to the Presentation -> Automatic Parameters menu and create a new one.
- Enter the name of this parameter (e.g. MyParameter) and save.
Activating an Automatic Parameter
Automatic parameters are only used at such moment when they have some value. To activate an automatic parameter, e.g.
MyParameter, it is necessary to create a link where this parameter will be passed together with some value. As an example, please try to enter the following URL into your browser:
http://www.domena.cz/index.php?MyParameter=MyValue
After the page is loaded, you will see that the
MyParameter parameter with the value being
MyValue has been added to all links leading to your presentation. The original link to the display of a list of news:
news.php
will be changed to:
news.php?MyParameter=MyValue
The link to the display of a particular piece of news:
news.php?id=25c60074-5c6b-102d-98e9-00e0814daf34
will be changed to:
news.php?MyParameter=MyValue&id=25c60074-5c6b-102d-98e9-00e0814daf34
Changing an Automatic Parameter Value
A value can be changed simply. You have only to create a link that will contain the name of this parameter with a different value. On clicking on this link, the system will add this new value – e.g.:
index.php?MyParameter=DifferentValue
Deactivating Passing an Automatic Parameter
To deactivate passing an automatic parameter, it is necessary to create a link so that the value of this parameter is empty. The system will change this link so that it removes the parameter completely from it and on clicking on this link it does not pass this parameter any more – e.g.:
index.php?MyParameter=
or
news.php?MyParameter=&id=25c60074-5c6b-102d-98e9-00e0814daf34
A Typical Use of Automatic Parameters
Automatic parameters can be used to display Sub-websites, for example, where we only display a page with links leading to individual Sub-websites on the initial page. Displaying these Sub-websites can be solved by means of conditions in layouts and templates in the system. For the parameter named
subWeb, links on an initial page would be e.g. as follows:
index.php?subWeb=web1
index.php?subWeb=web2
index.php?subWeb=web3
and individual layouts and templates would be distinguished by the conditions:
$subWeb == "web1"
$subWeb == "web2"
$subWeb == "web3"