SPIP

[ar] [ast] [bg] [br] [ca] [co] [cpf] [cs] [da] [de] [en] [eo] [es] [eu] [fa] [fon] [fr] [gl] [id] [it] [ja] [lb] [nl] [oc] [pl] [pt] [ro] [ru] [sk] [sv] [tr] [uk] [vi] [zh] Espace de traduction

Download

#SELF

July 2010 — updated on : June 2010

All the versions of this article:

#SELF returns the URL of the called page, cleaned of any variables specific to running SPIP.


#SELF (since SPIP 1.8, 1.8.1) returns the URL for the current page. Any variables specific to running SPIP (e.g. var_mode) are deleted.

Example: for a page with the URL: spip.php?article25&var_mode=recalcul, the #SELF tag inserted into article.html will return spip.php?article25.

Usages

-  Certain form tags accept a parameter to specify what page the visitor should be redirected to after having completed the form. #SELF can then be used so that it returns back to the current page. Example: [(#FORMULAIRE_FORUM{#SELF})]

-  Using the |parametre_url filter to add variables to the URL of the current page. Example: [(#SELF|parametre_url{'id_mot','3'})] adds id_mot=3 to the current URL. See |parametre_url for more details.

-  #SELF is used in forms so that the user returns back to the current page after validating the form:

<form action="#SELF">
[(#SELF|form_hidden)]
...
</form>

The |form_hidden ( SPIP 1.9) filter calculates the hidden fields of the form based on the arguments of #SELF. See |form_hidden.

#SELF used in included template files

Whenever one of the parameters of the page’s URL must be retrieved from an included template file, #SELF needs to be added as a parameter to the INCLURE. This will create a different cache for the included template file for each URL [1].
-  <INCLURE{fond=my_template}{self=#SELF}>
-  <INCLURE{fond=my_template}{self}>
-  <INCLURE{fond=my_template}{env}>

This {self=#SELF} parameter must also be passed to an INCLURE when you want to use the #PAGINATION tag in an included template file, given as the included file relies on the self function to retrieve the value of the debut_... variable.

Footnotes

[1This constitutes a security mechanism against potential XSS attacks.


Show the template of this page Site powered by SPIP | Translation area | Private area