Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

[ Magento templating ] Suggestion for more easy customization! 
 
ActusMedia
Member
 
Avatar
Total Posts:  46
Joined:  2007-11-01
Netherlands, Enschede
 

Dear Community,

Hereby I present you with an way to improve your designing for Magento and make it less time consuming.
This suggestion is not pixel perfect wink but has saved me some time so I thought to share it with you.

The main layout of your webshop is stored inside /templates/pages/2columns-right.phtml and the other files in the root of /pages
This would mean you need to edit EACH of these files to reflect your custom Magento design. Why not make things a litte more easy by creating a master.phtml which holds your basic layout.

step 1) create a master.phtml inside /pages/
step 2) openup all the files inside your /pages/ root directory (e.g 2columns-right.phtml, etc)
include your master.phtml inside these files like the below example:

<?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Open Software License (OSL 3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/osl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * @category   design_default
 * @package    Mage
 * @copyright  Copyright (c) 2004-2007 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
 * @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 */
?>
<?php 
/**
 * Template for Mage_Page_Block_Html
 */
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
>
<
html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<?php echo $this->getChildHtml('head'?>
</head>


<? include "master.phtml"?>

Now upload master.phtml to your Magento directory and you have only 1 file to change the complete layout of your store.

Additionally I have created a cart.phtml with a different layout for the shopping cart,
I include this cart.phtml like above inside 1column.phtml

I have not found any other location in Magento that uses the 1column.phtml except the shopping cart, if you find this to be untrue please let me know. By using above trick you only have 1 .phtml to hold your store layout meaning faster changes and more easy debugging.

Happy Magentoing!

 
Magento Community Magento Community
Magento Community
Magento Community
 
wally07
Jr. Member
 
Total Posts:  13
Joined:  2008-07-02
 

could you please explain a little more since this interests me a lot..

are you saying that i should design a template (preferably along the lines of a 2 col right template since that is used as a default across magento) and call it master.phtml and then remove from all of the other templates (regardless of they being 3 column / 2 col-left etc) all code except -

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN”
“http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<?php echo $this->getChildHtml('head') ?>
</head>

Upto this point after which i just include the master template.

and from there on i just design from the master template since the rest are just identical shells (as in the above quote) for my include.

am i understanding this correctly?

is there a possibility of a basic master template that you could post?

thanks.

 
Magento Community Magento Community
Magento Community
Magento Community
 
wally07
Jr. Member
 
Total Posts:  13
Joined:  2008-07-02
 

so do i have the right idea or not , please.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top