웹마스터 팁
page_full_width">
최신댓글에 닉네임 출력하기...
2007.08.28 16:36
현재 잡다한 몽상백서 댓글 소스입니다. 댓글 제목 뒤에 닉네임을 넣어봤습니다. (날짜도 나오구요)
zbxe/widgets/newest_comment/skins/cozy_simple/list.html 파일을 수정했습니다.
<!-- 설정된 컬러셋의 종류에 따라서 css파일을 import 합니다 -->
<!--%import("css/common.css")-->
<!--@if($colorset=="bluish_green")-->
<!--%import("css/bluish_green.css")-->
<!--@elseif($colorset=="green")-->
<!--%import("css/green.css")-->
<!--@elseif($colorset=="pink")-->
<!--%import("css/pink.css")-->
<!--@elseif($colorset=="blue")-->
<!--%import("css/blue.css")-->
<!--@else-->
<!--%import("css/red.css")-->
<!--@end-->
<div class="commentBox">
<div class="header">
<!--@if($widget_info->title)-->
<h2>{$widget_info->title}</h2>
<!--@else-->
<h2>newest comments</h2>
<!--@end-->
</div>
<div class="document">
<ul>
<!--@foreach($widget_info->comment_list as $val)-->
{@ $write_time=zdate($val->regdate, "Y-m-d") }
{@ $time_check=str_replace(" ","-",$write_time) }
{@ $time_check=str_replace(":","-",$time_check) }
{@ $time_check=explode("-",$time_check) }
{@ $write_time2=mktime($time_check[3],$time_check[4],$time_check[5],$time_check[1],$time_check[2],$time_check[0]) }
{@ $now_time=mktime(date("H"),date("i"),date("s"),date("m"),date("d"),date("Y")) }
{@ $time_pass=($now_time-$write_time2) }
<li><a href="{getUrl('','document_srl',$val->document_srl)}#comment_{$val->comment_srl}">{cut_str(strip_tags($val->content),24,'...')}</a>
<!--@if($time_pass < 86400)-->
<img src="./new.gif" align=absmiddle>
<!--@end-->
-{htmlspecialchars($val->nick_name)}
{zdate($val->regdate, "Y-m-d")}
</li>
<!--@end-->
</ul>
</div>
</div>
<!--%import("css/common.css")-->
<!--@if($colorset=="bluish_green")-->
<!--%import("css/bluish_green.css")-->
<!--@elseif($colorset=="green")-->
<!--%import("css/green.css")-->
<!--@elseif($colorset=="pink")-->
<!--%import("css/pink.css")-->
<!--@elseif($colorset=="blue")-->
<!--%import("css/blue.css")-->
<!--@else-->
<!--%import("css/red.css")-->
<!--@end-->
<div class="commentBox">
<div class="header">
<!--@if($widget_info->title)-->
<h2>{$widget_info->title}</h2>
<!--@else-->
<h2>newest comments</h2>
<!--@end-->
</div>
<div class="document">
<ul>
<!--@foreach($widget_info->comment_list as $val)-->
{@ $write_time=zdate($val->regdate, "Y-m-d") }
{@ $time_check=str_replace(" ","-",$write_time) }
{@ $time_check=str_replace(":","-",$time_check) }
{@ $time_check=explode("-",$time_check) }
{@ $write_time2=mktime($time_check[3],$time_check[4],$time_check[5],$time_check[1],$time_check[2],$time_check[0]) }
{@ $now_time=mktime(date("H"),date("i"),date("s"),date("m"),date("d"),date("Y")) }
{@ $time_pass=($now_time-$write_time2) }
<li><a href="{getUrl('','document_srl',$val->document_srl)}#comment_{$val->comment_srl}">{cut_str(strip_tags($val->content),24,'...')}</a>
<!--@if($time_pass < 86400)-->
<img src="./new.gif" align=absmiddle>
<!--@end-->
-{htmlspecialchars($val->nick_name)}
{zdate($val->regdate, "Y-m-d")}
</li>
<!--@end-->
</ul>
</div>
</div>
이소스는 최근댓글에 New아이콘도 함께 출력됩니다. 글 등록후 24시간 동안 New아이콘이 나타납니다.
댓글 5
-
HIKARU
2007.08.28 22:35
최근글 출력 방식이 점점 늘어나는군요.─..─bbb
카테고리 이미지로 표시해서 최근글 출력하는건 시도하시는 분 없으시려나..(_ _b -
아야어디가
2007.08.29 03:06
strtotime($val->regdate)
하면 작성일의 유닉스타임 쉽게 구할 수 있는데 strtotime 함수는 안쓰나요?
document 관련 클래스에서도 Simulz님 방식으로 유닉스타임을 얻고 있던데 뭔가 이유가 있나 싶습니다. -
strtotime(zdate($val->regdate))를 사용하면 아래처럼...
<!--@if((strtotime("now") - strtotime(zdate($val->regdate))) < 86400)-->New<!--@end-->
저는 {}괄호를 사용하는 방법이 궁금했어요.... -
아야어디가
2007.08.29 09:54
아... 그럼 안쓸 이유는 없는 건가요? 속도가 느리다는 말도 있고 해서요...
스마티템플릿에서 { } 문자를 내부에서 사용하려면 어찌하죠...ㅠㅠ
{@ereg ("([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})", $date, $val->regdate)}
결국....ㅠㅠ
{@$regs=array(substr($val->regdate, 0, 4),substr($val->regdate, 4, 2),substr($val->regdate, 6, 2),substr($val->regdate, 8, 2),substr($val->regdate, 10, 2),substr($val->regdate, 12, 2))}
<!--@if((mktime() - mktime($regs[3],$regs[4],$regs[5],$regs[1],$regs[2],$regs[0])) < 86400)-->New<!--@end-->