Go Back   vb.org Archive > vBulletin Article Depository > Read An Article > Programming Articles
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
[tip] Never underestimate the power of the phpinclude template
filburt1
Join Date: Feb 2002
Posts: 6,144

 

Maryland, US
Show Printable Version Email this Page Subscription
filburt1 filburt1 is offline 11-12-2002, 10:00 PM

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.
Reply With Quote
  #2  
Old 11-13-2002, 03:57 AM
Tony G's Avatar
Tony G Tony G is offline
 
Join Date: Nov 2001
Location: Melbourne, Australia
Posts: 8,357
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #3  
Old 11-16-2002, 07:56 AM
firenuts
Guest
 
Posts: n/a
Default

Can I use phpinclude to include a PHP page that is also dynamically generated from another database of the same local mySQL?
Reply With Quote
  #4  
Old 11-16-2002, 10:28 AM
Tony G's Avatar
Tony G Tony G is offline
 
Join Date: Nov 2001
Location: Melbourne, Australia
Posts: 8,357
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Is it part of the vB at all?
Reply With Quote
  #5  
Old 12-07-2002, 05:09 AM
drives fast's Avatar
drives fast drives fast is offline
 
Join Date: Nov 2001
Posts: 263
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #6  
Old 12-07-2002, 05:11 AM
Tony G's Avatar
Tony G Tony G is offline
 
Join Date: Nov 2001
Location: Melbourne, Australia
Posts: 8,357
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #7  
Old 12-08-2002, 02:31 AM
drives fast's Avatar
drives fast drives fast is offline
 
Join Date: Nov 2001
Posts: 263
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thank you
Reply With Quote
  #8  
Old 12-08-2002, 03:05 AM
Tony G's Avatar
Tony G Tony G is offline
 
Join Date: Nov 2001
Location: Melbourne, Australia
Posts: 8,357
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

No problem, glad to help! ^_^
Reply With Quote
  #9  
Old 04-09-2003, 01:15 AM
drives fast's Avatar
drives fast drives fast is offline
 
Join Date: Nov 2001
Posts: 263
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #10  
Old 05-20-2003, 02:41 PM
imported_hinch imported_hinch is offline
 
Join Date: Jan 2003
Posts: 8
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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)
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:27 AM.


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.04687 seconds
  • Memory Usage 2,279KB
  • Queries Executed 23 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_article
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (9)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete