unexpected 'public' (T_PUBLIC) |
Hello,
controllers/Pages.php PHP Code: <?php How to fix this error line # 13? Parse error: syntax error, unexpected 'public' (T_PUBLIC) in C:\Program Files (x86)\EasyPHP-Devserver-16.1\eds-www\blog\application\controllers\Pages.php on line 13 A PHP Error was encountered Severity: Parsing Error Message: syntax error, unexpected 'public' (T_PUBLIC) Filename: controllers/Pages.php Line Number: 13 Backtrace: Line 12 - 13: if ( ! file_exists(APPPATH.'views/pages/'.$page.'.php')) { I do not know how to fix the error. Can anyone help?
" If I looks more intelligence please increase my reputation."
Might sound daft, by try removing the closing php tag.
(Might not help too - but I never include them.)
Remove the "public" keyword before the controller function. Surely that's what it means when it says: "unexpected 'public'".
Using public or private is a good idea though, and should not in itself cause an issue. Usually this happens when I forget the curly brace but he has it.
He also has removed the basepath check, which was probably him trying to fix another problem, I suspect he has got the whole file structure and CI implementation wrong in the first place. PHP Code: defined('BASEPATH') OR exit('No direct script access allowed'); Paul.
I think he needs to learn PHP before trying to learn CodeIgniter.
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
try removing that closing: ?>
its probably the problem. if its not, then post again and someone will try to help. what is not a problem - is you learning how to code. i salute you doing the right thing and working through the tutorial. i encourage your efforts. it is difficult and confusing at first, but it does get easier. and you will find that sometimes the issues that take the longest to solve - are just a few characters in length.
The provided code probably has not been pasted exactly. I think there is something between the class declaration and the first method that we can not see.
That would make sense, then an un-closed if statement, say, would cause the unexpected public declaration.
|
Welcome Guest, Not a member yet? Register Sign In |