Magento Template System

E-mail Print PDF

The template system in Magento is pretty controversial. The choice of using regular PHP for the templating language has caught some criticism froma fewusers. But, the choice of regular PHPhas notmade the templating system simple or under-powered, not by a long shot. This has to be the most flexible and advanced templating system that this author has ever seen (in PHP).

A complete page is rendered as a nested set of magento template files (technically, a nested set of Blocks). There are no explicit “widgets” in the system, that means, you won’t find a specific “Form” class nor “Button” class or object. The lowly Block classes straddle the line between widgets and templates. The nested set of templates and blocks is controlled by... you guessed it, an XML file, specifically a set of XML files. This is quite powerful for developers and plug-in contributors, but it seems that it is overly complicated for most designers (even those familiar with PHP et al.).

Layout Files The layout files control the structure of any final page rendering. They are located in the layout folder under your design theme. There are a number of XML files whose names loosely relate to an individual module, but they are all lower-case letters, whereas the module names traditionally use the so-called camel-case method. The most important XML file is page.xml.


The page.xml file specifies the default page structure. All modifications from any of the other XML files are modifications of settings under the default XML tag. The following is a list of tags that are common to all layout files.

Sometimes you will see tags like the following. These tags are layout handles, they behave like the default tag, but only during certain requests. These tags follow a pattern that relates to the module, controller, and action of the given Web request. If the tag only has two parts, separated by an underscore, like cms_page, then these settings are applied to all requests to that module and controller.


Eu comprei um modelo aqui e fazer uma pequena personalização para o meu cliente. Meu cliente gosta muito do tema. Obrigado.

--- Miguélez

I've downloaded the virtuemart theme. :-P Thank you very much.

--- Kobayashi

Yo tengo mi propia empresa de diseño web. Yo siempre comprar sus temas y luego hacer algunas personalizaciones. Mis clientes les gusta mucho.

--- Robert

Jeg elsker min nye sportsbutikk. Det ser veldig profesjonelt .

--- Hyosun

Я очень впечатлен с шаблонами. Я буду покупать больше проектов в будущем.

--- Knopf

You are here: Magento Tutorial Magento Template System