Codeigniter METHOD ??? -error ? |
[eluser]sarah fox[/eluser]
Hi, Looking at :- http://ellislab.com/codeigniter/user-guide/ - I see controllers, models, views. helpers etc.. But nothing about METHODS . I've done a debug of my scripts & THINK I found a problem as to why CI doesn't work on my WIN XP box. C:\usr\local\lib\codeigniter\current\system\codeigniter\CodeIgniter.php Code: echo "if ( ! class_exists($class)<BR> Here is my output :- Code: if ( ! class_exists(home) It seems as if STRNCMP is the cause - as my 'method' doesn't contain an underline character - It displays the 404 screen. is my logic correct ? How do I find / Fix my method ? Ps, my root / main controller is /controllers/home.php (is correct)
[eluser]sarah fox[/eluser]
its not my Method It seems to e an error with my in_array command. Code :- Code: $a= strncmp(".$method.", '_', 1); Output :- Code: STRCOMPARE1 - -1 So, as in_array isn't producing any results - it activates the 404 page ? is this right / Correct ? Can someone advise how to fix it, & what that line actually means (in emglish)... Ps, using my friends login, incorrectly....
[eluser]WanWizard[/eluser]
in_array returns a boolean, which doesn't display with echo. try Code: echo "STRCOMPARE3 - ",($a ? "TRUE" : "FALSE"),"<BR>\n";
[eluser]sarah fox[/eluser]
Code: $a= strncmp(".$method.", '_', 1); STRCOMPARE32 = FALSE EDIT :- so, something in the 'in_array' command - Produces 'false' - which results in the 404 error. Are there any steps I can take - How do I check what should be / Is in this array... - it seems to combine 3 functions (None of which I am familiar with)...
[eluser]WanWizard[/eluser]
Show us that home controller. It's very unlikely that this is a CI issue...
[eluser]sarah fox[/eluser]
Ive removed comment lines starting with // Quote:<?php (Ive renamed the page from welcome/root/home etc - But all file-names are correct.. ) EDIT:- /controllers/home.php (correct / new filename)
[eluser]WanWizard[/eluser]
Do you have error reporting enabled, and display errors set to 'on' in php.ini? If so, you would have seen errors in your log files. The issue here is that the class doesn't load, because 'goto' is a reserved word, that causes a parse error.
[eluser]techgnome[/eluser]
I'm still fairly new to CI, but not programming... where is your $this->smarty_parser loaded? And I'm not sure what you mean about there being nothing about methods... the underscore is for "private" methods... meaning that they can't be accessed via the URL. Example: currently, with the controller above, the following url will work: index.php/home/about .... but if you were to change it to function _about .... then index.php/home/_about would not work. How ever, from within the controller $this->_about would work. Good call on that Wan - I didn't even see that. -tg
[eluser]sarah fox[/eluser]
[quote author="WanWizard" date="1286478163"]Do you have error reporting enabled, and display errors set to 'on' in php.ini? If so, you would have seen errors in your log files. [/quote] what errors in logs ? php.ini error_reporting = E_ALL & E_NOTICE display_errors = On error_log = 'c:\phpnew\logs\error.log' (I also had error_log = /phpnew/logs/error.log ) - No logs & no php errors - Directory does exist... PS - its the "Codeigniter" 404 file being displayed - Not a incorrect web-page (browser 404 page)... - so PHP is being run - & if I put phpinfo(); I do get results... Quote:The issue here is that the class doesn't load, because 'goto' is a reserved word, that causes a parse error. I'll remember that - for future, but thats still not the issue... I saved my home.php script into a new name, & adjusted the controllers/home.php script as so :- (taking out a lot).. Took out a LOT of functions - Bare basics... Quote:<?php Still no go... I'll check the $this->smarty_parser thing - However - Even if the templates don't get parsed as "smarty" - They'll be loaded / parsed as "something" (even if incorrect HTML code is shown...)
[eluser]WanWizard[/eluser]
I've copied your home controller into a fresh CI 1.7.2 install here, and get the parse error. You get the CI 404 error because 'get_class_methods('Controller')' doesn't return data, since the class didn't load. If I change 'goto' to 'x', the home controller loads without problems. If I copy the stripped home controller code in as per your post, it loads without problems (I get the "VIEWING ROOT FILE" text, and the can't find the model error). Just checking, this controller is in /system/application/controllers/home.php ? |
Welcome Guest, Not a member yet? Register Sign In |