PDA

View Full Version : How it works...


nautiqeman
10-14-2004, 02:11 PM
I'm a newbie to vBulletin, but very experienced in web development (over 7 years). I've install 3.0.3 and I'm trying to figure out how everything interacts with each other, specifically the TEMPLATES in the admin area and the .php files. Like for example, MEMBERINFO in the Templates area of the Admin and where is the call to MEMBERINFO in the member.php file? I mean I see the very last 2 lines is
$templatename = iif($quick, 'memberinfo_quick', 'MEMBERINFO');
eval('print_output("' . fetch_template($templatename) . '");');

But things that happen in one area of the site in the MEMBERINFO aren't happening in the User Profile, but they should be. Specifically talking about the Age in Profile hack.

I appreciate any info or help in anyway. Thanks in advance.

Colin F
10-14-2004, 03:17 PM
Hi

It's not that hard:

Templates are called with something like $foo = fetch_template(foo), which stores the template in the var $foo. Afterwards, print_output() outputs the whole thing, using the template indicated in the fetch_template() inside print_output().

Additionally, you have template conditionals, with which you can show or hide certain parts of the template based on conditionals. Those look like this:
<if condition="$foo == 2">foo is 2<else />foo isn't 2</if>
The else part is optional.

There's also a lot more information in the vBulletin documentation which you can find at www.vbulletin.com/docs/


Have fun with vBulletin!

nautiqeman
10-14-2004, 04:12 PM
Thanks Colin,

But when you look in the ACP, there are templates that are all caps and ORANGE, like MEMBERINFO and others that are just lower case, does this mean anything???

Colin F
10-14-2004, 04:24 PM
As far as I know not. Some that are all caps are page templates, the ones called with print_output, but I don't think it has any meaning other than to highlight them a bit more.

nautiqeman
10-14-2004, 04:29 PM
so what are the ones that are all lower case?

Colin F
10-14-2004, 04:38 PM
Templates inside the actual page. For example the postbit is repeated (using $postbit .= fetch_template(postbit) ) for each post. So the postbit is an own template. Or the navbar. Or the header. pretty much everything is in a template somewhere, except for the basic page layout.

Brad
10-14-2004, 04:49 PM
Thanks Colin,

But when you look in the ACP, there are templates that are all caps and ORANGE, like MEMBERINFO and others that are just lower case, does this mean anything???
Templates in all upper case are main templates. Basicly they are the template called at the end of the page, the main template contains all the code generated by other templates evaled durring page execution.

Basicly if you have this:

// parse some templates
eval('$foo = "' . fetch_template('foo') . '";');
eval('$foo2 = "' . fetch_template('foo2') . '";');
eval('$foo3 = "' . fetch_template('foo3') . '";');
eval('$foo4 = "' . fetch_template('foo4') . '";');

It would output nothing, but lets asume we have a main template called FOODISPLAY in the database that contains the following:

<html>$foo<br />$foo2<br />$foo3<br />$foo4</html>

So we would call it like this:

eval('print_output("' . fetch_template('FOODISPLAY') . '");');

The print_output function dose a few things, like flush the php buffer for instance and ensures all php is ended.

nautiqeman
10-14-2004, 05:10 PM
oh ok -- I see - thanks

I also wanted to ask -- if I am working off the Default Style, and adding in hacks and such. If I change the style, will I have to go thru and change all the Templates again???