简体   繁体   中英

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?

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>`]]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM