We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 27431
    • 8 Posts
    Hi guys,

    The standard newstemplate works great, nothing to complain about.

    But my problem is that i want to select a photo to the news item and show it off on the homepage.

    So i made a new page, a TV that can contain a photo from your Image map. I select a photo and save it.

    In the newstemplate chunk i add the TV of the Photo. It looks like this.

    <div class="nieuwefotos">
        <div class="fotohome"><img src="[*Foto1*]"></div>
        <h1><a href="[~[+id+]~]">[+pagetitle+]</a></h1>
        <p>[+introtext+]</p>
    
    <a class="readmore" href="[+url+]">Lees meer...</a>
        </div>
    
    



    Somehow, it wont show it on the website. Anyone got a clue? The site is www.janssen-malden.nl

    Thanks! Sjurdy
      • 8609
      • 607 Posts
      Did you set the output widget of your TV to image? Viewing source shows <img src=""> which means for some reason it’s not seeing your photo source
        • 27431
        • 8 Posts
        Yhea, checked it 5 times, but seems its not the problem. I was thinking of making it a image URL. So you select a image, and it places the url in the [*Foto1*], but that was allready the case.

        So, still stuck!
          • 8609
          • 607 Posts
          Ahhh... replace

          <div class="fotohome"><img src="[*Foto1*]"></div>

          with
          <div class="fotohome"><img src="[+Foto1+]"></div>

          See if that works
            • 27431
            • 8 Posts
            That solved the problem! Still I find it weird to use a placeholder tag instead of a TV tag.

            Anyway. Thanks alot!
            • The chunk is applied to the document specified (or to each document in turn in the case of multiple documents, as Ditto does) so you need to use the placeholder. The TV tag will return the value for the TV for the document being processed by MODx, the one containing your snippet call, and not the value for the document being processed by the snippet. The snippet gets the value of the TV for the document it is processing and sets a placeholder for it, and that is how it gets inserted into the chunk.

              So basically you have two parsers processing, MODx processing the document with the snippet call, and the snippet processing the documents specified in its parameters. If you can keep the two (what MODx is doing and what the snippet is doing) separate in your mind, you’ll better understand what’s going on.
                Studying MODX in the desert - http://sottwell.com
                Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                Join the Slack Community - http://modx.org