카테고리별로 wr_id 추출하려면? > 그누4 질문답변

그누4 질문답변

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

카테고리별로 wr_id 추출하려면? 정보

카테고리별로 wr_id 추출하려면?

본문

질문제목이 적절할지 모르겠습니다.
질문은 다음과 같습니다.

균이님의 갤러리 스킨을 사용하려고 합니다.
http://sir.co.kr/bbs/board.php?bo_table=g4_skin&wr_id=104255&sca=%EA%B0%A4%EB%9F%AC%EB%A6%AC&sfl=wr_subject%7C%7Cwr_content&stx=%ED%8F%AC%ED%8A%B8%ED%8F%B4%EB%A6%AC%EC%98%A4&sop=and

왼쪽 메뉴를 카테고리별 리스트로 표현하려고 카테고리별 최신글 뽑아오는
국경의남쪽님 팁을 사용하였습니다.
http://sir.co.kr/bbs/board.php?bo_table=g4_tiptech&wr_id=24310&sca=&sfl=wr_subject%7C%7Cwr_content&stx=%EC%B9%B4%ED%85%8C%EA%B3%A0%EB%A6%AC&sop=and

그런데 리스트가 너무 많아서 아래와 같이 트리메뉴를 사용하였습니다.
카테고리별로 리스트를 추출하고 트리메뉴도 잘 작동합니다.
그런데 카테고리별 리스트의 링크주소가 중복되어 나타납니다.
링크의 listNum=<?=$i?> 요것이 문제지요.
균이님 스킨을 보면 이런 게 있습니다.
$update_href="$g4[bbs_path]/write.php?w=u&bo_table=$bo_table&wr_id={$list[$listNum][wr_id]}";
아마도 이걸로 게시물번호를 대체하는 것 같은데요
카테고리별로 이 번호를 뽑아서 제대로 링크를 걸어주려면 어떻게 해야 할까요.

링크1은 구축중인 제 홈피이고
링크2는 균이님 스킨입니다.

<? // 트리메뉴 시작?>
<style type="text/css">
A:link {color:#000000; text-decoration:none}
A:visited {color:#000000; text-decoration:none}
A:active {color:#000000; text-decoration:none}
A:hover {color:#0000ff; text-decoration:none}
.submenu{
margin-bottom: 0.5em;
}
</style>

<script type="text/javascript">
var persistmenu="yes" //"yes" or "no".
var persisttype="sitewide"

if (document.getElementById){
document.write('<style type="text/css">\n')
document.write('.submenu{display: none;}\n')
document.write('</style>\n')
}

function SwitchMenu(obj){
if(document.getElementById){
var el = document.getElementById(obj);
var ar = document.getElementById("masterdiv").getElementsByTagName("span"); //DynamicDrive.com change
if(el.style.display != "block"){
for (var i=0; i<ar.length; i++){
if (ar[i].className=="submenu")
ar[i].style.display = "none";
}
el.style.display = "block";
}else{
el.style.display = "none";
}
}
}

function get_cookie(Name) {
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) {
offset += search.length
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}

function onloadfunction(){
if (persistmenu=="yes"){
var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname
var cookievalue=get_cookie(cookiename)
if (cookievalue!="")
document.getElementById(cookievalue).style.display="block"
}
}

function savemenustate(){
var inc=1, blockid=""
while (document.getElementById("sub"+inc)){
if (document.getElementById("sub"+inc).style.display=="block"){
blockid="sub"+inc
break
}
inc++
}
var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname
var cookievalue=(persisttype=="sitewide")? blockid+";path=/" : blockid
document.cookie=cookiename+"="+cookievalue
}

if (window.addEventListener)
window.addEventListener("load", onloadfunction, false)
else if (window.attachEvent)
window.attachEvent("onload", onloadfunction)
else if (document.getElementById)
window.onload=onloadfunction

if (persistmenu=="yes" && document.getElementById)
window.onunload=savemenustate

</script>

<div id="masterdiv">

<? if($ca_name=="상업시설") { ?>
<div class="menutitle" onclick="SwitchMenu('sub1')" style="cursor:hand">&nbsp;&nbsp;<strong><?=$ca_name?></strong></div>
<span class="submenu" id="sub1">
<?for($i=0; $i<count($list); $i++){
if($listNum==$i) $class='ctitle'; else $class='title';
?><div class='<?=$class?>' onmouseover="this.className='ctitle';" onmouseout="title_mout(<?=$i?>,this);" onmousedown="location.href='board.php?bo_table=<?=$bo_table?>&listNum=<?=$i?>&page=<?=$page?>';">
》<?=$list[$i][wr_subject]?></div>
<?} ?>
</span>
<?} ?>

<? if($ca_name=="업무시설") { ?>
<div class="menutitle" onclick="SwitchMenu('sub2')" style="cursor:hand">&nbsp;&nbsp;<strong><?=$ca_name?></strong></div>
<span class="submenu" id="sub2">
<?for($i=0; $i<count($list); $i++){
if($listNum==$i) $class='ctitle'; else $class='title';
?><div class='<?=$class?>' onmouseover="this.className='ctitle';" onmouseout="title_mout(<?=$i?>,this);" onmousedown="location.href='board.php?bo_table=<?=$bo_table?>&listNum=<?=$i?>&page=<?=$page?>';">
》<?=$list[$i][wr_subject]?></div>
<?} ?>
</span>
<?} ?>

<? if($ca_name=="산업시설") { ?>
<div class="menutitle" onclick="SwitchMenu('sub3')" style="cursor:hand">&nbsp;&nbsp;<strong><?=$ca_name?></strong></div>
<span class="submenu" id="sub3">
<?for($i=0; $i<count($list); $i++){
if($listNum==$i) $class='ctitle'; else $class='title';
?><div class='<?=$class?>' onmouseover="this.className='ctitle';" onmouseout="title_mout(<?=$i?>,this);" onmousedown="location.href='board.php?bo_table=<?=$bo_table?>&listNum=<?=$i?>&page=<?=$page?>';">
》<?=$list[$i][wr_subject]?></div>
<?} ?>
</span>
<?} ?>

</div>

Fatal error: Uncaught TypeError: mysqli_fetch_assoc(): Argument #1 ($result) must be of type mysqli_result, null given in /home/kagla/new-sir/old/lib/common.lib.php:2339 Stack trace: #0 /home/kagla/new-sir/old/lib/common.lib.php(2339): mysqli_fetch_assoc() #1 /home/kagla/new-sir/old/skin/board/v16/view.skin.php(795): sql_fetch_array() #2 /home/kagla/new-sir/old/bbs/view.php(403): include_once('...') #3 /home/kagla/new-sir/old/bbs/board.php(300): include_once('...') #4 {main} thrown in /home/kagla/new-sir/old/lib/common.lib.php on line 2339