我在catalog.xml文件中添加了以下代码,现在评论部分显示在产品视图页面中。但我想只在特定标签下显示。
<block type="review/product_view_list" name="product.info.product_additional_data" as="product_review" template="review/product/view/list.phtml">
<block type="review/form" name="product.review.form" as="review_form"/></block>
我们是否可以使用phtml代码显示此评论部分。
因此我打算在该标签下使用该phtml代码
答案 0 :(得分:2)
您可以调用特定的标签内容getChildHtml
功能来调用特定的块内容。如下所示:
echo $this->getChildHtml('product_review');
echo $this->getChildHtml('review_form');
答案 1 :(得分:0)
<?php
$reviewListBlock = $this->getLayout()->createBlock('review/product_view_list');
$reviewFormBlock = $this->getLayout()->createBlock('review/form');
echo $reviewListBlock->setTemplate('review/product/view/list.phtml')->toHtml();
echo $reviewFormBlock->setTemplate('review/form.phtml')->toHtml();
?>