将自定义页面添加到现有模块


Add Custom Page to the existing module

我有这个问题我无法解决。部分原因是我无法用正确的术语来解释它。我是新手,对这个笨拙的问题感到抱歉。

下面你可以看到我的目标概述。

我有一个名为"商城/品牌">的扩展名

我想将自定义页面添加到我这样写的模块中

品牌.xml

<brand_manufacturer_selectbrand>
      <reference name="content">
           <block type="brand/manufacturer" name="manufacturer_selectbrand" template="mall/brand/manufacturer/selectbrand.phtml"/>
      </reference>
</brand_manufacturer_selectbrand>

制造商控制器.php

public function selectbrandAction() {
    $this->loadLayout( array('default','brand_manufacturer_selectbrand'));
    $this->getLayout()->getBlock('head')->setTitle( Mage::helper('manufacturer')->__('Selected Brands'));
    $this->renderLayout();
}

在侧块文件夹制造商.php

<?php
   class Mall_Brand_Block_Manufacturer extends Mage_Core_Block_Template {
       public function getManufacturer() { 
         $manufacturer = Mage::registry('current_manufacturer');
        if($manufacturer == null) {
            $id = Mage::app()->getRequest()->getParam('id');
            $manufacturer = Mage::getModel('brand/manufacturer')->load($id);
        }
        return $manufacturer;
    }
}
?>

对于前端选择品牌.phtml

<?php echo "hello"; ?>

仅用于检查

我在地址栏中尝试过这样

http://localhost/mage12/index.php/selectbrand

它显示哎呀...我们的坏

我在这里做错了什么?

有什么想法吗?

检查你在etc/config中的前端名称.xml

然后尝试下面的网址

http://localhost/mage12/index.php/**frontend_name_in_config**/manufacturer/selectbrand

我认为您的前端名称是品牌,因此下面的URL将起作用

http://localhost/mage12/index.php/brand/manufacturer/selectbrand

希望这对你有帮助