how to change a banner to a rotating banner

For support and discussion related to templates, themes, and imagesets in phpBB 3.0.
Ideas Centre
country
Registered User
Posts: 44
Joined: Tue Mar 24, 2009 7:42 pm

how to change a banner to a rotating banner

Post by country » Tue Apr 21, 2009 7:35 pm

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

User avatar
Raimon
Former Team Member
Posts: 12088
Joined: Tue May 30, 2006 5:31 pm
Location: Netherlands
Name: Raimon Meuldijk
Contact:

Re: how to change a banner to a rotating banner

Post by Raimon » Tue Apr 21, 2009 10:21 pm

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
Need phpBB installation, extenstions, Styles or integrate phpBB with you website?
Contact me for fair prices and good service!

country
Registered User
Posts: 44
Joined: Tue Mar 24, 2009 7:42 pm

Re: how to change a banner to a rotating banner

Post by country » Wed Apr 22, 2009 8:34 pm

Thanks ,I found functions.php, and downloaded it to my computer from my ftp, but can't get it to open?

country
Registered User
Posts: 44
Joined: Tue Mar 24, 2009 7:42 pm

Re: how to change a banner to a rotating banner

Post by country » Wed Apr 22, 2009 9:08 pm

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.

User avatar
Raimon
Former Team Member
Posts: 12088
Joined: Tue May 30, 2006 5:31 pm
Location: Netherlands
Name: Raimon Meuldijk
Contact:

Re: how to change a banner to a rotating banner

Post by Raimon » Thu Apr 23, 2009 10:48 pm

You need to deleted it and replace it with the codes i have posted above.
Need phpBB installation, extenstions, Styles or integrate phpBB with you website?
Contact me for fair prices and good service!

User avatar
bonelifer
Community Team Member
Community Team Member
Posts: 3480
Joined: Wed Oct 27, 2004 11:35 pm
Name: William
Contact:

Re: how to change a banner to a rotating banner

Post by bonelifer » Fri Apr 24, 2009 1:53 am

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
Knowledge Base | phpBB Board Rules | Search Customisation Database
Image
Please don't contact me via PM or email for phpBB support .

country
Registered User
Posts: 44
Joined: Tue Mar 24, 2009 7:42 pm

Re: how to change a banner to a rotating banner

Post by country » Mon Apr 27, 2009 4:22 pm

thanks alot you'll!

country
Registered User
Posts: 44
Joined: Tue Mar 24, 2009 7:42 pm

Re: how to change a banner to a rotating banner

Post by country » Mon Apr 27, 2009 5:13 pm

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!

User avatar
Raimon
Former Team Member
Posts: 12088
Joined: Tue May 30, 2006 5:31 pm
Location: Netherlands
Name: Raimon Meuldijk
Contact:

Re: how to change a banner to a rotating banner

Post by Raimon » Tue Apr 28, 2009 4:23 pm

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.
Need phpBB installation, extenstions, Styles or integrate phpBB with you website?
Contact me for fair prices and good service!

ed111
Registered User
Posts: 66
Joined: Tue Dec 07, 2010 12:05 pm

Re: how to change a banner to a rotating banner

Post by ed111 » Tue Feb 01, 2011 7:58 am

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

ed111
Registered User
Posts: 66
Joined: Tue Dec 07, 2010 12:05 pm

Re: how to change a banner to a rotating banner

Post by ed111 » Tue Feb 01, 2011 8:51 pm

Bump

SilentDeath1226
Registered User
Posts: 135
Joined: Tue May 04, 2010 12:30 am

Re: how to change a banner to a rotating banner

Post by SilentDeath1226 » Wed Feb 02, 2011 4:12 am

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. :)

ed111
Registered User
Posts: 66
Joined: Tue Dec 07, 2010 12:05 pm

Re: how to change a banner to a rotating banner

Post by ed111 » Wed Feb 02, 2011 6:16 am

Thanks.

SilentDeath1226
Registered User
Posts: 135
Joined: Tue May 04, 2010 12:30 am

Re: how to change a banner to a rotating banner

Post by SilentDeath1226 » Wed Feb 02, 2011 6:57 am

No problem. :)

baloo
Registered User
Posts: 70
Joined: Mon Feb 11, 2008 12:32 pm

Re: how to change a banner to a rotating banner

Post by baloo » Wed Aug 29, 2012 4:17 am

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

Locked

Return to “[3.0.x] Styles Support & Discussion”