PDA

View Full Version : Creating a custom template


Mephistoxz
12-10-2013, 01:54 AM
I've created a custom template (aoglogo) in order to render a jquery logo inside my header template
I'm calling it with {vb:raw aoglogo} inside "header" template.

I've registered the variable with a plugin and it works fine, I'm seeing the logo, but I just want to be sure I'm doing the correct things ^^

To "register" the {vb:raw aoglogo} variable I've created a plugin using the hook location parse_tamplates with the following code:

$template = vB_Template::create('aoglogo');
$aoglogo = $template->render();
vB_Template::preRegister('header', array('aoglogo' => $aoglogo));

I want to know if some expert can help me to "optimize" the code (I'm using 4.2.1 version), I'm new at these hooks and I don't want to cause any problems to my vbulletin because I copied and pasted that code, I don't really know how this is working ^^

Thanks in advance!

tbworld
12-10-2013, 02:17 AM
I am no expert, but it looks fine to me. :)