Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 08-24-2006, 10:32 PM
Ian555 Ian555 is offline
 
Join Date: Aug 2006
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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
Reply With Quote
  #2  
Old 08-24-2006, 11:18 PM
Ntfu2 Ntfu2 is offline
 
Join Date: Feb 2006
Posts: 1,247
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #3  
Old 08-25-2006, 12:13 AM
Kirk Y's Avatar
Kirk Y Kirk Y is offline
 
Join Date: Apr 2005
Location: Tallahassee, Florida
Posts: 2,604
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #4  
Old 08-25-2006, 12:18 AM
Ian555 Ian555 is offline
 
Join Date: Aug 2006
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #5  
Old 08-25-2006, 12:27 AM
Kirk Y's Avatar
Kirk Y Kirk Y is offline
 
Join Date: Apr 2005
Location: Tallahassee, Florida
Posts: 2,604
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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>';
Remember to change all the Image Paths to the location of the banners you want to display.

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]
Reply With Quote
  #6  
Old 08-25-2006, 12:33 AM
Ian555 Ian555 is offline
 
Join Date: Aug 2006
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #7  
Old 08-25-2006, 12:37 AM
Kirk Y's Avatar
Kirk Y Kirk Y is offline
 
Join Date: Apr 2005
Location: Tallahassee, Florida
Posts: 2,604
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #8  
Old 09-03-2006, 10:48 PM
zooki zooki is offline
 
Join Date: May 2006
Location: uk
Posts: 111
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #9  
Old 09-04-2006, 12:15 AM
Kirk Y's Avatar
Kirk Y Kirk Y is offline
 
Join Date: Apr 2005
Location: Tallahassee, Florida
Posts: 2,604
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yep, you could do that too.
Reply With Quote
  #10  
Old 09-04-2006, 02:24 AM
furst furst is offline
 
Join Date: Dec 2005
Posts: 362
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
Reply


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

Forum Jump


All times are GMT. The time now is 12:46 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
  • Page Generation 0.08545 seconds
  • Memory Usage 2,256KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete