PDA

View Full Version : template condition problem


mcdull
07-02-2006, 07:19 PM
I want to modify the postbit to show some content based on the user custom field's content.
Here is my code.

<if condition="$post['field2'] == XXXX">
<div class="smallfont">Message1</div>
<else />
<if condition="$post['field2'] == YYYY">
<div class="smallfont">Message2</div>
<else />
Message3
</if>
</if>

but it only shows Message3 in all conditions. Can anyone help me?
FYI, I can show the content of $post[field2] by using <p>$post[field2]</p>

Thanks.

peterska2
07-02-2006, 10:20 PM
<if condition="$post[field2] == 'XXXX'">
<div class="smallfont">Message1</div>
<else />
<if condition="$post[field2] == 'YYYY'">
<div class="smallfont">Message2</div>
<else />
Message3
</if>
</if>

Note that I removed the ' from around the field2 and instead placed it around the XXXX and YYYY

Adrian Schneider
07-02-2006, 11:14 PM
It depends if the XXXX and YYYY are numbers, but you can enclose them in quotes either way.

In conditions, array keys should ALWAYS be quoted if they are strings.

Read a little bit of this thread, it is a prime example of why...
https://vborg.vbsupport.ru/showthread.php?t=120134