2

MY_Controller.php (アプリケーション/コア):

<?php 
class MY_Controller extends CI_Controller
{

    public $data = array();
    function __construct()
    {
        parent::__construct();
        $this->data['errors'] = array();
        $this->data['my_site_name'] = config_item('site_name');

    }
}

Frontend_Controller.php (アプリケーション/ライブラリ)

<?php 
class Frontend_Controller extends MY_Controller
{

    function __construct()
    {
        parent::__construct();

    }
}

pages.php (アプリケーション/コントローラー)

 class Pages extends Frontend_Controller {

        function __construct()
        {
            parent::__construct();

            $this->load->model('app_model');

        }

        public function index()
        {

            $this->view_data['main_content'] = 'frontpage';
            $this->load->view('template', $this->view_data);
            }       
  }

pages はルートのデフォルトルートとして設定されており、testmodule と呼ばれる HMVC モジュールを読み込もうとするとうまくhttp://localhost/testmodule動作します。

しかし、このモジュールをエコーし​​たい場合(インデックスメソッドには1行しか含まれていません

echo "Welcome from testmodule!";) お気に入り:

<div class="page">

    <?php $this->load->view('includes/block_left') ?>

    <div id="content">
        <div>
            <?php 
                echo modules::run('testmodule');
            ?>
            <?php  $this->load->view('articles_new'); ?>
        </div>
    </div><!-- /content -->

</div>

次のエラーが表示されます。

Fatal error: Cannot redeclare class CI in C:\wamp\www\application\third_party\MX\Base.php on line 57

編集:

変えようとしたら

class MY_Controller extends CI_Controller

class MY_Controller extends MX_Controller

このエラーが発生しました:

An Error Was Encountered

Unable to load the requested file:

何がうまくいかないのですか?;(

4

0 に答える 0