그냥 간단하게 하드코딩으로 글 제목하고 링크만 되게 해보려고하는데 잘 안되네요.
<?php
class nowread extends WidgetHandler{
function proc($args){
$list_count = (int)$args->list_count;
if(!$list_count) $list_count = 10;
$obj = new stdClass;
$obj->list_count = $list_count;
$output = executeQuery("widgets.nowread.docRead_get",$obj);
$widget_info = new stdClass;
$widget_info->list_count = $list_count;
Context::set('widget_info', $widget_info);
$oModuleModel = &getModel('module');
Context::set('module_info', $module_info);
// 템플릿의 스킨 경로를 지정
$tpl_path = sprintf('%sskins/%s', $this->widget_path, $args->skin);
$tpl_file = 'list';
Context::set('colorset', $args->colorset);
// 템플릿 컴파일
$oTemplate = TemplateHandler::getInstance();
return $oTemplate->compile($tpl_path, $tpl_file);
}
}
?>
<query id="docRead_get" action="select">
<tables>
<table name="sitemanagement_doc_read" />
</tables>
<columns>
<column name="*" />
</columns>
<navigation>
<index var="sort_index" default="regdate" order="desc" />
<list_count var="list_count" default="8" />
<page_count var="page_count" default="1" />
<page var="page" default="1" />
</navigation>
</query>
<div class="wm_default">
<ul>???
<!--@foreach($widget_info->list_count as $val)-->
<li>
{$val->document_srl}
<span class="title">
<a class="doc_title" href="{getUrl('','document_srl',$val->document_srl)}">
<span>{@ $title = cut_str($val->title,40,'...')}{$title}</span>
</a>
</span>
</li>
<!--@end-->
</ul>
</div>
반복문 안의 내용이 출력이 되지 않네요..... 어디를 고쳐야 할까요 ???
댓글 16
<ul>???
</ul>
</div></div></div>
이렇게 출력되네요. ??? 건 제가 확인하기 위해 넣은거구요...
https://xetown.com/board/745807 제 댓글 참고 해보세요.
해당 테이블이 보이지 않아 확인해보니.
별도 모듈 설치해야 되는군요.
$obj = new stdClass;
$obj->list_count = $list_count;
여기서 부터 이상합니다.
$output = executeQuery("widgets.nowread.docRead_get",$obj);
//widgets.nowread.docRead_get 이런 쿼리가 실제 있는지.. 있다면 아래를 확인 해보세요.
$widget_info = new stdClass;
$widget_info->list_count = $list_count;
//아래 처럼 변경 되어야 될거 같아요.
$widget_info->list_count = $output;
<!--@foreach($widget_info->list_count as $val)--> 에서 $widget_info->list_count 데이터 없기 때문에 출력을 안하는 것이에요.
소스를 보니 쿼리로 읽어 오는 데이터는 $output 인데.. $widget_info->list_count = $list_count; 라고 하셨네요.
위젯에 module_srl 이 필수 인가요? 위젯 생성후 저장을 하려는데 이 값이 없다고 뜨네요...