CodeIgniter generate static page methods, CodeIgniter generate static _php tutorial

Source: Internet
Author: User
Tags codeigniter zend framework

CodeIgniter generates a static page method, CodeIgniter generates a static


The examples in this article describe how CodeIgniter generates static pages. Share to everyone for your reference, as follows:

Now let's develop how to get the CI framework to generate static pages. The following direct code:

$this->output->get_output ();

Using this method, you can get the data that will be output and save it and keep it (we often need to generate a static HTML file when we do the news type site).

$string = $this->output->get_output (); $this->load->helper (' file '); Write_file ('./lianglong_ Codeigniter.html ', $string);

For example, the page we want to output is the data to load a view, so we

$this->load->view (' Welcome_lianglong);

Then join

$this->output->get_output ();

and store the value to a variable such as $lianglong. Then use the Write_file helper function in the CI file to generate the file you want, as in the following example

function SC () {$this->load->helper (' file '), $this->load->view (' welcome_message '); $lianglong = $this- >output->get_output (); if (!write_file ('./lianglongfile.html ', $lianglong)) {  echo ' Unable to write the file ';} else {  echo ' file Writt En! '; }}

Or:

function SC () {$this->load->helper (' file '); $liangdong = $this->load->view (' Welcome_message ', $data, True ); if (!write_file ('./lianglongfile.html ', $lianglong)) {  echo ' Unable to write the file ';} else {  echo ' file Writt En! '; }}

More interested in CodeIgniter related content readers can view this site topic: "CodeIgniter Introductory Tutorial", "CI (codeigniter) Framework Advanced Tutorial", "PHP Excellent Development Framework Summary", "thinkphp Getting Started", " Summary of common methods of thinkphp, "Introduction to Zend Framework Frame", "Introduction to PHP Object-oriented Programming", "Introduction to Php+mysql Database Operation" and "PHP common database Operation Skills Summary"

It is hoped that this article is helpful to the PHP program design based on CodeIgniter framework.

http://www.bkjia.com/PHPjc/1127866.html www.bkjia.com true http://www.bkjia.com/PHPjc/1127866.html techarticle CodeIgniter Generate static page methods, CodeIgniter generate static This article describes the CodeIgniter method of generating a static page. Share to everyone for your reference, as follows: Now we ...

  • Related Article

    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.