Welcome Guest, Not a member yet? Register   Sign In
[solved]Controller gets loaded twice and I do not know why
#4

[eluser]Jelmer[/eluser]
Actually this doesn't look at all like a .htaccess problem, that would cause the entire system to be loaded twice - not just the controller.

I think the problem is the name of the controller. "index" is a reserved name because it is also the name of the default function when a controller is loaded without a function set (see Reserved names in the User Guide).

What probably happens is that your index() function is loaded the first time as the class's constructor and then a second time as the default function. As the Router is loaded in the parent constructor this probably causes the Router to be loaded twice as well, though I'd need to see your code to be sure.

You need to rename your controller to something different from "index" and remove parent::Controller() from the index() function, that should only be in the constructor not the index function.


Messages In This Thread
[solved]Controller gets loaded twice and I do not know why - by El Forum - 09-06-2010, 05:40 AM



Theme © iAndrew 2016 - Forum software by © MyBB