dongmangzong8006 2014-08-26 13:38
浏览 23

以编程方式在Magento中使用模板创建块

I have in my Model class:

Mage::getDesign()->setArea(Mage_Core_Model_App_Area::AREA_FRONTEND);
$layout = Mage::app()->getLayout();
$block = $layout->createBlock('core/template','blockname');
$block->setTemplate('cronjob/items.phtml');
$blockProducts = $block->toHtml();

If I use these, Magento warns me with the message:

CRIT (2): Not valid template file: frontend\base\default\template\cronjob/items.phtml

File items.phtml is at these path: C:\wamp\www\magento\app\design\frontend\default\customtheme\template\cronjob\items.phtml

  • 写回答

1条回答 默认 最新

  • douzi8916 2014-08-26 13:50
    关注

    copy your items.phtml file from

    C:\wamp\www\magento\app\design\frontend\default\customtheme\template\cronjob\items.phtml
    

    to

    C:\wamp\www\magento\app\design\frontend\base\default\template\cronjob/items.phtml
    
    评论

报告相同问题?