Welcome Guest, Not a member yet? Register   Sign In
Content displayed in wrong order
#1

[eluser]Unknown[/eluser]
Newbie here... I suspect this may be an issue others have previously encountered but I haven't found it up this point so here I go...

I'm still at the start of my journey creating my portal, and at this point I'm just trying to output some content from my session array value. So far this is what I have:

models/auth_user.php:
Code:
class Auth_user extends CI_Model {
    function __construct() {
      parent::__construct();
    }

    function get_user() {
      if (isset($_SERVER["HTTP_IV_USER"])) {
        return $_SERVER["HTTP_IV_USER"];
      }
      else {
        return -1;
      }
    }

    function set_session($userid) {
      $this->session->set_userdata("userid", $userid);
      echo $this->session->userdata("userid");
    }
  }

I have an "echo" call in set_session() to make sure I'm actually executing that function.

views/header.php
Code:
<html>
  <head>
    <title>GTS Drawings Portal :: <?=$mode?></title>
  </head>
  <body>

    <table>
      <thead>
        <th>GTS Drawings Portal :: &lt;?=$mode?&gt;</th>
      </thead>
      <tr>
        <td>
        &lt;!-- end header --&gt;

views/footer.php
Code:
&lt;!-- start footer --&gt;
        </td>
      </tr>
    </table>

  &lt;/body&gt;
&lt;/html&gt;

controllers/main.php:
Code:
class Main extends CI_Controller{
    public function index() {
      $this->load->library('session');
      $this->load->model("Auth_user");

      $data["mode"] = "Main";
      $this->load->view('header',$data);

      $userid = $this->Auth_user->get_user();
      if (isset($userid)) {
        $this->Auth_user->set_session($userid);
      }
      $this->load->view('footer');
    }
  }

When the content is generated the echo I put in the method above is first to appear:
Code:
oprdnec&lt;html&gt;
  &lt;head&gt;
    &lt;title&gt;GTS Drawings Portal :: Main&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;

    <table>
      <thead>
        <th>GTS Drawings Portal :: Main</th>

      </thead>
      <tr>
        <td>
        &lt;!-- end header --&gt;
        &lt;!-- start footer --&gt;
        </td>
      </tr>
    </table>

  &lt;/body&gt;
&lt;/html&gt;
I'm trying to get it to appear between the two HTML comment lines.

Like I said I suspect this is something simple; I'd greatly appreciate any useful assistance.

- Joe


Messages In This Thread
Content displayed in wrong order - by El Forum - 02-08-2012, 03:18 PM
Content displayed in wrong order - by El Forum - 02-08-2012, 03:54 PM
Content displayed in wrong order - by El Forum - 02-08-2012, 04:14 PM
Content displayed in wrong order - by El Forum - 02-08-2012, 04:38 PM



Theme © iAndrew 2016 - Forum software by © MyBB