|extraire_attribut

The |extraire_attribut{attribute_name} filter (since SPIP 1.8.2) is used to retrieve the value of a specific attribute from an HTML tag.

For example:
Suppose that the #LOGO_SITE_SPIP tag (documentation here) generates the HTML code: <img width="353" height="120" style="height: 120px; width: 353px;" class="spip_logos" alt="SPIP" src="local/cache-vignettes/L353xH120/siteon0-1de24.jpg"/>,

In that case:

  • [(#LOGO_SITE_SPIP||extraire_attribut{src})] will return local/cache-vignettes/L353xH120/siteon0-1de24.jpg
  • [(#LOGO_SITE_SPIP||extraire_attribut{width})] will return 353
  • [(#LOGO_SITE_SPIP||extraire_attribut{style})] will return height: 120px; width: 353px;

Author Mark Published : Updated : 26/10/12

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