Magento:我的自定义扩展程序没有加载模板文件

时间:2015-05-08 11:17:16

标签: php magento templates

我创建了我的扩展程序。它工作正常。但问题是,它不会加载模板文件。我不知道为什么? 那么,伙计们请告诉我哪里错了。

应用的/ etc /模块/ CustomMod_Search.xml

<?xml version="1.0"?>
<config>
    <modules>
        <CustomMod_Search>
            <active>true</active>
            <codePool>local</codePool>
        </CustomMod_Search>
    </modules>
</config>

应用/代码/本地/ CustomMod /搜索/

等/ config.xml中

<?xml version="1.0"?>
<config>
    <modules>
        <CustomMod_Search>
            <version>0.1.0</version>
        </CustomMod_Search>
    </modules>
    <frontend>
        <routers>
            <search>
                <use>standard</use>
                <args>
                    <module>CustomMod_Search</module>
                    <frontName>search</frontName>
                </args>
            </search>
        </routers>
        <layout>
            <updates>
                <search>
                    <file>search.xml</file>
                </search>
            </updates>
        </layout>
    </frontend>
    <global>
        <blocks>
            <search>
                <class>CustomMod_Search_Block</class>
            </search>
        </blocks>
    </global>
</config>

阻止/ search.php中

class CustomMod_Search_Block_Search extends Mage_Core_Block_Template
{

}

控制器/ IndexController.php

class CustomMod_Search_IndexController extends Mage_Core_Controller_Front_Action
{
    public function indexAction()
    {
        $this->loadLayout();
        $this->renderLayout();
    }
}

应用/设计/前端/ RWD /默认/

布局/ search.xml

<?xml version="1.0"?>
<layout version="0.1.0">
    <search_index_index>
        <reference name="content">
            <block type="search/search" name="dropdown.search" template="search/search.phtml" />
        </reference>
    </search_index_index>
</layout>

模板/搜索/ search.phtml

<h1>Hello PHP</h1>

但是当我打开网址时 http://localhost/magento/index.php/search/index/index

打开的页面dosn在内容区域中没有

Hello PHP

内容。

我也启用了模板路径提示,但它不会在任何地方显示search.phtml模板。 我也试过<block type="core/template" name="dropdown.search" template="search/search.phtml" />但没有发生任何事情。

请各位朋友帮助我。告诉我哪里错了。如果我错了,或建议我采取正确的方法。

感谢。

0 个答案:

没有答案
相关问题