mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-20 00:20:44 +08:00
Merge pull request #784 from lucianobaraglia/master
Last typo fixes in guide - I swear - [skip ci]
This commit is contained in:
@@ -4,7 +4,7 @@ Configuration
|
|||||||
In Yii application and majority of components have sensible defaults so it's unlikely you spend lots of time configuring
|
In Yii application and majority of components have sensible defaults so it's unlikely you spend lots of time configuring
|
||||||
it. Still there are some mandatory options such as database connection you should set up.
|
it. Still there are some mandatory options such as database connection you should set up.
|
||||||
|
|
||||||
How application is configured depends on application template but there are some genral principles applying in any case.
|
How application is configured depends on application template but there are some general principles applying in any case.
|
||||||
|
|
||||||
Configuring options in bootstrap file
|
Configuring options in bootstrap file
|
||||||
-------------------------------------
|
-------------------------------------
|
||||||
@@ -39,7 +39,7 @@ return array(
|
|||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
In the above array keys are names of application properties. Depending on application type you can check properies of
|
In the above array keys are names of application properties. Depending on application type you can check properties of
|
||||||
either `\yii\web\Application` or `\yii\console\Application`. Both are extended from `\yii\base\Application`.
|
either `\yii\web\Application` or `\yii\console\Application`. Both are extended from `\yii\base\Application`.
|
||||||
|
|
||||||
> Note that you can configure not only public class properties but anything accessible via setter. For example, to
|
> Note that you can configure not only public class properties but anything accessible via setter. For example, to
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ If user isn't specifying any route i.e. using URL like `http://example.com/`, Yi
|
|||||||
used. It is determined by [[\yii\web\Application::defaultRoute]] method and is `site` by default meaning that `SiteController`
|
used. It is determined by [[\yii\web\Application::defaultRoute]] method and is `site` by default meaning that `SiteController`
|
||||||
will be loaded.
|
will be loaded.
|
||||||
|
|
||||||
A controller has a default action. When the user request does not specify which action to execute by usign an URL such as
|
A controller has a default action. When the user request does not specify which action to execute by using an URL such as
|
||||||
`http://example.com/?r=site`, the default action will be executed. By default, the default action is named as `index`.
|
`http://example.com/?r=site`, the default action will be executed. By default, the default action is named as `index`.
|
||||||
It can be changed by setting the [[\yii\base\Controller::defaultAction]] property.
|
It can be changed by setting the [[\yii\base\Controller::defaultAction]] property.
|
||||||
|
|
||||||
|
|||||||
@@ -37,4 +37,4 @@ How does Yii Compare with Other Frameworks?
|
|||||||
- Syntax and overall development usability are taken seriously.
|
- Syntax and overall development usability are taken seriously.
|
||||||
- Performance is one of the key goals.
|
- Performance is one of the key goals.
|
||||||
- We are constantly watching other web frameworks out there and getting the best ideas in. Initial Yii release was heavily
|
- We are constantly watching other web frameworks out there and getting the best ideas in. Initial Yii release was heavily
|
||||||
influenced by Ruby on Rails. Still, we aren't blindly copying anyhting.
|
influenced by Ruby on Rails. Still, we aren't blindly copying anything.
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ If a whole page remains relative static, we can use the page caching approach to
|
|||||||
save the rendering cost for the whole page.
|
save the rendering cost for the whole page.
|
||||||
|
|
||||||
|
|
||||||
### Leveraging HTTP to save procesing time and bandwidth
|
### Leveraging HTTP to save processing time and bandwidth
|
||||||
|
|
||||||
TBD
|
TBD
|
||||||
|
|
||||||
@@ -134,7 +134,7 @@ but it may slow down INSERT, UPDATE or DELETE queries.
|
|||||||
For complex queries, it is recommended to create a database view for it instead
|
For complex queries, it is recommended to create a database view for it instead
|
||||||
of issuing the queries inside the PHP code and asking DBMS to parse them repetitively.
|
of issuing the queries inside the PHP code and asking DBMS to parse them repetitively.
|
||||||
|
|
||||||
Do not overuse Active Record. Although Active Record is good at modelling data
|
Do not overuse Active Record. Although Active Record is good at modeling data
|
||||||
in an OOP fashion, it actually degrades performance due to the fact that it needs
|
in an OOP fashion, it actually degrades performance due to the fact that it needs
|
||||||
to create one or several objects to represent each row of query result. For data
|
to create one or several objects to represent each row of query result. For data
|
||||||
intensive applications, using DAO or database APIs at lower level could be
|
intensive applications, using DAO or database APIs at lower level could be
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ WHERE (`status` = 10) AND (`title` LIKE '%yii%')
|
|||||||
Order
|
Order
|
||||||
-----
|
-----
|
||||||
|
|
||||||
For odering results `orderBy` and `addOrderBy` could be used:
|
For ordering results `orderBy` and `addOrderBy` could be used:
|
||||||
|
|
||||||
```php
|
```php
|
||||||
$query->orderBy(array(
|
$query->orderBy(array(
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
Security
|
Security
|
||||||
========
|
========
|
||||||
|
|
||||||
Hashing and verifyig passwords
|
Hashing and verifying passwords
|
||||||
------------------------------
|
------------------------------
|
||||||
|
|
||||||
It is important not to store passwords in plain text but, contrary to popular belief, just using `md5` or `sha1` to
|
It is important not to store passwords in plain text but, contrary to popular belief, just using `md5` or `sha1` to
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
View
|
View
|
||||||
====
|
====
|
||||||
|
|
||||||
View is an important part of MVC and is reponsible for how data is presented to the end user.
|
View is an important part of MVC and is responsible for how data is presented to the end user.
|
||||||
|
|
||||||
Basics
|
Basics
|
||||||
------
|
------
|
||||||
@@ -32,7 +32,7 @@ So the view for the action above should be in `views/site/index.php` and can be
|
|||||||
<p>Hello, <?php echo $username?>!</p>
|
<p>Hello, <?php echo $username?>!</p>
|
||||||
```
|
```
|
||||||
|
|
||||||
Intead of just scalar values you can pass anything else such as arrays or objects.
|
Instead of just scalar values you can pass anything else such as arrays or objects.
|
||||||
|
|
||||||
Widgets
|
Widgets
|
||||||
-------
|
-------
|
||||||
@@ -108,7 +108,7 @@ Note that besides HTMLPurifier does excellent job making output safe it's not ve
|
|||||||
Alternative template languages
|
Alternative template languages
|
||||||
------------------------------
|
------------------------------
|
||||||
|
|
||||||
There are offlicial extensions for [Smarty](http://www.smarty.net/) and [Twig](http://twig.sensiolabs.org/). In order
|
There are official extensions for [Smarty](http://www.smarty.net/) and [Twig](http://twig.sensiolabs.org/). In order
|
||||||
to learn more refer to [Using template engines](template.md) section of the guide.
|
to learn more refer to [Using template engines](template.md) section of the guide.
|
||||||
|
|
||||||
Using View object in templates
|
Using View object in templates
|
||||||
@@ -128,7 +128,7 @@ $this->title = 'My page title';
|
|||||||
|
|
||||||
### Adding meta tags
|
### Adding meta tags
|
||||||
|
|
||||||
Adding meta tags such as encodig, description, keywords is easy with view object as well:
|
Adding meta tags such as encoding, description, keywords is easy with view object as well:
|
||||||
|
|
||||||
```php
|
```php
|
||||||
$this->registerMetaTag(array('encoding' => 'utf-8'));
|
$this->registerMetaTag(array('encoding' => 'utf-8'));
|
||||||
@@ -156,7 +156,7 @@ override the former and only a single tag will be rendered:
|
|||||||
|
|
||||||
### Registering link tags
|
### Registering link tags
|
||||||
|
|
||||||
`<link>` tag is useful in many cases such as customizing favicon, ponting to RSS feed or delegating OpenID to another
|
`<link>` tag is useful in many cases such as customizing favicon, pointing to RSS feed or delegating OpenID to another
|
||||||
server. Yii view object has a method to work with these:
|
server. Yii view object has a method to work with these:
|
||||||
|
|
||||||
```php
|
```php
|
||||||
|
|||||||
Reference in New Issue
Block a user