• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Template was duplicated when using modules::run()

#1
[eluser]kakallatt[/eluser]
I build a CMS based on Codeigniter but I have a problems when I use Modular Extensions - HMVC


I have 2 controllers:

-Controller modules/blog/page:
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Page extends Frontend_Controller {

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

    public function index() {
        $this->_data['title'] = 'Homepage | ' . config_item('site_name');

        // Parser data
        $this->template->parse_view('content', config_item('template') . '/home', $this->_data);

        // Render template
        $this->template->render();
    }

    public function _getPages() {
        $this->load->model('blog/page_m');
        $pages = $this->page_m->get();

        return count($pages) ? $pages : array();
    }
}

-Controller modules/blog/home:
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Home extends Frontend_Controller {

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

    public function index() {
        $this->_data['title'] = 'Homepage | ' . config_item('site_name');

        // Parser data
        $this->template->write_view('content', config_item('template') . '/home', $this->_data);

        // Render template
        $this->template->render();
    }
}

In my views, I have:
Code:
<?php $pages = modules::run('blog/page/_getPages'); ?>
<?php foreach ($pages as $page) : ?>
          <li><a href="&lt;?php echo $page-&gt;slug; ?&gt;">&lt;?php echo $page->title; ?&gt;</a></li>
&lt;?php endforeach; ?&gt;

When I run: http://mysite.com/cms/blog/page. It's OK.
But I run: http://mysite.com/cms/blog/home. Template was duplicated (has 2 headers and 2 footers).

Please help me, thank you very much!
P/s: I use Template Library for CodeIgniter for my project


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.