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.

app/design/frontend/default/default/layout/
...
page.xml
catalogsearch.xml
catalog.xml
checkout.xml
cms.xml
contacts.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.

Testimonials

Thank your for me install Apparel Store PrestaShop Theme 58967,now my site work fineSmile.

--- Lindan

Спасибо за ваш шаблон будет сделано быстро, чтобы уменьшить мою работу это!

--- Mlidf

Obrigado por seu modelo para reduzir minha força de trabalho, melhorar a eficiência, muito bom!!

--- Defiyi

Your help is ok,I like your site,like your templates.I want to buy many templates at your site.Cool

--- Nananli

Thank you help me resolved some web templates issues,I am very happy now.

--- SUFI

내 상사는 내가 템플릿 때문에 높은 품질, 합리적인 가격 8 템플릿을 구매해야했다.

---Mike Din

 

 

 
You are here: Magento Tutorial Magento Template System