Hello,
i wanted to include a file inside a custom template (but the problem is for any variable defined in a plugins that i want to use in a custom template) vB version 4.1.9.
i created a new plugins called google_analytics with hooklocation global_start
that's the code of the plugins:
Code:
ob_start();
include("../google_forum.inc.php");
$google_analytics = ob_get_contents();
ob_end_clean();
echo "pippo";
echo date("Y");
(i'll explain later thereason of the 2 last lines......)
then i put in my global.php the following line
Code:
vB_Template::preRegister('footer',array('google_analytics ' => $google_analytics));
and i recalled my variable inside the template with
Code:
{vb:raw google_analytics}
but nothing has been inserted in the html source code
now the questions are:
should i use the preRegister method to have the variables correctly addressed in my templates????
where to put this code (i mean the vBTemplate........et...etc...) cause anytime i ugrade the version i overwrite almost all files such as global.php for example??
why if i comment out the line in the global.php for variable registration and i delete the declaration of the variable in my template i get always at the beginning of my html source code (and never in the place where i put the variable in the template) "pippo2011"????
Thank you and
Regards
Franco