PDA

View Full Version : Calling custom templates in vB default templates


bpat1434
01-17-2010, 04:19 AM
I'm creating a product and have two template elements that I want to include. One is for thread creation, the other when displaying a thread. So I rightly named the templates:

newthread_my_module
showthread_my_module

Now they are visible in the admin template editor area. I have edited both "newthread" and "SHOWTHREAD" to try and inlcude my templates like so:

{vb:raw my_module}

I've also tried

{vb:raw newthread_my_module}

Either way, nothing seems to work. I can't quite look at the vB code and see exactly how the templates are associated. "threadmanagement" seems to link to the "newpost_threadmanage" template.

Can anyone shed some light on how I'm supposed to include my custom templates into a vB template?

bpat1434
01-22-2010, 09:13 PM
I think I solved this on my own. I just added template hooks which need to be added to the theme(s).

Aadil
02-21-2010, 03:27 AM
would u mind explaining how u did it? trying to do it myself

bpat1434
02-21-2010, 11:11 AM
I created a template hook in my plugin, then called the appropriate hook in whatever template I wanted.

For example:

$templater = vB_template::create('my_template_name');
$templater->register('my_variable', $my_variable);
$template_hook['my_hook_name'] = $templater->render();

Then in the template, I just added the hook:

{vb:raw template_hook.my_hook_name}