PDA

View Full Version : why [if conditions] not working in my new template in my style ?


mostafa megahed
01-13-2009, 09:58 PM
i've aded a new template to my vb style

and when i put [if condition] like :


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


it's not working !!!!

Bellardia
01-13-2009, 11:26 PM
It should work, what template are you putting this in?

Lynne
01-14-2009, 02:36 AM
Depending on where you are calling this template from, that variable may not be available.

Dismounted
01-14-2009, 03:28 AM
You may want to try this instead (as above, it may not be available in some templates):
<if condition="$bbuserinfo['userid'] != 0">

mostafa megahed
01-14-2009, 05:17 AM
It should work, what template are you putting this in?

Depending on where you are calling this template from, that variable may not be available.

thanks Mr Bellardia, Mr Lynne,

there is template i've add it and called it in 'Fourmhome'
and i want to show some contains in this template

in my template 'mytemp' i write this code : [just example]

<if condition="$show['member']">
<strong><phrase 1="$bbuserinfo[username]" 2="member.php?$session[sessionurl]u=$bbuserinfo[userid]">$vbphrase[welcome_x_link_y]</phrase></strong>
<else />
please login ....
</if>

the same thing in 'navbar' template


You may want to try this instead (as above, it may not be available in some templates):
<if condition="$bbuserinfo['userid'] != 0">

thanks Mr Dismounted,
i try to use this but it dosn't work for me,
and what if i want to display contains to multi-userid ? [if this code work by another way]

alot of thanks to all of you

OH-Shoot
01-14-2009, 05:23 AM
The problem is the phrase isn't available in forumhome template I dont think.

Try this


<if condition="$show[member]">
<strong>Welcome <a href="member.php?$session[sessionurl]u=$bbuserinfo[userid]">$bbuserinfo[username]</a>
</strong>
</if>

Dismounted
01-14-2009, 05:28 AM
and what if i want to display contains to multi-userid ?
This will display "Hi" to people with user IDs 1, 2 and 3.
<if condition="in_array($vbulletin->userinfo['userid'], array(1, 2, 3))">Hi</if>

PS. You may want to know that Lynne is a girl. ;)

mostafa megahed
01-14-2009, 05:32 AM
The problem is the phrase isn't available in forumhome template I dont think.

Try this


<if condition="$show[member]">
<strong>Welcome <a href="member.php?$session[sessionurl]u=$bbuserinfo[userid]">$bbuserinfo[username]</a>
</strong>
</if>


thanks Mr OH-Shoot,

But i think the problem not in my code because it is just example , i was try with semple words, but the the same problem i've ..

--------------- Added 1231945879 at 1231945879 ---------------

This will display "Hi" to people with user IDs 1, 2 and 3.
<if condition="in_array($vbulletin->userinfo['userid'], array(1, 2, 3))">Hi</if>

PS. You may want to know that Lynne is a girl. ;)

1st, thanks 4 ur PS :D;), Sorry Lynne :) ...

i try ur code mr but it didn't work for me ...

what i should to do now ?

Lynne
01-14-2009, 01:37 PM
i try ur code mr but it didn't work for me ...

what i should to do now ?
Are you sure that the template is being evaled? Is anything printing out from the template you added? Did you add it to the array of $globaltemplates in your php page?