【发布时间】:2014-04-11 05:46:45
【问题描述】:
我已经创建了一个非常简单的 Magento 模块,现在只插入一个红色方块。将我的 HTML 放在产品页面上我想要的位置的正确方法是什么?
我试图将块放在产品属性块的正上方。
以下将块放置在内容的底部但在页脚之前。我已经尝试通过reference 定位其他块,但到目前为止我只有content 可以工作。我也试过before="-" 和after="-" 没有运气。它只是将我的 html 移动到内容的上方或下方(应该如此)。
配置.xml
<global>
<blocks>
<comapany_modulename>
<class>Company_Modulename_Block</class>
</company_modulename>
</blocks>
</global>
<frontend>
<layout>
<updates>
<modulename module="Company_ModuleName">
<file>company/Module.xml</file>
</modulename>
</updates>
</layout>
app/design/frontend/base/default/layout/company/module.xml
<catalog_product_view>
<reference name="content">
<block type="company_modulename/blockphpname"
name="module.productview"
template="company/template.phtml" >
</block>
</reference>
</catalog_product_view>
app/code/local/company/module/Block/block.php
class Company_Modulename_Block_Blockname extends Mage_Core_Block_Template
{
public function getDate()
{
$date = date('Y-m-d');
return urlencode($date).' test';
}
}
app/design/frontend/base/default/template/company/template.phtml
<div style="padding:50px; background:red; float: left; width:100px; height:100px;">test: <?php echo $this->getDate() ?></div>
【问题讨论】: