Start learning with our library of video tutorials taught by experts. Get started
Viewed by members. in countries. members currently watching.
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.
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.
Here are the FAQs that matched your search "":
Sorry, there are no matches for your search ""—to search again, type in another word or phrase and click search.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
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.