Wednesday, December 28, 2011

Web Template Design Tutorial

By John Lewis


On this tutorial I'll introduce the idea of modular design of web templates. It is a way to create easily adaptable and maintainable web templates from simple ones proper as much as essentially the most complex.

A web site template is a framework for a website containing the code for web pages, graphic components and a styling template. Most individuals think of a template when it comes to it is visual appearance but this is actually the theme.

The two most important components of a template are the content management code and the theme. These needs to be saved separate so that the theme can simply be changed with out affecting the structure. For example, the styles needs to be defined in an exterior model sheet and not embedded within the HTML code of the pages.

The structure of a website shall be outlined by a set of templates. It is good practice to make the templates modular quite than having page templates containing all the code for every page. This allows site-vast adjustments to be easily applied. For instance, the footer may be largely identical between pages.

We would divide a page template right into a header, content, sidebar and footer where these are in separate files. The content will change most between pages, so moderately than having a content file, we embody the content right into a page file which pulls within the individual template records data and defines the unique features of that page.

The unique options of a web page will be the title, description and article content. We can define these firstly of the web page template with say PHP code to set the worth of variables that are used by the other templates such as the header template. Then we assemble the web page by together with the required templates and inserting the content.

If we directly insert the content, we are going to create a new page template for every page of the site. But this is fine since we are not duplicating the header, footer and sidebar.

To cut back the variety of page templates, we can store our content in a database and use a page ID to identify which page content to insert. This ID is often appended to our URLs of the website. If we do this, we're creating what is named a Content material Administration System (CMS).

Where the theme is more likely to be changed typically or people are encouraged to design new themes, a separate listing could be created to hold the varied themes. A learn me file could possibly be included to credit the designer, or this information could possibly be added to the start of the model sheet as a comment section.

For this to work, we now have to create master page templates that pull within the templates from the current theme. The master page templates will power the site. The code that these templates use is finest saved in separate records data in say an includes directory.

In abstract I have coated the ideas of modular web site template creation from the simple to a complex CMS.




About the Author:



0 comments: