Register Members List Search Today's Posts Mark Forums Read

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

Maryland, US
by filburt1 filburt1 is offline 13 Nov 2002

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:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

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.
Views: 3720
Reply With Quote
Comments
  #2  
Old 13 Nov 2002, 05:57
Tony G's Avatar
Tony G Tony G is offline
 
Join Date: Nov 2001
Real name: ITS A SECRET
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 16 Nov 2002, 09:56
firenuts
Guest
 
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 16 Nov 2002, 12:28
Tony G's Avatar
Tony G Tony G is offline
 
Join Date: Nov 2001
Real name: ITS A SECRET
Is it part of the vB at all?
Reply With Quote
  #5  
Old 07 Dec 2002, 07:09
drives fast's Avatar
drives fast drives fast is offline
 
Join Date: Nov 2001
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 07 Dec 2002, 07:11
Tony G's Avatar
Tony G Tony G is offline
 
Join Date: Nov 2001
Real name: ITS A SECRET
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 08 Dec 2002, 04:31
drives fast's Avatar
drives fast drives fast is offline
 
Join Date: Nov 2001
thank you
Reply With Quote
  #8  
Old 08 Dec 2002, 05:05
Tony G's Avatar
Tony G Tony G is offline
 
Join Date: Nov 2001
Real name: ITS A SECRET
No problem, glad to help! ^_^
Reply With Quote
  #9  
Old 09 Apr 2003, 03:15
drives fast's Avatar
drives fast drives fast is offline
 
Join Date: Nov 2001
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 20 May 2003, 16:41
imported_hinch imported_hinch is offline
 
Join Date: Jan 2003
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
  #11  
Old 20 May 2003, 17:08
filburt1 filburt1 is offline
 
Join Date: Feb 2002
Provided you used it correctly, it does work.
Reply With Quote
  #12  
Old 20 May 2003, 17:28
imported_hinch imported_hinch is offline
 
Join Date: Jan 2003
thats whats confusing me it does work on some pages just not on others

ie: the login box swap works fine on all the portal pages but it refuses to work on the vbb its self. even though both pages load exactly the same header templates and both process the phpinclude template

this is almost the last thing ive been stuck with and its confusing the hell outta me
Reply With Quote
  #13  
Old 10 Jun 2003, 00:37
dstruct2k's Avatar
dstruct2k dstruct2k is offline
 
Join Date: Dec 2002
Real name: Bill
hinch: I did that same hack... But to the header code itself within vBP's files. I decided a code hack would work better than a template hack. Ironically, I'm getting to opposite of what you are -- The themeheader is only changed within vB pages. vBP pages show the default. So, I think a combination of both our hacks would create exactly what we need.
Reply With Quote
  #14  
Old 11 Jun 2003, 09:24
imported_hinch imported_hinch is offline
 
Join Date: Jan 2003
heh possiably

well the vbp header swapping works perfectly all i did was add the template called P_themeheadersLI (LI for logged in)

then in header.php edited the line of code that just said
eval("\$themeheader = \"".gettemplate("P_themeheader")."\";");

to now say

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

thats on line 50 or so of header.php so that should work for you fine. i think

as for the vb one its self fancy giving me a clue im struggling to find even html in the vb files
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Article Options

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


New To Site? Need Help?

All times are GMT. The time now is 18:36.

Layout Options | Width: Wide Color: