cb6805b8
Administrator
12.04.16 finish ...
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
<?php
namespace frontend\components;
use common\models\SeoSearch;
use yii\base\Widget;
class Seo extends Widget
{
private $url;
public $row;
public function init(){
$this->url = $_SERVER['REQUEST_URI'];
parent::init();
}
public function run()
{
$widgetData = $this->findModel();
return $widgetData->{$this->row};
}
protected function findModel()
{
if (($model = \common\models\Seo::findOne(['url'=>$this->url])) !== null) {
return $model;
} else {
return new SeoSearch();
}
}
}
|