cssmodxmodx-revolutionmodx-resourcesmodx-templates

get image TV on homepage modx revolution


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>

Solution

  • 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.