We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4429
    • 429 Posts
    Hi i have the following call:

    [[!getResources? &parents=`22`  &tpl=`FrontPageNews` ]]


    With the following template:

    [[*image]]
    
    <h2>	<a href="[[~[[+id]]]]" title="[[+pagetitle]]">[[+pagetitle]]</a> </h2>
    <p class="teaser">[[+introtext]] <a href="[[~[[+id]]]]"><span class="caption">Read more</span></a></p>
    
    <hr/>


    For some strange reason, not matter what i do, the image will not show up. Despite me uploading one on the relevant news page.

    Is the above syntax correct?
      • 5340
      • 1,624 Posts
      Try [[+image]]
        • 28215
        • 4,149 Posts
        Actually, there, [[+tv.image]].
          shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
          • 4429
          • 429 Posts
          The tv is there as is the image, the exact same call works on another page, just not my homepage or any other page that is not under the ’news’ container.

          The text will show fine, but the images will not.
            • 28215
            • 4,149 Posts
            Because you need to use [[+tv.image]], not [[*image]].
              shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
              • 4429
              • 429 Posts
              [[+tv.image]] fails on all pages. [[*image]] works on those pages within id22 which is my news container.

              i thought that [*tv*] was replaced by [[*tv]]? not [[+tv.name of template variable]]
                • 5340
                • 1,624 Posts
                Try this

                <img alt="" src="[[+tv.image]]" />


                instead of [[*image]]
                  • 28215
                  • 4,149 Posts
                  Quote from: x0149128 at Sep 24, 2010, 06:49 PM

                  [[+tv.image]] fails on all pages. [[*image]] works on those pages within id22 which is my news container.
                  That’s because you didn’t include &includeTVs=`1` in your getResources call.


                  i thought that [*tv*] was replaced by [[*tv]]? not [[+tv.name of template variable]]
                  It is in the default processing parser. But we’re talking about getResources, an Extra. getResources (like Ditto and Wayfinder and nearly any addon for MODx) has its own placeholder syntax for TVs. getResources says to use [[+tv.name]].
                    shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
                    • 4429
                    • 429 Posts
                    Ok so i now have a call of:

                    [[!getResources? &parents=`22`  &tpl=`FrontPageNews` &includeTVs=`1` ]]


                    and a chunk of


                    [[+tv.image]]
                    <h2>	<a href="[[~[[+id]]]]" title="[[+pagetitle]]">[[+pagetitle]]</a> </h2>
                    <p class="teaser">[[+introtext]] <a href="[[~[[+id]]]]"><span class="caption">Read more</span></a></p>
                    
                    
                    <hr/>


                    This setup for me isn’t showing any images on any page instead its just giving me the url of the image
                    assets/images/news/dscf1068.jpg 


                    But at least it is now doing that on the front page, whereas previously it wasn’t even recognising that my news item had an image.
                      • 28215
                      • 4,149 Posts
                      Okay, great. Now like cipa said, the TV’s only going to return the URL. You need to use this:

                      <img alt="" src="[[+tv.image]]" />
                        shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com