Categories > Your tips & tricks >

Conditional Display of HTML Pending Database Field

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Anthony
Date: 2011-02-20
Time: 22:31

Conditional Display of HTML Pending Database Field

I am trying to show different HTML pending whether a database field is empty or not and I cannot seem to get it to work. I have made several attempts, including the following. Can anyone offer advise on how to accomplish it? Basically I want the <a href> block to show only when the hyperlink field from the database is not empty; otherwise, to delete the <a href> block and show the eventtitle field without any <a href> tag.

<dt><a href="[eventsblock.hyperlink;magnet=a]">[eventsblock.eventtitle;block=span;when [eventsblock.#]+-1;bmagnet=div]</a>[eventsblock.eventtitle;block=span;when [eventsblock.hyperlink]='']</dt>

By: Anthony
Date: 2011-02-20
Time: 22:44

Re: Conditional Display of HTML Pending Database Field

Ok, found the answer with the addition of the "mtype=m+m" parameter. However, I'm still not sure why the other code would not work. If hyperlink field is not empty, why would the [eventsblock.eventtitle;block=span;when [eventsblock.hyperlink]=''] section even show? Obviously, the "mtype=m+m" is cleaner.

<dt><a href="[eventsblock.hyperlink;magnet=a;mtype=m+m]">[eventsblock.eventtitle;block=span;when [eventsblock.#]+-1;bmagnet=div]</a></dt>