vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Coding noob having trouble with <IF> tag (https://vborg.vbsupport.ru/showthread.php?t=136638)

TeddyKGB 01-16-2007 03:14 AM

Coding noob having trouble with <IF> tag
 
I am looking at using the <IF> statement in one of my templates and I am having trouble, hoping somone here can assist.

I am looking to have on navbar button do 2 different things depending on the current page. So it would look something like this

Code:

<if CURRENT PAGE="index.php">
<td align="left" valign="top" width="62" height="69"><a href="$vboptions[forumhome].php$session[sessionurl_q]" accesskey="1"><img src="$stylevar[imgdir_misc]/nav_home.gif" width="62" height="69" border="0" alt="" /></a></td>
                                <else />
<td align="left" valign="top" width="62" height="69"><a href="/index.php" accesskey="1"><img src="$stylevar[imgdir_misc]/nav_home.gif" width="62" height="69" border="0" alt="" /></a></td>
                                </if>

Basically if you are on /forumindex.php the button will take you to /index.php and vice versa. Is this possible and if so what is the proper syntax of the condition (highlighted in red) that I need to use?

Thanks in advance

calorie 01-16-2007 03:22 AM

In the vB PHP files you will find constants:
Code:

// in the index.php file near the top
define('THIS_SCRIPT', 'index');

// in the showthread.php file near the top
define('THIS_SCRIPT', 'showthread');

Use THIS_SCRIPT in template conditionals:
Code:

<if condition="THIS_SCRIPT == 'index'">
        on forum index page
<else />
        not on forum index page
</if>

<if condition="THIS_SCRIPT == 'showthread'">
        on forum showthread page
<else />
        not on forum showthread page
</if>


TeddyKGB 01-16-2007 03:32 AM

Brilliant!

Thank you SO much calorie. Worked like a charm.


All times are GMT. The time now is 11:19 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.01354 seconds
  • Memory Usage 1,715KB
  • 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
  • (3)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)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