Register Members List Search Today's Posts Mark Forums Read

Reply
 
Mod Options
Embed PHP in Templates Details »
Embed PHP in Templates
Mod Version: 1.00, by filburt1 (Member) filburt1 is offline
Developer Last Online: May 2007 I like it Show Printable Version Email this Page

This modification is in the archives.
vB Version: 2.3.x Rating: (0 vote - 0 average) Installs: 16
Released: 11 May 2003 Last Update: Never Downloads: 22
Not Supported  

This hack lets you embed PHP code in templates. Simply add your code between a <? (not a <?php) and ?> tag and it will be eval'ed. All variables will be referenced in the global scope.

If you're using my Usergroup Tags in Templates hack then you're going to have an extraordinarily difficult time installing this hack. However the clever hacker can tell what has changed in this version.

You can somewhat use this to do conditionals in templates. Theoretically, this will work:


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

Just make sure that the variable to the left of the = and the variable right after the ?> match. Note that the entire <? and ?> tag itself will be stripped from the final template.

This hack also enhances the comments delimiting templates (if that option is turned on) to include the character count and PHP block count of the specified template.

Download Now

Only licensed members can download files, Click Here for more information.

Show Your Support

  • To receive notifications regarding updates -> Click to Mark as Installed.
  • This modification may not be copied, reproduced or published elsewhere without author's permission.
Similar Mod
Mod Developer Type Replies Last Post
Advanced Templates: Dynamic Templates Changing according to different conditions Logician vBulletin 2.x Full Releases 312 24 Apr 2005 19:20

Comments
  #2  
Old 11 May 2003, 00:59
filburt1 filburt1 is offline
 
Join Date: Feb 2002
Admin CP:
Attached Images
File Type: gif untitled-2 copy.gif (3.5 KB, 552 views)
Reply With Quote
  #3  
Old 11 May 2003, 01:00
filburt1 filburt1 is offline
 
Join Date: Feb 2002
The result:
Attached Images
File Type: gif untitled-1 copy.gif (26.7 KB, 468 views)
Reply With Quote
  #4  
Old 11 May 2003, 01:49
Koutaru's Avatar
Koutaru Koutaru is offline
 
Join Date: Feb 2003
Real name: Julie
I'm definately going to use this when I get back Thanks for the hack filburt!
__________________
http://www.miyechi.com/storage/sig.png
Miyechi - Adventure inside
Reply With Quote
  #5  
Old 11 May 2003, 03:04
Link14716's Avatar
Link14716 Link14716 is offline
 
Join Date: Jun 2002
Real name: Matthew Gordon
Wow, this leaves all the template conditional hacks in the dust. I might even install this one!

Great job, filburt!
__________________
Along with Zachery, I make releases as GeekyDesigns. Please do not PM or IM me for support.
Reply With Quote
  #6  
Old 11 May 2003, 09:29
N9ne N9ne is offline
 
Join Date: Feb 2002
Very nice filby! Is this efficient?
__________________
[Signature Goes Here]
Reply With Quote
  #7  
Old 11 May 2003, 09:34
Trigunflame's Avatar
Trigunflame Trigunflame is offline
 
Join Date: Aug 2002
Real name: Dusty Burns
I dont think effecient is the way to put it, its only as effecient as the code u put between the tags....if u just put <? ?> or <? // ?> its not gonna slow anything down a bit...
Reply With Quote
  #8  
Old 11 May 2003, 13:41
Dean C's Avatar
Dean C Dean C is offline
 
Join Date: Jan 2002
Real name: Dean Clatworthy
What are the limitations on the use of PHP ?

- miSt
__________________
Dean Clatworthy - Web Developer/Designer
Reply With Quote
  #9  
Old 11 May 2003, 14:39
N9ne N9ne is offline
 
Join Date: Feb 2002
Mist, as far as I know, I don't think there are any, as the example that Filburt gives with the if condition statement looks like proper PHP so by the looks of that, a lot can be done.
__________________
[Signature Goes Here]
Reply With Quote
  #10  
Old 11 May 2003, 16:31
Danielo's Avatar
Danielo Danielo is offline
 
Join Date: Jul 2002
Thank you very much... i try to use this script
Reply With Quote
  #11  
Old 11 May 2003, 16:39
Dean C's Avatar
Dean C Dean C is offline
 
Join Date: Jan 2002
Real name: Dean Clatworthy
N9ne - its called a ternary operator i believe

I'm very interested to see how this develops as IMO i think we'll see a lot of PHP errors popping up now on vBulletin.org due to poor PHP coding in the templates

- miSt
__________________
Dean Clatworthy - Web Developer/Designer
Reply With Quote
  #12  
Old 11 May 2003, 17:45
filburt1 filburt1 is offline
 
Join Date: Feb 2002
Today at 05:29 AM N9ne said this in Post #6
Very nice filby! Is this efficient?
Theoretically it is only limited by the speed of the preg functions.
Reply With Quote
  #13  
Old 11 May 2003, 17:54
mx3's Avatar
mx3 mx3 is offline
 
Join Date: Nov 2002
Real name: Matt
awesome! will install! i've been wanting this for awhile now!
Reply With Quote
  #14  
Old 11 May 2003, 20:45
all-the-vb's Avatar
all-the-vb all-the-vb is offline
 
Join Date: Apr 2003
nice work


All-the-vb click install
__________________
vbulletin is the best
http://arabusers.com
My Hacks:
clicks here
Reply With Quote
  #15  
Old 11 May 2003, 22:04
filburt1 filburt1 is offline
 
Join Date: Feb 2002
Pseudo-code of what it does:

1. Find every occurance of <? and ?> (and what's inbetween them)
2. For each occurance, make every variable within in the global scope, and then eval what's in the occurance
3. Remove the original occurances from the template.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Mod 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 00:40.

Layout Options | Width: Wide Color: