PDA

View Full Version : phpinclude mods


Bad Bunny
02-11-2003, 01:34 AM
There are a growing number of template mods that requirre adding if else statements in the phpinclude template. Does each one of these add a query or anything like that?

What is the downside of doing it this way rather than hacking the global.php or something of that nature?

filburt1
02-11-2003, 01:38 AM
Benefits of using phpinclude:
1. no hacking
2. vB support can still officially help you
3. upgrading is easy
4. easier than hacking (no file editing)

Downsides:
1. theoretically a speed hit
2. most feature additions require hacking
3. working with custom templates in phpinclude adds a query for each template (IIRC)

The main thing that people use phpinclude for is evaluating a condition because vB2 cannot have conditions in templates. I use it for adding features which usually requires queries.

Mods written for the latest version of PAPI and that use its query functions lets you keep track of how many queries you're adding.

Bad Bunny
02-11-2003, 01:48 AM
Ah, ok. That is interesting.
Thanks for replying.
So, just to get this straight, when I do use a conditional, like to display one text for guest and another for a member, and I put it in the phpinclude, that alone will not adda query? Only if I add my own custom template, and use that with the conditionals?

filburt1
02-11-2003, 02:05 AM
Right.

vB3 will support conditionals and there's a hack for vB2 that supports them.

Brad
02-11-2003, 02:40 AM
Originally posted by Bad Bunny
Ah, ok. That is interesting.
Thanks for replying.
So, just to get this straight, when I do use a conditional, like to display one text for guest and another for a member, and I put it in the phpinclude, that alone will not adda query? Only if I add my own custom template, and use that with the conditionals?

Correct, you only query the database with phpinclude if you use a custom template (requires hacking to cache the template. We can not add things to $templatesused = ''; varable used in all files via phpinclude). Or if you query the database directly. Heres a example of a query that might be added to phpinclude:

$grabinfo=$DB_site->query_first("SELECT COUNT(*) AS threads FROM thread WHERE lastpost > '$bbuserinfo[lastvisit]'");

Also anything you stick into phpinclude is evaled on every page, that is where the speed hit can come from (among other things like server extensive querys). So be careful about how much you add to the template.

To hack or not to hack, its really up to you. If you feel that you do not require vBulletin support and you understand the inner workings of vB enof hacking may be the way to go. I do a fare bit of it. _But_ if you require offical support, or hacking the files scares you, then use the phpinclude.

Brad
02-11-2003, 02:44 AM
*also* PAPI is not required for all phpinclude mods, its only a wrapper for the phpinclude (makes it easyer to code mods). Personaly ive never released anything that required PAPI, but a few others have.

Tony G
02-11-2003, 03:22 AM
Good to release two versions maybe - phpinclude and PAPI.

Bad Bunny
02-11-2003, 04:15 AM
Thanks for the help, guys. I thought I understood it alright, but I have a better grasp now. :)
I am using the phpinclude to display navigation based on member status. So it needs to be on every page. So that is alright with me.