vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   A Simple PHP Banner Rotator? (https://vborg.vbsupport.ru/showthread.php?t=124834)

buurman 01-08-2008 08:47 AM

Thanks Kirk, works great!! also made a rotating header logo.

happy I found your replys :)

kronnos 02-04-2008 01:28 PM

Quote:

Originally Posted by Kirk Y (Post 1059879)
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]

What if I would want to have just 2 banner options but not show them randomly, instead if its forum home, then show one ad if its something else show another?

Kirk Y 02-04-2008 02:18 PM

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>
That's a very basic example, if you'd like some more information: http://www.vbulletin.com/docs/html/t...e_conditionals

kronnos 02-04-2008 05:51 PM

Quote:

Originally Posted by Kirk Y (Post 1436106)
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>
That's a very basic example, if you'd like some more information: http://www.vbulletin.com/docs/html/t...e_conditionals

Tried it but it still doesn't work. It just shows both in one ad block. Could it be that the ad block does not allow php code?

--------------- 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>

Ranger269 02-04-2008 07:37 PM

Quote:

Originally Posted by MoT3rror (Post 1416362)

Execution Order: 1

I was wondering about that. The default setting I had was "5" so I left it that way and the banner works fine.

I didn't understand just what that was for?

Should I change it to "1"?

Kirk Y 02-04-2008 09:45 PM

Quote:

Originally Posted by kronnos (Post 1436262)
Tried it but it still doesn't work. It just shows both in one ad block. Could it be that the ad block does not allow php code?

What template are you using this in; and on what version of vBulletin? I tested the code you supplied above and it worked perfectly for me.

Quote:

Originally Posted by Ranger269 (Post 1436336)
I was wondering about that. The default setting I had was "5" so I left it that way and the banner works fine.

I didn't understand just what that was for?

Should I change it to "1"?

Execution orders allow Plugins within a modification which utilize the same hook to be run in a specific order. ie. Plugin A gathers the UserID, Plugin B executes a query based on the userid, and Plugin C displays something based on the query. Thus Plugin A must be run before Plugin B and Plugin B must be run before Plugin C. This can be achieved by setting the Execution Orders of the three plugins to 1, 2, and 3 (respectively).

Ranger269 02-05-2008 01:41 AM

Quote:

Originally Posted by Kirk Y (Post 1436393)

Execution orders allow Plugins within a modification which utilize the same hook to be run in a specific order. ie. Plugin A gathers the UserID, Plugin B executes a query based on the userid, and Plugin C displays something based on the query. Thus Plugin A must be run before Plugin B and Plugin B must be run before Plugin C. This can be achieved by setting the Execution Orders of the three plugins to 1, 2, and 3 (respectively).

Thanks!

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:

Kirk Y 02-05-2008 03:41 AM

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

Ranger269 02-05-2008 04:13 AM

Quote:

Originally Posted by Kirk Y (Post 1436504)
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

That's what I figured the problem was but I didn't know how to do it.

Code:

<div align="center">$random_banner[$random_number]</div>
When I tried adding a "2" between "number" and "]", it made the bottom banner disapear.

Can you tell me what code I need and if both of them need to be changed or only the bottom one?

kronnos 02-05-2008 06:06 AM

Quote:

Originally Posted by Kirk Y (Post 1436393)
What template are you using this in; and on what version of vBulletin? I tested the code you supplied above and it worked perfectly for me.

I'm Using Ultimate Side Columns and trying to paste this code into one of the left column blocks.


All times are GMT. The time now is 03:02 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.01443 seconds
  • Memory Usage 1,754KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (5)bbcode_code_printable
  • (8)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete