Coding with SPIP 3.0
SPIP3.0 Technical Documentation

> > > > #GET

#GET

#GET{variable} is used to retrieve the value of a local variable that was stored using a #SET{variable, value}. See also #SET.

A second argument is used to return a default value if the parameter requested does not exist or if its content is empty.

  1. #GET{variable, default value}

Example

If "use_documentation" equals "yes", make it known:

  1. #SET{use_documentation,yes}
  2. [(#GET{use_documentation}|=={yes}|oui)
  3. We use documentation!
  4. ]

Download

Display a link to the site’s home page over an image called "my_logo.png" if there is one, otherwise use "logo.png", otherwise use the site logo:

  1. [(#SET{image,[(#CHEMIN{my_logo.png}
  2. |sinon{#CHEMIN{logo.png}}
  3. |sinon{#LOGO_SITE_SPIP})]})]
  4. [<a href="#URL_SITE_SPIP/">(#GET{image}
  5. |image_reduire{100})</a>]

Download

Differentiate the absence of an element in the environment: define #ENV{default} as a default value when #ENV{activer} does not exist. To do this, the is_null filter allows us to test that #ENV{activer} is not defined. If #ENV{activer} exists but is empty, it will be used. We can thereby differentiate the case of sending an empty value into a form, as shown below when the value sent is that of the "champ_activer_non" input field

  1. [(#SET{valeur,[(#ENV{activer}
  2. |is_null|?{#ENV{defaut},#ENV{activer}})]})]
  3.  
  4. <input type="radio" name="activer" id="champ_activer_oui"[ (#GET{valeur}|oui)checked='checked'] value='on' />
  5. <label for="champ_activer_oui"><:item_yes:></label>
  6.  
  7. <input type="radio" name="activer" id="champ_activer_non"[ (#GET{valeur}|non)checked='checked'] value='' />
  8. <label for="champ_activer_non"><:item_no:></label>

Download

  • Author :
  • Published :
  • Updated : 11/06/10
  • Translations : English, français