-
Notifications
You must be signed in to change notification settings - Fork 2
/
readme.txt
58 lines (44 loc) · 1.37 KB
/
readme.txt
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
This extension simplifies work with SEO. It allows you to easily add SEO data to DB models.
Unpack release in the protected/extensions folder.
First, create table for storage SEO data
CREATE TABLE IF NOT EXISTS `seo_data` (
`model_name` varchar(50) NOT NULL,
`model_id` int(12) NOT NULL,
`title` text,
`keywords` text,
`description` text,
PRIMARY KEY (`model_name`,`model_id`)
)
Then add behavior to model
public function behaviors() {
return array(
'SeoBehavior' => array(
'class' => 'ext.YiiSEOBehavior.ESEOModelBehavior'
),
...
);
}
In _form view for this model, insert ESEOEditWidget
<?php $form=$this->beginWidget('CActiveForm', array(
'id'=>'sample-form',
)); ?>
...
<?php $this->widget('ext.YiiSEOBehavior.widgets.ESEOEditWidget', array(
'model' => $model
)); ?>
...
<?php $this->endWidget(); ?>
Add ESEOControllerBehavior to controller
public function behaviors() {
return array(
'SeoBehavior' => array(
'class' => 'ext.YiiSEOBehavior.ESEOControllerBehavior'
),
...
);
}
And last that you need to do - add folowing code to your controller in view action
public function actionView() {
$model=$this->loadModel($id);
$this->registerSEO($model);
}