Hi all,
I've spent the entire yesterday and today morning reading on how to use custom PHP code through plugins and referring to plugin-variables in a template, and I still haven't got it working. The approach to do this still seems a bit blurry even after reading multiple articles covering the subject, so please bear with me on these basic questions.
From my understanding you can't register a variable in existing templates, such as FORUMHOME. This is where I would like my code to be inserted. Do do that I need to preRegister the variable from my plugin code.
What I did was to make a new plugin. I made a name for it and set hook_location to global_start (If anyone has any links on when to use what hook please share). I leave execution order to 5 and the actual code for my new plugin looks like this:
PHP Code:
$customCode = "This is your custom code output!";
vB_Template::preRegister('FORUMHOME',array('customCode_ output' => $customCode));
If I got things right, I can access the variable only from the FORUMHOME template, because that's to where I registered it. And to access the variable I type this:
PHP Code:
{vb:raw customCode}
And there's the problem for me. Nothing shows up when I refresh my forum. I expect the contents of the variable "This is your custom code output!" to be shown but it's all just blank. What am I doing wrong and what is the proper way to do it?
Any help appreciated! Thank you.