질문드립니다~
본문
레벨을 이름으로 바꾸는데요 아래 팁자료실에서 찾아봤는데 오류가납니다
https://sir.kr/g5_tip/4372?sfl=wr_subject%7C%7Cwr_content&stx=%ED%9A%8C%EC%9B%90%EB%93%B1%EA%B8%89
수정하려는페에지 adm>admin.lib.php에서
// 회원권한을 SELECT 형식으로 얻음
function get_member_level_select($name, $start_id=0, $end_id=10, $selected="", $event="")
{
global $g5;
$str = "\n<select id=\"{$name}\" name=\"{$name}\"";
if ($event) $str .= " $event";
$str .= ">\n";
for ($i=$start_id; $i<=$end_id; $i++) {
$str .= '<option value="'.$i.'"';
if ($i == $selected)
$str .= ' selected="selected"';
$str .= ">{$i}</option>\n";
}
$str .= "</select>\n";
return $str;
}
를 아래처럼 수정하는게 맞는건가요?
// 회원권한을 SELECT 형식으로 얻음
function get_member_level_select($name, $start_id=0, $end_id=10, $selected="", $event="")
{
global $g5;
$str = "\n if ($event) $str .= " $event";
$str .= ">\n";
for ($i=$start_id; $i<=$end_id; $i++) {
switch ($i)
{
case 1 : $userName = "비회원"; break;
case 2 : $userName = "일반회원"; break;
case 3 : $userName = "업체회원"; break;
case 10 : $userName = "관리자"; break;
default : $userName = ""; break;
}
if ($userName)
{
$str .= ' if ($i == $selected)
$str .= ' selected="selected"';
$str .= ">{$userName}\n";
}
}
$str .= "\n";
return $str;
}
답변 1
$levelArr= array('','비회원','일반회원','업체회원');
$levelArr[10] = '관리자';
for ($i=$start_id; $i<=$end_id; $i++) {
$str .= '<option value="'.$i.'"';
if ($i == $selected)
$str .= ' selected="selected"';
$str .= ">{$levelArr[$i]}</option>\n"; <=====수정된곳
}