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 returnlocal/cache-vignettes/L353xH120/siteon0-1de24.jpg
-
[(#LOGO_SITE_SPIP||extraire_attribut{width})]
will return353
-
[(#LOGO_SITE_SPIP||extraire_attribut{style})]
will returnheight: 120px; width: 353px;