php - Ajax content area with CodeIgniter? -


have started re-develop application codeigniter , trying implement template system.

i facing issue can't yet see way around

basically, @ minute within controller example of doing is:

    /*      * load view header      */     $this->load->view('header_view');      /*      * load view navigation      */     $this->load->view('navigation_view');      /*      * load view content      */     $this->load->view('content_view');      /*      * load view footer      */     $this->load->view('footer_view'); 

however problem facing content area has pages dynamically loaded in it.

so navigation area links don't open href url load page data in content div via ajax.

i need able go controllers directly via url such 'http://www.website.co.uk/controller/method_name/parameters' @ minute fine.

the navigation load link in content area includes header/navigation/footer end nested layouts in content area...

the simple way around 'well don't include header/navigation/footer views in every page' can't directly go url such above, work when loaded in content area need have header, navigation , footer.

the solution ideally need header/navigation/footer loaded around controller if go controller/method via url don't have load header/navigation/footer in controller automatically loaded around it.

any ideas appreciated, thanks

why not extend ci controller my_controller, controllers extend my_controller. in my_controller have function like:

public function loadview($file, $data=array()){     $this->load->view('header', $data);     $this->load->view($file, $data);     $this->load->view('footer', $data); } 

then, controllers actions, call :

public function index(){     // code code code     $this->loadview('welcome', array('message'=>'hello!'));  } 

i think point.


Comments

Popular posts from this blog

node.js - Bad Request - node js ajax post -

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -