[英]Display phtml file inside phtml file in Magento
I am using magento and have set up a plugin but there are a few changes I would like to make to how it is displayed and in order to do so I need the following issue solved. 我正在使用magento并设置了一个插件,但是我想对它的显示方式进行一些更改,为此,我需要解决以下问题。 I have media.phtml in which I am calling another phtml file belonging to a plugin but for whatever reason the phtml file belonging to the plugin is not rendered.
我有media.phtml,其中我要调用另一个属于该插件的phtml文件,但是无论出于何种原因,都不会呈现该插件的phtml文件。
I call the file in media.phtml with the following code: 我使用以下代码在media.phtml中调用该文件:
echo $this->getChildHtml('mynewblock');
This is referencing the following code in catalog.xml: 这是在catalog.xml中引用以下代码:
<block type="catalog/product_view_media" name="product.info.media" as="media" template="catalog/product/view/media.phtml">
<reference name="content">
<block type="base/default_template_rwpproductvideo" name="product.mynewblock" as="mynewblock" template="base/default/template/rwproductvideo/video.phtml"/>
</reference>
</block>
<block type="core/text_list" name="alert.urls" as="alert_urls" translate="label">
<label>Alert Urls</label>
</block>
I should mention I also tried calling it using; 我应该提一下,我也尝试使用来调用它;
include('app/design/frontend/base/default/template/rwproductvideo/video.phtml');
Which gave an error on the page 页面上出现错误
There has been an error processing your request 处理您的请求时出错
Invalid method RocketWeb_ProductVideo_Block_Product_View_Media::_getProductVideos(Array ( ) ) 无效的方法RocketWeb_ProductVideo_Block_Product_View_Media :: _ getProductVideos(Array())
Thank you very much in advance. 提前非常感谢您。
<block type="catalog/product_view_media" name="product.info.media" as="media" template="catalog/product/view/media.phtml">
<reference name="content">
<block type="productvideo/video" name="product.info.media.video" as="mynewblock" template="rwproductvideo/video.phtml"/>
</reference>
</block>
<block type="core/text_list" name="alert.urls" as="alert_urls" translate="label">
<label>Alert Urls</label>
</block>
See I have given type as 'productvideo/video' for 'mynewblock' block. 请参阅我为“ mynewblock”块指定类型为“ productvideo / video”。
You need to refer some tutorials how to call blocks 您需要参考一些教程如何调用块
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.