vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   template condition that checks if a field is blank (https://vborg.vbsupport.ru/showthread.php?t=143540)

Scathefire 03-29-2007 08:15 PM

template condition that checks if a field is blank
 
I currently have a condition in the postbit template that shows a link under the username, with the URL having a user's name placed at the end of it:

Code:

<if condition="is_member_of($post, 17) OR is_member_of($post, 18) OR is_member_of($post, 6)">
<a class="smallfont" target="_blank" href="http://url.com?address=$post[musername]">Linky</a>
</if>

Is there a way I could "link" it with another condition that checks to see if they left a profile field blank?

What I am trying to do is have it check to see if a particular (field7) profile field isn't blank. If there IS something in it, then append it to the end of the URL instead of the username. On the other hand, if it IS blank, then grab the username instead and append it to the end of the URL without the field's value (because it is blank anyway).

RedTyger 03-29-2007 08:40 PM

HTML Code:

<if condition="is_member_of($post, 17) OR is_member_of($post, 18) OR is_member_of($post, 6)">
<if condition="$userinfo[field1] == ''">
<a class="smallfont" target="_blank" href="http://url.com?address=$userinfo[field1]">Linky</a>
<else />
<a class="smallfont" target="_blank" href="http://url.com?address=$post[musername]">Linky</a>
</if>
</if>


WetWired 03-29-2007 08:58 PM

You probably don't want to use $post[musername], use $post[username] instead. $post[musername] contains usergroup markup (ie. bold tags for staff).

Scathefire 03-30-2007 01:24 AM

Ok, I had to change a little from the above example:

Code:

<if condition="is_member_of($post, 17) OR is_member_of($post, 18) OR is_member_of($post, 6)">
<if condition="$post[field7] != ''">
<a class="smallfont" target="_blank" href="http://url.com?address=$post[field7]">Linky</a>
<else />
<a class="smallfont" target="_blank" href="http://url.com?address=$post[username]">Linky</a>
</if>
</if>

Thanks for the assistance, it is working perfectly now.


All times are GMT. The time now is 05:40 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01024 seconds
  • Memory Usage 1,718KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (1)bbcode_html_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete