View Full Version : Using phpInclude
Cabana
Wed 25th Sep '02, 3:16am
This code goes in my phpInclude:
include($_SERVER['DOCUMENT_ROOT']."/clsBanner.php");
$banner = new banners();
How do I get this code to work in a template?
$banner->largeBanner();
I tried putting this in the header so I could use $bannerCode in the template, but it displayed the banner at the top, not where I wanted:
$bannerCode = $banner->largeBanner();
perfectphp
Fri 27th Sep '02, 11:16pm
Either try using
$banner->largeBanner();
where you want the banner to display... or...
$bannerCode = $banner->largeBanner();
where you want the banner to display
Cabana
Fri 27th Sep '02, 11:26pm
The first gives me (): while the second gives me =(); - neither work because the code is stripped. Thanks for trying though, have any other ideas? This is frustrating.
filburt1
Sat 28th Sep '02, 12:19am
Are you putting $bannerCode = $banner->largeBanner(); in the header template or the phpinclude template? :confused:
Cabana
Sat 28th Sep '02, 12:29am
I put it in the phpInclude template so then I could put $banner in the header template, but that just processes the code at the very top of the page instead of where I put $banner. I can't put that line in any other template because it's PHP and that doesn't work.
filburt1
Sat 28th Sep '02, 12:31am
I'm confused; is this what you're doing:
in phpinclude:
include($_SERVER['DOCUMENT_ROOT']."/clsBanner.php");
$banner = new banners();
$bannerCode = $banner->largeBanner();
in header:
$bannerCode
?
Cabana
Sat 28th Sep '02, 1:36am
Correct. What that does is place the processed PHP code at the very top of the html file, not in the header where I want it.
Chen
Sat 28th Sep '02, 3:32am
phpinclude:
include($_SERVER['DOCUMENT_ROOT'].'/clsBanner.php');
$banner = new banners();
ob_start();
$banner->largeBanner();
$bannerCode = ob_get_contents();
ob_end_clean();
header:
$bannedCode
:)
Cabana
Sat 28th Sep '02, 5:05pm
Thank you thank you thank you! :) I'm fairly clueless when it comes to these things.
Raz Meister
Sat 28th Sep '02, 5:15pm
Very ineffiencent!
You should integrate the code properly!
vBulletin® v3.8.0 Beta 3, Copyright ©2000-2008, Jelsoft Enterprises Ltd.