Skip to main content
deleted 98 characters in body
Source Link
7ochem
  • 7.6k
  • 14
  • 52
  • 80

I'm fairly new to Magento, so please be patient if this is a dumb question :) II made a custom controller and declared a layout here. When I go to mysite/custom the controller and the layout works fine. But when I access the indexsite (mysite/index) the layout which I used for the Custom_IndexControllerCustom_IndexController is also loaded. I

I just want this layout to be loaded on the specific view. Please let me know what I'm doing wrong here.

This is what my config.xml looks like

<?xml version="1.0"?>
<config>
    <modules>
        <Unreal_Custom>
            <version>0.1.0</version> 
        </Unreal_Custom>
    </modules>
    <frontend>
        <routers>
            <custom>
                <use>standard</use>
                <args>
                    <module>Unreal_Custom</module>
                    <frontName>custom</frontName>
                </args>
            </custom>
        </routers>

        <layout>
          <updates>
            <custom>
              <file>uecustom.xml</file>
            </custom>
          </updates>
        </layout>
    </frontend>
</config>

My Controller:

<?php
class Unreal_Custom_IndexController extends Mage_Core_Controller_Front_Action
{
    public function indexAction()
    {
        echo "foo";
        $this->loadLayout();
        $this->renderLayout();
    }
}

The corresponding layout

<layout version="0.1.0">
    <default module="Unreal">

        <block type="page/html" name="root" output="toHtml" template="unreal/custom/main.phtml" >           
            <block type="page/html_head" name="header" as="header" template="unreal/custom/header.phtml"></block>
            <block type="page/html" name="content" as="content" template="unreal/custom/content.phtml"></block>
            <block type="page/html_footer" name="footer" as="footer" template="unreal/custom/footer.phtml"></block>
        </block>

    </default>
</layout>

Thanks a lot

I'm fairly new to Magento, so please be patient if this is a dumb question :) I made a custom controller and declared a layout here. When I go to mysite/custom the controller and the layout works fine. But when I access the indexsite (mysite/index) the layout which I used for the Custom_IndexController is also loaded. I just want this layout to be loaded on the specific view. Please let me know what I'm doing wrong here.

This is what my config.xml looks like

<?xml version="1.0"?>
<config>
    <modules>
        <Unreal_Custom>
            <version>0.1.0</version> 
        </Unreal_Custom>
    </modules>
    <frontend>
        <routers>
            <custom>
                <use>standard</use>
                <args>
                    <module>Unreal_Custom</module>
                    <frontName>custom</frontName>
                </args>
            </custom>
        </routers>

        <layout>
          <updates>
            <custom>
              <file>uecustom.xml</file>
            </custom>
          </updates>
        </layout>
    </frontend>
</config>

My Controller:

<?php
class Unreal_Custom_IndexController extends Mage_Core_Controller_Front_Action
{
    public function indexAction()
    {
        echo "foo";
        $this->loadLayout();
        $this->renderLayout();
    }
}

The corresponding layout

<layout version="0.1.0">
    <default module="Unreal">

        <block type="page/html" name="root" output="toHtml" template="unreal/custom/main.phtml" >           
            <block type="page/html_head" name="header" as="header" template="unreal/custom/header.phtml"></block>
            <block type="page/html" name="content" as="content" template="unreal/custom/content.phtml"></block>
            <block type="page/html_footer" name="footer" as="footer" template="unreal/custom/footer.phtml"></block>
        </block>

    </default>
</layout>

Thanks a lot

I made a custom controller and declared a layout here. When I go to mysite/custom the controller and the layout works fine. But when I access the indexsite (mysite/index) the layout which I used for the Custom_IndexController is also loaded.

I just want this layout to be loaded on the specific view. Please let me know what I'm doing wrong here.

This is what my config.xml looks like

<?xml version="1.0"?>
<config>
    <modules>
        <Unreal_Custom>
            <version>0.1.0</version> 
        </Unreal_Custom>
    </modules>
    <frontend>
        <routers>
            <custom>
                <use>standard</use>
                <args>
                    <module>Unreal_Custom</module>
                    <frontName>custom</frontName>
                </args>
            </custom>
        </routers>

        <layout>
          <updates>
            <custom>
              <file>uecustom.xml</file>
            </custom>
          </updates>
        </layout>
    </frontend>
</config>

My Controller:

<?php
class Unreal_Custom_IndexController extends Mage_Core_Controller_Front_Action
{
    public function indexAction()
    {
        echo "foo";
        $this->loadLayout();
        $this->renderLayout();
    }
}

The corresponding layout

<layout version="0.1.0">
    <default module="Unreal">

        <block type="page/html" name="root" output="toHtml" template="unreal/custom/main.phtml" >           
            <block type="page/html_head" name="header" as="header" template="unreal/custom/header.phtml"></block>
            <block type="page/html" name="content" as="content" template="unreal/custom/content.phtml"></block>
            <block type="page/html_footer" name="footer" as="footer" template="unreal/custom/footer.phtml"></block>
        </block>

    </default>
</layout>
Source Link
xhallix
  • 702
  • 2
  • 8
  • 27

Custom Module Controller overwriting default layout

I'm fairly new to Magento, so please be patient if this is a dumb question :) I made a custom controller and declared a layout here. When I go to mysite/custom the controller and the layout works fine. But when I access the indexsite (mysite/index) the layout which I used for the Custom_IndexController is also loaded. I just want this layout to be loaded on the specific view. Please let me know what I'm doing wrong here.

This is what my config.xml looks like

<?xml version="1.0"?>
<config>
    <modules>
        <Unreal_Custom>
            <version>0.1.0</version> 
        </Unreal_Custom>
    </modules>
    <frontend>
        <routers>
            <custom>
                <use>standard</use>
                <args>
                    <module>Unreal_Custom</module>
                    <frontName>custom</frontName>
                </args>
            </custom>
        </routers>

        <layout>
          <updates>
            <custom>
              <file>uecustom.xml</file>
            </custom>
          </updates>
        </layout>
    </frontend>
</config>

My Controller:

<?php
class Unreal_Custom_IndexController extends Mage_Core_Controller_Front_Action
{
    public function indexAction()
    {
        echo "foo";
        $this->loadLayout();
        $this->renderLayout();
    }
}

The corresponding layout

<layout version="0.1.0">
    <default module="Unreal">

        <block type="page/html" name="root" output="toHtml" template="unreal/custom/main.phtml" >           
            <block type="page/html_head" name="header" as="header" template="unreal/custom/header.phtml"></block>
            <block type="page/html" name="content" as="content" template="unreal/custom/content.phtml"></block>
            <block type="page/html_footer" name="footer" as="footer" template="unreal/custom/footer.phtml"></block>
        </block>

    </default>
</layout>

Thanks a lot