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
ada39df6
Commit
ada39df6
authored
Apr 02, 2014
by
Alexander Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Corrected theming docs not to give an example of theme view files under webroot
parent
3a232743
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
17 deletions
+17
-17
theming.md
docs/guide/theming.md
+8
-8
Theme.php
framework/base/Theme.php
+9
-9
No files found.
docs/guide/theming.md
View file @
ada39df6
...
...
@@ -18,7 +18,7 @@ be in your application config file:
'components'
=>
[
'view'
=>
[
'theme'
=>
[
'pathMap'
=>
[
'@app/views'
=>
'@
webroot
/themes/basic'
],
'pathMap'
=>
[
'@app/views'
=>
'@
app
/themes/basic'
],
'baseUrl'
=>
'@web/themes/basic'
,
],
],
...
...
@@ -26,8 +26,8 @@ be in your application config file:
```
In the above
`pathMap`
defines where to look for view files while
`baseUrl`
defines base URL for resources referenced
from these files.
For example, if
`pathMap`
is
`['/web/views' => '/web/themes/basic']`
, then
the themed version
for a view file
`
/web/views/site/index.php`
will be
`/web
/themes/basic/site/index.php`
.
from these files.
In our case
`pathMap`
is
`['@app/views' => '@app/themes/basic']`
so
the themed version
for a view file
`
@app/views/site/index.php`
will be
`@app
/themes/basic/site/index.php`
.
Using multiple paths
--------------------
...
...
@@ -36,14 +36,14 @@ It is possible to map a single path to multiple paths. For example,
```
php
'pathMap'
=>
[
'
/web
/views'
=>
[
'
/web
/themes/christmas'
,
'
/web
/themes/basic'
,
'
@app
/views'
=>
[
'
@app
/themes/christmas'
,
'
@app
/themes/basic'
,
],
]
```
In this case, the view will be searched in
`
/web
/themes/christmas/site/index.php`
then if it's not found it will check
`
/web
/themes/basic/site/index.php`
. If there's no view there as well application view will be used.
In this case, the view will be searched in
`
@app
/themes/christmas/site/index.php`
then if it's not found it will check
`
@app
/themes/basic/site/index.php`
. If there's no view there as well application view will be used.
This ability is especially useful if you want to temporary or conditionally override some views.
framework/base/Theme.php
View file @
ada39df6
...
...
@@ -27,23 +27,23 @@ use yii\helpers\FileHelper;
* to replace the original view file.
* 4. If Step 2 or 3 fails, the original view file will be used.
*
* For example, if [[pathMap]] is `['
/web/views' => '/web
/themes/basic']`,
* then the themed version for a view file `
/web
/views/site/index.php` will be
* `
/web
/themes/basic/site/index.php`.
* For example, if [[pathMap]] is `['
@app/views' => '@app
/themes/basic']`,
* then the themed version for a view file `
@app
/views/site/index.php` will be
* `
@app
/themes/basic/site/index.php`.
*
* It is possible to map a single path to multiple paths. For example,
*
* ~~~
* 'pathMap' => [
* '
/web
/views' => [
* '
/web
/themes/christmas',
* '
/web
/themes/basic',
* '
@app
/views' => [
* '
@app
/themes/christmas',
* '
@app
/themes/basic',
* ],
* ]
* ~~~
*
* In this case, the themed version could be either `
/web
/themes/christmas/site/index.php` or
* `
/web
/themes/basic/site/index.php`. The former has precedence over the latter if both files exist.
* In this case, the themed version could be either `
@app
/themes/christmas/site/index.php` or
* `
@app
/themes/basic/site/index.php`. The former has precedence over the latter if both files exist.
*
* To use a theme, you should configure the [[View::theme|theme]] property of the "view" application
* component like the following:
...
...
@@ -51,7 +51,7 @@ use yii\helpers\FileHelper;
* ~~~
* 'view' => [
* 'theme' => [
* 'basePath' => '@
webroot
/themes/basic',
* 'basePath' => '@
app
/themes/basic',
* 'baseUrl' => '@web/themes/basic',
* ],
* ],
...
...
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