The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Error on page
Can anyone tell me why I get an error on a php page when I move it out of the bbs directory and into a chat directory and add the chdir line of code? I get the error:
Line 43 Char 1 Object Expected I will paste the code below. Thanks Jaime PHP Code:
|
#2
|
||||
|
||||
Your problem is how you're setting the navbits. $parent isn't defined... You should do this instead...
Code:
<?php // ####################### SET PHP ENVIRONMENT ########################### error_reporting(E_ALL & ~E_NOTICE); // #################### DEFINE IMPORTANT CONSTANTS ####################### define('NO_REGISTER_GLOBALS', 1); define('THIS_SCRIPT', 'Chat'); // change this depending on your filename // ################### PRE-CACHE TEMPLATES AND DATA ###################### // get special phrase groups $phrasegroups = array( ); // get special data templates from the datastore $specialtemplates = array( ); // pre-cache templates used by all actions $globaltemplates = array( 'Chat', ); // pre-cache templates used by specific actions $actiontemplates = array( ); // ######################### REQUIRE BACK-END ############################ chdir('/path/to/bbs/directory'); require_once('/path/to/bbs/directory/global.php'); // ####################################################################### // ######################## START MAIN SCRIPT ############################ // ####################################################################### $navbits = array(); $navbits["chat.php"] = 'Chat Page'; $navbits = construct_navbits($navbits); eval('print_output("' . fetch_template('Chat') . '");'); ?> |
#3
|
|||
|
|||
I put chat.php where you said and still get an error, but on line 47 now. I only have 45 lines of code in that file, could the error be in my template? I don't understand this, all the code works fine when I have this file in the bbs directory, but I get an error when I move it out of the bbs directory into my chat directory. Will post my code below.
PHP Code:
|
#4
|
||||
|
||||
What's your new error message?
|
#5
|
|||
|
|||
I was editing my template tonight and now the line of the error has changed. The error is now this:
Line 22 Char 1 Object Expected Could the error be in my template? Could there be something wrong with the way I'm changing directories in my php file? I'm wondering that cause everything works fine when the php file is in my bbs directory where my global.php file is. Thanks Jaime |
#6
|
||||
|
||||
Well, changing the working directory generally only messes up other includes... I don't see anything in your code that would cause that problem. If you think it's a problem, you can try this:
Code:
<?php // ####################### SET PHP ENVIRONMENT ########################### error_reporting(E_ALL & ~E_NOTICE); // #################### DEFINE IMPORTANT CONSTANTS ####################### define('NO_REGISTER_GLOBALS', 1); define('THIS_SCRIPT', 'Chat'); // change this depending on your filename // ################### PRE-CACHE TEMPLATES AND DATA ###################### // get special phrase groups $phrasegroups = array( ); // get special data templates from the datastore $specialtemplates = array( ); // pre-cache templates used by all actions $globaltemplates = array( 'Chat', ); // pre-cache templates used by specific actions $actiontemplates = array( ); // ######################### REQUIRE BACK-END ############################ $curr_dir = getcwd(); chdir('/path/to/bbs/directory'); require_once('/path/to/bbs/directory/global.php'); chdir( $curr_dir ); // ####################################################################### // ######################## START MAIN SCRIPT ############################ // ####################################################################### $navbits = array(); $navbits["chat.php"] = 'Chat Page'; $navbits = construct_navbits($navbits); eval('print_output("' . fetch_template('Chat') . '");'); ?> |
#7
|
|||
|
|||
I changed NO_REGISTER_GLOBALS to false and that didn't change anything. I also added the code in red that you added to my code and I still get the same error message.
Any other suggestions? Thanks Jaime |
#8
|
||||
|
||||
Can you post your Chat template?
|
#9
|
|||
|
|||
Thats a template error and not an error from the php file.
Its usually from using coding thats not up to standards. Try to run the template through a validator. |
#10
|
||||
|
||||
Templates cannot be placed directly into the W3C validator - as it contains vBulletin's custom tags.
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|