![]() |
Problem with Controller - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Problem with Controller (/showthread.php?tid=2751) |
Problem with Controller - El Forum - 08-22-2007 [eluser]phrozen3[/eluser] When I use the default index function when using a controller, the website comes up perfectly. But if I call a different function in the controller, the stylesheet doesn't come up. Example Code ------------------------------------------------------------------------ <?php class Edit extends Controller { function index() { $data['PageHeader'] = "Delete User"; $this->load->view("deluser",$data); } function adduser() { $data['PageHeader'] = "Add User"; $this->load->view("adduser",$data); } } ?> ------------------------------------------------------------------------ If I call the index page http://www.website.com/edit, it works but if I use http://www.website.com/edit/adduser, the page comes up but it doesn't recognize the stylesheet. I've also tried the _remap function and encountered the same problem. What could be the problem? Thanks in advance... Problem with Controller - El Forum - 08-22-2007 [eluser]Code Arachn!d[/eluser] Where is the code that you're using to call the css from? Problem with Controller - El Forum - 08-22-2007 [eluser]phrozen3[/eluser] It's in header.php in the includes folder. So at the top of the adduser.php in the views folder, I have include 'includes/header.php'; I just don't understand why it works for the main index function and not for the rest. Problem with Controller - El Forum - 08-22-2007 [eluser]Michael Wales[/eluser] I assume you have the same include statement at the top of deluser.php as well, right? If you look at the source when viewing /edit/adduser is the header portion of the page being echoed out (to include the link to the stylesheet)? May I ask why you chose this route for your header? Maybe go with one of the suggestions outlined in the FAQ. It just sounds like a relative URL not mapping correctly to me. Problem with Controller - El Forum - 08-22-2007 [eluser]phrozen3[/eluser] Thanks a lot. Everything is working fine now, it seemed to be the path issue. |