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] [vi] [zh] Espace de traduction

Download

|extraire_balise

July 2010 — updated on : June 2010

All the versions of this article:


The |extraire_balise{tag_name} filter is used to retrieve the first HTML tag with the name "tag_name" found within the the HTML source generated by the tag to which it is applied.

Example:
We are syndicating a photo blog site which systematically distributes a small commentary followed by a photograph. This photograph is included as an HTML <img src="... /> type tag. Once we have syndicated the blog on our site, we can choose to only display the photo, without the accompanying commentary using this code: [(#DESCRIPTIF|extraire_balise{img})]

Starting from there, many other possibilities arise:

  • display the URL for the image:
    [(#DESCRIPTIF|extraire_balise{img}|extraire_attribut{src})]
  • display the width of the image:
    [(#DESCRIPTIF|extraire_balise{img}|extraire_attribut{width})]
  • assign a particular styling to the image:
    [(#DESCRIPTIF|extraire_balise{img}|inserer_attribut{style, border: double red 4px})]

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