我在admin中创建了一个自定义页面,在左侧选项卡中,我使用ajax调用了控制器。在控制器中,我调用了模板文件,但未显示模板的内容 这是我的代码 Tabs.php
$this->addTab(
'text_and_images',
array(
'label' => Mage::helper('agile_dynamicproductpage')->__('Add Text and Image'),
'title' => Mage::helper('agile_dynamicproductpage')->__('Add Text and Image'),
'url' => $this->getUrl('*/*/test'),
'class' => 'ajax'
)
);
IndexController.php
public function testAction()
{
$this->loadLayout('adminhtml_dynamicproductpage_dynamicblock_test');
$this->renderLayout();
}
adminlayout.xml
<adminhtml_dynamicproductpage_dynamicblock_test>
<reference name="content">
<block type="core/template" name="dynamicblock" template="agile_dynamicpductpage/test.phtml"/>
</reference>
</adminhtml_dynamicproductpage_dynamicblock_test>
test.phtml
<?php echo 'scuccess';?>
请帮忙
答案 0 :(得分:0)
在您的控制器中尝试,并从您的xml中删除引用。
<adminhtml_dynamicproductpage_dynamicblock_test>
<block type="core/template" name="dynamicblock" template="agile_dynamicpductpage/test.phtml"/>
</adminhtml_dynamicproductpage_dynamicblock_test>
$this->loadLayout('adminhtml_dynamicproductpage_dynamicblock_test');
$block = $this->getLayout()
->getBlock('dynamicblock');
$this->getResponse()->setBody($block->toHtml());