Extending from my own controller |
[eluser]Alface[/eluser]
[quote author="Phil Sturgeon" date="1273072843"][quote author="Alface" date="1273058408"]It show me this: Fatal error: Class 'Test' not found in C:\xampplite\htdocs\projetos\forsite\system\application\controllers\test2.php on line 3 PHP Version 5.2.8[/quote] Did you add the __autoload()? It's not found because you haven't told PHP how to find it.[/quote] I add, what could it be?
[eluser]Phil Sturgeon[/eluser]
[quote author="Alface" date="1273074100"]I add...[/quote] Ahh, well isn't that useful and descriptive. Using my powers of mental-remote PHP debugging I reckon... your rotary widgets are partially misaligned. Try re-polarizing them and point them west.
[eluser]Alface[/eluser]
[quote author="Phil Sturgeon" date="1273074216"][quote author="Alface" date="1273074100"]I add...[/quote] Ahh, well isn't that useful and descriptive. Using my powers of mental-remote PHP debugging I reckon... your rotary widgets are partially misaligned. Try re-polarizing them and point them west.[/quote] Sorry friend, I don't know what to say.. it is so simple... I add this code at the end of the file application/config/config.php Code: function __autoload($class){ And create the controller: Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); and this one too Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); I access the url http://localhost/index.php/test2 and shows this: Code: Fatal error: Class 'Test' not found in C:\xampplite\htdocs\projetos\forsite\system\application\controllers\test2.php on line 3 Is this wrong? o.o
[eluser]n0xie[/eluser]
Are you sure your __autoload is called? Please test this: Code: function __autoload($class){
[eluser]Alface[/eluser]
[quote author="n0xie" date="1273502891"]Are you sure your __autoload is called? Please test this: Code: function __autoload($class){ I don't think so.. but why? I recived it: Code: Fatal error: Class 'Test' not found in C:\xampplite\htdocs\projetos\forsite\system\application\controllers\test2.php on line 3
[eluser]ladooboy[/eluser]
Not sure if that helps, but I've did the following: Quote:class MY_Controller extends Controller{ // base controller where you put the MY_Controller class into the Libaries folder. In this way the MY_Controller get always loaded.
[eluser]Chandana Bandara[/eluser]
Thank you. You guys saved my day. Keep up the good work, and rock the world!! Cheers.
[eluser]Chandana Bandara[/eluser]
This worked in my localhost. But when I deployed it in Godaddy it gave me the old error that class not found :long: Any clue?? Thanks
[eluser]Chandana Bandara[/eluser]
[quote author="Chandana Bandara" date="1295751668"]This worked in my localhost. But when I deployed it in Godaddy it gave me the old error that class not found :long: Any clue?? Thanks[/quote] Found the problem, My localhost is Windows and Godaddy is Linux. I was missing the strtolower in the config function. Thanks. |
Welcome Guest, Not a member yet? Register Sign In |