Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
taskonsite-архив-перенесен
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dmitry Korolev
taskonsite-архив-перенесен
Commits
7409fd42
Commit
7409fd42
authored
Feb 03, 2016
by
Олег Гиммельшпах
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix meta tags
parent
ff092d07
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
6 deletions
+19
-6
common/modules/content/controllers/PageController.php
common/modules/content/controllers/PageController.php
+3
-3
common/modules/content/models/CoContent.php
common/modules/content/models/CoContent.php
+13
-0
frontend/controllers/SiteController.php
frontend/controllers/SiteController.php
+3
-3
No files found.
common/modules/content/controllers/PageController.php
View file @
7409fd42
...
...
@@ -34,9 +34,9 @@ class PageController extends \common\components\BaseController
}
$content
=
$model
->
content
->
content
;
$this
->
meta_title
=
$model
->
metaTag
s
->
title
.
' - '
.
\Yii
::
$app
->
params
[
'name'
];
$this
->
meta_description
=
$model
->
metaTag
s
->
description
;
$this
->
meta_keywords
=
$model
->
metaTag
s
->
keywords
;
$this
->
meta_title
=
$model
->
metaTag
->
title
.
' - '
.
\Yii
::
$app
->
params
[
'name'
];
$this
->
meta_description
=
$model
->
metaTag
->
description
;
$this
->
meta_keywords
=
$model
->
metaTag
->
keywords
;
return
$this
->
render
(
'view'
,
[
'content'
=>
$content
]);
}
...
...
common/modules/content/models/CoContent.php
View file @
7409fd42
...
...
@@ -106,6 +106,19 @@ class CoContent extends \common\components\ActiveRecordModel
return
$query
;
}
/**
* @return \yii\db\ActiveQuery
*/
public
function
getMetaTag
(
$lang_id
=
null
)
{
$lang_id
=
(
$lang_id
===
null
)
?
Languages
::
getCurrent
()
->
id
:
$lang_id
;
return
$this
->
hasOne
(
MetaTags
::
className
(),
[
'object_id'
=>
'id'
])
->
where
([
'model_id'
=>
get_class
(
$this
),
'lang_id'
=>
$lang_id
]);
}
/**
* @return \yii\db\ActiveQuery
*/
...
...
frontend/controllers/SiteController.php
View file @
7409fd42
...
...
@@ -100,9 +100,9 @@ class SiteController extends BaseController
$model
=
\common\modules\content\models\CoContent
::
findOne
([
'url'
=>
'site/error'
]);
$content
=
$model
->
content
->
content
;
$this
->
meta_title
=
$model
->
metaTag
s
->
title
.
' - '
.
\Yii
::
$app
->
params
[
'name'
];
$this
->
meta_description
=
$model
->
metaTag
s
->
description
;
$this
->
meta_keywords
=
$model
->
metaTag
s
->
keywords
;
$this
->
meta_title
=
$model
->
metaTag
->
title
.
' - '
.
\Yii
::
$app
->
params
[
'name'
];
$this
->
meta_description
=
$model
->
metaTag
->
description
;
$this
->
meta_keywords
=
$model
->
metaTag
->
keywords
;
return
$this
->
render
(
'error'
,
[
'content'
=>
$content
]);
}
...
...
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