퀵뷰 문의드립니다.
본문
아래코드는 그누보드4용 플록님이 공유해주신 팁으로 그누보드5용으로 바꾸었는데요
http://sir.kr/g4_tiptech/17247?sfl=wr_subject%7C%7Cwr_content&stx=%EC%98%A4%EB%8A%98%EB%B3%B8
모가 잘못됬는지 썸네일 이미지를 못가지고오고 링크도 안되네요
고수님들 확인좀 부탁드려요
<?php
$token = md5(uniqid(rand(), true));
set_session("ss_token", $token);
$tv_tbl = "product_bbs";// 지정된 제품 테이블일때만 세션생성
if ($bo_table == $tv_tbl)
{
$saved = false;
$tv_idx = (int)get_session("ss_tv_idx");
if ($tv_idx > 0) {
for ($i=1; $i<=$tv_idx; $i++)
{
if (get_session("ss_tv[$i]") == $bo_table."|".$wr_id)
{
$saved = true;
break;
}
}
}
if (!$saved && $bo_table && $wr_id)
{
$tv_idx++;
set_session("ss_tv_idx", $tv_idx);
set_session("ss_tv[$tv_idx]", $bo_table."|".$wr_id);
}
}
//print_r2($_SESSION);
$tv_idx = get_session("ss_tv_idx");
$tv_div[top] = 0;
$tv_div[img_length] = 5; // 보여줄 이미지갯수
?>
<style type="text/css">
#divTodayHidden { position:relative; top:<?=$tv_div[top]?>;display:none; }
/* #divToday { ie 스크립트 에러로 인라인코딩 } */
#divToday .top { margin:0; padding:0; background: url(<?=$g4[shop_path]?>/img/todayview01.gif) no-repeat; width:91px; height:31px; }
#divToday #todayviewcount { position:absolute; top:9px; right:10px; color:#555; }
#divToday #topBtn { margin:0; padding:0; background: url(<?=$g4[shop_path]?>/img/todayview02.gif) no-repeat; width:90px; height:12px; cursor:pointer; }
#divToday #botBtn { margin:0; padding:0; background: url(<?=$g4[shop_path]?>/img/todayview05.gif) no-repeat; width:90px; height:10px; cursor:pointer; }
#divToday #pList { margin:0 auto; padding:0; text-align:center; background: url(<?=$g4[shop_path]?>/img/todayview03.gif) repeat-y; width:90px; height:auto; }
#divToday #noList { margin:0; padding:0; background: url(<?=$g4[shop_path]?>/img/todayview04.gif) no-repeat; width:90px; height:21px; }
#divToday #hidBtn { margin:0; padding:0; background: url(<?=$g4[shop_path]?>/img/todayview06.gif) no-repeat; width:90px; height:23px; cursor:pointer; }
</style>
<div id='divTodayHidden'><a href='javascript:todayview_visible();' title="오늘본 제품 보기">
<img src='<?=$g4[shop_path]?>/img/todayview.gif' border=0></a>
</div>
<div id='divToday' style="position:relative; top:0; margin:0 auto; width:auto; height:auto;">
<div class="top">
<div id='todayviewcount'></div>
</div>
<?
if ($tv_idx)
{
// 상단 버튼
if ($tv_idx > $tv_div[img_length])
{
echo "<div id='topBtn' onclick=\"javascript:todayview_up();\" title=\"다음제품\"></div>\n";
}
// 제품 이미지 출력
echo "<div id='pList'>\n";
for ($i=1; $i<=$tv_div[img_length]; $i++)
{
echo " <div id='todayview_{$i}'></div>\n";
}
echo " </div>\n";
// 하단 버튼
if ($tv_idx > $tv_div[img_length])
{
echo "<div id='botBtn' onclick=\"javascript:todayview_dn();\" title=\"이전제품\"></div>\n";
}
}
else
{
echo "<div id='noList'></div>\n";
}
?>
<div id='hidBtn' onclick="javascript:todayview_hidden();"></div>
</div>
<!-- 오늘 본 제품 -->
<script type="text/javascript">
var goods_link = new Array();
<?php
echo "var goods_max = ".(int)$tv_idx.";\n";
echo "var goods_length = ".(int)$tv_div[img_length].";\n";
echo "var goods_current = goods_max;\n";
echo "\n";
for ($i=1; $i<=$tv_idx; $i++)
{
$tv_it_id = get_session("ss_tv[$i]");
list($ss_board, $ss_wr_id) = explode('|', $tv_it_id);
if ($ss_board == $tv_tbl)
{
$row = sql_fetch(" select bf_file from {$g5['board_file_table']} where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' and bf_no = '{$i}' ");
$it_name = get_text(addslashes($row['bf_file']));
$thumb = G5_PATH."/data/file/".$ss_board."/thumb/".$it_name;
$size = getimagesize($thumb);
$tw = $size[0] /2;
$th = $size[1]/2;
$img = "<a href='".G5_BBS_PATH."/board.php?bo_table=".$ss_board."&wr_id=".$ss_wr_id."'><img src='$thumb' width='".$tw."' height='".$th."' style='padding:1px 0; border:none;'/></a>";
echo "goods_link[$i] = \"{$img}<br/>\";\n";//<span class=small>".cut_str($it_name,10,"")."</span>
}
}
?>
var divSave = null;
function todayview_visible()
{
set_cookie('ck_tvhidden', '', 1);
document.getElementById('divToday').innerHTML = divSave;
}
function todayview_hidden()
{
divSave = document.getElementById('divToday').innerHTML;
set_cookie('ck_tvhidden', '1', 1);
document.getElementById('divToday').innerHTML = document.getElementById('divTodayHidden').innerHTML;
}
function todayview_move(current)
{
k = 0;
for (i=goods_current; i>0 ; i--)
{
k++;
if (k > goods_length)
break;
document.getElementById('todayview_'+k).innerHTML = goods_link[i];
}
}
function todayview_up()
{
if (goods_current + 1 > goods_max)
alert("오늘 본 마지막 제품입니다.");
else
todayview_move(goods_current++);
}
function todayview_dn()
{
if (goods_current - goods_length == 0)
alert("오늘 본 처음 제품입니다.");
else
todayview_move(goods_current--);
}
<?php
$k=0;
for ($i=$tv_idx; $i>0; $i--)
{
$k++;
if ($k > $tv_div[img_length])
break;
$tv_it_id = get_session("ss_tv[$i]");
list($ss_board, $ss_wr_id) = explode('|', $tv_it_id);
if ($ss_board == $tv_tbl)
{
echo "document.getElementById('todayview_{$k}').innerHTML = goods_link[$i];\n";
}
}
if ($tv_idx)
{
echo "document.getElementById('todayviewcount').innerHTML = '$tv_idx';\n";
}
?>
/****************************************************************************/
function CheckUIElements()
{
var yMenuFrom, yMenuTo, yButtonFrom, yButtonTo, yOffset, timeoutNextCheck;
yMenuFrom = parseInt (document.getElementById('divToday').style.top, 10);
if ( G5_is_gecko )
yMenuTo = top.pageYOffset + <?=$tv_div[top]?>;
else if ( G5_is_ie )
yMenuTo = document.body.scrollTop + parseInt('<?=$tv_div[top]?>');
timeoutNextCheck = 500;
if ( Math.abs (yButtonFrom - (yMenuTo + 152)) < 6 && yButtonTo < yButtonFrom )
{
setTimeout ("CheckUIElements()", timeoutNextCheck);
return;
}
if ( yMenuFrom != yMenuTo )
{
yOffset = Math.ceil( Math.abs( yMenuTo - yMenuFrom ) / 10 );
if ( yMenuTo < yMenuFrom )
yOffset = -yOffset;
document.getElementById('divToday').style.top = parseInt(document.getElementById('divToday').style.top) + yOffset;
timeoutNextCheck = 10;
}
setTimeout ("CheckUIElements()", timeoutNextCheck);
}
function OnLoad() {
var y;
if ( top.frames.length )
document.getElementById('divToday').style.display = '';
CheckUIElements();
return true;
}
OnLoad();
<?php
if ($_COOKIE['ck_tvhidden'])
echo "todayview_hidden();";
?>
//-->
</script>
답변 3
G5_PATH - G5_URL
G5_BBS_PATH - G5_BBS_URL로 수정해보세요
제윤아빠님 말씀해주신것과같이 수정했는데요
data/file/product_bbs/thumb/ 데이터 파일에서 썸네일 뒤에 상세 이미지를 불러와야하는데 못불러와요
ㅠㅠ
그누보드 썸네일 함수를 인쿠루드 하시고
$thumb = get_list_thumbnail($bo_table, $row['wr_id'],$tw, $th);
if($thumb['src']) {
$img_content = '<img src="'.$thumb['src'].'" alt="'.$thumb['alt'].'" width="'.$tw.'" height="'.$th.'">';
} else {
$img_content = '<span style="width:'.$tw.'px;height:'.$th.'px">no image</span>';
}
echo $img_content;
이런식으로 하시는게...맞을것 같은데요