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!
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
4. 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
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!
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
14. • 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
16. 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
17. 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
18. 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
19. 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
20. Forward to Workshop 003
Weerayut Hongsa : Network Engineer / Software Developer
Major Kantana Broadcasting Co., Ltd
https://kusumotolab.com