0

试图弄清楚为什么像下面这样的东西不能工作。首选项管理部分中有一个指向此控制器的选项卡,但是当转到它时,它总是输出一个空白页面。我已经尝试了几件事,但以下基本上是我需要的。没有模型...我只需要这个来获取上传的文件以进行后期处理...

控制器文件...

class AdminAstroImporterController extends ModuleAdminController {

    public function initContent() {
        parent::initContent();
        return $this->display(__FILE__, 'import.tpl');

    }

    public function postProcess() {
        //do something here

    }
}
4

2 回答 2

2

看起来您可以通过执行如下所示的 initContent() 函数来覆盖实际的内容输出。smarty 分配中的“内容”可以是您自己生成的任何 html。

class AstroImporterAdminController extends AdminController {
public function __construct() {
    parent::__construct();

    //load current settings
    $this->data = unserialize(Configuration::get('ASTRO_IMPORTER'));
}

public function initContent() {
    parent::initContent();

    $this->show_toolbar = false;
    $this->context->smarty->assign(array(
        'content' => $this->renderSettings().$this->renderForm().$this->displayFields(),
    ));
}
于 2014-02-06T17:02:40.387 回答
0

我发现这有效:

public function renderList()
{
    global $currentIndex, $cookie;

    $smarty = $this->context->smarty;

    $smarty->assign('currentIndex', $currentIndex);


    return $this->context->smarty->fetch($this->getTemplatePath().'/main.tpl');
}

尽管它很脏,但它似乎比 Amb3rL4nn 答案更干净。

在 v1.4 中,创建一个选项卡非常容易(并且很容易找到文档)我想知道他们为什么更改它并且不提供文档。

于 2016-05-10T08:07:32.063 回答