Yii implement static _php tutorial by implementing the method of displaying static page

Source: Internet
Author: User
Tags getting started with php smarty template yii

Yii implements the method of displaying static pages, and Yii implements static


The example in this paper describes the method that Yii implements to display static pages. Share to everyone for your reference, as follows:

Use a cviewaction built into Yii to serve all of these pages.

First, build a controller class such as Doccontroller, covering the actions method

Public function Actions () {  return Array (    ' page ' =>array (      ' class ' = ' cviewaction ',    ),  );}

According to the official guidelines, the above code declares an external action class cviewaction.

Then, generate the directory protected/views/Doc/pages.

Finally, a file is stored in this directory called about.php, with the content: "About this Site", where these pages will use the app's default layout file. Therefore, this document only describes the relevant content on this page.

http://www.yourhost.com/index.php?r=doc/page&view=about

If you have a lot of static pages, you can put them in subdirectories, assuming there is a static page in protected/views/doc/pages/help/contact.php:

http://www.yourhost.com/index.php?r=doc/page&view=help.contact

Of course, we can also customize the behavior of Cviewaction, view the API documentation to learn more about Cviewaction

For more information on YII related content readers can view this site topic: "YII framework Introduction and common skills Summary", "PHP Excellent Development Framework Summary", "Smarty Template Primer Basic Tutorial", "PHP date and Time usage summary", "PHP object-oriented Programming introduction Tutorial", " PHP String Usage Summary, "Getting Started with Php+mysql database operations" and "PHP Common Database Operations Skills Summary"

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

http://www.bkjia.com/PHPjc/1123836.html www.bkjia.com true http://www.bkjia.com/PHPjc/1123836.html techarticle yii Implementation of static page display method, Yii implementation of static This article describes the Yii implementation of the method of displaying static pages. Share to everyone for your reference, as follows: Using Yii built-in ...

  • 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.