codeigniter for project : lesson 104 - controller & view
TRANSCRIPT
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