下面我们实现一个新的block应用

1. 定义一个新的block文件:

app\code\core\Mage\Customer\Block\Form\Register1.php

                class Mage_Customer_Block_Form_Register1 extends Mage_Directory_Block_Data{  
                public function getHello(){  
                  return "Hello Block";  
               }  
         }

2. 定义template文件:

app\design\frontend\default\default\template\customer\form\register1.phtml

Html代码:

<?php echo $this->getHello(); ?>

3. 修改customer.xml配置

将Xml代码

<block type="customer/form_register" name="customer_form_register" template="customer/form/register.phtml"/>

修改为:

<block type="customer/form_register1" name="customer_form_register1" template="customer/form/register1.phtml"/>

posted @ 2017-03-07 11:41  定格的有天  Views(115)  Comments(0Edit  收藏  举报