Welcome Guest, Not a member yet? Register   Sign In
Problem with Controller

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


class Edit extends Controller {

function index() {
$data['PageHeader'] = "Delete User";

function adduser() {
$data['PageHeader'] = "Add User";

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...

[eluser]Code Arachn!d[/eluser]
Where is the code that you're using to call the css from?

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.

[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.

Thanks a lot. Everything is working fine now, it seemed to be the path issue.

Theme © iAndrew 2016 - Forum software by © MyBB