Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
0842c4a7
Commit
0842c4a7
authored
Apr 17, 2014
by
Alexander Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adjusted statc pages docs
parent
e842dec5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
16 deletions
+14
-16
view.md
docs/guide/view.md
+14
-16
No files found.
docs/guide/view.md
View file @
0842c4a7
...
...
@@ -398,12 +398,10 @@ echo $this->context->getRoute();
### Static Pages
For render static pages, you can use class `ViewAction`.
ViewAction represents an action that displays a view according
to a user-specified parameter.
If you need to render static pages you can use class `ViewAction`. It represents an action that displays a view according
to a user-specified parameter.
*How use:*
**create action in controller**
Usage of the class is simple. In your controller use the class via `actions` method:
```
php
class SiteController extends Controller
...
...
@@ -421,26 +419,26 @@ class SiteController extends Controller
}
```
**create `index.php` in `@app/views/site/pages/`**
Then create `index.php` in `@app/views/site/pages/`:
```
php
//index.php
<h1>
View static page
</h1>
<h1>
Hello, I am a static page!
</h1>
```
**open url `/index.php?r=site/static`**
That's it. Now you can try it using `/index.php?r=site/static`.
By default, the view being displayed is specified via the `view` GET parameter.
If you open
url `/index.php?r=site/static?&view=about` then will be opened view of file `@app/views/site/pages/about.php`
If you open
`/index.php?r=site/static?&view=about` then `@app/views/site/pages/about.php` view file will be used.
By default:
* GET parameter = `view`
* view file = `index.php`
* folder(viewPrefix) = `pages`
* layout for static page use as that in the current controller.
If not changed or specified via GET defaults are the following:
These parameters can be changed.
- GET parameter name: `view`.
- View file used if parameter is missing: `index.php`.
- Directory where views are stored (`viewPrefix`): `pages`.
- Layout for the page rendered matches the one used in controller.
For more information see [[yii\web\ViewAction]]
For more information see [[yii\web\ViewAction]]
.
### Caching blocks
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment