Joomla Templates shop

Premium Template

Search files

Search For: 
Search File Titles: 
Search File Descriptions: 

Categories

CategoryJoomla 1.0x(319)
CategoryJoomla 1.5 Downloads(73)
CategoryWordpress Theme(35)
CategorySEO(12)
CategoryAdsense(11)
CategoryGraphics(11)
CategoryMenu for joomla(9)
CategoryEbooks 4 joomla(6)

Newest files

Date iconNov.21

Simple for Noen( joomla 1.x)

Date iconNov.21

Snow gift clock MERY CHRISTMAS

Date iconSep.22

Demo Meet the latest advanced free Joomla template by Themza! Mini Website-Builder is here to h...

Date iconSep.03

BUSINESS Solutions Template Features1 Clean & Professional Design.2 XHTML 1.0.X Transitional...

Date iconSep.03

Demo here Business Solution

Date iconSep.03

Display latest news like yahoo homepage. 1. Name tabs as you want 2. select how many news you wan...

Date iconSep.03

This is module for Latest News with Accordian effect from mootools. Parameters 1. Count 2. Order ...

Link

javascriptbank
Jet-Source-Code
Home arrow Tutorials arrow Convent Htm css template to joomla template
Convent Htm css template to joomla template PDF Print E-mail
Written by Administrator   
Monday, 10 September 2007

Intro:
Well, I've seen alot of tutorials out there on how to program a Joomla Template with software like Dreamweaver and other big programs, this tutorial will focus on programming an entire Joomla Template with a program as simple as Notepad. This tutorial assumes that you have basic HTML/CSS knowledge, enough to build a template that isn't Joomla.


 

 

Who is this Tutorial For?
This tutorial is focused on people who have worked with the web before and would be able to program an HTML page with CSS or Tables, this tutorial will teach you common practices in how to add Joomla to your current websites. And is focused on a beginner to Joomla but not a beginner to basic web programming

Ok to begin, let me run you through the basics of how a Joomla Template is setup. The driving force behind a Template is it's 'Positions', a position in Joomla is an area like your Main Content, Left Navigation, and Header for example, you can further break this down to areas like your Advertising areas, login module areas, etc.. It can also be more efficient to combine something like your header position with your top header, but that is beyond the scope of this tutorial.

Now that you have a fairly good idea on what positions are, let me draw out a simple mockup of where you would position the positions of a simple Joomla template

How to Program a Joomla Template

We are actually going to end up programming that exact template for Joomla, so there is a light at the end of the tunnel!

Begin with an HTML template
So to start off you need to program the template in HTML, I will go over this a little bit, but this tutorial is focused on people who already have HTML knowledge, that simple Template above would look something like below

Code:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Page Document</title>
</head>

<body>
<table border="0" cellpadding="0" cellspacing="0" style="width: 800px;">
<tr>
<td valign="top" style="width: 800px; background: #a1a1a1;" colspan="2">Header is Here</td></tr>
<tr>
<td valign="top" style="width: 200px; background: #e2e2e2;">SideNav is here</td><td style="width: 600px;">Main Content</td>
</tr>
</table>
</body>

</html>

Convert it to Joomla
So what that will create is a simple HTML template, if you save that as an HTML file you will see an 800 pixel wide website with a place for a header, sidenav, and Main Content, now we need to add in the unique Joomla Commands to make the Template actually work with Joomla, let's start with the Main Content area:

Code:

<tr>
<td valign="top" style="width: 200px; background: #e2e2e2;">SideNav is here</td><td style="width: 600px;">Main Content</td>
</tr>

In the main content area we are going to want to put in the main body for our website, the Joomla PHP include for this is <?php mosMainBody(); ?>, So now our template would look like this:

Code:

<tr>
<td valign="top" style="width: 200px; background: #e2e2e2;">SideNav is here</td><td style="width: 600px;"><?php mosMainBody(); ?></td>
</tr>

The Side Navigation
Now in the area where 'Main Content' would be the maincontent of your Joomla website would always be there. Now back to when I was talking about positions the maincontent is a position but it is a special position, the rest of your positions will be loaded with the mosLoadModules() function. e.g. <?php mosLoadModules('left'); ?> So anywhere that code is placed in our template, Modules published to the 'left' position would display. You can publish as many modules to any position as you want, you can also make as many positions as you want, Joomla automatically comes with alot of default positions like 'banners', 'pathway', 'user1', and more, in our side nav we are going to want the main menu and a way for users to login, so in the side nave area, we are going to put the 'left' and 'user1' positions, like below.

Code:

<tr>
<td valign="top" style="width: 200px; background: #e2e2e2;"><?php mosLoadModules('left'); ?><br/><?php mosLoadModules('user1'); ?></td><td style="width: 600px;"><?php mosMainBody(); ?></td>
</tr>

That would load the 'left' and 'user1' positions into our sidenavigation, if you are interested try some of Joomla's other default positions to see what they do, to find the other positions in Joomla go to Site > Template Manager > Module Positions You can also create your own positions there.

What does the left and user1 positions do by default? Well left will load the Main Menu, and Top Menu, the user1 position loads a login module that people can register and login to your website, in Joomla you can password protect some of your pages so that only registered users can view it.

Now the only thing we have left to program is the header, what we'll put there is a pathway/breadcrumb area, e.g. It lists what page your on and a way to navigate back, kind of like a boardwalk. The position for an area like that is 'pathway' so in order to load that in our top area, we'd go to the area in our HTML code that has the 'Header is Here' text and replace it with: <?php mosLoadModules('pathway'); ?>, So now your code should look like below:

Code:

<tr>
<td valign="top" style="width: 800px; background: #a1a1a1;" colspan="2"><?php mosLoadModules('pathway'); ?></td>
</tr>

Now you are basically done, only thing left is to add in the header information. Joomla has some default code that should be placed at the top of every Joomla template, it is listed below:

Code:

Replace

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Page Document</title>
</head>

- with -

<?php defined( "_VALID_MOS" ) or die( "Direct Access to this location is not allowed." );?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php if ( $my->id ) { initEditor(); } ?>
<meta http-equiv="Content-Type" content="text/html;><?php echo _ISO; ?>" />
<?php mosShowHead(); ?>
<?php echo "<link rel=\"stylesheet\" href=\"$GLOBALS[mosConfig_live_site]/templates/$GLOBALS[cur_template]/css/template_css.css\" type=\"text/css\"/>" ; ?><?php echo "<link rel=\"shortcut icon\" href=\"$GLOBALS[mosConfig_live_site]/images/favicon.ico\" />" ; ?>
</head>

Now your entire template should look like below:

index.php

<?php defined( "_VALID_MOS" ) or die( "Direct Access to this location is not allowed." );?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php if ( $my->id ) { initEditor(); } ?>
<meta http-equiv="Content-Type" content="text/html;><?php echo _ISO; ?>" />
<?php mosShowHead(); ?>
<?php echo "<link rel=\"stylesheet\" href=\"$GLOBALS[mosConfig_live_site]/templates/$GLOBALS[cur_template]/css/template_css.css\" type=\"text/css\"/>" ; ?><?php echo "<link rel=\"shortcut icon\" href=\"$GLOBALS[mosConfig_live_site]/images/favicon.ico\" />" ; ?>
</head>

<body>
<table border="0" cellpadding="0" cellspacing="0" style="width: 800px;">
<tr>
<td valign="top" style="width: 800px; background: #a1a1a1;" colspan="2"><?php mosLoadModules('pathway'); ?></td></tr>
<tr>
<td valign="top" style="width: 200px; background: #e2e2e2;"><?php mosLoadModules('left'); ?><br/><?php mosLoadModules('user1'); ?></td><td style="width: 600px;"><?php mosMainBody(); ?></td>
</tr>
</table>
</body>

</html>

Now save this document as index.php, I saved it to 'C:/Joomla/Template1/index.php' for simplisties sake.

The Joomla XML File

Now we need to write the Joomla XML file, this is a file that lets us say, 'I programmed this Template Foo!' :) below is a sample XML File:

template_details.xml

<?xml version="1.0" encoding="iso-8859-1"?>
<mosinstall type="template">
<name>My Super Template </name>
<creationDate>Date here </creationDate>
<author>I created this!</author>
<copyright>don't steal my template FOO! </copyright>
<authorEmail>jordash@joomlahax</authorEmail>
<authorUrl>www.joomlahax.com</authorUrl>
<version>1.0</version>
<description>This is the Best Template ever created! </description>
<files>
<filename>index.php</filename>
</files>
<images>
<filename>images/logo.gif</filename>
</images>
<css>
<filename>css/template_css.css</filename>
</css>
</mosinstall>

Save that as templateDetails.xml, keeping with our previous example save it to 'C:/Joomla/Template1/templateDetails.xml', Now a couple of things to notice about this file, you need to add in your images and CSS file to the XML file.

Notice that the first file we add in is the index.php file that we just created, it is located inside of the <files> tag, then further into the <filename> tag, we can also add in all our images which would be enclosed in a <images> tag, and then the filename tag again, notice that we didn't use any image in this template but if you did you'd add all your images like in the code above, for an example I added in the 'images/logo.gif' image (C:/Joomla/Template1/images/logo1.gif). We can also add our CSS file inside of the <css> tag. Once again we didn't use a CSS file but if you need to add one in (which you probably will) that is how you'd do it.

Important
Since we are not using logo1.gif or template_css.css, you need to remove the references to these files from the templateDetails.xml file or you will get an error.

Now we are basically done with the programming of the template, so we need to Zip (or Tarball if your on linux) our Template1 folder to Template1.zip, now our template is ready to distribute and upload into Joomla. To upload your template in Joomla, go to Site > Template Manager > Site Templates click on New in the top right, then you can Browse and Upload your Template1.zip file you just created, and your done!

Hits: 4063
Comments (3)Add Comment
css design lesson
written by :-: S€ZæR ->, May 03, 2008
CSS "Cascading Style Sheets" LessoNs - WeB DesigN LessoN - - Web site : http://WWW.css-lessons.ucoz.com/index.html
report abuse
vote down
vote up
Votes: +0
css design lesson
written by :-: S€ZæR ->, May 14, 2008
css web template page (example) -- http://www.css-lessons.ucoz.co...e-page.htm
report abuse
vote down
vote up
Votes: +0
Help to develop the site in joomla
written by Khushal kumar, October 14, 2008
i am just started in my website in joomla, but i don't know more about the joomla.
please help me to develop the site.
thanks
report abuse
vote down
vote up
Votes: +0

Write comment
quote
bold
italicize
underline
strike
url
image
quote
quote
smile
wink
laugh
grin
angry
sad
shocked
cool
tongue
kiss
cry
smaller | bigger

busy




Reddit!Del.icio.us!Facebook!Slashdot!Netscape!Technorati!StumbleUpon!Newsvine!Furl!Yahoo!Ma.gnolia!Free social bookmarking plugins and extensions for Joomla! websites!
Last Updated ( Monday, 14 January 2008 )
 
< Prev   Next >

Polls

Best hosting for joomla
 

Most download in 10 day

Date iconFeb.06

The skeleton template is exactly what it says on the tin - a blank template intended to provide t...

Date iconJul.22

This is a nice little web 2.0 clock developed as a Joomla module. The actual size is shown here ...

Date iconJul.25

Shows current date,time and day of the week, with "fade effect" Six color option: Blue...

Date iconAug.29

Demo

Date iconMay.05

Date iconDec.15

Newsflash

Freqently people want to know how to customize the free templates that come with Joomla.  And, knowing how to do some template customization is an important Joomla skill to have.

A frequent question on the Joomla forums is, "how to I change or remove the "footer" text on a template."

It might be a "Template by ---- " or "Powered by Joomla"  or something like that.

Read more...