vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   conditionals not working (https://vborg.vbsupport.ru/showthread.php?t=104917)

harmor19 01-10-2006 12:26 AM

conditionals not working
 
In my product I check what number is in the field then I write an HTML conditional for the appropiate parts.

PHP Code:

 //not logged in
        
if($dlink['view_link] == 1)
        {
          $custom_droplinks .= "<if condition='".
$show['registerbutton']."'>
<tr><td class='
vbmenu_option'>$img<a href='".$dlink['url']."' target='$new' title='".$dlink['alt']."'>".$dlink['name']</a></td></tr></if>";
        }
       //is logged in
        elseif($dlink['
view_link] == 2)
        {
          
$custom_droplinks .= "<if condition='".$show['member']."'>
<tr><td class='vbmenu_option'>
$img<a href='".$dlink['url']."' target='$new' title='".$dlink['alt']."'>".$dlink['name']</a></td></tr></if>";
        }
       //both
        else
        {
          
$custom_droplinks .= "
<tr><td class='vbmenu_option'>$img<a href='".$dlink['url']."' target='$new' title='".$dlink['alt']."'>".$dlink['name']</a></td></tr>";
        } 

The hook I'm using is "global_start"

peterska2 01-10-2006 12:29 AM

you've got a typo.

Code:

<if condition='".$show['meber']."'>
should be
Code:

<if condition='".$show['member']."'>
apart from that, I'm nto too hot on php but it looks ok to me.

harmor19 01-10-2006 12:31 AM

I fixed that but still doesn't work.

Maybe if I cancel out the array
<if condition='.\$show['member']."'>

calorie 01-10-2006 12:38 AM

Make sure $show['member'] is set and try...
Code:

<if condition="$show[member]">

harmor19 01-10-2006 01:12 AM

I tried this but this doesn't work
PHP Code:

<template name="custom_droplinks" templatetype="template" date="1128881080" username="harmor19" version="3.5.0"><![CDATA[<if condition="$show[member]">$custom_droplinks</if>
]]></
template

Maybe it's my hook location?

calorie 01-10-2006 01:22 AM

Oops, missed your hook location. Yes it's that b/c $show['member'] is not defined until after that hook. In global you'll see...
Code:

if ($vbulletin->userinfo['userid'])
{
        $show['guest'] = false;
        $show['member'] = true;
}
else
{
        $show['guest'] = true;
        $show['member'] = false;
}

So, instead of <if condition="$show[member]"> try...
Code:

<if condition="$bbuserinfo[userid]">

harmor19 01-10-2006 10:19 AM

i'll do that tonight.
thanks


All times are GMT. The time now is 01:12 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.00968 seconds
  • Memory Usage 1,735KB
  • 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
  • (5)bbcode_code_printable
  • (2)bbcode_php_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