Joomla Templates: Creating a Pure CSS Template | Part 2
Joomla Templates: Creating a Pure CSS Template - Part 2
templateDetails.xml must include all the files that are part of the template. It also includes information such as the author and copyright. Some of these are shown in the admin backend in the Template Manager. An example XML file is shown here:
Let's explain what some of these lines mean:
The files used in the template are laid out with
What actually is in an
index.php file? It is a combination of (X)HTML and PHP that determines everything about the layout and presentation of the pages.
First, let's look at a critical part of achieving valid templates, the DOCTYPE at the top of the
index.php file. This is the bit of code that goes at the very top of every web page. At the top of our page, we have this in our template:
The first PHP statement simply makes sure that the file is not accessed directly for security.
A web page DOCTYPE is one of the fundamental components of how a web page is shown by a browser, specifically, how that browser interprets CSS. To give you further understanding, an observation from alistapart.com says
Information on W3C's site about DOCTYPEs is written by geeks for geeks. And when I say geeks, I don't mean ordinary web professionals like you and me. I mean geeks who make the rest of us look like Grandma on the first day of She's Got Mail.
Anyway, you can use several DOCTYPEs. Basically, the DOCTYPE tells the browser how to interpret the page. Here the words "strict" and "transitional" start getting floated around (float:left and float:right usually). Essentially, ever since the Web started, different browsers have had different levels of support for CSS. This means for example, that Internet Explorer won't understand the "min-width" command to set a minimum page width. To duplicate the effect, you have to use "hacks" in the CSS.
Some say that serving (X)HTML as text/html is considered harmful. If you actually understand that statement you are well ahead of the game and beyond this guide. You can read more at hixie.ch/advocacy/xhtml.
Strict means the HTML (or (X)HTML) will be interpreted exactly as dictated by standards. A transitional DOCTYPE means that the page will be allowed a few agreed upon differences to the standards.
To complicate things, there is something called "quirks" mode. If the DOCTYPE is wrong, outdated, or not there, the browser goes into quirks mode. This is an attempt to be backwards-compatible, so Internet Explorer 6 for example, will render the page pretending as if it were IE4.
Unfortunately, people sometimes end up in quirks mode accidentally. It usually happens in two ways:
Next is an XML statement (after the DOCTYPE):
The part about IE6 quirks mode is important. In this chapter we only design for IE6+, so we will make sure that it's running in standards mode. This will minimize the hacks we have to do later on.
Making a page standards-compliant, where you see "valid xhtml" at the bottom of the page does not mean really difficult coding, or hard-to-understand tags. It merely means that the code you use matches the DOCTYPE you said it would. That's it! Nothing else.
Designing your site to standards can, on one level, be reduced to saying what you do and then doing what you say.
Here are some useful links, which will help you understand DOCTYPE and quirks mode: