View Full Version : <vte:if> Statement

11-02-2007, 10:08 PM
Hi gang,

Just trying something out here which can't seem to pull off :confused:

I created a result.tpl which will act as my search results template - this will help the system redirect feeds links offsite if I use the {article.get_link} .

What I want to achive is basicly let the template show only the selected article headline link as either {article.get_link} or {article.get_href} depending on the article settings. If the article has a REDIRECTED LINK then it will show the headline using the {article.get_link} - If it's an in house article then it will show the headline with {article.get_href}.

This is what I tried:

<vte:if test="{article.get_link}">
<h2><a href="{article.get_link}"><vte:value select="{article.get_title}" /> </a></h2></vte:if>

<h2><a href="{article.get_href}"><vte:value select="{article.get_title}" /></a></h2> </vte:else>

I assumed that the <vte:else> tag will act as the decider.

If <vte:if test="{article.get_link}"> does not exsist then <vte:else> comes into play to show the next possible choice...

Would love some tips and help on this.

11-02-2007, 11:13 PM
Got around it:

<vte:if test="{article.get_link}">
<h2><a href="{article.get_link}" target="_blank"><vte:value select="{article.get_title}" /> </a></h2>

<h2><a href="{article.get_href}"><vte:value select="{article.get_title}" /></a></h2> </vte:else> </vte:if>

Works wonders. Begining to love this!

11-03-2007, 03:11 PM
Vivvo Template Engine has a different structure of code blocks, it is more similar to XML language. Therefore, the syntax for using the if-else statement looks like in xml.