about how to load views in the CI framework view

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

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.