Difference between #1 and #2 of
How to display static pages in Yii?

Revision #2 has been created by auxbuss on Jul 24, 2009, 4:26:32 PM with the memo:

fixed illiteracy
« previous (#1) next (#3) »

Changes

Title unchanged

How to display static pages in Yii?

Category unchanged

Tutorials

Yii version unchanged

Tags unchanged

Content changed

In a Web application, we often need to display pages like "about this site", "legal information", whose content are mostly static. There are several approaches to deal with this kind of pages. * We can store these pages in individual HTML files so that the Web server will directly serve them to end users without incurring PHP. The drawback is that it is a hassle to maintain the common layout shared by these static pages and the other dynamic pages. * We can write an action and render the corresponding view file for each of the static pages. This resolves the layout problem, but it is too much trouble to write an action for each page, especially when the only work the action does is to render a view.

* We can use a single [CViewAction] to serve all these pages. Below we will show you how this approach works.


First, in the default `SiteController` (or other controller if you like), override the `actions()` method as follows,
[...]
14 0
13 followers
Viewed: 83 749 times
Version: 1.1
Category: Tutorials
Written by: qiang
Last updated by: resurtm
Created on: Mar 18, 2009
Last updated: 11 years ago
Update Article

Revisions

View all history