vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   phpinclude mods (https://vborg.vbsupport.ru/showthread.php?t=86261)

Bad Bunny 02-11-2003 01:34 AM

phpinclude mods
 
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

Quote:

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.


All times are GMT. The time now is 07:40 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.01163 seconds
  • Memory Usage 1,726KB
  • 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_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)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