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

Passing a variable to html

Started by Muut Archive 10 years ago · 2 replies · 443 views
10 years ago

Hello. How can i pass a variable to a value, thats between comas? that is:

{{ page.media.images[job.image].resize(300, 300).quality(85).html("{{ job.text }}") }}

i know job.text is valid, because

<h2>{{ job.title }}</h2>

becomes

<h2>Demarca</h2>

but html("{{ job.text }}

becomes

<img title="{{ job.title }}" src="/grav4/images/b/6/c/f/2/b6cf2143b98d3bcf125dd81b0b532929e5fd7f42- thumb-demarca.jpeg">

Thanks for any feedback

10 years ago

You already opened the Twig parentheses, so simply use

TWIG
{{ page.media.images[job.image]
.resize(300, 300)
.quality(85)
.html(job.text) }}
10 years ago

worked like a charm. i thought i had to manually insert the commas. But it seems Grav sees a string, and takes care of them.

thanks!!

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1366 9 years ago
Archive · by Muut Archive, 9 years ago
2 940 9 years ago
Archive · by Muut Archive, 9 years ago
2 4069 9 years ago
Archive · by Muut Archive, 9 years ago
1 2960 9 years ago
Archive · by Muut Archive, 9 years ago
3 1125 9 years ago