The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
if conditional inside php file, how?
I'm trying to use an if conditional inside the skin file for my ipbpro arcade mode.
The problem is when I edit and reupload, I get a blank page due to the code I'm using but I'm not sure where I'm messing up. In a regular vb template it looks like this. Code:
<if condition="in_array($bbuserinfo['usergroupid'], array(2,6,7,35))"> <if condition="$bbuserinfo['posts'] > 4"> <a href="http://www.talkjesus.com/misc.php?do=page&template=Chat"><span><img src="/images/media-menu/chat.png" alt="Christian Live Chat" class="img-media-menu" /> Live Chat</span></a><else /><a href="http://www.talkjesus.com/forum-rules-ten-commandments/53-talk-jesus-10-commandments-rule.html"><span><img src="/images/media-menu/chat.png" alt="Christian Live Chat" class="img-media-menu" /> Live Chat: Disabled (?)</span></a></if></if> It looks like this and results in a blank page Code:
<if condition='in_array($bbuserinfo['usergroupid'], array(2,6,7,35))'> <if condition='$bbuserinfo['posts'] > 4'> <a href='http://www.talkjesus.com/misc.php?do=page&template=Chat'><span><img src='/images/media-menu/chat.png' alt='Christian Live Chat' class='img-media-menu' /> Live Chat</span></a> <else /><a href='http://www.talkjesus.com/forum-rules-ten-commandments/53-talk-jesus-10-commandments-rule.html'><span><img src='/images/media-menu/chat.png' alt='Christian Live Chat' class='img-media-menu' /> Live Chat: Disabled (?)</span></a></if></if> |
#2
|
||||
|
||||
If it's php, you can't use template conditions - you need to use actual php code. For instance:
PHP Code:
|
#3
|
||||
|
||||
Thanks Lynne.
What about this one? <if condition="$bbuserinfo['posts'] > 4"> Is this the correct replacement? if (in_array($vbulletin->userinfo['bbuserinfo['posts'] > 4') Tried this: Code:
if (in_array($vbulletin->userinfo['usergroupid'], array(2, 6, 7, 35))) { <a href='http://www.talkjesus.com/misc.php?do=page&template=Chat'><span><img src='/images/media-menu/chat.png' alt='Christian Live Chat' class='img-media-menu' /> Live Chat</span></a> } if (in_array($vbulletin->userinfo['$bbuserinfo['posts'] > 4') { <a href='http://www.talkjesus.com/forum-rules...ents-rule.html'><span><img src='/images/media-menu/chat.png' alt='Christian Live Chat' class='img-media-menu' /> Live Chat: Disabled (?)</span></a> } |
#4
|
||||
|
||||
This is the entire portion of that file
Code:
function top_links_table($links,$width,$extra) { global $ibforums; return <<<EOF <!-- Media Center Nav --> <div class="mc_border_out"> <div class="mc_border_in"> <div id="middlebar"> <a href='http://www.talkjesus.com/arcade.php'><span><img src='/images/media-menu/games.png' alt='Arcade Games' class='img-media-menu' /> Arcade</span></a> <a href='http://www.talkjesus.com/journal.php'><span><img src='/images/media-menu/highlight.png' alt='Journals' class='img-media-menu' /> Journals</span></a> if (in_array($vbulletin->userinfo['usergroupid'], array(2, 6, 7, 35))) { <a href='http://www.talkjesus.com/misc.php?do=page&template=Chat'><span><img src='/images/media-menu/chat.png' alt='Christian Live Chat' class='img-media-menu' /> Live Chat</span></a> } if (in_array($vbulletin->userinfo['$bbuserinfo['posts'] > 4') { <a href='http://www.talkjesus.com/forum-rules...ents-rule.html'><span><img src='/images/media-menu/chat.png' alt='Christian Live Chat' class='img-media-menu' /> Live Chat: Disabled (?)</span></a> } <a href='http://www.talkjesus.com/album.php'><span><img src='/images/media-menu/folder.png' alt='Member Albums' class='img-media-menu' /> Member Albums</span></a> <a href='http://www.talkjesus.com/gallery/index.php'><span><img src='/images/media-menu/image.png' alt='Photo Gallery' class='img-media-menu' /> Photo Gallery</span></a> <a href='javascript:openRadioAndTV()'><span><img src='/images/media-menu/multimedia.png' alt='Radio Streaming' class='img-media-menu' /> Radio</span></a> </div> </div> </div> <!-- /Media Center Nav --> <br /> <table width='100%' border='0' cellspacing='1' cellpadding='4' class="tborder"> <tr> <td class="tcat" align="center" width="{$width}">{$links}</td> {$extra} </tr> </table> EOF; } |
#5
|
||||
|
||||
I think it will work with posts, but I'm not sure. You'll have to see if it's been formatted at the point that you go to use it.
You also cannot go in and out of html/php like you are doing. You may want to read up on using html in a php page and how to end your php and go into html and vice-versa. |
#6
|
||||
|
||||
Can anyone else help me please?
I'm not a coder, so I have no idea how to really go about this and I tried looking at other default vb files for hints, not picking up on how it works. |
#7
|
||||
|
||||
I've not fooled around with it too much and I only understand a little about it, but I know you can't jumble your HTML and PHP together like you have. Take a look at the one of the skin files for ibProArcade and take note of where HTML is being placed and how. Take note of how only variables are being used within the HTML and how it stands out from the code structure of PHP. For instance, if conditions are not being used inside of return <<<EOF EOF;
|
#8
|
||||
|
||||
Try something like this...
PHP Code:
|
#9
|
||||
|
||||
I tried your method HM and got this
http://pingy.us/?v=box.png The code Code:
function top_links_table($links,$width,$extra) { global $ibforums; return <<<EOF <!-- Media Center Nav --> <div class="mc_border_out"> <div class="mc_border_in"> <div id="middlebar"> <a href='http://www.talkjesus.com/arcade.php'><span><img src='/images/media-menu/games.png' alt='Arcade Games' class='img-media-menu' /> Arcade</span></a> <a href='http://www.talkjesus.com/journal.php'><span><img src='/images/media-menu/highlight.png' alt='Journals' class='img-media-menu' /> Journals</span></a> if (in_array($vbulletin->userinfo['usergroupid'], array(2, 6, 7, 35)) AND $vbulletin->userinfo[posts] > 4) { <a href='http://www.talkjesus.com/misc.php?do=page&template=Chat'><span><img src='/images/media-menu/chat.png' alt='Christian Live Chat' class='img-media-menu' /> Live Chat</span></a> } else { <a href='http://www.talkjesus.com/forum-rules...ents-rule.html'><span><img src='/images/media-menu/chat.png' alt='Christian Live Chat' class='img-media-menu' /> Live Chat: Disabled (?)</span></a> } <a href='http://www.talkjesus.com/album.php'><span><img src='/images/media-menu/folder.png' alt='Member Albums' class='img-media-menu' /> Member Albums</span></a> <a href='http://www.talkjesus.com/gallery/index.php'><span><img src='/images/media-menu/image.png' alt='Photo Gallery' class='img-media-menu' /> Photo Gallery</span></a> <a href='javascript:openRadioAndTV()'><span><img src='/images/media-menu/multimedia.png' alt='Radio Streaming' class='img-media-menu' /> Radio</span></a> </div> </div> </div> <!-- /Media Center Nav --> <br /> <table width='100%' border='0' cellspacing='1' cellpadding='4' class="tborder"> <tr> <td class="tcat" align="center" width="{$width}">{$links}</td> {$extra} </tr> </table> EOF; } Code:
function top_links_table($links,$width,$extra) { global $ibforums; return <<<EOF <!-- Media Center Nav --> <div class="mc_border_out"> <div class="mc_border_in"> <div id="middlebar"> <a href='http://www.talkjesus.com/arcade.php'><span><img src='/images/media-menu/games.png' alt='Arcade Games' class='img-media-menu' /> Arcade</span></a> <a href='http://www.talkjesus.com/journal.php'><span><img src='/images/media-menu/highlight.png' alt='Journals' class='img-media-menu' /> Journals</span></a> <a href='http://www.talkjesus.com/misc.php?do=page&template=Chat'><span><img src='/images/media-menu/chat.png' alt='Christian Live Chat' class='img-media-menu' /> Live Chat</span></a> <a href='http://www.talkjesus.com/album.php'><span><img src='/images/media-menu/folder.png' alt='Member Albums' class='img-media-menu' /> Member Albums</span></a> <a href='http://www.talkjesus.com/gallery/index.php'><span><img src='/images/media-menu/image.png' alt='Photo Gallery' class='img-media-menu' /> Photo Gallery</span></a> <a href='javascript:openRadioAndTV()'><span><img src='/images/media-menu/multimedia.png' alt='Radio Streaming' class='img-media-menu' /> Radio</span></a> </div> </div> </div> <!-- /Media Center Nav --> <br /> <table width='100%' border='0' cellspacing='1' cellpadding='4' class="tborder"> <tr> <td class="tcat" align="center" width="{$width}">{$links}</td> {$extra} </tr> </table> EOF; } |
#10
|
||||
|
||||
I'm not entirely sure what your trying to do, but why not just use the standard vBulletin conditionals in the ARCADE template? Then you can set up an <else> in the conditional with a message or whatever else you want those usergroups to see. Seems like that would be easier and closer to what your trying to accomplish.
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|