PDA

View Full Version : <if...> Help


engineerisaac
02-20-2009, 09:57 PM
Hello, I have just started coding for vBulletin yesterday, and I am getting fairly used to it. Although I have one problem, I cannot seem to get sub-pages working correctly for custom pages.

A link in the template would call a location to look something like:

/videoadmin.php?action=addvideo


The current PHP snippet for sub-pages I have in videoadmin.php is:

$page = $_GET['action'];


The <if> statement in the template file is:


<if condition="$page == 'addvideo'">
Testing AddVideo Command
</if>


It seems correct from the tutorials I've read, but I guess I have something incorrect.

Thanks for you help in advance.

SEOvB
02-20-2009, 09:58 PM
did you try to define the page with the define_script 'addvideo'

Then use <if condition="THIS_SCRIPT == addvideo">


(note, my syntax is never excatly correct but should may be close :D)

engineerisaac
02-20-2009, 10:07 PM
Would I define a variable like this:


define("THIS_SCRIPT", $_GET['action']);


Or is THIS_SCRIPT an already implanted variable?

TigerC10
02-20-2009, 10:47 PM
Put your sub-page conditionals in the php code, not in your template code.

videoadmin.php

//... lots of stuff that you need for php files...

$globaltemplates = array(
// change the lines below to the list of actual templates used in the script
'test_mytesttemplate1',
'test_mytesttemplate2',
);

//... more stuff

if( $_REQUEST['do'] == 'addvideo' )
{
//PHP logic, set some variables for your templates.
//whatever else...

eval('print_output("' . fetch_template('test_mytesttemplate1') . '");');

}




Check out this page for more info:
https://vborg.vbsupport.ru/showthread.php?t=98009

Dismounted
02-21-2009, 03:21 AM
When you instantiate vBulletin, it will clear most superglobals for security reasons (forcing you to clean them with the input cleaner). You should be using "do", not "action".