0

Here parts data for lost in file system/engine/controller.php.

    if (file_exists(DIR_TEMPLATE . $this->template)) {
        extract($this->data);
          /* Here found header.tpl, media.tpl(my module), 
           column_left.tpl(this show my module), column_right.tpl,
           language.tpl,  footer.tpl */
        ob_start();

           /* Here found header.tpl, language.tpl, footer.tpl */
        require(DIR_TEMPLATE . $this->template);

        $this->output = ob_get_contents();
        ob_end_clean();
              }

Why might this be? I use a Opencart framework, which you can add new modules. Made module can be found in the controller/common/column_left.php

Appendix 3 hours later: I guess that this is due to the structure of Opencart Development. I imported across this problem is raised in a page that is different from OpenCart layout structure. Opencart front-page layout is of such

product/category = category.php file in the directory controller/product.

I have here, this kind of layout:

line/page/path = in file controller/line/page.php, this method called "path".

Is one of the more detailed information about the structure of OpenCart is a problem with that? And if because of what editing brings the problem is ignored? OpenCart original code is easy to modify vqMod board with the block when I know what should be changed.

  • 2
    lost **HOW**? ob_start() doesn't "lose" data - it captures any output that occurs. If you're losing data, then it's operator error, not a php error. – Marc B Mar 07 '14 at 17:31

1 Answers1

0

I do not understand the question but looking at your code you probably want to achieve this:

    if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/account/account.tpl')) {
        $this->template = $this->config->get('config_template') . '/template/account/account.tpl';
    } else {
        $this->template = 'default/template/account/account.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());

The first if-else is checking for custom template if present or loads the default one otherwise. $this->children part is enabling sub-templates. Last line is doing the rest - filling the template with data and rendering the output. If you are developing something new in OpenCart it is always best to look into files already there not only to find out how things work but also to follow the same coding standards.

shadyyx
  • 15,825
  • 6
  • 60
  • 95