|extraire_balise

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.

  • New in : SPIP 1.8.2

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})]

Author Mark Published : Updated : 22/07/23

Translations : català, English, Español, français, Nederlands