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查看變量橫幅或價值請幫我,我與評論功能掙扎因爲這個原因,我的項目上週暫停。 –