Welcome Guest, Not a member yet? Register   Sign In
PHP error
#1

[eluser]davy_yg[/eluser]

controllers/page.php

Code:
class Page extends CI_Controller {

// declare property
protected $data = array();

public function __construct(){

  parent::__construct();

  ## load the url helper object
  $this->load->helper("url");
  
  
  ## define the property

  $this->$data['assets'] = array(
    'style' => base_url().'assets/css/style.css',
    'connection' => base_url().'assets/images/connection.jpg',
    'collaboration' => base_url().'assets/images/collaboration.jpg',
    'solution' => base_url().'assets/images/solution.jpg',
    'connectionUrl' => base_url().'index.php/connection/',
    'collaborationUrl' => base_url().'index.php/collaboration/',
    'solutionUrl' => base_url().'index.php/solution/'
  
    );



A PHP Error was encountered

Severity: Notice

Message: Undefined variable: data

Filename: controllers/page.php

Line Number: 19

Fatal error: Cannot access empty property in C:\xampp\htdocs\IndonusaCI\application\controllers\page.php on line 19


Line 19: $this->$data['assets'] = array(


what should I do?
#2

[eluser]CroNiX[/eluser]
$data shouldn't have a $, it's a class property, not a variable.

Code:
$this->data['assets'] = array(




Theme © iAndrew 2016 - Forum software by © MyBB