How to display a Variable Model


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

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.

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

    &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>`

I have an issue with the link, You can observe


and (this paart of code is temporary and it print either 12, 13 and 14)


My link works fine as long as is


but of coursem it should not.

I initially tried with


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