![]() |
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 :) |
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 |
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. :)
|
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. :) |
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); 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] |
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 |
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.
|
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 |
Yep, you could do that too.
|
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? |
Yep, just change the variable like you've got it there.
Using this plugin at hook location global_start enables the $random_banner variable to be used anywhere on the forum. |
acidburn - thanks for the tip about using global_start as the hook location. When I followed the instructions from the .com post, the hook location that was automatically selected was ajax_start ... probably because that is the first of the hooks in the drop down menu.
global_start clearly works well for this MOD, but what other hook locations would also be appropriate to select? Thanks again, twobob |
It all depends on what template you're trying to add the variable to.
For example, if you wanted to place the ads on your Forumhome (Index), you'd place the variable in the forumhome template and set the hook location to forumhome_start. But like I said, using global_start let's you use it anywhere. |
Hey acidburn, pray tell, how can I do this:
$random_banner[1] = '<a href="http://www.link1.com/"><img src="path/to/banner1.gif" alt="" border="0" /></a>'; and have different images appear for random_banner[1]? For instance, I want to rotate /images/banners/banner[1-20].jpg but use the same link each time. Do I have to place them all in different $random_banner lines or is there a shortcut? |
In your case, it's simpler just to set them all on seperate lines.
|
Hi guys,
One Question is How do i get it to display on the VB CMPS? you might wanna check this page out for future reference: Rotating Banners in NavBar https://vborg.vbsupport.ru/showthread.php?t=120707 |
What would the Plugin Hook Location for the footer be?
|
Just use global_start.
|
Does this work for the new vb 3.6?
|
It will work on any version of vBulletin that supports the Plugin System. At the moment, anything 3.5.x and up.
|
Quote:
|
I'm using it on my 3.6.2 forum, so I can assure you that it works. Recheck all the steps and be sure you didn't miss something.
|
subscribes
|
Thats the most easiest plugin and cleanest to install
If there was reputation stats I would add one to you acidburn0520 /me props* |
lol, thanks Shazz. Happy to help. :)
|
My banners are not rotating, I have 5 that are currently setup but two of the same banners keep showing. Please help me.
www.club246.com is the site Thank you! |
It's all random, each banner has a 1/5 chance of being displayed... assuming you've installed it right, you'll eventually see them all. Post up the Plugin code you're using just be sure, though.
|
Quote:
i would like this do i have to write a php script and call it global_start ??? only new at this please help me daniel d |
Hook Location: global_start (Makes it available on anypage)
Title: Random Banner (You can make your own name) Execution Order: 1 PHP Code: Quote:
Then you put Quote:
|
AdminCP -> Products & Plugins -> Add New Plugin
|
Thanks Kirk, works great!! also made a rotating header logo.
happy I found your replys :) |
Quote:
|
Then you don't need to use this plugin.
Instead use template conditionals to output a header based on what page the user is viewing. Example: Code:
<if condition="THIS_SCRIPT == 'index">Show this only on the Index<else />Show this on pages other than the Index</if> |
Quote:
--------------- Added [DATE]1202145412[/DATE] at [TIME]1202145412[/TIME] --------------- This is the code i tried but it shows the ad code and the text: <if condition="THIS_SCRIPT == 'index'"> <center><script type="text/javascript"><!-- google_ad_client = "pub-8336492106717154"; //120x60, created 1/25/08 google_ad_slot = "4645103244"; google_ad_width = 120; google_ad_height = 60; google_cpa_choice = ""; // on file //--></script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script> <center/> <else /> This text </if> |
Quote:
I didn't understand just what that was for? Should I change it to "1"? |
Quote:
Quote:
|
Quote:
I'm having trouble with two rotating banners on the same forum... https://vborg.vbsupport.ru/showthread.php?t=169672 I had both plugins set at 5 which was the default, so I changed them to 1 & 2. But it still didn't fix the problem. :confused: |
Well execution orders wouldn't matter in that instance. I'm going to bet your problem is that you're not using different variable names for each banner.
ie: $random_banner and then $random_banner2 |
Quote:
Code:
<div align="center">$random_banner[$random_number]</div> Can you tell me what code I need and if both of them need to be changed or only the bottom one? |
Quote:
|
All times are GMT. The time now is 11:36 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|