상태 | 완료 |
---|
적용파일들은 아래와 같습니다. 모듈명은 test로 하겠습니다. test/conf/module.xml test/test.view.php test/test.api.php test/skin/default/view_document.html test/skin/default/comment.html
적용된 파일들은 위와 같으며 각 파일에 적용된 것은 아래와 같습니다. test/conf/module.xml
---
<action name="dispTestContentCommentList" type="view" />
===
test/test.view.php
===
function dispTestContentCommentList(){ $oDocumentModel = &getModel('document'); $document_srl = Context::get('document_srl'); $oDocument = $oDocumentModel->getDocument($document_srl); $comment_list = $oDocument->getComments();
// 비밀글일때 컨텐츠를 보여주지 말자. foreach($comment_list as $key => $val){ if(!$val->isAccessible()){ $val->add('content',Context::getLang('thisissecret')); } } Context::set('comment_list',$comment_list); }
===
test/test.api.php
===
function dispPlannerContentCommentList(&$oModule) { $oModule->add('comment_list',$this->arrangeComment(Context::get('comment_list'))); } function arrangeComment($comment_list) { $output = array(); if(count($comment_list) > 0 ) { foreach($comment_list as $key => $val){ $item = null; $item = $val->gets('comment_srl','parent_srl','depth','is_secret','content','voted_count','blamed_count','user_id','user_name','nick_name','email_address','homepage','regdate','last_update'); $output[] = $item; } } return $output; }
===
test/skin/default/document_view.html
===
<!-- 댓글 --> <a name="comment"></a> <!--#include("./comment.html")-->
===
test/skin/default/comment.html
===
{$oDocument->getCommentcount()}
{@ $_comment_list = $oDocument->getComments() } <getCommentCount">!--@if($oDocument->getCommentCount())--> <!--@foreach($_comment_list as $key => $comment)--> comment <!--@end--> <!--@end-->
===
위와 같이 했는데 댓글이 나와야 하는 comment.html에 결과값은 숫자만 나옵니다. {@ $_comment_list = $oDocument->getComments() } 의 숫자값만 나오고 그 이후의 값이 출력 되지 않습니다.
댓글이 0개이면 당연히 숫자 0만 출력 되겠지만 댓글이 1개이상이면 comment라는 단어도 같이 반복되어 출력되어야 하는데 제가 무엇을 잘못 했는지 삽질삽질 하다 이렇게 문의 드립니다.
![](http://www.bek.me/modules/ip2nation/tpl/images/flag/all/kr.gif)
===
<action name="dispTestModifyComment" type="view" />
<action name="dispTestReplyComment" type="view" />
<action name="dispTestDeleteComment" type="view" />
<action name="dispTestContentCommentList" type="view" />
<action name="dispTestWriteComment" type="view" />
<action name="procTestInsertComment" type="controller" standalone="true" />
<action name="procTestDeleteComment" type="controller" standalone="true" />
===
![](http://www.bek.me/modules/ip2nation/tpl/images/flag/all/kr.gif)
test/test.view.php
===
function dispTestContentCommentList(){
$oDocumentModel = &getModel('document');
$document_srl = Context::get('document_srl');
$oDocument = $oDocumentModel->getDocument($document_srl);
$comment_list = $oDocument->getComments();
// 비밀글일때 컨텐츠를 보여주지 말자.
foreach($comment_list as $key => $val){
if(!$val->isAccessible()){
$val->add('content',Context::getLang('thisissecret'));
}
}
Context::set('comment_list',$comment_list);
}
===
![](http://www.bek.me/modules/ip2nation/tpl/images/flag/all/kr.gif)
test/test.api.php
===
function dispPlannerContentCommentList(&$oModule) {
$oModule->add('comment_list',$this->arrangeComment(Context::get('comment_list')));
}
function arrangeComment($comment_list) {
$output = array();
if(count($comment_list) > 0 ) {
foreach($comment_list as $key => $val){
$item = null;
$item = $val->gets('comment_srl','parent_srl','depth','is_secret','content','voted_count','blamed_count','user_id','user_name','nick_name','email_address','homepage','regdate','last_update');
$output[] = $item;
}
}
return $output;
}
===
![](http://www.bek.me/modules/ip2nation/tpl/images/flag/all/kr.gif)
===
<!-- 댓글 -->
<a name="comment"></a>
<!--#include("./comment.html")-->
===
test/skin/default/comment.html
===
{$oDocument->getCommentcount()}
{@ $_comment_list = $oDocument->getComments() }
<getCommentCount">!--@if($oDocument->getCommentCount())-->
<!--@foreach($_comment_list as $key => $comment)-->
comment
<!--@end-->
<!--@end-->
===
![](http://www.bek.me/modules/ip2nation/tpl/images/flag/all/kr.gif)
위와 같이 했는데
댓글이 나와야 하는 comment.html에 결과값은 숫자만 나옵니다.
{@ $_comment_list = $oDocument->getComments() } 의 값만 나오고 그 이후의 값이 출력 되지 않습니다.
댓글이 0개이면 당연히 숫자 0만 출력 되겠지만 댓글이 1개이상이면 comment라는 단어도 같이 반복되어 출력되어야 하는데
제가 무엇을 잘못 했는지 삽질삽질 하다 이렇게 문의 드립니다.
![](http://www.bek.me/modules/ip2nation/tpl/images/flag/all/kr.gif)
![profile](http://www.bek.me/files/member_extra_info/profile_image/004/4.png?20140228180321)
![](http://www.bek.me/modules/ip2nation/tpl/images/flag/all/kr.gif)
빠른 응대 감사합니다.
그 부분은 제가 잘못 작성했습니다.
{$oDocument->getCommentcount()}
{@ $_comment_list = $oDocument->getComments() }
<getCommentCount">!--@if($oDocument->getCommentCount())-->
이렇게 작성된 겁니다...
아시겠지만..
{$oDocument->getCommentcount()} 이건 댓글 갯수 작성하는 부분입니다.
![](http://www.bek.me/modules/ip2nation/tpl/images/flag/all/kr.gif)
![profile](http://www.bek.me/files/member_extra_info/profile_image/004/4.png?20140228180321)
<getCommentCount">!--@if($oDocument->getCommentCount())-->
![](http://www.bek.me/modules/ip2nation/tpl/images/flag/all/kr.gif)
{@ $_comment_list = $oDocument->getComments()}
getCommentCount())--">!--@if($oDocument->getCommentCount())--
이렇게 작성된 겁니다.
적용된 파일
test/conf/module.xml
test/test.view.php
test/test.api.php
test/skin/default/view_document.html
test/skin/default/comment.html