Previous Thread
Next Thread
Print Thread
Hop To
Joined: May 2010
Posts: 28
M
newbie
newbie
M Offline
Joined: May 2010
Posts: 28
Hi,

How do I add an image slider with links (so that I can link to a forum topic) to the portal home page. Currently I have added a static image with a link by modifying the portal.tpl file directly which is less than ideal.

Here is my site currently with the static image on the portal page http://www.saints247.com/ubbthreads.php

Cheers
Neil



Neil
Saints247.com - http://www.saints247.com

-- using version 7.5.7
Joined: Jun 2006
Posts: 1,344
G
veteran
veteran
G Offline
Joined: Jun 2006
Posts: 1,344
Are you looking for images to change when refresh the page or automatically change every few seconds? Either way youll need to modify the portal.tpl but will only have to do it once. Where you placed the code for the image use a php includes so you only need to edit that file once to change images.

Replace the image code you added with something like this

PHP Code
{php} include("/path/to/includes/script.php"); {/php} 

This means you'll only need to edit the script.php or what ever you name it.php to add or remove images and links.

If your wanting it to change when you refresh page you would add some php code to the script.php or what ever you name it.php like this.

PHP Code


<?php
$banner_src[0]="http://www.yoursite.com/image.jpg";
$banner_link[0]="http://www.yoursite.com/desired_link";

$banner_src[1]="http://www.yoursite.com/image.jpg";
$banner_link[1]="http://www.yoursite.com/desired_link";

$banner_src[2]="http://www.yoursite.com/image.jpg";
$banner_link[2]="http://www.yoursite.com/desired_link";

$banner_src[3]="http://www.yoursite.com/image.jpg";
$banner_link[3]="http://www.yoursite.com/desired_link";

$banner_src[4]="http://www.yoursite.com/image.jpg";
$banner_link[4]="http://www.yoursite.com/desired_link";

$banner_src[5]="http://www.yoursite.com/image.jpg";
$banner_link[5]="http://www.yoursite.com/desired_link";

/*The above code has created 2 arrays, one array of image
 urls and another array for the  links  that go with them. You can
 add as many as you like, increasing the number  in the 
[square brackets] by 1 as you do. */

$banner_count=((count($banner_src))-1);
/*this line counts how many banners you have in your arrays,
 but since arrays start at number 0, we minus 1 from the count*/

$which_banner=(rand(0, $banner_count));
/*this line picks a random number between 0(the start of our array) 
and the current  banner count */


/*this next bit of code displays the chosen banner as a link */
print "<center><a href=\"$banner_link[$which_banner]\" target=\"_blank\">
<img src=\"$banner_src[$which_banner]\" border=\"0\"></a></center>";
?> 



Now if you want it to automatically change images you'll need some java scripting or do a flash image. Just replace that code with the php coding in the script.php or what ever you name it.php file.

Joined: May 2010
Posts: 28
M
newbie
newbie
M Offline
Joined: May 2010
Posts: 28
Thanks I will give that a go



Neil
Saints247.com - http://www.saints247.com

-- using version 7.5.7
Joined: May 2010
Posts: 28
M
newbie
newbie
M Offline
Joined: May 2010
Posts: 28
Hey, just thought I would let you know, that I did thinks slightly different to your suggestion and instead added the required html code to the portal.tpl file and added the scripts links under HTML includes in the control panel and it's working great.

Obviously there is an element of manual intervention each time I update an image and it's link however, this would no more than once a day anyhow.

Thanks for getting my creative thoughts into gear anyhow!

You can see how it is working here http://www.saints247.com/ubbthreads.php



Neil
Saints247.com - http://www.saints247.com

-- using version 7.5.7
Joined: Jan 2004
Posts: 2,474
Likes: 3
D
Pooh-Bah
Pooh-Bah
D Offline
Joined: Jan 2004
Posts: 2,474
Likes: 3
Nice looking site Neil!

Joined: May 2010
Posts: 28
M
newbie
newbie
M Offline
Joined: May 2010
Posts: 28
Thanks driv smile



Neil
Saints247.com - http://www.saints247.com

-- using version 7.5.7
Joined: Jun 2006
Posts: 287
enthusiast
enthusiast
Joined: Jun 2006
Posts: 287
macisbac, your forum is really well done! I can't remember seeing a better style created for UBB Threads.


Ford diesel master technician by day...
Webmaster by night! cool
FordDoctorsDTS.com running UBB Threads 7.5.4.2p2
Joined: May 2010
Posts: 28
M
newbie
newbie
M Offline
Joined: May 2010
Posts: 28
FordDoctor, many thanks for your comments smile



Neil
Saints247.com - http://www.saints247.com

-- using version 7.5.7
Joined: Jan 2008
Posts: 514
addict
addict
Joined: Jan 2008
Posts: 514
Very well done site! I actually would nominate it for one of the best UBB based sites I have ever seen.

Dunny

Joined: Jan 2004
Posts: 2,474
Likes: 3
D
Pooh-Bah
Pooh-Bah
D Offline
Joined: Jan 2004
Posts: 2,474
Likes: 3
You should post it in the community spotlight forum. smile

Joined: Mar 2008
Posts: 262
enthusiast
enthusiast
Joined: Mar 2008
Posts: 262
Ditto!!! That site looks great!!!


Ian
http://www.firstgenmc.com/ubbthreads

"Experience is a hard teacher because she gives the test first, the lesson afterwords."

Link Copied to Clipboard
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Recent Topics
spam issues
by ECNet - 03/19/2024 11:45 PM
Looking for a forum
by azr - 03/15/2024 11:26 PM
Editing Links in Post
by Outdoorking - 03/15/2024 9:31 AM
Question on barkrowler and the like
by Mors - 02/29/2024 6:51 PM
Member Permissions Help
by domspeak - 02/27/2024 6:31 PM
Who's Online Now
1 members (Havenofsobriety), 522 guests, and 99 robots.
Key: Admin, Global Mod, Mod
Random Gallery Image
Latest Gallery Images
Los Angeles
Los Angeles
by isaac, August 6
3D Creations
3D Creations
by JAISP, December 30
Artistic structures
Artistic structures
by isaac, August 29
Stones
Stones
by isaac, August 19
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20230217)