PDA

View Full Version : Issue calling information from php file


Hell Bomb
10-23-2009, 03:28 AM
Hello everyone im trying to make a custom page from where i can display a chat room inside vbulletin template system. So far i am unable to get it to work maybe someone can offer a suggestion.

I Made a plug in here is the code:


ob_start();
require(DIR . '/chat/index.php');
$chatroom = ob_get_contents();
ob_end_clean();


Next i created a php file to display the new custom vbulletin page i made and named it chat.php. Here is the code:

<?php

// ######################## SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);

// ##################### DEFINE IMPORTANT CONSTANTS #######################
// change the line below to the actual filename without ".php" extention.
// the reason for using actual filename without extention as a value of this constant is to ensure uniqueness of the value throughout every PHP file of any given vBulletin installation.

define('THIS_SCRIPT', 'chat');

// #################### 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(
// change the lines below to the list of actual templates used in the script
'chat_chatroom',
);

// pre-cache templates used by specific actions
$actiontemplates = array();

// ########################## REQUIRE BACK-END ############################
require_once('./global.php');

// #################### HARD CODE JAVASCRIPT PATHS ########################
$headinclude = str_replace('clientscript', $vbulletin->options['bburl'] . '/clientscript', $headinclude);

// ################################################## ######################
// ######################### START MAIN SCRIPT ############################
// ################################################## ######################

$navbits = array();
// change the line below to contain whatever you want to show in the navbar (title of your custom page)
$navbits[$parent] = 'Chatroom';

$navbits = construct_navbits($navbits);
eval('$navbar = "' . fetch_template('navbar') . '";');

// change the line below to contain the name of the actual main output template used in your script
eval('print_output("' . fetch_template('chat_chatroom') . '");');

?>

<script type="text/javascript" src="http://toxicgamerz.net/vb/chat/index.php"></script>


Then i created a new custom template named chat_chatroom. Here is the code:

$stylevar[htmldoctype]
<html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
$headinclude
<title>$vboptions[bbtitle]</title>
</head>
<body>

$header
$navbar

<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%"

align="center">
<tr>
<td class="tcat">Chatroom</td>
</tr>
<tr>
$GLOBALS[chatroom]
</tr>
</table>
$footer
</body>
</html>


Now for the problems i am having. I think i have somethign wrong in the code but i am not sure.

When i set the plugin to start on global_complete i get the error

Fatal error: Call to a member function on a non-object in /home/choas0/public_html/vb/global.php on line 242

when i set the plugin to start on global_start i get the error

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, webmaster@toxicgamerz.net and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.


Yea im lost at this point if someone could suggest anything for me to try or has any idea why all help would be appreciated.