How to load views in the CI framework view

Source: Internet
Author: User
Tags codeigniter
This article focuses on the method of loading views in CI (codeigniter) http://www.php.cn/css/css-rwd-frameworks.html "target=" _blank > Frame view. Combined with the example form analysis of the CodeIgniter frame view loading related operation skills, the need for friends can 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: 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: Localhost/codeigniter/index.php/student/index

The result would output:

Welcome to the classroom Management Systemcongratulations.your initial setup is complate!

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.