0

path: app\code\local\Bhtech\Designer inside this folder all other folder Block, Controller

config.xml

<?xml version="1.0"?>
  <config>
     <modules>
        <Bhtech_Designer>
          <version>0.1.0</version>
        </Bhtech_Designer>
     </modules>
     <frontend>
       <routers>
          <routeurfrontend>
              <use>standard</use>
              <args>
                 <module>Bhtech_Designer</module>
                 <frontName>designer</frontName>
              </args>
           </routeurfrontend>
       </routers>
       <layout>
            <updates>
                <bhtech_designer>
                    <file>bhtech_designer.xml</file>
                </bhtech_designer>
            </updates>
        </layout>
    </frontend>
    <global>
        <blocks>
            <bhtech_designer>
                <class>Bhtech_Designer_Block</class>
            </bhtech_designer>
        </blocks>
    </global>
</config>

indexController.php

<?php
class Bhtech_Designer_IndexController extends Mage_Core_Controller_Front_Action
{
    protected function _initAction()
    {
        $this->loadLayout();
        $this->renderLayout();
        return $this;
    }
    public function indexAction()
    {
         $block = $this->getLayout()->createBlock('bhtech/designer');
         $block->setTemplate('designer/designer.phtml');
         echo $block->toHtml(); 
        //Zend_Debug::dump($this->getLayout()->getUpdate()->getHandles());

    }  
}

Block designer.php

<?php
class Bhtech_Designer_Block_Designer extends Mage_Core_Block_Template
{
    // Methods (optional)
}
?>

designer.xml

<?xml version="1.0" ?>
<!-- Root node for Magento layout configuration -->
<layout version="0.1.0">
    <!--Page handle -->
    <designer_index_view>
        <!-- reference tag specifies the block where we a going to add child block -->
        <reference name="content">
            <!-- Our page content block -->
            <block type="bhtech/designer" name="designer" template="design.phtml"></block>
        </reference>
    </designer_index_view>
</layout>

path: app\design\frontend\bhtech\designer inside this folder layout and template folders are placed

layout.xml

<block type="bhtech/designer" template="bhtech/designer.phtml">
    <action method="setData">
        <key>area</key>
        <value>frontend</value>
    </action>
</block>

but I still getting error my magento version 1.9 please help me out if there any details document or example of this please give me that. I'm just trying to load a complete new template for a page.

1

In your config.xml your blocks name is not properly declared, you need to replace:

<global>
    <blocks>
        <bhtech_designer>
            <class>Bhtech_Designer_Block</class>
        </bhtech_designer>
    </blocks>
</global>

With:

<global>
    <blocks>
        <bhtech>
            <class>Bhtech_Designer_Block</class>
        </bhtech>
    </blocks>
</global>
  • @Dhiman feel free to mark your question as answered so it will benefit for others – Raphael at Digital Pianism Dec 3 '16 at 8:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.