The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Simple problem but idk how to fix it
Hello
It's very simple to explain. I want to include my custom php header on my forum so i set a plugin with global_start with this code: Code:
ob_start(); include('custom/header.php'); $custom_header = ob_get_contents(); ob_end_clean(); Code:
$custom_header = include('custom/header.php'); Code:
<? ob_start('cache_page'); ?> <div class="blablablablablablabla"></div> <? ob_end_clean(); ?> Thank you! |
#2
|
|||
|
|||
Maybe try this:
PHP Code:
(of course change 'template_name' to whatever template your want to put your custom header in. And then in the template: Code:
{vb:raw custom_header} I don't know why the other things you posted didn't work - I learned a couple things about php just trying to figure out your code. |
#3
|
|||
|
|||
Why are you using ob_start and ob_get_contents instead of file_get_contents or file?
I think it might be possible that you mess parts of the vbulletin php file up, if you use ob_end_clean in the wrong place? Not exactly sure if end_clean closed the last ob_start - or everything. And i do not think you need it if you use file() or file_get_contents() instead? just realised you use a *.php file, then $foo = include(YOURFILE); should have the desired effekt as long as your phpfile returns the desired value. |
#4
|
|||
|
|||
I'm guessing the OP is using ob_start()/ob_end_clean() because the vb manual has that as an example of how to include an external file. I think the reason for doing that is if you have a php file that produces html (as opposed to returning it in a string) then with this method you don't have to make any changes to it.
|
#5
|
|||
|
|||
I'm using the code published (as guide) in vB forum so the code you are "trying to figure out" is not mine Anyway now it works.
Mooff i'm using ob_start just because it was written in vB forum and the thread has been recently linked by "vBulletin Technical Support Lead" so i thought that it was good. edit: exactly kh99. There are php and js scripts in the included file Thanks. |
#6
|
|||
|
|||
Quote:
Anyway, I'm glad you got it working. |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|