Register Members List Search Today's Posts Mark Forums Read

Reply
 
Article Options
Add PHP to your Templates (Trick)
TheAdminMarket
Join Date: Jun 2013
Posts: 511

Thessaloniki, Greece
by TheAdminMarket TheAdminMarket is offline 02 Oct 2014
Rating: (5 votes - 5.00 average)

First of all, let's make clear something. Yes, (unfortunatelly) vBulletin does not allows PHP in templates. But don't stuck on this. Extend your imagination. "If you can't go left, go right. Just don't stand"

The solution for this problem is much more easier than you can think. "If you can't add PHP in the templates, add templates to PHP" You just need a "echo" command in your PHP file. Yes it's so simple, the result will be exactly what you want, and most important, you can use vboptions, vbphrases, datamanager and everything you want.

1.- Create a template for Header:


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




Remark:
If you want to make use of vB sidebar in your page, you must add within head section:


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




2.- Create a template for Footer:



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

3.- In your PHP file (assuming that is a file which loads all vB functions that you need), add (again is an example):


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

............Here you can add any PHP code that you like..............


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

As you can see you can use ANY vB template in the PHP file. Just assign it to a variable and then use echo to show it in the screen.

Hope that this short tutorial will be useful to those who have stuck with this vB limitation. I love to use the Smarty template engine with PHP.
Views: 3311
Reply With Quote
Comments
  #2  
Old 31 Oct 2014, 02:45
abdobasha2004's Avatar
abdobasha2004 abdobasha2004 is offline
 
Join Date: Aug 2008
That is a way I searched for a lot!
Thanks Nick
Reply With Quote
  #3  
Old 31 Oct 2014, 08:45
Linhnt Linhnt is offline
 
Join Date: Oct 2008
For What?
Reply With Quote
  #4  
Old 31 Oct 2014, 08:47
TheAdminMarket's Avatar
TheAdminMarket TheAdminMarket is offline
 
Join Date: Jun 2013
Real name: Christos Teriakis
Originally Posted by Linhnt View Post
For What?
For what it needs? Just a word can explains it: AJAX
Reply With Quote
Reply

Similar Article
Article Author 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



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 20:24.

Layout Options | Width: Wide Color: