【问题标题】:Display .phtml page in another .phtml page在另一个 .phtml 页面中显示 .phtml 页面
【发布时间】:2015-07-13 12:07:13
【问题描述】:

我在catalog/product/new.phtml 中创建了一个new.phtml 页面。 其中包含new/latest products。 我还有另一个 .phtml 页面 [product_slider.phtml]。我想将new.phtml 添加到product_slider.phtml 这可能吗??如何使用..任何想法。?

【问题讨论】:

    标签: php magento catalog


    【解决方案1】:

    在另一个 .phtml 页面中显示 .phtml 页面。你可以使用:

    <?php echo $this->getLayout()->createBlock('core/template')->setTemplate('path after template dir/filename.phtml')->toHtml(); ?>
    

    【讨论】:

      【解决方案2】:
      <?php echo $this->getLayout()->createBlock('core/template')->setTemplate('custom/product_slider.phtml')->toHtml(); ?>
      

      你必须确定块类型,而不是core/template

      【讨论】:

        【解决方案3】:

        回答

        在尝试了代码后,我得到了解决方案。

        <?php echo $this->getLayout()->createBlock('core/template')->setTemplate('catalog/product/new.phtml')->toHtml(); ?>
        

        【讨论】:

          猜你喜欢
          • 2016-05-11
          • 1970-01-01
          • 1970-01-01
          • 2015-03-21
          • 2014-04-26
          • 1970-01-01
          • 2016-03-21
          • 2016-09-19
          • 1970-01-01
          相关资源
          最近更新 更多