Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 15 Aug 2007, 23:32
webgod webgod is offline
 
Join Date: Sep 2002
php code in templates

I'm a programmer by profession, but I am still trying to get the hang of Vbulletin.

here is what I am trying to do:

I'd like to place a snippet of code in the footer template that creates an array which israndom sorted then spits it out the resultants...

basically I'm randomize the display order of ~ 50 images.


The code works perfectly in a standalone php page...
however when I insert it into the footer template, it obviously does not.


so my question is, what is the easiest way of achieving my result?


here's a snippet of the php code structure:

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

Reply With Quote
  #2  
Old 15 Aug 2007, 23:42
Wayne Luke's Avatar
Wayne Luke Wayne Luke is offline
 
Join Date: Jan 2002
Real name: Wayne
The easiest way? Creating a plugin. You can't put PHP code into vBulletin's templates for security purposes. (((Though with the new plugin system this is kind of oxymoronic))).

Put your code in a global_start plugin and assign the output to a variable. Then put that variable in your footer template.
__________________
Wayne Luke
Get started with your own social network. Purchase and download vBulletin today.
Take vBulletin to the next level - vBCodex. Find Tips, Tutorials, and Resources.
Reply With Quote
  #3  
Old 15 Aug 2007, 23:45
webgod webgod is offline
 
Join Date: Sep 2002
Originally Posted by Wayne Luke View Post
The easiest way? Creating a plugin. You can't put PHP code into vBulletin's templates for security purposes. (((Though with the new plugin system this is kind of oxymoronic))).

Put your code in a global_start plugin and assign the output to a variable. Then put that variable in your footer template.
after I posted I had the same idea...

except I put the php code in the global.php page


and instead of echo(ing) the result I'll load it into a variable and up the variable in the footer template

my method with global.php did not work.

but your plugin method sure did.

thanks a million

Last edited by webgod : 16 Aug 2007 at 00:01. Reason: Automerged Doublepost
Reply With Quote
Reply


Similar Threads
Thread Thread Starter Forum Replies Last Post
Let PHP Live! (Allow PHP code in templates) King Internet vBulletin 3.6 Add-ons 40 28 Jun 2011 10:55

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

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


New To Site? Need Help?

All times are GMT. The time now is 02:19.

Layout Options | Width: Wide Color: