vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Another newbie question. (https://vborg.vbsupport.ru/showthread.php?t=59127)

Fugler 12-12-2003 01:47 PM

Another newbie question.
 
Ok, so I understand that the PHP files and the templates in Vbulletin are used together. But I'm not quit sure how. What I think is that variables and things are made in the PHP files and they're used somehow in the templates, Can anyone tell me how it all works please, or where I can find a thread that does.

Thanks.

Velocd 12-12-2003 04:05 PM

The vBulletin system uses the eval() function to parse variables in HTML templates.

It uses an additional custom function, called fetch_template(), to grab a template that contains the HTML and variables.

Templates are stored in the database, contrary to what many CMS systems do by storing them as files.

What vBulletin system does can be done alternatively using some PHP functions (without the advance caching though):

PHP Code:

vBulletin:

eval(
'$navbar = "' fetch_template('navbar') . '";'); 

PHP Code:

Alternative:

$file file_get_contents("c:\templates\index.tpl");

str_replace("{username}"$fetch_username$file);

echo 
$file;

exit; 

The above is similar to what PHPbb does, last I checked.

Zachery 12-12-2003 05:26 PM

remeber fetech_tempalte is done via vb3 not vb2 ;D

Velocd 12-12-2003 11:12 PM

Regardless of the name, the function exists in both versions. Whenever I say vBulletin, I'm always talking about the latest version.

/me shivers at the thought of vBulletin 2

Fugler 12-20-2003 08:00 PM

So all I'd need to do is do all of my variable stuff in the php, and then use the fetch_template at the bottom with the template I want to use and than I'd just put the variables with the values in the template?

Zachery 12-20-2003 08:01 PM

you cannot use the fetch_template inside ofa template its a php statment


All times are GMT. The time now is 10:28 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.01079 seconds
  • Memory Usage 1,720KB
  • 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
  • (2)bbcode_php_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