Detailed description of how to load a view in the CI framework view

Source: Internet
Author: User
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!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.