CodeIgniter For ProjectLesson 104 : Controller & View
Weerayut Hongsa : Network Engineer / Software Developer
Major Kantana Broadcasting Co., Ltd
https://kusumotolab.com
Controller
Weerayut Hongsa : Network Engineer / Software Developer
Major Kantana Broadcasting Co., Ltd
https://kusumotolab.com
“The Controller serves as an intermediary between the Model, the
View, and any other resources needed to process the HTTP
request and generate a web page”
Caution : Security!
To Create files associated with CodeIgniter must add code to check
BASEPATH.
Weerayut Hongsa : Network Engineer / Software Developer
Major Kantana Broadcasting Co., Ltd
https://kusumotolab.com
Controller
• Controller file store in /application/controllers
• Controller Name matched Filename.
• First character in Controller Name is upper case only.
• You CodeIgniter Controller must always extends CI_Controller
class.
• You CodeIgniter Controller must always override method index()
and __construct
Weerayut Hongsa : Network Engineer / Software Developer
Major Kantana Broadcasting Co., Ltd
https://kusumotolab.com
Controller
Weerayut Hongsa : Network Engineer / Software Developer
Major Kantana Broadcasting Co., Ltd
https://kusumotolab.com
Controller
Weerayut Hongsa : Network Engineer / Software Developer
Major Kantana Broadcasting Co., Ltd
https://kusumotolab.com
Controller
Weerayut Hongsa : Network Engineer / Software Developer
Major Kantana Broadcasting Co., Ltd
https://kusumotolab.com
Controller
Weerayut Hongsa : Network Engineer / Software Developer
Major Kantana Broadcasting Co., Ltd
https://kusumotolab.com
Controller
Weerayut Hongsa : Network Engineer / Software Developer
Major Kantana Broadcasting Co., Ltd
https://kusumotolab.com
Controller
Weerayut Hongsa : Network Engineer / Software Developer
Major Kantana Broadcasting Co., Ltd
https://kusumotolab.com
Controller
Weerayut Hongsa : Network Engineer / Software Developer
Major Kantana Broadcasting Co., Ltd
https://kusumotolab.com
Weerayut Hongsa : Network Engineer / Software Developer
Major Kantana Broadcasting Co., Ltd
https://kusumotolab.com
View
“The View is the information that is being presented to a user. A
View will normally be a web page, but in CodeIgniter, a view can
also be a page fragment like a header or footer. It can also be an
RSS page, or any other type of page”
Caution : Security!
To Create files associated with CodeIgniter must add code to check
BASEPATH.
Weerayut Hongsa : Network Engineer / Software Developer
Major Kantana Broadcasting Co., Ltd
https://kusumotolab.com
• View file store in /application/views
• View file none character case rule.
• View file can store in sub-folder /application/view/
template1 etc.
• View content store in filetype .php file.
View
Weerayut Hongsa : Network Engineer / Software Developer
Major Kantana Broadcasting Co., Ltd
https://kusumotolab.com
View
Weerayut Hongsa : Network Engineer / Software Developer
Major Kantana Broadcasting Co., Ltd
https://kusumotolab.com
You can use this code in Controller section to use view file
Map Controller to use View
Weerayut Hongsa : Network Engineer / Software Developer
Major Kantana Broadcasting Co., Ltd
https://kusumotolab.com
Example : Map TestController in index function to use textview.php view file.
Map Controller to use View
Weerayut Hongsa : Network Engineer / Software Developer
Major Kantana Broadcasting Co., Ltd
https://kusumotolab.com
You can send variable or data from Controller to View
Map Controller to use View
Weerayut Hongsa : Network Engineer / Software Developer
Major Kantana Broadcasting Co., Ltd
https://kusumotolab.com
Example : Map TestController in index function to use textview.php view file 

and send 2 variable name “fname” and “lname” from controller to view.
Map Controller to use View
Weerayut Hongsa : Network Engineer / Software Developer
Major Kantana Broadcasting Co., Ltd
https://kusumotolab.com
Forward to Workshop 003
Weerayut Hongsa : Network Engineer / Software Developer
Major Kantana Broadcasting Co., Ltd
https://kusumotolab.com

CodeIgniter For Project : Lesson 104 - Controller & View

  • 1.
    CodeIgniter For ProjectLesson104 : Controller & View Weerayut Hongsa : Network Engineer / Software Developer Major Kantana Broadcasting Co., Ltd https://kusumotolab.com
  • 2.
    Controller Weerayut Hongsa :Network Engineer / Software Developer Major Kantana Broadcasting Co., Ltd https://kusumotolab.com “The Controller serves as an intermediary between the Model, the View, and any other resources needed to process the HTTP request and generate a web page”
  • 3.
    Caution : Security! ToCreate files associated with CodeIgniter must add code to check BASEPATH. Weerayut Hongsa : Network Engineer / Software Developer Major Kantana Broadcasting Co., Ltd https://kusumotolab.com
  • 4.
    Controller • Controller filestore in /application/controllers • Controller Name matched Filename. • First character in Controller Name is upper case only. • You CodeIgniter Controller must always extends CI_Controller class. • You CodeIgniter Controller must always override method index() and __construct Weerayut Hongsa : Network Engineer / Software Developer Major Kantana Broadcasting Co., Ltd https://kusumotolab.com
  • 5.
    Controller Weerayut Hongsa :Network Engineer / Software Developer Major Kantana Broadcasting Co., Ltd https://kusumotolab.com
  • 6.
    Controller Weerayut Hongsa :Network Engineer / Software Developer Major Kantana Broadcasting Co., Ltd https://kusumotolab.com
  • 7.
    Controller Weerayut Hongsa :Network Engineer / Software Developer Major Kantana Broadcasting Co., Ltd https://kusumotolab.com
  • 8.
    Controller Weerayut Hongsa :Network Engineer / Software Developer Major Kantana Broadcasting Co., Ltd https://kusumotolab.com
  • 9.
    Controller Weerayut Hongsa :Network Engineer / Software Developer Major Kantana Broadcasting Co., Ltd https://kusumotolab.com
  • 10.
    Controller Weerayut Hongsa :Network Engineer / Software Developer Major Kantana Broadcasting Co., Ltd https://kusumotolab.com
  • 11.
    Controller Weerayut Hongsa :Network Engineer / Software Developer Major Kantana Broadcasting Co., Ltd https://kusumotolab.com
  • 12.
    Weerayut Hongsa :Network Engineer / Software Developer Major Kantana Broadcasting Co., Ltd https://kusumotolab.com View “The View is the information that is being presented to a user. A View will normally be a web page, but in CodeIgniter, a view can also be a page fragment like a header or footer. It can also be an RSS page, or any other type of page”
  • 13.
    Caution : Security! ToCreate files associated with CodeIgniter must add code to check BASEPATH. Weerayut Hongsa : Network Engineer / Software Developer Major Kantana Broadcasting Co., Ltd https://kusumotolab.com
  • 14.
    • View filestore in /application/views • View file none character case rule. • View file can store in sub-folder /application/view/ template1 etc. • View content store in filetype .php file. View Weerayut Hongsa : Network Engineer / Software Developer Major Kantana Broadcasting Co., Ltd https://kusumotolab.com
  • 15.
    View Weerayut Hongsa :Network Engineer / Software Developer Major Kantana Broadcasting Co., Ltd https://kusumotolab.com
  • 16.
    You can usethis code in Controller section to use view file Map Controller to use View Weerayut Hongsa : Network Engineer / Software Developer Major Kantana Broadcasting Co., Ltd https://kusumotolab.com
  • 17.
    Example : MapTestController in index function to use textview.php view file. Map Controller to use View Weerayut Hongsa : Network Engineer / Software Developer Major Kantana Broadcasting Co., Ltd https://kusumotolab.com
  • 18.
    You can sendvariable or data from Controller to View Map Controller to use View Weerayut Hongsa : Network Engineer / Software Developer Major Kantana Broadcasting Co., Ltd https://kusumotolab.com
  • 19.
    Example : MapTestController in index function to use textview.php view file 
 and send 2 variable name “fname” and “lname” from controller to view. Map Controller to use View Weerayut Hongsa : Network Engineer / Software Developer Major Kantana Broadcasting Co., Ltd https://kusumotolab.com
  • 20.
    Forward to Workshop003 Weerayut Hongsa : Network Engineer / Software Developer Major Kantana Broadcasting Co., Ltd https://kusumotolab.com