我有一个管理自定义模块,其中有三个选项卡。第一个选项卡是用于收集模块的基本信息,第二个选项卡用于向后的信息收集。

我希望使用模板文件呈现一些内容部分,并在我的第二个选项卡中使用选项卡文件本身呈现其余的内容渲染。这是我的第二个标签文件

<?php
class Electronicsstore_News_Block_Adminhtml_News_Edit_Tab_Advance extends Mage_Adminhtml_Block_Widget_Form
{
    public function __construct()
  {                  

        $this->setTemplate('news/calendar/calendar.phtml');//use to render calander field   
        parent::__construct();                    
  }

  protected function _prepareForm()
  {
    $news = new Varien_Data_Form();
    $this->setForm($news);
    $fieldset = $news->addFieldset('news_advance',  array('legend'=>Mage::helper('news')->__('Advanced Settings')));


   //use to add date; need to add start and final days in this module
    $fieldset->addField('news_stime', 'time', array(
          'label'     => Mage::helper('news')->__('Start Date'),
          'class'     => 'required-entry',
          'required'  => true,
          'name'      => 'title',
          'onclick' => "",
          'onchange' => "",
          'value'  => '12,04,15',
          'disabled' => false,
          'readonly' => false,
          'after_element_html' => '<small>Comments</small>',
          'tabindex' => 1
    ));
    $fieldset->addField('news_ltime', 'time', array(
          'label'     => Mage::helper('news')->__('End Date'),
          'class'     => 'required-entry',
          'required'  => true,
          'name'      => 'title',
          'onclick' => "",
          'onchange' => "",
          'value'  => '12,04,15',
          'disabled' => false,
          'readonly' => false,
          'after_element_html' => '<small>Comments</small>',
          'tabindex' => 1
    ));
}
}

因此,我希望先渲染日历模板,然后再进行通过方法设置的时间字段 _prepareform() 在我的第二个标签的内容部分中。目前,它没有一起工作。我没有在标签中获取模板文件输出。在Magento中有可能吗?请以好主意启发我。提前致谢

有帮助吗?

解决方案

更改此方法:

public function __construct()
{                   

    $this->setTemplate('news/calendar/calendar.phtml');//use to render calander field   
    parent::__construct();                    
 }

protected function _construct() //only one underscore in front
{                  
    parent::_construct(); //only one underscore
    $this->setTemplate('news/calendar/calendar.phtml');//use to render calander field   

}
许可以下: CC-BY-SA归因
scroll top