Welcome Guest, Not a member yet? Register   Sign In
parent construct
#1

How to fix the error?

Parse error: syntax error, unexpected 'parent' (T_STRING), expecting function (T_FUNCTION) in C:\Program Files (x86)\EasyPHP-Devserver-16.1\eds-www\CompanyProfileCI\application\controllers\Cpages.php on line 22
A PHP Error was encountered
Severity: Parsing Error
Message: syntax error, unexpected 'parent' (T_STRING), expecting function (T_FUNCTION)
Filename: controllers/Cpages.php
Line Number: 22
Backtrace:


Line 22:    parent::__construct();


controllers/cpages.php


PHP Code:
parent::__construct();
    {    
        
$this->load->helper('url'); //Just for the examples, this is not required thought for the library
    
}    

    
    public function 
index()
    {        
        
$this->load->view('index');
    } 



views/index.php


PHP Code:
<html lang="en">
    <
head>
        <
title>Gionda CMS</title>
        <
meta charset="UTF-8" />
 
       <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <
link rel="stylesheet/less" type="text/css" href="<?php echo base_url(); ?>assets/themes/less/bootstrap.less">
        <
script src="<?php echo base_url(); ?>assets/themes/js/less/less.js" type="text/javascript"></script>
        <
link rel="stylesheet" href="<?php echo base_url(); ?>assets/themes/style/fullcalendar.css" />    

        <
link rel="stylesheet" href="<?php echo base_url(); ?>assets/themes/style/delta.main.css" />
        <
link rel="stylesheet" href="<?php echo base_url(); ?>assets/themes/style/delta.grey.css"/>
        
        <
link rel="stylesheet" href="<?php echo base_url(); ?>assets/themes/style/add.css"/>
        
    </
head


How to fix the error above?
" If I looks more intelligence please increase my reputation."
Reply
#2

(05-16-2016, 08:14 AM)davy_yg Wrote: How to fix the error?

Parse error: syntax error, unexpected 'parent' (T_STRING), expecting function (T_FUNCTION) in C:\Program Files (x86)\EasyPHP-Devserver-16.1\eds-www\CompanyProfileCI\application\controllers\Cpages.php on line 22
A PHP Error was encountered
Severity: Parsing Error
Message: syntax error, unexpected 'parent' (T_STRING), expecting function (T_FUNCTION)
Filename: controllers/Cpages.php
Line Number: 22
Backtrace:


Line 22:    parent::__construct();


controllers/cpages.php


PHP Code:
parent::__construct();
 { 
 
$this->load->helper('url'); //Just for the examples, this is not required thought for the library
 


 
 public function 
index()
 { 
 
$this->load->view('index');
 } 



views/index.php


PHP Code:
<html lang="en">
 <
head>
 <
title>Gionda CMS</title>
 <
meta charset="UTF-8" />
 
       <meta name="viewport" content="width=device-width, initial-scale=1.0" />
 <
link rel="stylesheet/less" type="text/css" href="<?php echo base_url(); ?>assets/themes/less/bootstrap.less">
 <
script src="<?php echo base_url(); ?>assets/themes/js/less/less.js" type="text/javascript"></script>
 <
link rel="stylesheet" href="<?php echo base_url(); ?>assets/themes/style/fullcalendar.css" /> 

 <
link rel="stylesheet" href="<?php echo base_url(); ?>assets/themes/style/delta.main.css" />
 <
link rel="stylesheet" href="<?php echo base_url(); ?>assets/themes/style/delta.grey.css"/>
 
 <
link rel="stylesheet" href="<?php echo base_url(); ?>assets/themes/style/add.css"/>
 
 </
head


How to fix the error above?
parent::__construct() no semicolon
Keep calm.
Reply
#3

Dude, seriously ... this is syntax, entry level. You need to know a lot more than that before trying to work with a framework.
All of your questions here are like this, which irritates people, and you're ignoring all criticism.

To put it in simpler terms - you're trying to write a book, but you can't even spell yet.
Reply
#4

PHP Code:
function __construct()
{
    
parent::__construct();
    
$this->load->helper('url'); //Just for the examples, this is not required thought for the library


Now go here and learn PHP before trying to learn a PHP Framework!

PHP NET
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#5

PHP is not difficult. I'm also struggled at the beginning, learn from here http://www.w3schools.com/php/
Keep calm.
Reply
#6

Parse error: syntax error, unexpected 'parent' (T_STRING), expecting function (T_FUNCTION) in C:\Program Files (x86)\EasyPHP-Devserver-16.1\eds-www\CompanyProfileCI\application\controllers\Cpages.php on line 22
A PHP Error was encountered
Severity: Parsing Error
Message: syntax error, unexpected 'parent' (T_STRING), expecting function (T_FUNCTION)
Filename: controllers/Cpages.php
Line Number: 22
Backtrace:


I already erase the semi colons and still dealing with the same error:

http://127.0.0.1/upload/index.php/uploadfile/upload



PHP Code:
parent::__construct()
    {    
        $this
->load->helper('url'); //Just for the examples, this is not required thought for the library
    }     


CodeIgniter File Upload Demo

Select File to Upload
 
The upload path does not appear to be valid.



(I only know CI for 5 months)
" If I looks more intelligence please increase my reputation."
Reply
#7

function __construct()
{
parent::__construct();
//load here
}
Keep calm.
Reply
#8

Look at InstiteFx example code more carefully, you are still not doing the class constructor correctly.
Reply
#9

(05-16-2016, 03:01 PM)arma7x Wrote: PHP is not difficult. I'm also struggled at the beginning, learn from here http://www.w3schools.com/php/

No! Not w3schools!

Try something like Codecademy:
https://www.codecademy.com/learn/php
Reply
#10

(05-16-2016, 05:19 PM)JayAdra Wrote:
(05-16-2016, 03:01 PM)arma7x Wrote: PHP is not difficult. I'm also struggled at the beginning, learn from here http://www.w3scm/phhools.cop/

No! Not w3schools!

Try something like Codecademy:
https://www.codecademy.com/learn/php

w3schools not cover for whole thing about php, but I’m prefer http://php.net/ for documentation and references.
Keep calm.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB