Certificated magento

3.11) In which way does a template block store information about its template file? Does it store an absolute or a relative path to the template?

A Magento template block stores the relative path to the template file in a protected variable _template that can be accessed to the corresponding setter and getter methods (setTemplate and getTemplate).

Mage_Core_Block_Template->getTemplate()

     public function getTemplate()
    {
        return $this->_template;
    }
 
Mage_Core_Block_Template->setTemplate()
    public function setTemplate($template)
    {
        $this->_template = $template;
        return $this;
    }
 
The stored path begins at the template folder but it doesn´t store information about the package or theme to be used. That is determined in Magento during the render phase, by the Mage_Core_Design_Package instance.
 
For example, the full template path for the cart block is:
/app/design/frontend/<package>/<theme>/checkout/cart/sidebar.phtml

The corresponding block will store only the last part of the path:
checkout/cart/sidebar.phtml

0 Bình luận

Trở về
  • 1.12) Set up a cron job
  • 1.12) Set up a cron job

    Let’s start with server setup.   As any complex system, Magento has a lot of tasks that need to be executed...