View Full Version : if condition problem
Alexey?
10-02-2009, 11:12 AM
Ok, i want to show some information in forum x y z and in the other forums i want to hide it.
Which conditions you think i should use?
By the way i'm editing the template forumhome_forumbit_level1_post.
I'm want that forum 9,10,11 will show hey
and the other forums will show nothing
By the way it is all an examples.
Lynne
10-02-2009, 02:07 PM
If you look at the template, you'll see the variables used in it and one of them is $forum[forumid]. So, use that in your condition:
<if condition="in_array($forum['forumid'], array(x, y, z))">
stuff only for forums x, y, and z
</if>
Alexey?
10-02-2009, 03:10 PM
Its not working.
I'm trying to do this
<if condition="in_array($forum['forumid'], array(9, 132, 95, 72, 13, 288, 113, 124, 11, 12, 100, 62, 16, 421, 14, 10))">
My costume code.
</if>
and it is not change, i still staying the same as the main code
Digital Jedi
10-02-2009, 03:30 PM
You ONLY put the forum IDs of the forums you WANT it to show in.
Alexey?
10-02-2009, 03:31 PM
This is what i did, i put the id of the categories i want to show it there.
Maybi i need another condition to hide some COSTUME TEMPLATE in this forums
Digital Jedi
10-02-2009, 03:34 PM
So your saying your custom code is still showing everywhere on the forum?
Alexey?
10-02-2009, 03:38 PM
My costume code isn't showing any where, But i think i need another code that make the opposite of this code.
I want to hide some information in a few forums that i choose
Digital Jedi
10-02-2009, 04:57 PM
Did you test the code first to make sure it was showing at all, by itself?
Alexey?
10-02-2009, 05:03 PM
of course, i tried to replace it with the original code and it worked good.
but the problem was that i want to show it only in categories and not in the all forums.
And the code Lynne gave me above doesn't work
Lynne
10-02-2009, 05:05 PM
You can try the opposite:
<if condition="!in_array($forum['forumid'], array(x, y, z))">
stuff only if NOT in forums x, y, and z
</if>
Alexey?
10-02-2009, 05:22 PM
its still now working
this is my code in forumhome_forumbit_level1_post
<if condition="!in_array($forum['forumid'], array(9, 132, 95, 72, 13, 288, 113, 124, 11, 12, 100, 62, 16, 421, 14, 10))">
<tr align="center">
<td class="alt1Active" colspan="2" align="$stylevar[left]" id="f$forum[forumid]">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td><img src="$stylevar[imgdir_statusicon]/$forum[imageprefix]forum_$forum[statusicon].gif" alt="" border="0" id="forum_statusicon_$forum[forumid]" /></td>
<td><img src="$vboptions[cleargifurl]" alt="" width="9" height="1" border="0" /></td>
<td>
<div>
<a href="forumdisplay.php?$session[sessionurl]f=$forum[forumid]"><strong>$forum[title]</strong></a>
</div>
<if condition="$show['forumdescription']"><div class="smallfont">$forum[description]</div></if>
</td>
</tr>
</table>
</td>
</tr>
</if>
<if condition="in_array($forum['forumid'], array(9, 132, 95, 72, 13, 288, 113, 124, 11, 12, 100, 62, 16, 421, 14, 10))">
<tr align="center">
<td class="alt1Active" colspan="2" align="$stylevar[left]" id="f$forum[forumid]">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td colspan="2" width="850" height="60" style="background: url('http://www.images.tgt.co.il/FB/$forumid.jpg')">
<table border="0" width="100%" height="60" dir="rtl">
<tr>
<td width="28%" align="right" onclick="window.location.href='forumdisplay.php?$session[sessionurl]f=$forum[forumid]'" style="cursor: pointer">
<h2 style="margin: 0em; color: #003355; font-family: arial;"><nobr><font color="#003355">$forum[title]</font><nobr></h2>
</td>
<td width="72%" align="right"><strong><font face=verdana>
$forum[description]</strong></font>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2" style="border-top:#000000 1px dashed; border-bottom:#000000 1px dashed">
<img src="$stylevar[imgdir_statusicon]/$forum[imageprefix]forum_$forum[statusicon].gif" alt="" border="0" id="forum_statusicon_$forum[forumid]" />
</td>
</tr>
</table>
</td>
</tr>
</if>
The first condition is what i don't want to show in the forum i writed there.
and the second condition is what i want to show in those categories.
SOL-R
10-02-2009, 05:46 PM
I did it a bit differently but mine works fine for me.
<if condition="in_array($forumid, array(41,0))">
stuff to be shown
</if>
I also put this in the Forum display template.
That is what someone told me once.....I tried it and it worked.
Alexey?
10-02-2009, 06:08 PM
:(
Doesn't work for me.
And i'm editing the template forumhome_forumbit_level1_post
Digital Jedi
10-03-2009, 04:55 AM
Maybe the problem is we're misunderstanding what it is you're trying to do. What are you trying to do with your custom code?
Lynne
10-03-2009, 05:00 AM
Instead of doing an two if conditions, one for if true, the other for if not true, combine them into one - if true or else.
Also, are you positive you are editing the correct template for the page?
Alexey?
10-03-2009, 07:24 AM
I think so.
Any way what i'm trying to do is this.
http://www.tgt.co.il/forumdisplay.php?f=9 - link to my category.
http://www.tgt.co.il/forumdisplay.php?f=17 - link to forum that have inside sub forums.
what i'm trying to do is to change the view in the category and NOT to change the view in the sub forum table.
Hope you'll understand now.
And maybe i used a wrong template.
edit :
Now i'm trying to do this in the HARD way, it seems like to be working.
TNX for you help every body.
Those codes really helped me.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.