#10 Views in CodeIgniter 4 | Loading Multiple views

Опубликовано: 17 Март 2026
на канале: GoPHP
16,989
156

View components are used to build what is returned to the user.
A view will always talk about front end which is displayed to the user
A view is simply a web page, or a page fragment, like a header, footer, sidebar, etc.
We can also embed the views with other views also
A view will NEVER called directly, The Views are always loaded with the help of controllers only.
Creating a View
Using your text editor, create a file called BlogView.php and put some HTML Code inside and save the files into App/Views folder

Loading Views
In MVC, A view will never called directly, Then who will loads view? The Controller
Yes, A Controllers is a responsible person to load views, The Controller will decide what view should load, when to load and how to load…
To load and display a particular view file you will use the following global function into your controller
echo view(" view_name ");