The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
A Simple PHP Banner Rotator?
I have searched high and low for a simple banner rotator... and have found quite a few options on script sites. I got a few of them working outside of vBulletin without any trouble.
But PLEASE can someone tell me why whenever I place any php code in the header template the board refuses to show anything... when perfectly simple php page in the same directory works fine? I don't want phpadsnew, I don't want to count clicks or anything, I don't want to use javascript, I just need to integrate stuff that's simple outside of vBulletin into the templates... I followed this to the letter http://www.vbulletin.com/forum/showthread.php?t=170826 and it doesn't work. I am running the latest version 3.6.0 and I just need to rotate 3 or 4 banners on page refresh... nothing complicated at all outside of vBulletin... but there must be something you guys are not telling about. ANY help appreciated, thanks |
#2
|
|||
|
|||
because you cant parse php in the templates without a modification. Search for the let php live modification if you wish to use php in templates.
And you didnt follow that to the letter or else it would have worked just fine |
#3
|
||||
|
||||
Just make a plugin using hook global_start. I do the same for header rotations on my forums. Don't know why people insist on working against vBulletin's templating system when it's easy enough to work with it... but that's just my daily rant.
|
#4
|
|||
|
|||
Obviously I am not setting up plugins properly.
I honestly cannot see what I missed http://www.vbulletin.com/forum/showthread.php?t=170826 So please tell me what is the most simple and efficient way of making banners rotate working with the template system? Thanks Hook Location = ? Title = ? Execution Order = ? Then how do you call it? Using the title? I don't understand what a Plugin is... I guess it ain't an include then. |
#5
|
||||
|
||||
Okay, let me see if I can explain it better:
Add a New Plugin using Hook Location "global_start". Code:
$random_number = rand(1, 5); $random_banner[1] = '<a href="http://www.link1.com/"><img src="path/to/banner1.gif" alt="" border="0" /></a>'; $random_banner[2] = '<a href="http://www.link2.com/"><img src="path/to/banner2.gif" alt="" border="0" /></a>'; $random_banner[3] = '<a href="http://www.link3.com/"><img src="path/to/banner3.gif" alt="" border="0" /></a>'; $random_banner[4] = '<a href="http://www.link4.com/"><img src="path/to/banner4.gif" alt="" border="0" /></a>'; $random_banner[5] = '<a href="http://www.link5.com/"><img src="path/to/banner5.gif" alt="" border="0" /></a>'; Then edit whatever template you'd like to display the random banner in and stick this code wherever you'd like it to show: Code:
$random_banner[$random_number] |
#6
|
|||
|
|||
Ok thanks
The other thread I linked to says I need a different type of Hook location, and that doesn't work, so I guess I'll try it using the global_start instead. Cheers |
#7
|
||||
|
||||
Well global_start allows you to use it anywhere on the forum -- in my case, I use it on the Header for a Logo Rotation. It all depends on the template you're trying to put the banner in - the header template's only hook is global_start.
|
#8
|
|||
|
|||
Hi, can i ask, how could i also get Google Adsense in there
$random_banner[3] = '<a href="http://www.link3.com/"><img src="path/to/banner3.gif" alt="" border="0" /></a>'; Could i do Random_banner[3] = ' adsense code here.... ' ?? Right now i have adsense ads on my page, but i had requests from people for adding some seperate banners..... was wondering good and effective way to rotate that all in one space........ i am so tired, i hope someone can help.. thank you |
#9
|
||||
|
||||
Yep, you could do that too.
|
#10
|
|||
|
|||
Good stuff there, acidburn. That helped me a whole lot.
If I want to run 10 random banners, do I just replace rand(1, 5); with $random_number = rand(1, 10);? Also, how could I create a few different plug-ins like this so that I can run different banners in different areas? |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|