• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
receiving error when following the tuturial

#1
[eluser]Unknown[/eluser]
Hello, i'm new to codeIgniter.

I was following the tutorial on 'news section'. I get the following error for the code in the controller:

Parse error: syntax error, unexpected T_PUBLIC in C:\wamp\application\controllers\news.php on line 21

Quote:<?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');
}

#2
[eluser]TWP Marketing[/eluser]
You have duplicate index function names


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.