Page 1 of 2

how to change a banner to a rotating banner

Posted: Tue Apr 21, 2009 7:35 pm
by country
Hello, I have a banner on my board between the forums, I could use some help, I can not figure out how to make it a rotating banner, so I can have multiple images rotating on it, thanks in advance for any help.
Here is a link: www.usa-shooters.com

Re: how to change a banner to a rotating banner

Posted: Tue Apr 21, 2009 10:21 pm
by Raimon
The easiest solution would be to use the mt_rand php function.

open includes/functions.php

search:

Code: Select all

'T_STYLESHEET_NAME'      => $user->theme['theme_name'], 
after add:

Code: Select all

'RANDOM'      => mt_rand(1, 4), 
This is for 4 random images, do you have less or more images then 4, just change the 4.

On the HTML files you are using the next HTML then ;

Code: Select all

<img src="{T_IMAGESET_PATH}/banner{RANDOM}.EXTENSION" alt="Logo" title="Logo" />
name the images like;

banner1.extension
banner2.extension
banner3.extension

don't forget to rename EXTENSION to gif or jpeg or png etc etc

and upload those to the /imageset/ directory

Re: how to change a banner to a rotating banner

Posted: Wed Apr 22, 2009 8:34 pm
by country
Thanks ,I found functions.php, and downloaded it to my computer from my ftp, but can't get it to open?

Re: how to change a banner to a rotating banner

Posted: Wed Apr 22, 2009 9:08 pm
by country
Ok, I have the banner in between forumslist_body.html , do I put this code in there, and what do I do, with the code for the existing banner.

Re: how to change a banner to a rotating banner

Posted: Thu Apr 23, 2009 10:48 pm
by Raimon
You need to deleted it and replace it with the codes i have posted above.

Re: how to change a banner to a rotating banner

Posted: Fri Apr 24, 2009 1:53 am
by bonelifer
Here's a link to a much more advanced way(ie random header on certain dates) to do this.

http://www.phpbb.com/community/viewtopi ... &t=1510695

Re: how to change a banner to a rotating banner

Posted: Mon Apr 27, 2009 4:22 pm
by country
thanks alot you'll!

Re: how to change a banner to a rotating banner

Posted: Mon Apr 27, 2009 5:13 pm
by country
It is rotating, also how do I make each banner clickable to take you to another site? Thanks for all the help, you'll are great!

Re: how to change a banner to a rotating banner

Posted: Tue Apr 28, 2009 4:23 pm
by Raimon
You could try ;

Code: Select all

<a href="http://site_url.com"><img src="{T_IMAGESET_PATH}/banner{RANDOM}.EXTENSION" alt="Logo" title="Logo" /></a>
But then all the banners are linked to the same URL.

Re: how to change a banner to a rotating banner

Posted: Tue Feb 01, 2011 7:58 am
by ed111
Hi

If I am trying to make the header rotate where should I include the path to the images?

As the overall_header has the div for the headerbar.css which appears in colours.css:

Code: Select all

.headerbar {
	background-color: #FFFFFF;
	background-image: url("{T_THEME_PATH}/images/forum_header.gif");
	color: #FFFFFF;
}
I replaced

Code: Select all

background-image: url("{T_THEME_PATH}/images/forum_header.jpg");
with

Code: Select all

background-image: url("{T_IMAGESET_PATH}/banner{RANDOM}.jpg"
But this does not work... should I be including the above in the overall_header.html not colours.css??



(I have added the mt_rand function to funtions.php and uploaded all my images ('banner1' etc) to /imageset/ )

Thanks

Re: how to change a banner to a rotating banner

Posted: Tue Feb 01, 2011 8:51 pm
by ed111
Bump

Re: how to change a banner to a rotating banner

Posted: Wed Feb 02, 2011 4:12 am
by SilentDeath1226
HI,

I believe you need to edit the template not the stylesheets.

Try something like:

Code: Select all

<a href="http://site_url.com"><img src="{T_IMAGESET_PATH}/banner{RANDOM}.EXTENSION" alt="Logo" title="Logo" /></a>
Add that to the desired template and you should be good. :)

Re: how to change a banner to a rotating banner

Posted: Wed Feb 02, 2011 6:16 am
by ed111
Thanks.

Re: how to change a banner to a rotating banner

Posted: Wed Feb 02, 2011 6:57 am
by SilentDeath1226
No problem. :)

Re: how to change a banner to a rotating banner

Posted: Wed Aug 29, 2012 4:17 am
by baloo
This hack breaks with PHP 5.3

Code: Select all

'RANDOM'      => mt_rand(1, 4), 
is the offending line I think

here are the error messages.

Code: Select all

Warning: mt_rand() [function.mt-rand]: max(0) is smaller than min(7) in path/to/my/forum/test/includes/functions.php on line 4684

Warning: Cannot modify header information - headers already sent by (output started at path/to/my/forum/test/includes/functions.php:4684) in path/to/my/forum/test/includes/functions.php on line 4707

Warning: Cannot modify header information - headers already sent by (output started at path/to/my/forum/test/includes/functions.php:4684) in path/to/my/forum/test/includes/functions.php on line 4708

Warning: Cannot modify header information - headers already sent by (output started at path/to/my/forum/test/includes/functions.php:4684) in path/to/my/forum/test/includes/functions.php on line 4709

Warning: Cannot modify header information - headers already sent by (output started at path/to/my/forum/test/includes/functions.php:4684) in path/to/my/forum/test/includes/functions.php on line 4710