0

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>
aiddev
  • 1,409
  • 2
  • 24
  • 56

3 Answers3

1

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

Sean Kimball
  • 4,506
  • 9
  • 42
  • 73
  • thanks much, you are right I could get image source with this [[+tv.image_prew]], but I accepted LIannotti's answer because without this "&includeTVs=1" I can't see anything. – aiddev Aug 12 '15 at 07:06
1

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.

LIannotti
  • 382
  • 1
  • 11
0

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;).

HarveyEV
  • 101
  • 3
  • 8