0
我使用cakephp2.0并要整合评论插件,但我什么也没得到。我用commentDc插件,但它不工作作为我的requirements.Because我正在integreating我的用户登录系统xenforo和commentDc插件使用Auth组件,所以它不能正常工作。评论插件cake2.0
请让我知道在那里,我可以整合和修改我的需要的任何简单的评论插件。
感谢,
我使用cakephp2.0并要整合评论插件,但我什么也没得到。我用commentDc插件,但它不工作作为我的requirements.Because我正在integreating我的用户登录系统xenforo和commentDc插件使用Auth组件,所以它不能正常工作。评论插件cake2.0
请让我知道在那里,我可以整合和修改我的需要的任何简单的评论插件。
感谢,
下面是如何设置的意见:
评论表中的字段:
在任何模式,你想成为commentable,在此您的关联:
public $hasMany = array(
'Comment' => array(
'className' => 'Comment',
'foreignKey' => 'parent_id',
'conditions' => array('Comment.parent_type' => 'question')
)
);
这是一个视图元素:
<?php
/*
set variables:
$data : data of the parent
$type : the type of the parent
*/
if(!isset($name)) {
$name = 0;
}
foreach($data['Comment'] as $comment){
echo '<div class="comment">'.$comment['content'].
' - '.$this->Html->link($comment['User']['username'],array('controller'=>'users','action'=>'view',$comment['User']['id']))
.'</div>';
}
echo $this->Form->create(null, array('url' => '/comments/add','id'=>'qCommentForm'));
echo $this->Form->input('Comment.parent_id', array('type'=>'hidden','value'=>$data[$type]['id']));
echo $this->Form->input('Comment.parent_type', array('type'=>'hidden','value'=>$type));
echo $this->Form->textarea('Comment.content',array('div'=>'false','class'=>'small','label'=>false));
echo $this->Form->submit(__('Leave comment'),array('div'=>'false','class'=>'small'));
echo $this->Form->end();
?>
然后,在为您的模型视图查看,添加(假设你指定的元素comment.ctp:
<?php echo $this->element('comment',array('data'=>$modelData,'type'=>'MyModel')) ?>
你可以只修改DC插件为您的需要(替换身份验证系统):) – mark
感谢Mark.I没有改变它的工作呢now.But我得到当我与一个以上的controller.I整合cakedccomment插件错误整合了cakedccomment插件室内用博客的现在工作正常,但是当我试图integreate它与旗帜它给我的错误: - > CommentsComponent:缺少模型旗主键ID查看变量横幅或价值请帮我,我与评论功能挣扎因为这个原因,我的项目上周暂停。 –