vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   question regarding <if> in templates (https://vborg.vbsupport.ru/showthread.php?t=96456)

Vitesse 09-17-2005 03:16 PM

question regarding <if> in templates
 
I'm writing a few custom pages for my site, one of which is an email form. I have a varaible in the PHP called $sendfail which is set to 0 or 1 depending if the email sent correctly. How can i check this value using <if> in the template so i can display the relevant message? I presumed it would have been <if $sendfail == "0"> but this doesnt seem to work.

Any help would be great, thanks

Marco van Herwaarden 09-17-2005 04:52 PM

HTML Code:

<if condition="$sendfail">
......
</if>


Vitesse 09-17-2005 06:43 PM

so can i test that for a matching value like
HTML Code:

<if condition $sendfail == "0"> Do something if it was equal to zero </if>
<if condition $sendfail =="1"> Do something else here if it was equal to 1 </if>

I think i kinda worded that badly, what i want to do is check if the variable $sendfail in my php script has a value of 1 or 0, and could i also do an IF that checks the value of a string, like
HTML Code:

<if $sentto == "The Admin Team"> do something </if>
Would that syntax be correct or am i getting totally wrong?

Marco van Herwaarden 09-17-2005 07:04 PM

Yes both are correct. Since the $sendfail is a boolean, you could also just perform the test like i gave in my example above.

Vitesse 09-17-2005 09:25 PM

For some reason this just will not work, here's a bit of my template:
HTML Code:

<tr>

<td class="alt1">Here we have added all the websites of interest for everything from Engine tuners and performance parts retailers to buying those hard to find cables for you ICE install. This is what the var contains: $showcategory
<if $showcategory == "Display body retailers"> Some test text here</if>
</td></tr>

The var $showcategory is set to either "SHOW ALL" or "Display body retailers" but either way the test text in between the IF is still being displayed, the variable is definately being changed but the IF is always treating it as true. Any ideas?

Paul M 09-17-2005 09:39 PM

The format is <if condition="xxxxxxx"> ....... </if>

Where xxxxxx is what you want to test - so in your example above you need ;

<if condition=" $showcategory == 'Display body retailers' ">

Vitesse 09-17-2005 09:44 PM

Nice one :D that works a treat now. Thankyou


All times are GMT. The time now is 06:39 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.01082 seconds
  • Memory Usage 1,722KB
  • 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
  • (4)bbcode_html_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)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