<!--@if ($item->get('voted_count') >= 3 && $item->get('voted_count') <= 4 )--><img src="인기아이콘이미지경료"></img><!--@end-->
위 코드는 웹지기님이 알려주신 코드인데요 스케치북 게시판에서 구현은
<!--@if ($document->get('voted_count') >= 3 && $document->get('voted_count') <= 4 )--><img src="인기아이콘이미지경료"></img><!--@end--> 이 코드로 성공했습니다.
그런데 모바일 위젯에서는 위와 같이 명령어를 넣으면
Error Parsing Template - syntax error, unexpected end of file in template file widgets/mcontent/skins/default/normal.html
브라우저 에러가 발생됩니다. 다른 명령어가 있는건가요?
댓글 37
파일이 아니라 코드라도
네 신경써주서서 감사합니다. 코드 파일 붙여 놓을게요
<!--@if($widget_info->modules_info && count($widget_info->modules_info)==1)-->
{@$__module_info=$widget_info->modules_info;}
{@$__module_info=array_pop($__module_info);}
<div class="hx h2">
<h2>{$__module_info->browser_title}</h2>
</div>
<!--@end-->
<ul class="lt">
<!--@foreach($widget_info->content_items as $key => $item)-->
<li>
<a href="{$item->getLink()}">
<!--@for($j=0,$c=count($widget_info->option_view_arr);$j<$c;$j++)-->
<!--@if($widget_info->option_view_arr[$j]=='title')-->
<span class="title">
<!--@if(!$__module_info && $widget_info->show_browser_title=='Y' && $item->getBrowserTitle())-->
{$item->getBrowserTitle()} ›
<!--@if ($item->get('voted_count') > 3)--> <span style="background-color: #FF6C6C;border-radius: 3px;color:#fff;font-size:11px;font-weight:bold; padding: 1px; ">BEST</span> <!--@end-->
<span cond="$item->get('module_srl')=='868485' && !$item->getCommentCount()" style="margin-left:2px;background-color:#8041D9;border-radius:6px;padding:2px 5px;font-size:11px;font-weight:bold;color:#fff">Question!</span>
<span cond="$item->get('module_srl')=='868556' && !$item->getCommentCount()" style="margin-left:2px;background-color:#8041D9;border-radius:6px;padding:2px 5px;font-size:11px;font-weight:bold;color:#fff">help me!</span>
<!--@end-->
<!--@if($widget_info->show_category=='Y' && $item->getCategory())-->
{$item->getCategory()} ›
<!--@end-->
<strong>{$item->getTitle($widget_info->subject_cut_size)}</strong>
<!--@if($widget_info->show_comment_count=='Y' && $item->getCommentCount())-->
<em title="Replies">[{$item->getCommentCount()}]</em>
<font color="#ff0000">+{$item->get('voted_count')}</font></p>
<!--@end-->
<!--@if($widget_info->show_trackback_count=='Y' && $item->getTrackbackCount())-->
<em title="Trackbacks">[{$item->getTrackbackCount()}]</em>
<!--@end-->
</span>
<!--@else if($widget_info->option_view_arr[$j]=='nickname')-->
<span class="auth">
<strong>{$item->getNickName()}</strong>
<span class="time">{$item->getRegdate("Y-m-d H:i")}</span>
</span>
<!--@end-->
<!--@end-->
</a>
</li>
<!--@end-->
</ul>
변수 명이 $document 가 아닌 $ item 이라는 것에 주의해서요.
오류날 부분은 딱히 없어보입니다.
그리고 img 는
<img src="이미지 주소" alt="대체 문자열" /> 같은 식으로 쓰시면 됩니다. (닫고 싶으시다면)
</img> 안 하셔도 돼요 :)
<!--@if ($item->get('voted_count') >= 3 && $item->get('voted_count') <= 4 )-->
이코드를 등호를 빼면 어떻게 써야되는지요?
if 뒤에 공백도 제거했습니다.
<!--@if($item->get('voted_count') > 2 && $item->get('voted_count') < 5 )-->
이것을 /widgets/content/skins/default 여기에 넣는게 맞는지요
여기가 맞다면 어디에 넣는거에요 저는 아무리 해봐도 안되는군요 ㅠㅠ
혹시 어디다가 넣는지 알수 있을가요 ...?
그리고 <!--@if($item->get('voted_count') > 2 && $item->get('voted_count') < 5 )--> 이것만 넣으면 될가요 자꾸 질문드려서 죄송 합니다
<조건>조건이 맞을때 표시할 코드(이미지나 문구) </조건닫기>
어디다 넣을지는 표시하고 싶은 곳에 각자 넣으셔야 하는데 지금 하시려는 의도가 위 조건이 걸렸을때 특정한 게시글이다 라고 표시해 주려고 하시는 것이니 위젯의 경우 보통 글 제목이 나오니 글 제목 앞 또는 뒤쪽에 넣게 되겠죠.
/widgets/content/skins/default/normal.html 에서 아래처럼 넣어 봤습니다 근대
아래 숮자가어던게 2가 있고 5가 있습니다 그럼 2에서 5까지 추천수를 본다는 건가요 ...?
<!--// 목록형 출력 -->
<!--@if($widget_info->show_browser_title=='Y' && $item->getBrowserTitle())-->
<!--@if($item->get('voted_count') > 2 && $item->get('voted_count') < 5 )--><a href="<!--@if($item->contents_link)-->{$item->contents_link}<!--@else-->{getSiteUrl($item->domain, '', 'mid', $item->get('mid'))}<!--@end-->" class="board" target="_blank"|cond="$widget_info->new_window"><strong>{$item->getBrowserTitle()}</strong></a><!--@end-->
<!--@end-->
지금 구현하신 코드는
브라우저 타이틀을 출력하는 곳에 넣으셨습니다.
조건이 맞으면 브라우저타이틀을 출력하는 이상한 것을 구현하신 것 입니다.
브라우저 타이틀 출력의 조건으로 해당 조건을 거시면 안되겠죠.
"인기글" 이런 문구에 조건을 거셔야죠.
위치는 게시글 제목 앞이 되던 뒤가 되던 원하는 위치를 잡기 나름이죠.
저희는 위젯의 경우는 글 제목 뒤에 나오게 했습니다.
경우에 따라서는 섬네일에 표시할수도 있고 조회수 추천수 표시되는 쪽 옆에 할 수 있고 생각이 다 다르니까요.
목록 리스트가 무언지 잘 모르겠습니다.
제가 어리다로 알려드릴 수 없는 것이 위젯코드를 생성할때 어떤 옵션을 선택했는지 모르기 때문에 위치는 알려드릴 수 없구요.
위치를 찾고 싶으실때는 구현하려는 코드가 아닌 무조건 출력되는 !!!!!!!!!!!! 이런 것을 넣어 어디에 출력되는지 확인해보시면 됩니다.
컨텐츠위젯은 테이블형,목록형 두군데 반복된 코드가 들어갑니다.
선택을 테이블형으로 할 수도 있고 목록형으로 할 수도 있습니다.
두군데 모두 코드를 넣는게 좋겠죠.
위에 빨간 색으로 알려주신 이코드요
<!--@if ($item->get('voted_count') > 3)--> <span style="background-color: #FF6C6C;border-radius: 3px;color:#fff;font-size:11px;font-weight:bold; padding: 1px; ">BEST</span> <!--@end-->
이거 보통은 타이틀 부분을 감싸거나 해야 하는게 아닌가 싶은데요
그냥 저것만 중간에 들어가 있어서 저게 맞나 싶어요
글 제목을 추천수 3 이상인 게시물만 보이게 하고 추천수 3 미만의 글은 공백으로 출력하시려면 타이틀에 조건을 거시면 됩니다.
타이틀 옆 또는 앞 혹은 특정한 위치에 추천수 3인 게시물의 경우 best 를 띄우고 싶은거 아닌가요?
감사합니다
이게 모든 게시판에 다 나오니 영 공지가 보기 싫으네요
공지 게시판만 적용에서 제외 할려면 어찌하면 좋을가요 ...?
&& $item->get('module_srl')!=='모듈번호'
현재 적용된
<!--@if ($item->get('voted_count') > 30)--><span style="background-color: #ff0000;color:#fff;font-size:10px;padding: 1px;font-family:dotum; ">인기</span><!--@end-->
위 소스에서 어느곳에 넣어야 하는지요
<!--@if ($item->get('voted_count') > 30)-->이부분에 넣나요<span style="background-color: #ff0000;color:#fff;font-size:10px;padding: 1px;font-family:dotum; ">인기</span><!--@end-->
된것 같아서요 그래도 몰라서 혹시나 하는 마음에 잘했나 싶어서 여쭤 봅니다
끝까지 이렇게 답글 주셔어 감사합니다