CodeIgniter Forums
Newbie Question about the official codeigniter.com tutorial. - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Newbie Question about the official codeigniter.com tutorial. (/showthread.php?tid=84797)



Newbie Question about the official codeigniter.com tutorial. - pecon - 11-10-2022

Hi All,

I have been following the Codeigniter tutorial for beginners and had no issues till I finished this page:
https://codeigniter.com/user_guide/tutorial/news_section.html

 where I got the following error. Can anyone tell me why this is happening and how to fix it please?:
“…

ParseError
syntax error, unexpected token "public", expecting end of file 

APPPATH/Models/NewsModel.php at line 12
 5 use CodeIgniter\Model;
 6 
 7 class NewsModel extends Model
 8 {
 9     protected $table = 'news';
10 }
11 
12     public function getNews($slug = false)
13     {
14         if ($slug === false) {
15             return $this->findAll();
16         }
17 
18         return $this->where(['slug' => $slug])->first();
19     }

…”