WebsiteBaker Logo
  • *
  • Templates
  • Help
  • Add-ons
  • Download
  • Home
*
Welcome, Guest. Please login or register.

Login with username, password and session length
 

News


WebsiteBaker 2.13.6 is now available!


Will it continue with WB? It goes on! | Geht es mit WB weiter? Es geht weiter!
https://forum.websitebaker.org/index.php/topic,32340.msg226702.html#msg226702


The forum email address board@websitebaker.org is working again
https://forum.websitebaker.org/index.php/topic,32358.0.html


R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WB
https://forum.websitebaker.org/index.php/topic,32355.0.html


* Support WebsiteBaker

Your donations will help to:

  • Pay for our dedicated server
  • Pay for domain registration
  • and much more!

You can donate by clicking on the button below.


  • Home
  • Help
  • Search
  • Login
  • Register

  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Templates, Menus & Design »
  • Need help with background image slideshow
  • Print
Pages: [1]   Go Down

Author Topic: Need help with background image slideshow  (Read 3830 times)

hep

  • Guest
Need help with background image slideshow
« on: October 21, 2010, 03:18:18 AM »
I already have some "random background" code that pulls random images from a media folder, but I'd like for it to cycle through all of the images in the folder like a slide show, instead of only loading different background images each time the page loads. Any suggestions? Here's the code I currently have:

$folder=opendir(WB_PATH.MEDIA_DIREC TORY.'/'.$dir.'/.');
$names = array();
while ($file = readdir($folder))  {
   $ext=strtolower(substr($file,-4));
   if ($ext==".jpg"||$ext==".gif"||$ext==".png"){
      $names[count($names)] = $file;
   }
}
closedir($folder);
shuffle($names);
$image=$names[0];
$name=substr($image,0,-4);
$return_img = 'style="background: transparent url(\''.WB_URL.MEDIA_DIREC TORY.'/'.$dir.'/'.$image.'\') no-repeat;"';
return $return_img;
Logged

Offline Ruud

  • Posts: 3671
  • Gender: Male
  • Do not use PM for help! Please use the forum!
    • Dev4Me - Professional WebsiteBaker Development
Re: Need help with background image slideshow
« Reply #1 on: October 21, 2010, 09:31:48 AM »
A webserver and PHP code will never rotate your images automatically.
You will need to add some extra javascript logic in there.

There are many solutions for doing that.
Maybe the captionslider module is something for you.
Logged
Dev4me - WebsiteBaker modules - WBhelp.org

  • Print
Pages: [1]   Go Up
  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Templates, Menus & Design »
  • Need help with background image slideshow
 

  • SMF 2.0.19 | SMF © 2017, Simple Machines
  • XHTML
  • RSS
  • WAP2