Welcome Guest, Not a member yet? Register   Sign In
Page disapears after login - cache problem?
#1

[eluser]bena[/eluser]
Hi everyone,

I'm quite new to CI and it's been the answer to my prayers so far, but I've just come across a problem I've no idea how to fix because, as far as I'm aware, I'm doing no caching at all anywhere in the site.

The site is here - it's been working lovely so far up until I started to develop the admin side. What's happening is, everything is OK up until I login; after I enter the username and password I get redirected to the admin side, and the page shows just after I login. Then, if I refresh or leave the page, the whole site stops showing - it just shows a blank page! I know this suggests an error somewhere in my code, but I can't understand why it works and suddenly stops after reloading the page - the only conclusion I could think of is caching.

Anyway, I made three models: one for the template, form data and users. Here's a basic dir/file structure of the site:

Code:
+ application
  + controllers
    + admin
      - home.php
    - contact.php
    - home.php
    - login.php
  + models
    - form_data.php
    - template.php
    - user.php
  + views
    + admin
      + home
        - ctrl_panel.php
    + public
      + home
        - main.php
      + login
        - login.php
        - recover.php
Seemed pretty straight forward, all the models are autoloaded and everything is ready to rumble, so to load the homepage I use:

Code:
$this->template->loadView('public', 'home/main', $this->data);

The loadView() function loads the common header/footer files and the main display file by using param1 of loadView as the group (i.e. public); param2 as the file path within the group, and param3 as optional data array, so you basically end up with a new load->view() function to automatically load a few more files and to set a bit more default data.

Here's a few examples just to be a bit clearer:

Code:
$this->template->loadView('public', 'home/main');
/*
Outputs the contents of:
  views/public/common/header.php
  views/public/home/main.php
  views/public/common/footer.php
*/

$this->template->loadView('admin', 'home/ctrl_panel');
/*
Outputs the contents of:
  views/admin/common/header.php
  views/admin/home/ctrl_panel.php
  views/admin/common/footer.php
*/

If anyone could possibly shed some light on what might be happening or possibly tell me I'm doing it all wrong, I'd welcome the help!

Thanks,
Ben
#2

[eluser]jcavard[/eluser]
You should paste your controller code. try this
Code:
ERROR_REPORTING(E_ALL);
it will output any error
#3

[eluser]bena[/eluser]
Hi man thanks for the reply,

This is what I mean though, it's set to max error output and I still just end up with nothing. It works just fine up until I login, here's some of the code:

... and while pasting the code I found the problem ... oops I had a mistake in the user model:

Code:
$this->session('user_data');

instead of:

Code:
$this->session->userdata('user_data');

Never mind.. thanks for asking me to paste the code!

Regards,
Ben




Theme © iAndrew 2016 - Forum software by © MyBB