Start learning with our library of video tutorials taught by experts. Get started

Joomla! 1.5: Creating and Editing Custom Templates
Illustration by

Placing a random image


From:

Joomla! 1.5: Creating and Editing Custom Templates

with Jen Kramer

Video: Placing a random image

One of the fun effects that comes built into Joomla! is the ability to add a random image to your webpage and it can add a lot of interest to your website. I am looking at the Ordering page of our site right now and if I hit my Refresh button, most of the time when I refresh the page, a different image will come up. So I would like to go through how you go about setting this up. If you go over to the back-end of Joomla! and make sure that you are logged in, let's take a look at the module itself. So under Extensions in the Module Manager, you can find Random Image right in our list. It's called Random Image and you are probably familiar with some of these settings from other modules that you have worked with. Just like every other module, there is a title, which you can show or not show on the website, that it's Enabled and then it's in Left Position. It's available for all the users and then it's assigned to certain pages of the website here in our list.

Watch this entire course now—plus get access to every course in the library. Each course includes high-quality videos taught by expert instructors.

Become a member
please wait ...
Joomla! 1.5: Creating and Editing Custom Templates
2h 11m Intermediate Dec 02, 2008

Viewers: in countries Watching now:

Custom templates are the key to making a Joomla!-driven website stand out. In Joomla! 1.5 Creating and Editing Custom Templates, Jen Kramer McKibben offers instruction and insight to help Joomla! users create eye-popping websites. Jen starts with the basics, like how to add the Joomla! template codes to a static HTML layout, install the template package, and clean up styling after installation. She also shows how to make multiple layouts within the same Joomla! template, configure menus and submenus, and more. Exercise files accompany the course.

Topics include:
  • Converting HTML comps to Joomla! templates
  • Troubleshooting installation problems
  • Creating XML and index files
  • Placing random images
  • Configuring menus and submenus
  • Changing the favicon
Subjects:
Web CMS Web Development
Software:
Joomla!
Author:
Jen Kramer

Placing a random image

One of the fun effects that comes built into Joomla! is the ability to add a random image to your webpage and it can add a lot of interest to your website. I am looking at the Ordering page of our site right now and if I hit my Refresh button, most of the time when I refresh the page, a different image will come up. So I would like to go through how you go about setting this up. If you go over to the back-end of Joomla! and make sure that you are logged in, let's take a look at the module itself. So under Extensions in the Module Manager, you can find Random Image right in our list. It's called Random Image and you are probably familiar with some of these settings from other modules that you have worked with. Just like every other module, there is a title, which you can show or not show on the website, that it's Enabled and then it's in Left Position. It's available for all the users and then it's assigned to certain pages of the website here in our list.

Specific to the Random Image module though is the right hand side of the page. These settings point to a specific location in the images/stories directory where all of the images live. The way this is set up right now is to say to find all PNG files that live within the images/stories folder and display them randomly on the website. Ahead of this, I had already taken all of these images and cropped them such that they are all a 162 pixels wide. Keeping all of your images a constant size gives that site a little bit more of a professional polish. If they are slightly different sizes, they may interfere with text surrounding the images and it may actually even expand or reduce the size of the website overall.

Using a consistent size gives it a final polish. I am going to close this window. I am going to show you the Media Manager, which is under Site > Media Manager. All of the images that are used on your website should reside within the stories folder in Joomla!. Inside of the stories folder, you can make other folders where images will also live. But in this particular site, I have chosen not to do that. All of the images that you see here are used in the Random Image module, except for these two images; newsbar and newsbox. These are the two pictures that are used in the Latest News module on the Home page. They end in .jpg instead of .png. That's why they are not picked up by the Random Image module.

Let's take a look at how we can style this a little bit better on the front of the website. Most of the graphic designers would say that this left edge of this image should probably be lined up with the left edge of the B in Bliss up top. It will just give it a little bit more polish and a little bit more style. So we are going to go to CSS, Edit CSS again and the Default tab and I think we can probably just do this with one style. If I view the source of the webpage and I take a look at the left side, here is our div with id of left, you will see that we have a div with a class of moduletable and another div inside of it that's outlining the image inside of that div in the center. Our image has a width of a 162 pixels.

What we are going to do is we are going to take this div of moduletable and make it a 162 pixels. That will automatically affect this other div that has no class or id assigned to it. It will also shrink down to 162 pixels and everything will wrap nice and tight around this image. So back over to our code and I am going to add div.moduletable. First I am going to make the width 162 pixels. That pushes it all the way to the left hand side of the page.

I need a little bit more space so that I can line it up under the B. I have already worked out with that padding should be in advance. I am putting 3 ems on the top of this so that there maybe a little bit space between the random image and any other modules that appear on this page. Plus it gives us a little bit of space between the top logo and the random image itself. And 40 pixels over on the left, which will push this over just nicely. Then once again, Ctrl+A or Command+A, Ctrl+C or Command+C, back to the back-end of Joomla! to Extensions > Template Manager.

In the Template Manager, select our inside template, Edit, Edit CSS, choose default CSS and Edit, once again Ctrl+ A or Command+A, Ctrl+V or Command+V to paste in our changes and save and now when we go to the Ordering page and refresh, a different image may load but you can see that the alignment is much better. The Random Image module loads different images in the same location on the same webpage. This is something that you can't do with static HTML and it's very easy to set up and use within Joomla!. It's a great feature for adding a lot of interest to your webpages.

Find answers to the most frequently asked questions about Joomla! 1.5: Creating and Editing Custom Templates.


Expand all | Collapse all
please wait ...
Q: When creating and uploading custom templates as described in Joomla! Creating and Editing Custom Templates , the following error occurs:

XML Parsing Error at 1:1. Error 4: Empty document
JInstaller::install: File '/tmp/install_4bd887e090339/css/default.css' does not exist.


What is causing this error?
A: Check through the errors described in the “Fixing typical installation problems” video (e.g. files included in the install package that are not listed in the XML file; the XML file lists files that are not in the install package; XML is badly formed). Also check for permissions issues with your server.
In all likelihood, if this message appears, there is an error with the XML file, possibly a typo or a misnamed file. Make sure the CSS file is called default.css and is located in the CSS folder. Also, make sure everything is spelled correctly.
 
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.
Upgrade now


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ.

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

join now Upgrade now

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed Joomla! 1.5: Creating and Editing Custom Templates.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferencesfrom the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.

Are you sure you want to delete this note?

No

Notes cannot be added for locked videos.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.