Log in

View Full Version : Another newbie question.


Fugler
12-12-2003, 01:47 PM
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):


vBulletin:

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



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