• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Message: Undefined variable: css

#21
[eluser]jzmwebdevelopement[/eluser]
[quote author="Aken" date="1328653646"]It has nothing to do with your route. What URL are you viewing that is giving you the error?

[quote author="Aken" date="1328652789"]If your admin login page is where you are receiving the undefined variable error, it's because you are loading the view without passing any data to it. When you load a view, it does not inherit anything from a specific controller (like one with the same name). So your admin/assets/header controller is just sitting there doing nothing.[/quote][/quote]

http://jzm.co.nz/clients/farm/index.php/admin/

#22
[eluser]InsiteFX[/eluser]
I think he needs to move his admin view stuff to the views folder. CI Dev 3.0 allows you to set the view folder path. In his case I think it is looking for the view in the ./application/views folder but he has it in his controller folder.

views
-- admin
---- header.php

#23
[eluser]jzmwebdevelopement[/eluser]
[quote author="InsiteFX" date="1328653904"]I think he needs to move his admin view stuff to the views folder. CI Dev 3.0 allows you to set the view folder path. In his case I think it is looking for the view in the ./application/views folder but he has it in his controller folder.

views
-- admin
---- header.php
[/quote]

I do not understand this post due to I do have the above and I am looking in the admin/ folder

#24
[eluser]CroNiX[/eluser]
$route['admin'] = "admin/login";

You are trying to access this url: http://jzm.co.nz/clients/farm/index.php/admin/
Which would load the login controller, defined by your route, from the admin directory, which you have.

However, right THERE in login.php you are loading your header view and not passing your variables. Your /admin/assets/header.php controller isn't even being touched (now I know why you weren't getting a controller not found error), which is where you ARE setting your variable.


#25
[eluser]InsiteFX[/eluser]
You need to move your header controller up into the admin folder! CI only allowws one folder deep on the controllers folder...

controllers
-- admin
---- header.php
------ assets <-- this will not be seen by ci it is 2 folders deep!

Aken explained this to you in his post!

#26
[eluser]CroNiX[/eluser]
Just delete /controllers/admin/assets directory. Delete /controllers/admin/assets/header.php (not needed anyway)

In /controllers/admin/login.php, change it to this:
Code:
&lt;?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Login extends CI_Controller {


  public function index()
  {
    $data['text'] = "TEXT";

    $this->load->view('admin/assets/header', $data);
    $this->load->view('admin/login.php');
  }
}

Now, go to your url: http://jzm.co.nz/clients/farm/index.php/admin/

#27
[eluser]jzmwebdevelopement[/eluser]
[quote author="CroNiX" date="1328654569"]$route['admin'] = "admin/login";

You are trying to access this url: http://jzm.co.nz/clients/farm/index.php/admin/
Which would load the login controller, defined by your route, from the admin directory, which you have.

However, right THERE in login.php you are loading your header view and not passing your variables. Your /admin/assets/header.php controller isn't even being touched (now I know why you weren't getting a controller not found error), which is where you ARE setting your variable.

[/quote]

Could you example this?

My understanding of my code is that I am loading the header controller /header view and then loading the header view into the login controller

#28
[eluser]CroNiX[/eluser]
But, you aren't loading your header controller...at all. You are loading the login controller (look at the route). See above your last post and try that.

#29
[eluser]jzmwebdevelopement[/eluser]
[quote author="CroNiX" date="1328654963"]Just delete /controllers/admin/assets directory. Delete /controllers/admin/assets/header.php (not needed anyway)

In /controllers/admin/login.php, change it to this:
Code:
&lt;?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Login extends CI_Controller {


  public function index()
  {
    $data['text'] = "TEXT";

    $this->load->view('admin/assets/header', $data);
    $this->load->view('admin/login.php');
  }
}

Now, go to your url: http://jzm.co.nz/clients/farm/index.php/admin/[/quote]

Thanks,

working now

#30
[eluser]Aken[/eluser]
$this->load->view() loads ONLY from your views folder. It has nothing to do with calling controllers. You should read through the User Guide from the beginning again to get a better understanding of how CodeIgniter works.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.