This article mainly introduces the method of loading view in CI (codeigniter) frame view, analyzes the operation skill of codeigniter frame view loading with the example form, and needs friends to refer to the following
This example describes how to load views in the CI (codeigniter) framework view. Share to everyone for your reference, as follows:
CI as a lightweight framework of PHP, its own many advantages, in this I would like to say is the view load view.
1: After setting the CodeIgniter database variable in the application\config\database.php file, set the underlying URL in the application\config\config.php file shortly thereafter. For example, my base URL is: http://localhost/codeigniter/
2: Next Create the default controller and view, create the Controller directory as: Application\controllers\ folder, create a controller named student.php. and set it as the default controller within the 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
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 strict//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" >< HTML xmlns= "http://www.w3.org/1999/xhtml" lang= "en" xml:lang= "en" >
view->student_index.php
Congratulations.your Initial setup is complate!
If you visit: Http://localhost/CodeIgniter/index.php/student/index
The result would output:
Welcome to the classroom Management Systemcongratulations.your initial setup is complate!
The above is the whole content of this article, I hope that everyone's learning has helped, more relevant content please pay attention to topic.alibabacloud.com!