Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

Creating a new XML file

From: Joomla! 1.5: Creating and Editing Custom Templates

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.

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.

Show transcript

This video is part of

Image for Joomla! 1.5: Creating and Editing Custom Templates
Joomla! 1.5: Creating and Editing Custom Templates

25 video lessons · 23014 viewers

Jen Kramer
Author

 

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold
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.


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 "Already a member? Log in

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

Your file was successfully uploaded.

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.