Welcome Guest, Not a member yet? Register   Sign In
Can not create Controller naming 'index'.
#1

[eluser]aerian[/eluser]
On creating a controller namely "index" the following error comes


Quote:Fatal error: Cannot re declare index::index() in C:\wamp\www\websitename\system\application\controllers\index.php on line 10


due to the presence of constructor with the same name.

is the "index" name for controller is prohibited.
#2

[eluser]Pascal Kriete[/eluser]
You can in theory do it under PHP 5, by using the __construct magic function. However under PHP 4 you cannot have two methods of the same name in one class. It will still work if you don't declare an index function, but calling it without a method will rerun the constructor. That makes it rather impractical which is why it is considered a reserved controller name.
#3

[eluser]aerian[/eluser]
thanks :-)




Theme © iAndrew 2016 - Forum software by © MyBB