Version 13: CSS Datenkommentare

24. Apr 2018

Über Datenkommentare lässt sich nun im CSS auch umfangreiches JavaScript oder HTML speichern, auf das dann über PHP zugegriffen werden kann.

Über Datenkommentare lässt sich nun im CSS auch umfangreiches JavaScript oder HTML speichern, auf das dann über PHP zugegriffen werden kann.

Definition eine Datenkommentars mit dem Namen data-html innerhalb einer CSS-Variante

/*@wProperty:data-html;
<div itemscope="itemscope" itemtype="http://schema.org/[!--addresstype--]">
  <div itemprop="name">[!--name--]</div>
  <div itemprop="streetAddress">[!--street--]</div>
  <div><span itemprop="postalCode">[!--zip--]</span> <span itemprop="addressLocality">[!--town--]</span>[!--#if test="country != ''"--] - <span itemprop="addressCountry">[!--country--]</span>[!--#endif--]</div>  
  [!--#if test="mail != ''"--]<div><a class="mail" itemprop="email" href="mailto:[!--mail--]">[!--mail--]</a></div>[!--#endif--]
  [!--#if test="phone != ''"--]<div><a class="phone" itemprop="telephone" href="tel:[!--phone--]">[!--phone--]</a></div>[!--#endif--]
</div>
*/    

Zugriff über PHP im XSLT-Template

$displayOutput = $dataOfVariant['options']['data-html'];