Welcome Guest, Not a member yet? Register   Sign In
Parse error: syntax error, unexpected 'function_construct' (T_STRING), expecting variable (T_VARIABLE) in C:wampwwwframe
#1

[eluser]Dario[/eluser]
Hi!

I just started using CodeIgniter and to get to know with the system i started writing the tutorial that comes with it. Was very entusiastic until i tried to view my news page Smile. the error i get is Parse error: syntax error, unexpected 'function_construct' (T_STRING), expecting variable (T_VARIABLE) in C:\wamp\www\framework\application\controllers\news.php on line 5.

This is the code
Code:
<?php

class News extends CI_Controller {

public function_construct()
{
  parent::_construct();
  $this->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');
}
}

Thank you!!


Messages In This Thread
Parse error: syntax error, unexpected 'function_construct' (T_STRING), expecting variable (T_VARIABLE) in C:wampwwwframe - by El Forum - 10-23-2012, 01:33 AM



Theme © iAndrew 2016 - Forum software by © MyBB