| 상태 | 완료 |
|---|
모듈 개발하다가 삽질을 너무 많이 해서 .. 죄송하게도 고수님께 문의 드립니다. 모듈 개발중인데.. 기존 모듈중에 댓글(comment)모듈을 함께 쓰고 싶어서 넣었더니 잘 안됩니다. 댓글의 리스트가 보이지 않습니다. 관리자모드 댓글관리에서는 잘 보입니다. 제가 무엇을 잘못 했는지 고수님께서 함 봐 주세요..
적용파일들은 아래와 같습니다. 모듈명은 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라는 단어도 같이 반복되어 출력되어야 하는데 제가 무엇을 잘못 했는지 삽질삽질 하다 이렇게 문의 드립니다.
적용파일들은 아래와 같습니다. 모듈명은 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라는 단어도 같이 반복되어 출력되어야 하는데 제가 무엇을 잘못 했는지 삽질삽질 하다 이렇게 문의 드립니다.
최근 수정일 : 2011-02-12 21:42:30 - 아무나
글 작성한 곳 :
2011.02.11 21:30:08 (*.124.167.196)
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;
}
===
글 작성한 곳 :
2011.02.11 21:30:25 (*.124.167.196)
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-->
===
===
<!-- 댓글 -->
<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-->
===
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);
}
===