繁体   English   中英

Magento:通过XML在list.phtml中调用自定义phtml

[英]Magento: Call custom phtml in list.phtml via XML

在Magento中,我试图在list.phtml中显示一个phtml自定义模块。 我的xml看起来像这样:

<catalog_category_default>
    <reference name="content">
            <block type="my_prevenda/prevendalist" name="prevenda" as="prevenda" template="prevenda/prevenda_list.phtml" />
    </reference>
</catalog_category_default>

我这样叫: <?php echo $this->getChildHtml('prevenda') ?>

但是此方法只能在view.phtml中进行。 如何显示在list.phtml中? 将保留产品名称

我Tks所有!

<?xml version="1.0"?>
<layout>
    <catalog_category_default>
        <reference name="product_list"><!-- need to add to the correct parent block -->
                <block type="my_prevenda/prevendalist"
                       name="prevenda" as="prevenda"
                       template="prevenda/prevenda_list.phtml" />
        </reference>
    </catalog_category_default>
</layout>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM