forked from segoddnja/Comments-module
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
84 lines (75 loc) · 2.75 KB
/
README
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
Yii module to add comments to any instance of CActiveRecord.
Features
------------
-Comments administration
-Threaded comments
-Each instance with their own configuration
Installation
--------------
To add a comment to the model, you need to perform the following steps.
Add Comments table to your schema:
CREATE TABLE IF NOT EXISTS `tbl_comments` (
`owner_name` varchar(50) NOT NULL,
`owner_id` int(12) NOT NULL,
`comment_id` int(12) NOT NULL AUTO_INCREMENT,
`parent_comment_id` int(12) DEFAULT NULL,
`creator_id` int(12) DEFAULT NULL,
`user_name` varchar(128) DEFAULT NULL,
`user_email` varchar(128) DEFAULT NULL,
`comment_text` text,
`create_time` int(11) DEFAULT NULL,
`update_time` int(11) DEFAULT NULL,
`status` int(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`comment_id`),
KEY `owner_name` (`owner_name`,`owner_id`)
)
Configure the module in app config:
'modules'=>array(
...
'comments'=>array(
//you may override default config for all connecting models
'defaultModelConfig' => array(
//only registered users can post comments
'registeredOnly' => false,
'useCaptcha' => false,
//allow comment tree
'allowSubcommenting' => true,
//display comments after moderation
'premoderate' => false,
//action for postig comment
'postCommentAction' => 'comments/comment/postComment',
//super user condition(display comment list in admin view and automoderate comments)
'isSuperuser'=>'false',
//order direction for comments
'orderComments'=>'DESC',
),
//the models for commenting
'commentableModels'=>array(
//model with individual settings
'Citys'=>array(
'registeredOnly'=>true,
'useCaptcha'=>true,
'allowSubcommenting'=>false,
//config for create link to view model page(page with comments)
'pageUrl'=>array(
'route'=>'admin/citys/view',
'data'=>array('id'=>'city_id'),
),
),
//model with default settings
'ImpressionSet',
),
//config for user models, which is used in application
'userConfig'=>array(
'class'=>'User',
'nameProperty'=>'username',
'emailProperty'=>'email',
),
),
...
),
Display ECommentListWidget in view for displaying commentable models
$this->widget('comments.widgets.ECommentsListWidget', array(
'model' => $model,
));
To manage all comments go to http://yoursite.com/modules.