php - CI template - element is displayed in wrong place -


i having problems displaying views template. template looks this:

<?php $this->load->view('includes/header');  if($this->session->userdata('is_loggedin')!=1) //check if logged in  {     $this->load->view('includes/not_loggedin');  //includes when not logged in }  else //includes when logged in {      if(isset($content)) //check if content variable isnt empty      {          $this->load->view($content); //this content whic displayed in wrong pos      }     $this->load->view('includes/is_loggedin'); // }  $this->load->view('includes/footer'); ?> 

by wrong position, mean form being displayed in top lefthand corner outside of html structure. here copy inspect element window. notice div located; head tags empty; and, head information in body.

<html lang="en"> <head></head> //head tags empty <body> <div id="settings">...</div>  //this loaded div  <meta charset="utf-8"> <title>sludinājumu lapa</title> //head info outside tags <link href="/assets/css/style.css" type="text/css" rel="stylesheet"> <div id="wrapper">....</div>  //i need settings div inside wrapper div  </body> </html> 

without loading view, html structure fine. there no problems loading is_loggedin , not_logged views.

my header contains :

<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>sludinājumu lapa</title> <link rel="stylesheet" type="text/css" href="/assets/css/style.css"> </head> <body> <div id="wrapper"> 

and footer contains:

<foter> <p>developed kriss</p> </foter> </div> //end of "wrapper" div </body> </html> 

from controller passing data this:

    $data['content'] = $this->load->view('vchangeinfo');     $this->load->view('template', $data); 

any ideas why messed up?

two ways of doing this:

codeigniter views

load in advance (like you're doing) , pass other view

there third optional parameter lets change behavior of function returns data string rather sending browser. can useful if want process data in way. if set parameter true (boolean) return data. default behavior false, sends browser. remember assign variable if want data returned:

// "true" argument tells return content, rather display $data['content'] = $this->load->view('vchangeinfo', null, true); $this->load->view ('template', $data);  // view  if(isset($content)) //check if content variable isnt empty {     $this->load->view($content);     // or don't know wich 1 works.     // echo $content; } 

load view "from within" view:

<?php // controller $this->load->view('template');  <?php // views :  /application/views/template.php $this->view('vchangeinfo'); 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -