Parse Error Syntax Error Unexpected T_public Codeigniter
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads syntax error unexpected 'public' (t_public) laravel with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack
Parse Error: Syntax Error, Unexpected 'public' (t_public)
Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign message: syntax error, unexpected 'public' (t_public) up PHP Parse error: syntax error, unexpected T_PUBLIC [closed] up vote 9 down vote favorite 3 I am getting this error in this PHP code on line 3, what could be wrong? This code has been taken from php manual user parse error: syntax error, unexpected 'protected' (t_protected) notes by frank at interactinet dot com myMethod()) { // $val might be 1 instead of the expected 'test' } if( ($val = $this->myMethod()) ) { // now $val should be 'test' } // or to check for false if( !($val = $this->myMethod()) ) { // this will not run since $val = 'test' and equates to true } // this is an easy way to assign
Parse Error Syntax Error Unexpected 'public' (t_public) In Wordpress
default value only if a value is not returned: if( !($val = $this->myOtherMethod()) ) { $val = 'default' } ?> php share|improve this question edited Jul 31 '15 at 20:22 ceejayoz 116k27179260 asked Nov 12 '12 at 9:43 Ashish Yadav 71115 closed as too localized by deceze, GBD, Anax, mario, ronalchn Nov 12 '12 at 10:03 This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question. 1 Looks like this is supposed to be part of a class definition. This won't run as is. –deceze Nov 12 '12 at 9:44 in addition, the code is showcasing bad programming, something you should not do. Why would you want to use the code? –eis Nov 12 '12 at 9:49 add a comment| 2 Answers 2 active oldest votes up vote 23 down vote accepted the public keyword is used only in function/variable declarations from within a class. Since you're not using a class you need to remove it from your code. share|improve this answer answered Nov 12 '12 at 9:44 Omar Jackman 10.6k23157 what's the difference between a public function in a class and a fun
error: syntax error, unexpected T_PUBLIC in /home/main.php on line 209 Thread [symfony\component\debug\exception\fatalerrorexception] syntax error, unexpected 'public' (t_public) Closed 0 Vote(s) - 0 Average 1 2 3 syntax error unexpected 'public' laravel 4 5 Thread Modes Parse error: syntax error, unexpected T_PUBLIC in /home/main.php on
Parse Error Syntax Error Unexpected 'public' (t_public) Opencart
line 209 El Forum Unregistered #1 01-12-2012, 06:25 AM [eluser]Unknown[/eluser] could anyone help me im trying to get this controller to http://stackoverflow.com/questions/13341378/php-parse-error-syntax-error-unexpected-t-public work and i keep getting this error. _______ Parse error: syntax error, unexpected T_PUBLIC in /home/main.php on line 209 _ thanks in advance load->library http://forum.codeigniter.com/thread-48333.html (array('form_validation', 'session')); $this->load->helper(array('url', 'form')); $this->load->model('account_model'); $this->_salt = '123456789987654321'; } //This is the index function for logging into the dashboard function index () { if ($this->account_model->logged_in() ===TRUE) { $this->dashboard(TRUE); } else { $this->load->view('account/details'); } } //This is the dashboard area. function dashboard($condition = FALSE) { if ($condition ===TRUE OR $this->account_model->logged_in() ===TRUE) { $this->load->view('account/dashboard'); } else { $this->load->view('account/details'); } } //This is the code for validating the login. function login() { $this->form_validation-> set_rules('username', 'Username', 'xss_clean|required|callback_username_check'); $this->form_validation-> set_rules ('password', 'Password', 'xss_clean|required|min_length[4]|max_length[12]| sha1|callback_password_check'); $this->_username = $this->input->post('username'); $this->_password = sha1($this->_salt . $this->input->post('password')); { if ($this->form_validation->run() ==FALSE) { $this->load->view('account/login'); } else { $this->account_model->login(); $data ['message'] = "You are logged in" . anchor('account/dashboard', 'Dashboard'); $this->load->view('account/success', $data); } } //This is for new users to register account. function register() { $this->form_validation-> set_rules('username', 'Username', 'xss_clean|required'); $this->form_validation-> set_rules('email', 'Email Address', 'xss_clean|required|valid_email|callback_email_exi
PHP Applications Javascript Disabled Detected You currently have javascript disabled. Several https://forums.phpfreaks.com/topic/268707-codeigniter-public-t-error/ functions may not work. Please re-enable javascript to access full functionality. Codeigniter - Public_T Error Started by stijn0713, Sep 23 2012 09:05 PM Please https://github.com/Gudeg/rtu-power-monitoring/blob/master/Backend/App/phperror_log.txt log in to reply 2 replies to this topic #1 stijn0713 stijn0713 Advanced Member Members 231 posts Posted 23 September 2012 - 09:05 PM syntax error Hello, i'm following the codeIgniter tutorial on 'news section' which basically retrieves news items records from database and shows them on a page but according to the MVC principle.Therefore, i just copy paste this code in the news controller: load->model('news_model'); } public function index() { $data['news'] = $this->news_model->get_news(); } public function view($slug) { $data['news'] = $this->news_model->get_news($slug); } } public function index() { $data['news'] = $this->news_model->get_news(); $data['title'] = 'News archive'; $this->load->view('templates/header', $data); $this->load->view('news/index', $data); $this->load->view('templates/footer'); } public function view($slug) { $data['news_item'] = $this->news_model->get_news($slug); if (empty($data['news_item'])) { show_404(); } $data['title'] = $data['news_item']['title']; $this->load->view('templates/header', $data); $this->load->view('news/view', $data); $this->load->view('templates/footer'); } But i get the following error then: Parse error: syntax error, unexpected T_PUBLIC in C:\wamp\application\controllers\news.php on line 21I haven't worked much with OOP but it seems no problem to declare those index and view functions public, right? else the tutorial must be wrong, which i rarely doubt. So what is the problem then? Back to top #2 Jessica Jessica This is not my name. Staff Alumni 8,982 posts LocationDallas, TX Age:26 Posted 23 September 2012 - 09:08 PM You have too many } at one point.
Sign in Pricing Blog Support Search GitHub This repository Watch 1 Star 1 Fork 0 Gudeg/rtu-power-monitoring Code Issues 9 Pull requests 0 Projects 0 Pulse Graphs Permalink Branch: master Switch branches/tags Branches Tags bugfix development master Nothing to show Nothing to show Find file Copy path rtu-power-monitoring/Backend/App/phperror_log.txt Fetching contributors… Cannot retrieve contributors at this time Raw Blame History 75 lines (74 sloc) 14.7 KB [29-Mar-2012 06:25:20 UTC] PHP Parse error: syntax error, unexpected '(', expecting ',' or ';' in /Users/TheFruit/Project/rtu-power-monitoring-prototype/Backend/CodeIgniter/application/controllers/test.php on line 4 [29-Mar-2012 06:25:39 UTC] PHP Parse error: syntax error, unexpected '(', expecting ',' or ';' in /Users/TheFruit/Project/rtu-power-monitoring-prototype/Backend/CodeIgniter/application/controllers/test.php on line 4 [29-Mar-2012 06:25:42 UTC] PHP Parse error: syntax error, unexpected '(', expecting ',' or ';' in /Users/TheFruit/Project/rtu-power-monitoring-prototype/Backend/CodeIgniter/application/controllers/test.php on line 4 [29-Mar-2012 06:26:21 UTC] PHP Parse error: syntax error, unexpected '(', expecting ',' or ';' in /Users/TheFruit/Project/rtu-power-monitoring-prototype/Backend/CodeIgniter/application/controllers/test.php on line 4 [29-Mar-2012 06:26:51 UTC] PHP Fatal error: Call to undefined method Test::set_content_type() in /Users/TheFruit/Project/rtu-power-monitoring-prototype/Backend/CodeIgniter/application/controllers/test.php on line 12 [29-Mar-2012 07:01:58 UTC] PHP Parse error: syntax error, unexpected T_VARIABLE in /Users/TheFruit/Project/rtu-power-monitoring-prototype/Backend/CodeIgniter/application/controllers/test.php on line 5 [29-Mar-2012 07:02:06 UTC] PHP Parse error: syntax error, unexpected T_VARIABLE in /Users/TheFruit/Project/rtu-power-monitoring-prototype/Backend/CodeIgniter/application/controllers/test.php on line 5 [29-Mar-2012 07:02:09 UTC] PHP Parse error: syntax error, unexpected T_VARIABLE in /Users/TheFruit/Project/rtu-power-monitoring-pr