최신글에서 관리자에게만 링크를! 정보
최신글에서 관리자에게만 링크를!본문
skin/latest/basic
최신글에서 관리자에게만 링크를 보이도록 하기 위해
<? if ($is_admin == "super" || $is_auth) { ?>내용<? } ?>
등을 참고하여 최신글에서 관리자에게만 링크를 보이도록 하기 위해 여러 가지를 해 보았지만 되지 않는군요.
어떤 방법이 있다면 도움 부탁드립니다.
댓글 전체
lib/latest.lib.php에
현재 global $g4; 를
global $g4, $is_admin, $member; 로 바꾸어 보세요....$is_admin만 추가하셔도 됩니다.
$member은 추후 회원에 대해 적용시 참조하시라고....^^
현재 global $g4; 를
global $g4, $is_admin, $member; 로 바꾸어 보세요....$is_admin만 추가하셔도 됩니다.
$member은 추후 회원에 대해 적용시 참조하시라고....^^
아하! 명쾌한 답변 감사합니다. ^^;
음...; 천상재회 님 말씀대로 lib의 latest.lib.php에 $is_admin 을 추가하였습니다만
관리자인 것을 인식하지 못하네요.
아웃로그인과 최근게시물이 같이 나오는데 아웃로그인만 관리자임을 인식하고...
<? if ($is_admin == "admin" || $is_auth) { ?>
<span class='member'><strong><?=$nick?></strong></span>님
<?} else { ?><span class='member'><strong><?=$nick?></strong></span>님sd<? } ?>
관리자인 것을 인식하지 못하네요.
아웃로그인과 최근게시물이 같이 나오는데 아웃로그인만 관리자임을 인식하고...
<? if ($is_admin == "admin" || $is_auth) { ?>
<span class='member'><strong><?=$nick?></strong></span>님
<?} else { ?><span class='member'><strong><?=$nick?></strong></span>님sd<? } ?>
<? if ($is_admin == "admin" || $is_auth) { ?> 에서 $is_admin == "admin" 가 무엇을 뜻하는 지요...?
제가 답을 드린부분과 상이 합니다만.....ㅠ.ㅠ
lib/latest.lib.php 입니다..
<?
if (!defined('_GNUBOARD_')) exit;
// 최신글 추출
function latest($skin_dir="", $bo_table, $rows=10, $subject_len=40, $options="")
{
global $g4, $is_admin, $member;
if ($skin_dir)
$latest_skin_path = "$g4[path]/skin/latest/$skin_dir";
else
$latest_skin_path = "$g4[path]/skin/latest/basic";
$list = array();
$sql = " select * from $g4[board_table] where bo_table = '$bo_table'";
$board = sql_fetch($sql);
$tmp_write_table = $g4['write_prefix'] . $bo_table; // 게시판 테이블 전체이름
$sql = " select * from $tmp_write_table where wr_is_comment = 0 order by wr_id desc limit 0, $rows ";
//explain($sql);
$result = sql_query($sql);
for ($i=0; $row = sql_fetch_array($result); $i++)
$list[$i] = get_list($row, $board, $latest_skin_path, $subject_len);
ob_start();
include "$latest_skin_path/latest.skin.php";
$content = ob_get_contents();
ob_end_clean();
return $content;
}
?>
제가 배포한 최신글 스킨에 관리자라면 bold를 접목해 테스트 한 것입니다. 정상 동작합니다.
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
?>
<table width='100%' cellpadding='0' cellspacing='0'>
<tr height='25'>
<td align="left" bgcolor='#f6f6f6' style="padding-left:10px;cursor:pointer;cursor:hand;border:1px solid #dfdfdf;" onClick="javascript:location.href='<?=$g4[bbs_path]?>/board.php?bo_table=<?=$bo_table?>'">▒ <strong><font color='#bbbbbb'><?=$board['bo_subject']?></font></strong></td>
</tr>
<?// echo"$board[bo_category_list]"; ?>
<? for ($i=0; $i<count($list); $i++) { ?>
<tr height='25'>
<td align="left" style="padding-left:10px;word-break:break-all;cursor:pointer;cursor:hand;border-bottom:1px solid #BFBFBF;" onClick="javascript:location.href='<?=$list[$i][href]?>';"><font color='orange'>+</font> <font color='#aaaaaa'><? if($is_admin) { ?><b><? } ?><?=$list[$i][subject]?><? if($is_admin) { ?></b><? } ?></font> <font color='#999999'><sup><?=$list[$i][comment_cnt]?></sup></font> <? if($list[$i][icon_new]) echo "<font color='#ff8040'><sup>new</sup></font>"; ?></td>
</tr>
<? } ?>
<? if (count($list) == 0) { ?><tr><td align='center' height='100'><font color='#6A6A6A'>게시물이 없습니다.</td></tr><? } ?>
</table>
제가 답을 드린부분과 상이 합니다만.....ㅠ.ㅠ
lib/latest.lib.php 입니다..
<?
if (!defined('_GNUBOARD_')) exit;
// 최신글 추출
function latest($skin_dir="", $bo_table, $rows=10, $subject_len=40, $options="")
{
global $g4, $is_admin, $member;
if ($skin_dir)
$latest_skin_path = "$g4[path]/skin/latest/$skin_dir";
else
$latest_skin_path = "$g4[path]/skin/latest/basic";
$list = array();
$sql = " select * from $g4[board_table] where bo_table = '$bo_table'";
$board = sql_fetch($sql);
$tmp_write_table = $g4['write_prefix'] . $bo_table; // 게시판 테이블 전체이름
$sql = " select * from $tmp_write_table where wr_is_comment = 0 order by wr_id desc limit 0, $rows ";
//explain($sql);
$result = sql_query($sql);
for ($i=0; $row = sql_fetch_array($result); $i++)
$list[$i] = get_list($row, $board, $latest_skin_path, $subject_len);
ob_start();
include "$latest_skin_path/latest.skin.php";
$content = ob_get_contents();
ob_end_clean();
return $content;
}
?>
제가 배포한 최신글 스킨에 관리자라면 bold를 접목해 테스트 한 것입니다. 정상 동작합니다.
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
?>
<table width='100%' cellpadding='0' cellspacing='0'>
<tr height='25'>
<td align="left" bgcolor='#f6f6f6' style="padding-left:10px;cursor:pointer;cursor:hand;border:1px solid #dfdfdf;" onClick="javascript:location.href='<?=$g4[bbs_path]?>/board.php?bo_table=<?=$bo_table?>'">▒ <strong><font color='#bbbbbb'><?=$board['bo_subject']?></font></strong></td>
</tr>
<?// echo"$board[bo_category_list]"; ?>
<? for ($i=0; $i<count($list); $i++) { ?>
<tr height='25'>
<td align="left" style="padding-left:10px;word-break:break-all;cursor:pointer;cursor:hand;border-bottom:1px solid #BFBFBF;" onClick="javascript:location.href='<?=$list[$i][href]?>';"><font color='orange'>+</font> <font color='#aaaaaa'><? if($is_admin) { ?><b><? } ?><?=$list[$i][subject]?><? if($is_admin) { ?></b><? } ?></font> <font color='#999999'><sup><?=$list[$i][comment_cnt]?></sup></font> <? if($list[$i][icon_new]) echo "<font color='#ff8040'><sup>new</sup></font>"; ?></td>
</tr>
<? } ?>
<? if (count($list) == 0) { ?><tr><td align='center' height='100'><font color='#6A6A6A'>게시물이 없습니다.</td></tr><? } ?>
</table>
천상재회 님의 말씀대로 적용하고
천상재회 님의 최근게시물을 그대로 해보았지만 볼드체로 나타나지 않는 것으로 보아(관리자 게시물임에 불구하고)
서버에 어떤 문제가 있다던지.. 싶습니다. ^^;
(올려주신 소스 그대로 복사해서도 해 보았습니다만..)
<? if($is_admin) { ?>관리자<?} else { ?>일반사용자<? } ?>
skin/latest/basic/latest.skin.php에 이렇게 넣어서 테스트 해보고 있습니다만
이 소스를 skin/outlogin/basic/outlogin.skin.php 에 넣으면 관리자 라고 잘 나오지만
skin/latest/basic/latest.skin.php에서는 일반사용자 라는 말이 나오며 절 우울하게 만드네요.
설마.. 싶어서 아웃로그인을 지우고 최근게시물만 작동시켜보아도
최근게시물만 나오게 php를 작성하여 실행해 보아도 관리자를 구분 못하는군요.
서버.. 문제라고 하기에는 '그건 아닌거 같은데' 생각이 들지만
개인적인 문제인 것 같으니 이리저리 삽질해 보도록 하겠습니다.
테스트까지 해 주셔서 감사합니다. ^^
천상재회 님의 최근게시물을 그대로 해보았지만 볼드체로 나타나지 않는 것으로 보아(관리자 게시물임에 불구하고)
서버에 어떤 문제가 있다던지.. 싶습니다. ^^;
(올려주신 소스 그대로 복사해서도 해 보았습니다만..)
<? if($is_admin) { ?>관리자<?} else { ?>일반사용자<? } ?>
skin/latest/basic/latest.skin.php에 이렇게 넣어서 테스트 해보고 있습니다만
이 소스를 skin/outlogin/basic/outlogin.skin.php 에 넣으면 관리자 라고 잘 나오지만
skin/latest/basic/latest.skin.php에서는 일반사용자 라는 말이 나오며 절 우울하게 만드네요.
설마.. 싶어서 아웃로그인을 지우고 최근게시물만 작동시켜보아도
최근게시물만 나오게 php를 작성하여 실행해 보아도 관리자를 구분 못하는군요.
서버.. 문제라고 하기에는 '그건 아닌거 같은데' 생각이 들지만
개인적인 문제인 것 같으니 이리저리 삽질해 보도록 하겠습니다.
테스트까지 해 주셔서 감사합니다. ^^
<?
include_once("./_common.php");
include_once("$g4[path]/lib/latest.lib.php");
?>
<? if($is_admin) { ?>1<?} else { ?>2<? } ?>
이런 페이지를 만들어 실행시켰을 때
1 이 잘 나오는 것을 보면 latest.lib.php 에는 문제가 없는 것 같고
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
?>
<? if($is_admin) { ?>1<?} else { ?>2<? } ?>
skin/latest/basic/latest.skin.php 를 이렇게 작성하였을 때 2가 나오는 것을 보면
include_once("./_common.php");
include_once("$g4[path]/lib/latest.lib.php");
?>
<? if($is_admin) { ?>1<?} else { ?>2<? } ?>
이런 페이지를 만들어 실행시켰을 때
1 이 잘 나오는 것을 보면 latest.lib.php 에는 문제가 없는 것 같고
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
?>
<? if($is_admin) { ?>1<?} else { ?>2<? } ?>
skin/latest/basic/latest.skin.php 를 이렇게 작성하였을 때 2가 나오는 것을 보면