Understanding this {xen:if} statement.

TheBigK

Well-known member
In Kier's ScratchPad Addon, the template scratchpad_index has this line -

HTML:
<div id="ScratchpadNoNotes" class="secondaryContent {xen:if '{$notes}', 'hasNotes'}">There are no notes yet.</div>

I'm wondering what exactly is {xen:if '{$notes}', 'hasNotes'} doing?

My Guess: It's inserting class as 'hasNotes' if there are no notes.

Am I right?
 
In the case of that example, it's adding the CSS class hasNotes to the div, if the $notes variable is true.
 
And you can keep the false part empty if you don't need it ;)
Code:
{xen:if [condition], [what to add if the condition is true]}
Okay, what if I only want to insert the false condition?

In the case of that example, it's adding the CSS class hasNotes to the div, if the $notes variable is true.
Well, this is what the related CSS says -

#ScratchpadNoNotes.hasNotes
{
display: none;
}

So, what if $notes is false?
 
Back
Top Bottom