This article mainly introduces the method of loading views in the CI (CodeIgniter) framework view, and analyzes the operation skills related to loading views in the CodeIgniter framework based on examples, for more information about how to load a view in the framework view, see the following article: CI (CodeIgniter) # css/css-rwd-frameworks.html "target =" _ blank ">, combined with the instance form, I analyzed the CodeIgniter framework view loading related operation skills. For more information, see
This article describes how to load a view in the CI (CodeIgniter) framework view. We will share this with you for your reference. The details are as follows:
CI, as a lightweight php framework, has many advantages. here I want to focus on loading views in views.
1: Set the CodeIgniter database variable in the Application \ config \ database. php file, and then set the basic URL in the Application \ config. php file. For example, my basic URL is: localhost/codeigniter/
2: Create the default controller and view, and create a controller named student. php in the application \ controllers \ folder. Set it to the default controller in application \ config \ routes. php.
Controller-> student. php
class Student extends CI_controller{ public function construct(){ parent::construct(); } public function index(){ $date['title']="Classroom:Home Page"; $date['headline']="Welcome to the Classroom Management System"; $date['include']="Student_index"; $this->load->view('template',$date); }}
Views-> template. php
<?php echo $title;?>
load->view($include);?>
View-> student_index.php
Congratulations. Your initial setup is complate!
If you access: localhost/CodeIgniter/index. php/student/index
The result will output:
Welcome to the Classroom Management SystemCongratulations.Your initial setup is complate!
The above is a detailed description of how to load the view in the CI framework view. For more information, see other related articles in the first PHP community!