PDA

View Full Version : Template <vb:if> with Profile Field


Cable_Player
10-06-2018, 10:47 AM
Hi,
I have a profile field which isn't required, so members can leave it blank but would like to keep it from displaying the title if it is blank.

I'm sure there's a simple if statement I can use to check to see if there's any data in it, could someone help me with that please?

Specifically, it's for the Flag Mod, this is the code in the postbit template I have.

<!-- Wy Country Flags Start -->
<div align="left">Country: </dt>
<vb:if condition="$post['field5']">
<img src="{ROOT}/images/buttons/flags/{vb:raw post.field5}.GIF" alt="Users Flag!" align="center" border="" /></vb:if></div>
<!-- Wy Flags End -->


Thanks


Edit:
Doh! I shouldn't have doubted myself and tinkered a little longer:


<!-- Wy Country Flags Start -->
<vb:if condition="$post['field5'] == ''">
<vb:else />
<div align="left">Country: </dt>
<vb:if condition="$post['field5'] ">
<img src="{ROOT}/images/buttons/flags/{vb:raw post.field5}.GIF" alt="Users Flag!" align="center" border="" /></vb:if></div>
</vb:if>
<!-- Wy Flags End -->