PDA

View Full Version : Put own variables


Gamempire
03-29-2010, 07:02 PM
I want to include a php file in vb4 header.
How can i do?

I don't understand well how to use a variable that i create in a new "global start" plugin.
I try with {vb:raw varname}, but it doesn't display nothing...

Thanks

Link14716
03-29-2010, 07:10 PM
Variables must be registered with the template before you can use them. Add this to the end of your plugin, for example.

vB_Template::preRegister('header', array('varname' => $varname));

Gamempire
03-29-2010, 07:40 PM
id doesn't work:


ob_start();
include('/pathto/header.php');
$header_include = ob_get_contents();
ob_end_clean();
vB_Template::preRegister('header', array('header_include' => $header_include));

Link14716
03-29-2010, 07:51 PM
Move the plugin to the 'parse_templates' hook and see if anything changes.

Gamempire
03-29-2010, 08:05 PM
it works well! :)
thanks