vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   <if...> Help (https://vborg.vbsupport.ru/showthread.php?t=206058)

engineerisaac 02-20-2009 09:57 PM

<if...> Help
 
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:
Code:

/videoadmin.php?action=addvideo
The current PHP snippet for sub-pages I have in videoadmin.php is:
PHP Code:

$page $_GET['action']; 

The <if> statement in the template file is:

HTML Code:

<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:

PHP Code:

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
PHP Code:

//... 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".


All times are GMT. The time now is 10:11 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.00973 seconds
  • Memory Usage 1,724KB
  • 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
  • (1)bbcode_code_printable
  • (1)bbcode_html_printable
  • (3)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)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