vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Fetch Template (https://vborg.vbsupport.ru/showthread.php?t=269525)

Slayerz 09-01-2011 06:54 PM

Fetch Template
 
I saw a few threads about it, but they were vague and I couldn't get too deep of a grasp for the basis of it.

I was wondering how to change raw php, using templates.

For instances, I got the program to work and it shows in admincp, but to view it on forum errors occur.

So I checked it out and found out that it's mostly fetch template coding.

I was wondering if there is a simple method to easily change the fetch templates into vb_template class.

As if to take main standards of the fetch and just use it in a template of the vb_template class for it to read and work.

kh99 09-01-2011 07:00 PM

I don't understand. Do you mean you want to convert vb3 type "fetch and eval" template code to vb4? Or do you want to change an adminCP "just print out the html" page to work in with templates?

Slayerz 09-01-2011 07:06 PM

I wanted to convert vb3 type "fetch and eval" into vb4

kh99 09-01-2011 07:12 PM

Here's an article on that. https://vborg.vbsupport.ru/showthread.php?t=228078

You really just have to create the template object and call render(), but the big difference is that you have to register all the variables used in the template, where you didn't have to do that at all in vb3.

Also the template syntax changed. That's described in the manual: https://www.vbulletin.com/docs/html/...emplates_intro

Basically, <if> and <else> are now <vb:if> and <vb:else>, and where you had $varname before you'd now have {vb:raw varname} (but not in condition="", those would stay the same).

Slayerz 09-01-2011 07:25 PM

I saw that, but wasn't 100% sure on what'd I do for this.

eval('$templater = vB_Template::create('inferno_header');
$navbits = construct_navbits($navbits);
eval('$navbar = "' . fetch_template('navbar') . '";');
}

How would that be changed?

kh99 09-01-2011 08:43 PM

To be honest I don't know what to make of that. Are you trying to add a template called 'inferno_header' to your navbar? Then you'd want something like this:

PHP Code:

$templater vB_Template::create('inferno_header');
$inferno_header $templater->render();
vB_Template::preRegister('navbar', array('inferno_header' => $inferno_header)); 

and then in the navbar template:

Code:

{vb:raw inferno_header}

Slayerz 09-01-2011 08:47 PM

That's what I'm assuming.

I'm taking a failed modification and rebuilding it.


All times are GMT. The time now is 05:05 AM.

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.01722 seconds
  • Memory Usage 1,723KB
  • 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)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)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