get image TV on homepage modx revolution

488 views Asked by At

I have a lot of sub pages and latest 3 I am showing at homepage, I could display only title but image can't(every sub page has TV named 'image_prew' and I am trying to get value of this TV for image), here is my code:

<div class="cat">
        <div class="role">
                <h1 class="[[+pagetitle]]">[[+pagetitle]]</h1>
        </div>
        <div class="menu_prew-[[+pagetitle]]">
              <img src="[[*image_prew]]" class="image"/>
        </div>
        <div class="clear"></div>
</div>
3

There are 3 answers

0
LIannotti On BEST ANSWER

You don't say how you're fetching the sub-pages, but if you're using getResources you need to use the parameter &includeTVs=1.

And as Sean mentions above, in a template chunk TVs are placed in a placeholder tag -- use a plus sign not an asterisk.

0
HarveyEV On

What is your output setting on the TV? Whenever you are outputting image source urls in your TVs, make sure in your output setting tab the output is set to "text". You want the text to render to your html tag. Default may or may not work depending on your input type setting, so I always force this to "text". I have had that issue once or twice;).

1
Sean Kimball On

try [[+tv.image_prew]] and check the documentation near the bottom "Displaying Template Variables with getResources" is clearly labelled