문제

I've created a custom module. In controller file the function as bellows.

    /**
     * Load slider images
     */
    public function loadImageAction()
    {
        $this->loadLayout();
        $this->renderLayout();
    }

layout handler declaration is as follows.

<layout version="0.1.0">
    <slider_slider_loadImage>
        <reference name="content">
            <block type="slider/load" name="load_custom_slider" template="slider/slider.phtml" />
        </reference>
    </slider_slider_loadImage>
 </layout>

But this doesn't loads the template file. If I rename the controller action as loadimageAction(){ ...} then it's working.

Can anyone explain how can I use action names with several words?

Eg: loadImageAction()
navNextAction()

Any clarification on this will be appreciated.

도움이 되었습니까?

해결책

It worked.

Controller action is as below.

  /**
     * Load slider images
     */
    public function loadImageAction()
    {
        $this->loadLayout();
        $this->renderLayout();
    }

layout.xml file

<layout version="0.1.0">
    <slider_slider_loadimage>
        <reference name="content">
            <block type="slider/load" name="load_custom_slider" template="slider/slider.phtml" />
        </reference>
    </slider_slider_loadimage>
 </layout>

The issue was earlier handler was slider_slider_loadImage. I changed it to slider_slider_loadimage . Now it working fine.

다른 팁

Magento doesn't discriminate between action names with multiple words, as far as I know.

You can look at the code in Mage_Core_Controller_Varien_Action.

Many Magento modules have action names that are more than one word, and they don't do anything funny to take care of it. See Mage_Cms, for example.

I'm afraid your error is somewhere else.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 magento.stackexchange
scroll top