Jira Courses, Training and Consulting: Sparxsys Trainings
Thanks for coming here, I hope you are enjoying learning here, I have also written some books in case you want to learn a bit more :)
If you need my help with Drupal, Linux, Jira, Scripting, Automation or want to contact me then raise a ticket for me please :) and I will get back to you, promise. At Sparxsys we provide Atlassian consultancy services, reach out to me at ravi at sparxsys dot com

Display Random images

Yesterday I came across this excellent tutorial to display Random Images. I also tried it and implemented it on this site.

1. I use bluemarine theme for this site. I created a folder "images" and uploaded three images in there.

themes/bluemarine/images
header_1.jpg
header_2.jpg
header_3.jpg

2. Modified "page.tpl.php" and added the following code

  1. <img src="/themes/bluemarine/images/header_<?php echo(rand(1,3)); ?>.jpg" alt="Ravi Sagar" / id="random_header">

3. Modified "style.css" and add section to handle "random_header"

  1. #random_header {
  2.   float: left;
  3.   width: 900px;
  4.   height: 170px;
  5. }

Thats it! it is simple and it looks good. Now every time page is refreshed a new Image is displayed!!

Similar posts

Subscribe

* indicates required

Please confirm that you would like to from Sparxsys:

You can unsubscribe at any time by clicking the link in the footer of our emails. For information about our privacy practices, please visit our website.

We use Mailchimp as our marketing platform. By clicking below to subscribe, you acknowledge that your information will be transferred to Mailchimp for processing. Learn more about Mailchimp's privacy practices.

Want to contact me?