OpenCart渲染前端

时间:2013-08-22 10:06:09

标签: templates rendering opencart output

Hy all,

我正在尝试在用户取消订阅简报时向用户发送确认消息。但是我只是在没有网站其他部分的情况下收到确认消息。

Here's the url so you can see what's going on...

在unsubscribe控制器类中,我有这个代码来呈现页面:

$this->language->load('newsletter/unsubscribe');

$this->data['heading_title'] = $this->language->get('heading_title');

$this->data['breadcrumbs'] = array();
$this->data['breadcrumbs'][] = array(
    'text'      => $this->language->get('text_home'),
    'href'      => $this->url->link('common/home'),         
    'separator' => false
);

$this->template = 'default/template/newsletter/newsletter.tpl';
$this->children = array(
    'common/column_left',
    'common/column_right',
    'common/content_top',
    'common/content_bottom',
    'common/footer',
    'common/header' 
);

$this->response->setOutput($this->render());

我的模板文件如下所示:

<div class="box">
    <div class="box-heading">Uitschrijven</div>
    <div class="box-content">
        <div id="notification">
            <div class="success" style="">
                U bent succesvol uitgeschreven.
                <img src="catalog/view/theme/metroshop/image/close.png" alt="" class="close">
            </div>
        </div>
    </div>
</div>

当我查看对方(产品控制器或帐户和谷歌)时,它表示这是呈现页面的正确方式(与孩子一样)。但正如您所看到的,孩子们(网站的其余部分)没有被渲染。

我错过了什么?为什么这不起作用?

1 个答案:

答案 0 :(得分:1)

好吧,我已经明白了。我可以删除我的问题,但mayby将来会帮助其他人,所以我正在回答它......

我的模板文件如下所示:

<div class="box">
    <div class="box-heading">Uitschrijven</div>
    <div class="box-content">
        <div id="notification">
            <div class="success" style="">
                U bent succesvol uitgeschreven.
                <img src="catalog/view/theme/metroshop/image/close.png" alt="" class="close">
            </div>
        </div>
    </div>
</div>

这只是内容。但是你还需要回显页眉,页脚和所有那些东西。所以你必须做像thisedi这样的事情:

<?php echo $header; ?>
<?php echo $column_left; ?>
<?php echo $column_right; ?>

<div id="content">
    <?php echo $content_top; ?>
    <h1 style="display: none;">
        <?php echo $heading_title; ?>
    </h1>
    <div class="box">
    <div class="box-heading">Uitschrijven</div>
    <div class="box-content">
        <div id="notification">
            <div class="success" style="">
                U bent succesvol uitgeschreven.
                <img src="catalog/view/theme/metroshop/image/close.png" alt="" class="close">
            </div>
        </div>
    </div>
</div>
    <?php echo $content_bottom; ?>
</div>

<?php echo $footer; ?>

现在工作正常。希望这对未来的人有所帮助。

相关问题