vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   Using template class (https://vborg.vbsupport.ru/showthread.php?t=274231)

januszmk6 11-18-2011 10:37 AM

Using template class
 
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

Code:

$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?


All times are GMT. The time now is 04:12 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01138 seconds
  • Memory Usage 1,716KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete