CodeIgniter Forums
Controller Example - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Best Practices (https://forum.codeigniter.com/forumdisplay.php?fid=12)
+--- Thread: Controller Example (/showthread.php?tid=15)



Controller Example - Tux - 10-22-2014

Its always good idea to use "BASEPATH" to see if file is been loaded directly. Also, comment "}" class/functoin endings. This is especially useful if you have maby lines of code. Use "EOF" (End-Of-File) with file path at the end of your file, to endicate that the file has ended.

Source Code:
Code:
<?php defined('BASEPATH') OR exit('Access Denied');

class Welcome extends CI_Controller {

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

} #class

#EOF: ./application/controllers/Welcome.php



RE: Controller Example - Joostvanveen - 12-14-2014

Or you can scroll down and see that the file has ended Wink