• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Understanding this {xen:if} statement.

TheBigK

Well-known member
#1
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?
 

Brogan

XenForo moderator
Staff member
#4
In the case of that example, it's adding the CSS class hasNotes to the div, if the $notes variable is true.
 

TheBigK

Well-known member
#5
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?