Hi everybody,
I have a quick question. I'm working on an integration of Ghostscripter's Amazon Store with my vBulletin installation, and I've come across a problem. I've got the script fairly well integrated into my site, with the header and footer "sandwiching" the Amazon Store code. Here's the code I add to the beginning of the Amazon Store php files to make most of it work:
PHP Code:
<?php
error_reporting(E_ALL & ~E_NOTICE);
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', 'bookstore'); //Change to match file name
chdir('/var/www/html/vbulletin/'); //Change to server path of yoru forums
$globaltemplates = array(
'footer',
'header',
'navbar',
);
if ($_REQUEST['page'])
{
$globaltemplates = array_merge($globaltemplates);
}
require_once('./global.php');
globalize($_REQUEST, array('page' => STR,));
eval('$nakedheader = "' . fetch_template('nakedheader') . '";');
eval('$footer = "' . fetch_template('footer') . '";');
eval('$navbar = "' . fetch_template('navbar') . '";');
$headinclude = str_replace(array('"clientscript', 'url(images/gradients'), array("\"$vboptions[bburl]/clientscript", "url($vboptions[bburl]/images/gradients"), $headinclude);
$footer = str_replace('"cron.php', "\"$vboptions[bburl]/cron.php", $footer);
if ($shownewpm AND $vboptions['showpm'])
{
eval('$pmscript = "' . fetch_template('pm_popup_script') . '";');
$footer .= str_replace('"private.php', "\"$vboptions[bburl]/private.php", $pmscript);
}
//-------- End call to VBulletin header and footer -------//
chdir("/var/www/html/amazon/");
After I do this, I have no problem with echoing my header and footer to the Amazon Store pages. The problem is when I try to access the cart.php to add items, etc. The urls when an item is to be added look like this:
HTML Code:
http://myserver.com/amazon/cart.php?cmd=add&asin=0345391802
When I try to do this, I get the following error, and no I don't have whitespaces before or after my php tags:
Quote:
Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/amazon/cart.php:35) in /cart.php on line 116
|
I know that this error is occurring because global.php sends header / cookie information and the cart.php file also sends header information. I guess something must be getting printed or echoed in between. Here's an example of the code from cart.php that's altering the header (would post more but this code is proprietary):
PHP Code:
case'clear':
unset($_SESSION['cart']['items']);
header("Location: cart.php");
break;
case 'remove':
unset($_SESSION['cart']['items'][$_GET['asin']]);
header("Location: cart.php");
break;
Does anyone know of 1) a way to put all the output of global.php into a variable or something like that, then echo it in the cart.php file? 2) some other brilliant thing I haven't thought of yet?
I know people doing integrations of external scripts have come across this problem and I was wondering if anyone had a clue.
Thanks,
Kenny