New Feature: Playlist Center! Pick a topic and let our playlists guide the way—like a learning mixtape.

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

Joomla! 1.5: Creating and Editing Custom Templates
Illustration by

Creating a new XML file


From:

Joomla! 1.5: Creating and Editing Custom Templates

with Jen Kramer

Video: Creating a new XML file

The last thing we need to create to have all the files ready for a Joomla! template installation is our XML file. You can use this for every Joomla! template you make forever after as a starting point for putting together this XML file which is our installation file. It gives Joomla! all the instructions it needs to put together the installation for you. The file is always called templateDetails. Lower case t template, capital D Details, all one word, .xml. Make sure you note that capitalization and it's always written in XML.

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

Creating a new XML file

The last thing we need to create to have all the files ready for a Joomla! template installation is our XML file. You can use this for every Joomla! template you make forever after as a starting point for putting together this XML file which is our installation file. It gives Joomla! all the instructions it needs to put together the installation for you. The file is always called templateDetails. Lower case t template, capital D Details, all one word, .xml. Make sure you note that capitalization and it's always written in XML.

Most designers are terribly familiar with XML. And most XML files are unique to their application. So it makes sense just to use this as a starting point and then modify it for every set of templates that you put together. So now that we have this open, let's go ahead and start editing it. And more importantly, knowing what we should not change. The first three lines of this templateDetails file you do not want to change. These are the declaration lines that tell you that this is an XML file and specifically, where its DOC type lives and that this is Joomla! 1.5 template. So none of those things are ever going to change.

On line four, it asks for the name of your template. This is going to be the name of your template in the Template Manager and it's also going to be the name of the folder where the template is kept on the server. So keep this name very simple. In our case, we are just going to call it inside. We don't want any spaces in this name and no funny business, no funny characters, nothing like that. It should always be a unique name. So if you have more than one template for your site, this name always has to be different relative to other templates on the site. Obviously, if you have several Joomla! installations in a particular domain, or you have several Joomla! installations on a server, names can overlap. But for a given Joomla! installation, the template names must be unique.

The creation date, you can put in your date and you can use whatever format you want. I am going to put my date in this way. You could say October 12th, 2008. You could also do European formats or anything else that you want. Your author name goes here. Your author e-mail goes after that. And type in your website here. I always use my specific company website, rather than the website that the template is necessarily going to be used on. This is because in the Template Manager once again, they will show the author e-mail and the author URL. It's kind of like free advertising for you. So it may be better to point people to your particular company website as opposed to the website that the template is being used on. Of course, sometimes those are the same things. And the copyright statement, and you can put in some information about a license and a version number. Finally, you have a description that you can put in. And that can be as long or short as you want. So these are all the easy things.

All we have done so far is just edit what's between the opening and closing tags. Next part, between lines 13 and 19 are a series of file names. These are all of the files that are making up your Joomla! website. What you must do is copy and paste these lines and make sure the paths and the file names exactly match up. If you would include more files then there are lines in this section of the XML file, or you include file name lines here that don't correspond to the files that live actually in the ZIP file that you will ultimately create, Joomla! will get very upset and will refuse to install your template file. So pay attention to the details here and make sure that you have listed all of your files. So let's go through that. I will show you how I do it.

Over here on the right side in Joomla!, I can see all of my files that make up my site. So first one is templateDetails.xml. We have got that. We have index.php. We have the template_ thumbnail.png. Inside our folder called css, we have a file called default.css. So those match. If I had more than one style sheet, I would need to add some extra filename lines here and then make sure I include css/, whatever the name of my style sheet was.

And then we have some images. So here I have logo. But I don't have these other images that are represented on this site. So what I am going to do is Edit > Copy this particular line. And then Edit > Paste. I like to make sure my code line is up so I can read it. So next file I have is bkgd, the background file. And I am going to Ctrl+V, which for Mac people is Command+V. So I am just going to keep on pasting here that same line over and over. And changing it to make sure that I am matching my filenames with what I have. So there is tagline and there is footer. So we have four images, one style sheet, and three other files, which matches what we have over here on this side.

Now the last part of our XML file between lines 23 and 34 are some commonly used positions. These are the module positions that we have assigned earlier in index.php. Commonly used names are things like top, and left, and right, breadcrumbs, and so on and so forth. As I mentioned earlier, you can have any name you want for a module. You don't have to stick with the names that are here. The reason we are including them here in this XML file is so that-- I am going to switch over to Firefox here really quickly.

And I am in an Edit screen here for a given Module. You will see here under Position, there is a little dropdown that's generated with a series of positions. These are the module positions that appear in the default template that's set up for the particular website. If they are spelled out in the XML file, those module positions will then appear in this dropdown. So that a user can only assign module positions that actually exist within the template. You can overwrite this. For example, I can take away left and I can type in george, right on top of that. That's not necessarily intuitive because of the type of widgit that they use here on this form. So I wanted to be sure to point that out.

I am going to switch back to Dreamweaver. So in my particular index.php file, I only have three module positions. I have a top, I have a left, and I have a footer. So I am going to get rid of a lot of these just by highlighting and hitting Delete. So there is top, left, and footer. We have one more tweak now to make to our index.php file. And that tweak could have only been made once this templateDetails file was created. We named this inside. And I told you earlier that inside will become a folder name for the template in the Templates folder on the server where this template will live.

We now need to go back to the index.php file and adjust our image paths to make sure that they point to the correct location on the server so that we will be able to see the images. So let's save this templateDetails.xml file and you can close it. Now we are going to open up index.php. We have only one image that's not a background image here in our index.php file. That's here on line 14 and you will see there is a line here about image source, etcetera, etcetera. This of course, is pointing to a local location. So this is wherever the image and folders are living right now, whether that's the CD or on your desktop. We will need to change this to where that image will actually live on the server. Since we called our template inside in our XML file, our path for that image is going to be templates/inside/images/logo.gif. Why is it that complicated path? Because that's the way Joomla! puts things together on a server.

So we are going to highlight this piece and we are going to type in what I just said, templates/inside/images/logo.gif. You need to repeat this process for every image that appears within your index.php file. And you may have more image files for other templates than we do for this one. You do not need to change the paths in your CSS file, however. The paths in your CSS file are relative and the relative locations between CSS and the images folder are not going to change on the server. So you will find that those paths will work correctly.

Finally, we have all of our files and folders set to go to make our Joomla! installation ZIP file. Let's go ahead and give that a try.

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.