PDA

View Full Version : Using template class


januszmk6
11-18-2011, 10:37 AM
Hello.
I am converting my forum on phpbb to vBulletin. I have portal integrated into my forum. I wanted to use vB template class in my portal, but I cannot find info about how to parse informations into my templates file. Could you tell me, where can I declare variable of template file?
Thanks in advance

kh99
11-18-2011, 10:43 AM
Here's an article on registering variables to templates, in case that helps: https://vborg.vbsupport.ru/showthread.php?t=228078

januszmk6
11-18-2011, 11:26 AM
So if I want to my use my template, then I put the code of template in Style manager and then
$templater = vB_Template::create('portal');
print_output($templater->render());
where 'portal' is a title of template in style manager?
If yes, then I am doing something wrong, because nothing is not generating

kh99
11-18-2011, 12:02 PM
$templater->render() returns a string, so just calling it doesn't produce anything. if your portal template represents and entire html document, then you can call print_output(), like

$templater = vB_Template::create('portal');
print_output($templater->render());

Note that print_output() doesn't return, so it has to be the last thing you call.

If the portal template isn't an entire document, then you need to save the string in a variable, then use it in another template.

januszmk6
11-18-2011, 12:15 PM
Thanks for help but my mistake was that, I added template into not default style but second style.
Regards

januszmk6
11-28-2011, 09:42 AM
I have one more question about template class.
The conditions like <vb:if> are working just on global variables. Is there way to use my own variables without changing class code?