You are here: Home › Web Developers and Designers Learn How to Build Web Sites

Web Design Quick Tutorial – Adding Magento Page Templates

0 April 30, 2012 in Magento by advanced

This week I’m going to give you a very quick and not at all dirty Magento tutorial. Our site e-commerce web design usually handle these kinds of things but this is something I’ve been asked a few times recently by newcomers to Magento and is probably too simple for the experts on there!

Now, even if you’ve been in web design a while you might not have used Magento before and at first it can seem like some aspects are hard to find and use. Adding a page template to use for your site’s pages is easy when you know how and like everything in Magento it has it’s foundation in the XML building blocks.

Step 1 – Create your template

This is the easy bit of an easy tutorial. To start with in Magento you have 4 main page templates to choose from: 1-column, 2-columns-left, 2-columns-right and 3-columns. These are found in your theme folder, usually in app >design >frontend >default >yourtheme >template >page. I’d advise copying the modern theme folder and renaming it something relevant to avoid it being overwritten on upgrading. Just select the template to use as a base, copy it and rename it to whatever you want your new template to be called. You could call it anything relevant but in this case we’ll call it homepage as I want the homepage to use a layout not shared with any other pages. You would then add the HTML structure and upload it.

Step 2 – As easy as X, M, L

Time to get your hands dirty with some XML. Find and open the XML file local.xml located at app >etc. Here, between the opening and closing <global> tags insert the code below (change as appropriate for your template name remembering mine is called homepage).

<cms>
     <layouts>
           <homepage>
                  <label>Homepage</label>
                  <template>page/homepage.phtml</template>
           </homepage>
     </layouts>
</cms>

Here you are establishing the template name with the <homepage></homepage> tags and inside as you might expect you are setting the label and the file to be used for the template.

Now if you have cache enabled it’s time to refresh those caches (there’s a quiz show catchphrase waiting to be used) and you might need to log out and back in before you see the new template available to you like the image below in any situation in Magento where a layout template can be selected.


Last Modified: May 17, 2012
  • Visits: 5372
  • (Current Rating 5.0/5 Stars) Total Votes: 1
  • 0 0

No Comments Yet...

Leave a reply


Home Page Sitemap Rss
Copyright ©2022 Europi Web All Rights Reserved.