简体   繁体   中英

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. 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.

I call the file in media.phtml with the following code:

    echo $this->getChildHtml('mynewblock');

This is referencing the following code in 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 ( ) )

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.

You need to refer some tutorials how to call blocks

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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