Hello,
I am back to MODx but I can not remimber how to show image stored in a variable model.
I created a Variable Model and I defined as a image
In my ressource ‘Actualité 1’, I download a image
I need now to show the image in the parent ressoucre ‘actualité’
Actualité
– Actualité 1
– Actualité 2
– Actualité 2
I installed the Extra getRessource, abd at this point, I can display the title of ‘Actualité 1’, on the ressource ‘Actualité’
But how to select the Image (Variable Model of Actualité 1) and display it?
Many thanks for your refresh
Enjoiy
markh
June 25, 2021, 10:09pm
2
In your getResources snippet call, add &include TVs=`1`
and the name of your variable to &includeTVList
.
Then you can use [[+tv.nameOfTV]] in your tpl.
Hello,
thanks for your reply. It solved my problem.
However, I wonder if you could help me on another associated problem
In my getRessource, I have this
[[getResources?
&parents=`[[*id]]`
&includeContent=`1`
&includeTVs=`1`
&includeTVList=`img-architecture`
&tplWrapper=`@INLINE <div class="gallery">[[+output]]</div>`
&tpl=`@INLINE <a href="[[~14]]" title="[[+pagetitle]]"><figure><img src="[[++site_url]][[+tv.img-architecture]]" alt="[[+pagetitle]]" class="img-fluid"><figcaption><h4>[[+pagetitle]]</h4>[[+content]]</figcaption></figure>[[+id]]</a>`
&sortby=`{"publishedon":"DESC"}`
&limit=`0`
&showUnpublished=`0`
&showHidden=`1`
]]
I have an issue with the link, You can observe
href="[[~14]]"
and (this paart of code is temporary and it print either 12, 13 and 14)
[[+id]]
My link works fine as long as is
href="[[~14]]"
but of coursem it should not.
I initially tried with
href="[[~[[+id]]]]"
but this does not work, why if [[+id]] print either 12, 13, or 14 ???
Try using a chunk for the property &tpl
instead of an @INLINE
template.
Sometimes with nested tags and inline templates the parser doesn’t work the way you intended.
Thanks you for your suggestion. It’s work