갤러리 게시판 게시글 클릭시 링크 거는 방법 좀 알려주세요. > 그누4 질문답변

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기
기존 게시물은 열람만 가능합니다.

갤러리 게시판 게시글 클릭시 링크 거는 방법 좀 알려주세요. 정보

갤러리 게시판 게시글 클릭시 링크 거는 방법 좀 알려주세요.

본문

갤러리 게시판을 사용해서 여러개의 게시글들이 나와 있습니다.
각 게시글을 클릭할때 세부 내용으로 들어가는데요
특정 몇몇 게시글은 다른 게시판 게시글로 링크를 걸려고 하는데 어떻게 하는지 모르겠습니다.
고수님들께서 도와주세요 ㅠ.ㅠ

제가 질문을 어렵게 한거 같습니다. ㅠ.ㅠ
정확히 말하자면
z2_06게시판의 wr_id=1글을 클릭시
z2_1게시판으로 링크걸고 싶은 겁니다. ㅠ.ㅠ

밑에는 갤러리 게시판 리스트 스킨 파일입니다.
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
include_once $board_skin_path."/zp_config.php";
include_once $board_skin_path."/zp_update.lib.php";

sql_query("alter table `$g4[write_prefix]$bo_table` add wr_tags varchar(255) not null", false);

//if ($is_category) $colspan++;
if ($is_checkbox) $colspan++;
if ($is_good && $zp_list_good) $colspan++;
if ($is_nogood && $zp_list_nogood) $colspan++;

$mod = $board[bo_gallery_cols];
$td_width = (int)(100 / $mod);
?>

<div style="width:<?=$bo_table_width?>">
<!-- fcategory -->
<div style="clear:both;">
    <div style="float:left;">
    <form name="fcategory" method="get" style="margin:0px;">
    <? if ($is_category) { ?>
    <select name=sca onchange="location='<?=$category_location?>'+<?=strtolower($g4[charset])=='utf-8' ? "encodeURIComponent(this.value)" : "this.value"?>;">
    <option value=''>전체</option>
    <?=$category_option?>
    </select>
    <? } ?>
    </form>
    </div>
    <div style="float:right;">
    <div style="float:left; padding:5px 5px 0 0; height:25px;">
    <span style="font-family:arial; font-size:10px;">TOTAL (<?=number_format($total_count)?>)</span>
    <? if ($rss_href) { ?><a href='<?=$rss_href?>'><img src="<?=$g4['path']?>/Templates/<?=$config['zncf_templates']?>/img/btn_rss.gif" border="0" style='vertical-align:middle;' alt="rss"></a><? } ?>
    </div>
    <? if ($member[mb_id]==$config[cf_admin]) { ?>
    <div style="float:left; height:25px;">
    <input onclick="if (this.checked) all_checked(true); else all_checked(false);" type="checkbox">전체선택
    <input type="button" value="설정" onclick="window.open('<?=$board_skin_path?>/board_setup.php?bo_table=<?=$bo_table?>', 'board_setup', 'left=50, top=50, width=500, height=550, scrollbars=1');return false;" class="button00" style="width:38px">
    <input type="button" value="썸네일삭제" onclick="document.location.href='<?=$_SERVER['PHP_SELF']?>?delete_smallimg=1&<?=$_SERVER['QUERY_STRING']?>';" class="button00" style="width:76px">
    <input type="button" value="날짜정렬" onclick="document.location.href='<?=$g4['bbs_path']?>/board.php?bo_table=<?=$bo_table?>&fadmin=sort';" class="button00" style="width:64px">
    <input type="button" value="관리자" onclick="document.location.href='<?=$admin_href?>';" class="button00 bold" style="width:54px">
    </div>
    <? } ?>
    </div>
</div>
<!-- // fcategory -->

<!-- fboardlist -->
<form name="fboardlist" method="post" style="margin:0;">
<input type='hidden' name='bo_table' value='<?=$bo_table?>'>
<input type='hidden' name='sfl'  value='<?=$sfl?>'>
<input type='hidden' name='stx'  value='<?=$stx?>'>
<input type='hidden' name='spt'  value='<?=$spt?>'>
<input type='hidden' name='page' value='<?=$page?>'>
<input type='hidden' name='sw'  value=''>

<div style="height:5px; line-height:1px; font-size:1px; clear:both;">&nbsp;</div>
<div style="border-bottom:1px solid #dddddd;"></div>
<div style="height:10px; line-height:1px; font-size:1px; clear:both;">&nbsp;</div>
<table class="board_list" summary="<?=$board[bo_subject]?>">
<caption><?=$board[bo_subject]?></caption>
<tr>
    <?
    for ($i=0; $i<count($list); $i++)
    {
    if ($i && $i%$mod==0)
    echo "</tr><tr>";

if ($zp_board[zp_thumb] == "1") {
$thumb = $thumb_path.'/'.$list[$i][wr_id].'.'.jpg;
// thumb
if (!file_exists($thumb)) {
if ($list[$i][file][0][file]){
$file = $list[$i][file][0][path] .'/'. $list[$i][file][0][file];
}elseif ($list[$i][file][1][file]){
$file = $list[$i][file][1][path] .'/'. $list[$i][file][1][file];
}elseif ($list[$i][file][2][file]){
$file = $list[$i][file][2][path] .'/'. $list[$i][file][2][file];
}else{
$file = $list[$i][file][0][path] .'/'. $list[$i][file][0][file];
}
// getimage
if (preg_match("/\.(jp[e]?g|gif|png)$/i", $file) && file_exists($file)) {
$size = getimagesize($file);
if ($size[2] == 1)
$src = imagecreatefromgif($file);
else if ($size[2] == 2)
$src = imagecreatefromjpeg($file);
else if ($size[2] == 3)
$src = imagecreatefrompng($file);
else
break;

$rate = $zp_thumb_width / $size[0];
$height = (int)($size[1] * $rate);

if ($height < $zp_thumb_height)
    $dst = imagecreatetruecolor($zp_thumb_width, $height);
else
    $dst = imagecreatetruecolor($zp_thumb_width, $zp_thumb_height);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $zp_thumb_width, $height, $size[0], $size[1]);
//imagepng($dst, $thumb_path.'/'.$list[$i][wr_id].'.'.jpg, $zp_thumb_quality);
imagejpeg($dst, $thumb_path.'/'.$list[$i][wr_id].'.'.jpg, $zp_thumb_height);
chmod($thumb_path.'/'.$list[$i][wr_id].'.'.jpg, 0606);
}
}
} else if ($zp_board[zp_thumb] == "2") {
$thumb = $thumb_path.'/'.$list[$i][wr_id].'.'.jpg;
// thumb
if (!file_exists($thumb)) {
if ($list[$i][file][0][file]){
$file = $list[$i][file][0][path] .'/'. $list[$i][file][0][file];
}elseif ($list[$i][file][1][file]){
$file = $list[$i][file][1][path] .'/'. $list[$i][file][1][file];
}elseif ($list[$i][file][2][file]){
$file = $list[$i][file][2][path] .'/'. $list[$i][file][2][file];
}else{
$file = $list[$i][file][0][path] .'/'. $list[$i][file][0][file];
}
// getimage
if (preg_match("/\.(jp[e]?g|gif|png)$/i", $file) && file_exists($file)) {
$size = getimagesize($file);
if ($size[2] == 1)
$src = imagecreatefromgif($file);
else if ($size[2] == 2)
$src = imagecreatefromjpeg($file);
else if ($size[2] == 3)
$src = imagecreatefrompng($file);
else
break;

$rate = $zp_thumb_height / $size[1];
$width = (int)($size[0] * $rate);
       
//echo "rate : $rate ,width : $width, $height : $board[bo_2] <br>";
if($width <= $zp_thumb_width) { //width가 지정된 사이즈보다 작을경우 rate 비율로 썸네일 생성
    $dst = imagecreatetruecolor($width, $zp_thumb_height);
    imagecopyresampled($dst, $src, 0, 0, 0, 0, $width, $zp_thumb_height, $size[0], $size[1]);
    imagejpeg($dst, $thumb_path.'/'.$list[$i][wr_id].'.'.jpg, $zp_thumb_height);
} else {
    $rate = $zp_thumb_width / $size[0];
    $height = (int)($size[1] * $rate);

    $dst = imagecreatetruecolor($zp_thumb_width, $height);
    imagecopyresampled($dst, $src, 0, 0, 0, 0, $zp_thumb_width, $height, $size[0], $size[1]);
    imagejpeg($dst, $thumb_path.'/'.$list[$i][wr_id].'.'.jpg, $zp_thumb_height);
}
chmod($thumb_path.'/'.$list[$i][wr_id].'.'.jpg, 0606);
}
}
}
    // thumb
    if (file_exists($thumb))
    $img = "<img src='$thumb' border='0' style='vertical-align:middle;'>";
    else
    if(preg_match("/\.(swf|wma|asf)$/i","$file") && file_exists($file))
    { $img = "<script>doc_write(flash_movie('$file', 'flash$i', '$zp_thumb_width', '$zp_thumb_height', 'transparent'));</script>"; }


    $style = "";
    if ($list[$i][is_notice]) $style = " style='font-weight:bold;'";

    $subject = "<span $style>".cut_str($list[$i][subject],60)."</span>";

    $comment_cnt = "";
    if ($list[$i][comment_cnt])
    $comment_cnt = " <a href=\"{$list[$i][comment_href]}\"><span class='small' style='color:#EE5A00;'>{$list[$i][comment_cnt]}</span></a>";
    $wr_datetime = date("Y-m-d", strtotime($list[$i][wr_datetime]));

    echo "<td width='{$td_width}%' align='center' valign='top'>";
    if (file_exists($thumb)) {
    echo "<table>";
    if ($zp_list_date) {
    echo"<tr><td align='right'>{$wr_datetime}</td></tr>";
    }
    echo "<tr><td class='list_img_bg'>";
    echo "<a href='{$list[$i][href]}'>$img</a>";
    echo "</td></tr></table>";
    }
    echo "<table><tr><td align=center style='padding:0 5px;'><a href='{$list[$i][href]}'>$subject</a>{$comment_cnt}";
    if ($zp_list_name) {
    echo"<br />{$list[$i][name]}";
    }
    echo"</td></tr>";
    if ($is_category) echo "<tr><td align=center><span class=small><font color=gray>[<a href='{$list[$i][ca_name_href]}'>{$list[$i][ca_name]}</a>]</font></span></a></td></tr>";
    if ($is_checkbox) echo "<tr><td align=center><input type=checkbox name=chk_wr_id[] value='{$list[$i][wr_id]}'></td></tr>";
    echo "<tr><td height=5></td></tr>";
    echo "</table></td>\n";
    }

    // td
    $cnt = $i%$mod;
    if ($cnt)
    for ($i=$cnt; $i<$mod; $i++)
    echo "<td width='{$td_width}%'>&nbsp;</td>";
    ?>
</tr>
</tbody>
</table>
<? if (count($list) == 0) { echo "<div style='padding:30px; text-align:center;'>There are no post</div>"; } ?>
</form>
<!-- // fboardlist -->

<div style="border-bottom:1px solid #5E5E5E;"></div>

<!-- board_page -->
<div class="board_page">
<? if ($prev_part_href) { echo "<input type='button' value='이전' onclick=\"document.location.href='$prev_part_href';\" class='button00 bold' style='width:44px;'>"; } ?>
<?
//echo $write_pages;
$write_pages = str_replace("처음", "처음", $write_pages);
$write_pages = str_replace("이전", "이전", $write_pages);
$write_pages = str_replace("다음", "다음", $write_pages);
$write_pages = str_replace("마지막", "마지막", $write_pages);
//$write_pages = preg_replace("/<span>([0-9]*)<\/span>/", "$1", $write_pages);
$write_pages = preg_replace("/<b>([0-9]*)<\/b>/", "<b><span style=\"color:#4d6185; text-decoration:underline\">$1</span></b>", $write_pages);
?>
<?=$write_pages?>
<? if ($next_part_href) { echo "<input type='button' value='다음' onclick=\"document.location.href='$next_part_href';\" class='button00 bold' style='width:44px;'>"; } ?>
</div>
<!-- // board_page -->
<!-- bottom,search -->
<!-- bottom -->
<div class="board_button">
    <div style="float:left;">
    <? if ($list_href) { ?>
    <input type="button" value="목록" onclick="document.location.href='<?=$list_href?>';" class="button00 bold" style="width:44px;">
    <? } ?>
    <? if ($is_checkbox) { ?>
    <input type="button" value="선택삭제" onclick="javascript:select_delete();" class="button00" style="width:64px">
    <input type="button" value="선택복사" onclick="javascript:select_copy('copy');" class="button00" style="width:64px">
    <input type="button" value="선택이동" onclick="javascript:select_copy('move');" class="button00" style="width:64px">
    <? } ?>
    <? if ($write_href) { ?><input type="button" value="글쓰기" onclick="document.location.href='<?=$write_href?>';" class="button00_b bold" style="width:70px; padding:0 0 0 15px;"><? } ?>
    </div>
</div>
<!-- // bottom -->
<!-- search -->
<div class="board_search">
    <form name="fsearch" method="get">
<div style="float:left; padding:5px 5px 0 0;">
    <input type="hidden" name="bo_table" value="<?=$bo_table?>">
    <input type="hidden" name="sca" value="<?=$sca?>">
    <input type="hidden" name="sop" value="and">
    <select name="sfl">
    <option value="wr_subject">제목</option>
    <option value="wr_content">내용</option>
    <option value="wr_subject||wr_content">제목+내용</option>
    <option value="mb_id,1">회원아이디</option>
    <option value="mb_id,0">회원아이디(코)</option>
    <option value="wr_name,1">글쓴이</option>
    <option value="wr_name,0">글쓴이(코)</option>
    </select>
    <input type="text" name="stx" maxlength="15" class="text" value='<?=$stx?>'>
</div>
<div style="float:left; padding:5px 0 0 0;">
    <input type="image" src="<?=$g4['path']?>/Templates/<?=$config['zncf_templates']?>/img/btn_search03.gif" border="0" style="vertical-align:middle;" alt="검색">
    <!--<input type="submit" class="button03 bold" value="검색">-->
</div>
    </form>
</div>
<!-- // search -->
<!-- // bottom,search -->

<script type="text/javascript">
if ('<?=$sca?>') document.fcategory.sca.value = '<?=$sca?>';
if ('<?=$stx?>') {
    document.fsearch.sfl.value = '<?=$sfl?>';
}
</script>

<? if ($is_checkbox) { ?>
<script type="text/javascript">
function all_checked(sw) {
    var f = document.fboardlist;

    for (var i=0; i<f.length; i++) {
        if (f.elements[i].name == "chk_wr_id[]")
            f.elements[i].checked = sw;
    }
}

function check_confirm(str) {
    var f = document.fboardlist;
    var chk_count = 0;

    for (var i=0; i<f.length; i++) {
        if (f.elements[i].name == "chk_wr_id[]" && f.elements[i].checked)
            chk_count++;
    }

    if (!chk_count) {
        alert(str + "할 게시물을 하나 이상 선택하세요.");
        return false;
    }
    return true;
}

// select_delete
function select_delete() {
    var f = document.fboardlist;

    str = "삭제";
    if (!check_confirm(str))
        return;

    if (!confirm("선택한 게시물을 정말 "+str+" 하시겠습니까?\n\n한번 "+str+"한 자료는 복구할 수 없습니다"))
        return;

    f.action = "./delete_all.php";
    f.submit();
}

// select_copy
function select_copy(sw) {
    var f = document.fboardlist;

    if (sw == "copy")
        str = "복사";
    else
        str = "이동";

    if (!check_confirm(str))
        return;

    var sub_win = window.open("", "move", "left=50, top=50, width=500, height=550, scrollbars=1");

    f.sw.value = sw;
    f.target = "move";
    f.action = "./move.php";
    f.submit();
}
</script>
<? } ?>
<!-- // list -->
</div>
  • 복사

댓글 전체

음... 뭔가 도움을 드리고 싶은데...
국어가 딸리는지 말을 이해를 잘 못하겠네요.. 제가 좀 딸립니다. 짜집퍼라. ^^

게시글 등록하실 때 링크를 걸 수 있는 필드가 글쓰기 하단에 두개 나오지요...
거기에 다른게시판의 url을 링크를 걸어두시고...
위 소스에서
<a href='{$list[$i][href]}'>$subject</a> 요런부분 군데군데 보입니다. $subject 대신 $img 가 있기도 하고 그렇네요... 요게 제목 클릭하면 상세보기로 이동... 하는 소스거든요...

<?
  if($list[$i][wr_link1]) $href = $list[$i][wr_link1];
  else $href = $list[$i][href];
?>
를 적당한 위치에 넣고...
<a href='{$list[$i][href]}'>$subject</a>  요런 부분을
<a href='{$href}'>$subject</a> 요렇게 바꿔보세요... 될 것 같은데요... ^^
제가 질문을 어렵게 한거 같습니다. ㅠ.ㅠ
정확히 말하자면
z2_06게시판의 wr_id=1글을 클릭시
z2_1게시판으로 링크걸고 싶은 겁니다. ㅠ.ㅠ
© SIRSOFT
현재 페이지 제일 처음으로