아래 전체 보드카테고리 메뉴에서 특정 그룹 제외는 어찌 구현해야 하는가요 ? 정보
아래 전체 보드카테고리 메뉴에서 특정 그룹 제외는 어찌 구현해야 하는가요 ?본문
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
?>
<!-- 디자인 부분 -->
<style type="text/css">
.menutitle{
cursor:pointer;
margin-bottom: 5px;
background-color:#CDCDCD;
color:#000000;
width:140px;
padding:2px;
text-align:left;
font-weight:bold;
border:0px solid #000000;
}
.submenu{
margin-bottom: 0.5em;
}
</style>
<script type="text/javascript">
var persistmenu="yes"
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");
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>
<?
global $g4;
$sql = " select * from $g4[board_table] where bo_list_level = '1' order by bo_subject ";
$result = sql_query($sql);
echo "<div id='masterdiv' align=center>";
$k="";
while ($row = mysql_fetch_array($result)) {
$k=$k+1;
if ($row[bo_use_category]==0) {
echo <<<HEREDOC
<div class="menutitle" onClick="location.href='$g4[bbs_path]/board.php?bo_table=$row[bo_table]'"> {$row[bo_subject]}</div>
<span class="submenu" id="sub$k"></span>
HEREDOC;
continue;
}
else {
echo <<<HEREDOC
<div class="menutitle" onclick="SwitchMenu('sub$k')"> {$row[bo_subject]}</div>
<span class="submenu" id="sub$k">
HEREDOC;
$arr = explode("|", $row[bo_category_list]); // 구분자가 , 로 되어 있음
echo <<<HEREDOC
<A HREF="$g4[bbs_path]/board.php?bo_table=$row[bo_table]&sca=">전체</A><br>
HEREDOC;
for ($i=0; $i<count($arr); $i++)
if (trim($arr[$i])) {
echo <<<HEREDOC
<A HREF="$g4[bbs_path]/board.php?bo_table=$row[bo_table]&sca=$arr[$i]">{$arr[$i]}</A><br>
HEREDOC;
}
echo "</span>";
}
}
echo "</div> ";
mysql_free_result($result);
?>
============================================================
어느 고수님의 메뉴스킨인데요 ..
특정 그룹 제외는 어찌 해야 하는가요 ?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
?>
<!-- 디자인 부분 -->
<style type="text/css">
.menutitle{
cursor:pointer;
margin-bottom: 5px;
background-color:#CDCDCD;
color:#000000;
width:140px;
padding:2px;
text-align:left;
font-weight:bold;
border:0px solid #000000;
}
.submenu{
margin-bottom: 0.5em;
}
</style>
<script type="text/javascript">
var persistmenu="yes"
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");
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>
<?
global $g4;
$sql = " select * from $g4[board_table] where bo_list_level = '1' order by bo_subject ";
$result = sql_query($sql);
echo "<div id='masterdiv' align=center>";
$k="";
while ($row = mysql_fetch_array($result)) {
$k=$k+1;
if ($row[bo_use_category]==0) {
echo <<<HEREDOC
<div class="menutitle" onClick="location.href='$g4[bbs_path]/board.php?bo_table=$row[bo_table]'"> {$row[bo_subject]}</div>
<span class="submenu" id="sub$k"></span>
HEREDOC;
continue;
}
else {
echo <<<HEREDOC
<div class="menutitle" onclick="SwitchMenu('sub$k')"> {$row[bo_subject]}</div>
<span class="submenu" id="sub$k">
HEREDOC;
$arr = explode("|", $row[bo_category_list]); // 구분자가 , 로 되어 있음
echo <<<HEREDOC
<A HREF="$g4[bbs_path]/board.php?bo_table=$row[bo_table]&sca=">전체</A><br>
HEREDOC;
for ($i=0; $i<count($arr); $i++)
if (trim($arr[$i])) {
echo <<<HEREDOC
<A HREF="$g4[bbs_path]/board.php?bo_table=$row[bo_table]&sca=$arr[$i]">{$arr[$i]}</A><br>
HEREDOC;
}
echo "</span>";
}
}
echo "</div> ";
mysql_free_result($result);
?>
============================================================
어느 고수님의 메뉴스킨인데요 ..
특정 그룹 제외는 어찌 해야 하는가요 ?
댓글 전체
단순한 방법으로 아래처럼 제외할 그룹에 그룹 아이디($gr_id)를 대입해주면 됩니다.
//$sql = " select * from $g4[board_table] where bo_list_level = '1' order by bo_subject ";
$sql = " select * from $g4[board_table]
where gr_id <> '제외할 그룹1'
and gr_id <> '제외할 그룹2'
and gr_id <> '제외할 그룹3'
and gr_id <> '제외할 그룹4'
order by bo_subject ";//게시판 이름순으로 정렬
//$sql = " select * from $g4[board_table] where bo_list_level = '1' order by bo_subject ";
$sql = " select * from $g4[board_table]
where gr_id <> '제외할 그룹1'
and gr_id <> '제외할 그룹2'
and gr_id <> '제외할 그룹3'
and gr_id <> '제외할 그룹4'
order by bo_subject ";//게시판 이름순으로 정렬