Log in

View Full Version : php include within a vBullitin template?


lightnb
02-15-2006, 12:08 AM
I'm trying to replace the logo on my vBullitin site with a <?PHP include_once tag, so that I can use my global mast head as the header for the forums too.

I get nothing when I replace the default:

<a href="$vboptions[forumhome].php$session[sessionurl_q]"><img src="$stylevar[titleimage]" border="0" alt="$vboptions[bbtitle]" /></a>

With:

<?PHP include_once('http://www.rahlentertainment.com/livexchange/header.html');?>

Any ideas?

Thanks,

Nick

Marco van Herwaarden
02-15-2006, 09:30 AM
You can not use PHP in Templates.

You can easily set the Header Image in your Style Settings.

lightnb
02-15-2006, 11:29 PM
I'm not trying to change the header image, I'm trying to replace the image with an included HTML document that has the header, plus all of the navigation.

I managed to acomplish this by placing:

include('http://www.rahlentertainment.com/livexchange/header.html');

in the global.php file.

the only problem is that using this method causes an error with the log-in/out scripts.

When i try to log in or out, i get an error that says "Unable to add cookies, header already sent. File: http://www.rahlentertainment.com/livexchange/header.html
Line: 6"

Any ideas?

thanks,

nick

Reeve of shinra
02-15-2006, 11:37 PM
You can probably code this into a plugin and use a variable to call the header script.

lightnb
02-16-2006, 12:53 AM
Assuming I know the basics of HTML and PHP, but have never created a vB plugin, how would I go about creating one?

thanks,

nick

Reeve of shinra
02-16-2006, 03:26 AM
admincp -> plugin system -> add new plugin

You will get a text box where you add the php code. The hook is the file you want it to be attached to. I'd assume since its the header template, you'd want to hook into global or something.

Read the tutorial section as well for some hints about how to properly format your syntax to take advantage of vb's code.

lightnb
02-16-2006, 05:53 PM
Thanks. That was really easy...

harmor19
02-16-2006, 06:41 PM
I tried what Reeve said a while back but it didn't work.

Hook: global_start
Title: New Header
Code: $new_header = include_once('http://www.rahlentertainment.com/livexchange/header.html');

Then in the header template I put $new_header but it didn't work.

lightnb
02-16-2006, 08:09 PM
I just used Hook:global complete, and inserted the code:

include('http://www.rahlentertainment.com/livexchange/header.html');

I didn't use variables....

S@NL - BlackBik
02-16-2006, 08:52 PM
Why don't you just edit the "header" template?
I did that on my forum and have a costumized header whitout a problem.

lightnb
02-17-2006, 06:19 AM
Why don't you just edit the "header" template?
I did that on my forum and have a costumized header whitout a problem.

I had originally done that, but the header code got screwed up at some point, so i had to revert the template. Having all my header code (it's a bit long since it calls java for rollover buttons, and such) in one place makes my life alot easier for two reasons:

first, I can revert the header without lossing any of my code since it's located in an independant html file; and second, i can update evey page on my site by changing one file. The header template only controls pages that are under vB 'jurisdiction'.

I have gotten the header working, and have found no errors so far...


My question is, how can I globalize the footer in the same fashion? attaching it to global shutdown puts it in about the right place, but causes the whole admin CP to "freak out" for lack of a better term.

Any ideas on how i can attach an HTML file where the footer goes?

Thanks,

Nick