Hi, lucien4t2
It is syntax of Dust.js, the syntax of Dust.js can be a bit confusing at first, but you will find it easy to read and understand once you follow the documentation.
{#data}
<div class="item product product-item">
<div data-container="product-grid" class="product-item-info {?thumbnail}{:else} no-image {/thumbnail}">
<div class="product-item-details">
{@info:data}
<div class="item-field {._class} {render_class}">
{?.key}<div class="item-field-label {label_render_class}">{.key}</div>{/.key}
{@select key=._class}
{@eq value="name"}
<h4 class="product-item-name">
<a href="{url}" class="product-item-link">
<span class="k-icon-document-{icon|s}"> </span>
{name|s}
</a>
</h4>
{/eq}
{@eq value="thumb"}
{?thumbnail}
<a tabindex="-1" class="product-item-photo" href="{url}">
<span class="product-image-container">
<img alt="{name|s}" src="{thumbnail}" class="product-image-photo">
</span>
</a>
{/thumbnail}
{/eq}
{@eq value="desc"}
{desc|s}
{/eq}
{@none}
{.value|s}
{/none}
{/select}
</div>
{/info}
</div>
<div class="product-item-actions">
<a class="btn btn-default" href="{url}"><?php echo Text::_('COM_JAMEGAFILTER_VIEW_DETAIL'); ?></a>
</div>
</div>
</div>
{/data}
A short explaination of the code block:
- Looping Over Data: The {#data} block iterates over an array of product items.
- Conditional Classes and Content: Uses conditionals ({?thumbnail}, {@eq value="..."} {...} {/eq}, etc.) to dynamically add classes and render different parts of the product information based on the presence of certain data.
- Custom Helpers: Custom helpers like {@info:data} and {@select key=._class} allow for advanced data manipulation and rendering.
- Dynamic Field Rendering: The template dynamically renders fields such as product names, thumbnails, and descriptions based on the _class key.
- Safe Output: Uses |s to ensure that output is safely rendered, preventing potential XSS attacks.
- Localization: Incorporates PHP localization for multi-language support in action buttons.
Please check and response to us if you need any further help.
Regards