Codeigniter equivalent of include -


i working on codeigniter project requires me display different html in form depending on situation.

all want pass information view , have output on screen.

it important note use modified version of codeigniter doesn't require sort of $this->load->view in order create view. header , footer set automatically, using $this->load->view isn't going work.

i want finds file , allows pass view can output it. know can include, wondering if there simpler way.

sounds feature of not requiring load view going hinder you. not recommend practice. have infer if not pass view pulls default view can override this. can create my_controller method handle template , views , assume if not explicitly state view call view in dir same name class , file same name method in uri (http://ellislab.com/codeigniter/user-guide/general/routing.html). way if ever need explicitly call view or alter anything, override method or fill property:

if (count($this->loadviews)) {     foreach ($this->loadviews $view)         $this->load->view($view); }else {     $this->load->view($this->uri->segment(1, 'welcome') . '/' . $this->uri->segment(2, 'index')) } 

you can call views within views may still work can go default view being called modified version of ci , like

<? if isset($flag): ?>     $this->load->view('partial_view1'); <? else ?>     $this->load->view('partial_view2'); <? endif; ?> 

you can hooks take care of well. had 1 project views , templates controlled hooking in , ob_start views, scrubbing them, outputting data. http://ellislab.com/codeigniter/user-guide/general/hooks.html

i hope either of these solutions help. if need else let me knwo.


Comments