Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Archive

How to add class to the html() created element

Started by Muut Archive 9 years ago · 1 replies · 1209 views
9 years ago

I am trying to loop through some images and display the correct ones inside a newly created element. How do I add a class to this newly created element ?

TWIG
    <div class="poza-produs">
                                        {% for item in produs.imagelogo %}
                                            {{ page.media[item.name].html()}}
                                        {% endfor %}
      </div>

9 years ago

---twig
{{ page.media['sample-image.jpg'].html('My title', 'Some ALT text', 'myclass') }}

TXT

see [Learn.getgrav.doc](https://learn.getgrav.org/content/media#html-title-alt-classes)

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1297 9 years ago
Archive · by Muut Archive, 9 years ago
2 894 9 years ago
Archive · by Muut Archive, 9 years ago
2 4024 9 years ago
Archive · by Muut Archive, 9 years ago
1 2899 9 years ago
Archive · by Muut Archive, 9 years ago
3 1082 9 years ago