php - Whats the best way to manage divs in a controller in CodeIgniter? -


it's becoming increasingly annoying manage /divs in codeigniter.

there seems a lot of times want load multiple views under more encompassing div.

i forced either include opening div in first view, , closing div in last view, or, i've tried creating view solely opening , closing divs easier keep track of.

function index($page = '1-home') {         /*if (!$this->tank_auth->is_logged_in()) {                 redirect('/auth/login/');         } else { */         $this->blurb_model->session_load();         $data['user_id'] = $this->tank_auth->get_user_id();         $data['username'] = $this->tank_auth->get_username();         $data['title'] = ucfirst($page); // capitalize first letter         $data['title'] = $this->page_model->make_title($data['title']);         $data['page'] = $page;         //top of page         $this->load->view('templates/head', $data);         /* div wrapper */ $this->load->view('templates/wrapper-start', $data);         $this->load->view('templates/nav', $data);         $this->load->view('templates/logo');         $this->load->view('leftbar/create', $data);         $this->load->view('leftbar/category', $data);         $this->load->view('leftbar/addfilter', $data);         $this->load->view('page/board', $data);         /* div wrapper */ $this->load->view('templates/wrapper-end', $data);         $this->load->view('templates/footer', $data);  } 

is there i'm missing? or easier way this?

how making general template following sections , using css style it:

  1. head
  2. navigation
  3. left/rightcolumn
  4. maincontent
  5. footer

    <div id="innerwrapper">     <div id="header">         <div id="logo"><!-- logo html -></div>         <div id="navigation"><?php echo $navigation; // or navigation html , logic in here ?></div>     </div>     <div id="mainbody">         <div id="leftmenu"><?php echo $leftmenu; ?></div>         <div id="maincontent"><?php echo $content; ?></div>     </div>     <div id="footer">         <div id="column1"><!-- html -></div>         <div id="column2"><!-- html -></div>     </div> </div> 

you can assign $leftmenu , $content (and other variable in template) following:

// assigns returned html $content variable in maintemplate $data['content'] = $this->load->view('somtetemplate, null, true);    $this->load->view('innerpage', $data);  // main template 

does make sense? it'll make better organisation imo.


Comments

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -