Random background in Acquia Slate

Events happening in the community are now at Drupal community events on www.drupal.org.
meinemitternacht's picture

Hello! I am the proud user of Acquia slate and was wondering if I could somehow rotate the background of the front page on a refresh. Would I use a PHP script with a bunch of images in a directory, or can I use gallery2, which I've already set up.

The web addresses are here:

Drupal site: http://www.claudebing.com
Gallery site: http://gallery.claudebing.com

The album "Backgrounds (Rotating)" is the album of images I want to use on the front page. They're already all the same size and dimensions. Any hints?

Comments

Got it figured out. Best

meinemitternacht's picture

Got it figured out. Best and easiest way is a PHP script, called by the CSS file background image URL property. Here's what I used:

http://sonspring.com/journal/easy-random-css-backgrounds

Just figured I would throw

tommyent's picture

Just figured I would throw it out there.

ddblock
http://ddblock.myalbums.biz/
http://drupal.org/project/ddblock

I was actually going to try and do this at some point.

how exactly is this done

Paul M's picture

Hi can you give more specifics of exactly how this is done, as I am fairly new to drupal thanks

Paul

Are you referring to my

meinemitternacht's picture

Are you referring to my method, or the other one?

rotate.php method

Paul M's picture

Hi meinemitternach

I am referring to your method. I had a look at your site and this is what I'd like to do. I understand about putting the rotate.php in the same folder as the banners but don't know what files and how they should be modified to get it to point to this file.

Paul

Ok, sorry for the delay.

meinemitternacht's picture

Ok, sorry for the delay. What you will need to do is the following.

If you're using Acquia Slate (which I'm sure you are), you need to go to /themes/acquia_slate and edit style.css

The style you want to edit is preface-wrapper, like so:

#preface-wrapper {
  background: transparent url('http://www.yourdrupalsite.com/rotate.php') no-repeat

Save the file. Now, upload rotate.php to your site base directory after you make this change:

$folder = '/var/www/vhosts/claudebing.com/httpdocs/images/bg/';  <--- this folder location is the absolute directory path to your images, including the trailing slash.

If you cache your site, go to drupal-admin/performance and clear your cached data.

That's it! enjoy your rotating background :)

my background doent not appear

r4m's picture

i have followed the tutorial from meinemitternach..., and i was try edit preface-wrapper in local.css too both of them isn't work,
my background does not appear. any solutions?

info :
i'm using acquia_slate stable.

thanks.

--Be Creative, Be Smart and Make History--

Don't edit the style css

tommyent's picture

Save yourself some trouble rename the local_sample.css to local.css and add the changes to it that way you avoid having complications when updates come out.

http://drupal.org/node/418326#local-css

Don't edit local.css

wretched sinner - saved by grace's picture

I agree that you don't want to edit style.css, but because we have to basically redefine the whole section, it is simpler to replace the whole section. There are a number of definitions for I have changed for specificity, and trying to override in local.css makes the job harder.

Thanks!

otosi's picture

This worked well for my needs. Thanks for the example of integrating this into Drupal, meinemitternacht.

Otosi

TNT Themes

Group organizers

Group categories

Type of post

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: