vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Programming Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=188)
-   -   [tip] Never underestimate the power of the phpinclude template (https://vborg.vbsupport.ru/showthread.php?t=85294)

filburt1 11-12-2002 10:00 PM

[tip] Never underestimate the power of the phpinclude template
 
A substantial number of hacks at vBulletin.org could be completely ported to a pure phpinclude-based structure. The phpinclude template lets you enter PHP code that is parsed before virtually everything else; it does get parsed before every single template gets loaded.

phpinclude is critical if you want to add features with your template modifications. Most of my October/November template releases have required phpinclude. Also using phpinclude does not edit the actual PHP files and makes upgrading to the latest version of vBulletin extremely easy: just upgrade normally!

However remember though that phpinclude is PHP code and can also compromise the security of your forums, just like any hack. For example, never do this:
Code:

if ($condition)
{
    $value = 'something';
}
.
.
.

Notice that I didn't assign something to $value if $condition is false. So then if I were to use $value in a template and $condition was false, a clever user could inject HTML into the current page. This is really bad because they can go so far as to steal your admin password MD5 hash and given time derive your admin password!

So use the phpinclude template but beware of the dark side. :)

Tony G 11-13-2002 03:57 AM

phpinclude is good for easy upgrading, but several hacks won't work through it. So depending on what hacks you use depends on if you can use phpinclude or not. Some are possible but alot harder to port. ;)

firenuts 11-16-2002 07:56 AM

Can I use phpinclude to include a PHP page that is also dynamically generated from another database of the same local mySQL?

Tony G 11-16-2002 10:28 AM

Is it part of the vB at all?

drives fast 12-07-2002 05:09 AM

this is very interesting to me but my being a retard I have no idea how to go about utilizing this idea.

if you wouldn't mind helping the mentally challenged....would you tell me how you would make the quick reply hack by FireFly hack work by using the phpinclude template?

I chose this hack to ask about because if someone could explain how to make this one work your way...I believe I could figure out how to do all og the others I use.

thank you in advance

Tony G 12-07-2002 05:11 AM

If you're interested, take a look at this:

http://www.vbulletintemplates.com/mo...&threadid=2224

It makes phpinclude mods code a whole lot easier to mod. Hope it helps. :)

drives fast 12-08-2002 02:31 AM

thank you

Tony G 12-08-2002 03:05 AM

No problem, glad to help! ^_^

drives fast 04-09-2003 01:15 AM

I am making a classifieds area on my site but instead of hacking to do this I am using the existing forum scripting to accomplish it.

however...I have made a page to show the classifieds categories on and want to order them on the page the way I think they should look rather then one under the other like the forum list.

anyway....can anyone help me with the code I would put into phpinclude to display the forum title then forum thread count and finally below that the forum description?

I have been trying many things but am aparently php stupid

thank you in advance

imported_hinch 05-20-2003 02:41 PM

so how come this doesnt work then

if ($bbuserinfo['userid']!=0) {
eval("\$themeheader = \"".gettemplate("P_themeheaderLI")."\";");
}else{
eval("\$themeheader = \"".gettemplate("P_themeheader")."\";");
}

yet works fine on the vbportal front end (remembering that vbp and vbb both use same user logged in details and in this case both use the same header pages)


All times are GMT. The time now is 02:04 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01584 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_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete