modxmodx-evolution

MODx template variable is link to an image jpg but doesnt show


I have a template variable in MODx EVO and its called image-link. The URL of the images are something like... http://www.friendssite-image5.jpg.

In my HTML I have this:

[[if? &is=`[+image-link+]:not_empty` &then=` 
<div class="image-link">
<a href="[~[+id+]~]"><img alt="[*longtitle*]" src=
"[+image-link+]"></a>
        </div>`]]

I tried setting the template variable as URL , also as image, and also as text, but the image does not want to appear. How can I solve this?


Solution

  • I noticed that you have your tags mixed between [+...+] and [...]. The "+" signs are for use with Ditto, but if you are placing the call directly in your document, use the "*" signs instead.

    Example

    Change:

    [[if? &is=`[+image-link+]:not_empty` &then=` 
    <div class="image-link">
    <a href="[~[+id+]~]"><img alt="[*longtitle*]" src=
    "[+image-link+]"></a>
        </div>`]] 
    

    To:

    [[if? &is=`[*image-link*]:not_empty` &then=` 
    <div class="image-link">
    <a href="[~[*id*]~]"><img alt="[*longtitle*]" src=
    "[*image-link*]"></a>
        </div>`]]