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

    I have an image type template variable set up on my website that easily allows me to switch images. However I would now like to make the image act as a link. Is there a way to do this if the link is likely to be frequently changed or will I need to change the TV to a rich text box instead so I can add the image manually and then make it a link?

    Cheers
      • 25663 MODX Staff
      • 12,272 Posts
      Would the link change with the image or stay constant? Internal or external link?
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • 3717
        • 22 Posts
        The link would change with the image

        I would think that for the vast majority of cases the link would be internal
          • 7231
          • 4,205 Posts
          Is it a link to the image itself? Or is it an external link. To link to the image itself (or some variation based on the tv value) simply use the tv in the <a> tag:
          <a herf="[*tvname*]"><img src="/assets/images/[*tvname*]" /></a>

          To link to an external file add another TV to be used as the URL:
          <a herf="[*URLtvname*]"><img src="/assets/images/[*IMAGEtvname*]" /></a>
            [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

            Something is happening here, but you don&#39;t know what it is.
            Do you, Mr. Jones? - [bob dylan]