0

ここでは、ファイル 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();
              }

これはなぜでしょうか?新しいモジュールを追加できる Opencart フレームワークを使用します。作成されたモジュールは、controller/common/column_left.php にあります。

追記3時間後: これはOpencart Developmentの仕組みによるものだと思います。この問題は、OpenCart のレイアウト構造とは異なるページで発生します。Opencartのフロントページのレイアウトはそのようなものです

product/category = ディレクトリ controller/product の category.php ファイル。

私はここに、この種のレイアウトを持っています:

line/page/path = ファイル controller/line/page.php では、このメソッドは「path」と呼ばれます。

OpenCart の構造に関するより詳細な情報の 1 つに問題がありますか? そして、どの編集が原因で問題が無視された場合はどうなりますか? OpenCart のオリジナル コードは、何を変更する必要があるかがわかっている場合、ブロックを使用して vqMod ボードを簡単に変更できます。

4

1 に答える 1

0

私は質問を理解していませんが、あなたのコードを見ると、おそらくこれを達成したいと思うでしょう:

    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());

1 つ目if-elseは、カスタム テンプレートが存在する場合はチェックするか、そうでない場合はデフォルトのテンプレートをロードします。$this->children一部はサブテンプレートを有効にしています。テンプレートにデータを入力し、出力をレンダリングするのは最後の行です。OpenCart で何か新しいものを開発している場合は、既存のファイルを調べて、物事がどのように機能するかを調べるだけでなく、同じコーディング標準に従うことを常にお勧めします

于 2014-03-10T12:03:01.493 に答える