客户注册表单模板无法在网站主页上运行

时间:2019-03-27 05:56:28

标签: php magento magento-1.9

我正在尝试在我的主页上调用Magento客户注册表格。当我在主页上调用它时,我会尝试两种方式,即静态块或template.phtml文件,并且我的站点停止工作。谁能为我提出解决方案?

<?php
echo $this->getLayout()->createBlock('cms/block')->setBlockId('register-form')->toHtml();

<?php
echo $this->getLayout()->createBlock('core/template')->setTemplate('persistent/customer/form/mini.register')->toHtml();

1 个答案:

答案 0 :(得分:0)

使用模板文件时,在文件名中添加扩展名“ .phtml”。

在您的示例中:

echo $this->getLayout()->createBlock('core/template')->setTemplate('persistent/customer/form/mini.register.phtml')->toHtml();

请不要使上面的代码仅在模板文件中起作用。
如果您尝试通过admin cms页面将其添加到首页,则可以执行以下操作:

{{ block type="core/template" template="persistent/customer/form/mini.register.phtml" }}

或通过布局文件:

<block type="core/template" template="persistent/customer/form/mini.register.phtml" />