레벨 아이콘 이미지 출력
본문
<?php
if (!defined('_GNUBOARD_')) exit;
// 포인트별 아이콘 부여
function get_level_icon($mb_id) {
global $g5;
$max_point = 1000; // 최저
$ren_point = 1000; // 나누기
$max_level = 101; // 마지막레벨
$mb = get_member($mb_id, "mb_id, mb_point");
$ic_mb_id = $mb['mb_id'];
$is_admin = is_admin($ic_mb_id);
if ($ic_mb_id) {
// 관리자
if ($is_admin == 'super') {
$mb_icon = "<img src='".G5_IMG_URL."/level/lv_admin.png' align='absmiddle' title='관리자'>";
//} else if ($ic_mb_id == 'test' || $ic_mb_id == 'test2') { // 특정회원들
// $mb_icon = "<img src='".G5_IMG_URL."/level/lv_special.png' align='absmiddle' title='특별회원'>";
} else {
$mb_point = $mb['mb_point'];
$point = ($mb_point < $max_point) ? $max_point : $mb_point; // 최저포인트 이하
$mb_level = (int)($point / $ren_point);
$level = ($mb_level > $max_level) ? $max_level : $mb_level; // 맥스레벨 까지만
$mb_icon = "<img src='".G5_IMG_URL."/level/".$level.".png' align='absmiddle' title='포인트레벨 ".$level."".number_format($mb_point)."점'>";
}
}
else {
// 비회원
$mb_icon = "<img src='".G5_IMG_URL."/level/lv_guest.png' align='absmiddle' title='손님'>";
}
return $mb_icon;
//echo $mb_icon;
}
?>
1레벨은 재대로 적용 되는데 다른레벨도 1레벨로 아이콘이 표기 되는데 어떤게 문제인지..
초보자라 이런문의 드려서 죄송합니다.
!-->답변 6
$mb_level = (int)($point / $ren_point);
1300 EXP 니까 1.3이 나오고 int선언하니까 1이 나오는게 맞습니다.
ceil로 올림처리 하시거나 +1을 해주시는 형태로 변경하셔야 원하시는
형태가 될것 같습니다
소스에는 전혀 문제가 없고요
추측으론 이미지 경로 문제거나
저 함수를 불러오는 곳이 잘못될 가능성이 큽니다
<?php
if (!defined('_GNUBOARD_')) exit;
// 포인트별 아이콘 부여
function get_level_icon($mb_id) {
global $g5;
$max_point = 1000; // 최저
$ren_point = 1000; // 나누기
$max_level = 101; // 마지막레벨
$mb = get_member($mb_id, "mb_id, mb_point");
$ic_mb_id = $mb['mb_id'];
$is_admin = is_admin($ic_mb_id);
if ($ic_mb_id) {
// 관리자
if ($is_admin == 'super') {
$mb_icon = "<img src='".G5_IMG_URL."/level/lv_admin.png' align='absmiddle' title='관리자'>";
//} else if ($ic_mb_id == 'test' || $ic_mb_id == 'test2') { // 특정회원들
// $mb_icon = "<img src='".G5_IMG_URL."/level/lv_special.png' align='absmiddle' title='특별회원'>";
} else {
$mb_point = $mb['mb_point'];
$point = ($mb_point < $max_point) ? $max_point : $mb_point; // 최저포인트 이하
if ($mb_point >= 606000) $level = 101;
else if ($mb_point >= 595000) $level = 100;
else if ($mb_point >= 584100) $level = 99;
else if ($mb_point >= 573300) $level = 98;
else if ($mb_point >= 562600) $level = 97;
else if ($mb_point >= 552000) $level = 96;
else if ($mb_point >= 541500) $level = 95;
else if ($mb_point >= 531100) $level = 94;
else if ($mb_point >= 520800) $level = 93;
else if ($mb_point >= 510600) $level = 92;
else if ($mb_point >= 500500) $level = 91;
else if ($mb_point >= 490500) $level = 90;
else if ($mb_point >= 490500) $level = 89;
else if ($mb_point >= 470800) $level = 88;
else if ($mb_point >= 461100) $level = 87;
else if ($mb_point >= 451500) $level = 86;
else if ($mb_point >= 442000) $level = 85;
else if ($mb_point >= 432600) $level = 84;
else if ($mb_point >= 423300) $level = 83;
else if ($mb_point >= 423300) $level = 82;
else if ($mb_point >= 405000) $level = 81;
else if ($mb_point >= 396000) $level = 80;
else if ($mb_point >= 387100) $level = 79;
else if ($mb_point >= 378300) $level = 78;
else if ($mb_point >= 369600) $level = 77;
else if ($mb_point >= 361000) $level = 76;
else if ($mb_point >= 352500) $level = 75;
else if ($mb_point >= 344100) $level = 74;
else if ($mb_point >= 335800) $level = 73;
else if ($mb_point >= 327600) $level = 72;
else if ($mb_point >= 319500) $level = 71;
else if ($mb_point >= 311500) $level = 70;
else if ($mb_point >= 303600) $level = 69;
else if ($mb_point >= 295800) $level = 68;
else if ($mb_point >= 288100) $level = 67;
else if ($mb_point >= 280500) $level = 66;
else if ($mb_point >= 273000) $level = 65;
else if ($mb_point >= 265600) $level = 64;
else if ($mb_point >= 258300) $level = 63;
else if ($mb_point >= 251100) $level = 62;
else if ($mb_point >= 244000) $level = 61;
else if ($mb_point >= 237000) $level = 60;
else if ($mb_point >= 230100) $level = 59;
else if ($mb_point >= 223300) $level = 58;
else if ($mb_point >= 216600) $level = 57;
else if ($mb_point >= 210000) $level = 56;
else if ($mb_point >= 203500) $level = 55;
else if ($mb_point >= 197100) $level = 54;
else if ($mb_point >= 190800) $level = 53;
else if ($mb_point >= 184600) $level = 52;
else if ($mb_point >= 178500) $level = 51;
else if ($mb_point >= 172500) $level = 50;
else if ($mb_point >= 166600) $level = 49;
else if ($mb_point >= 160800) $level = 48;
else if ($mb_point >= 155100) $level = 47;
else if ($mb_point >= 149500) $level = 46;
else if ($mb_point >= 144000) $level = 45;
else if ($mb_point >= 138600) $level = 44;
else if ($mb_point >= 133300) $level = 43;
else if ($mb_point >= 128100) $level = 42;
else if ($mb_point >= 123000) $level = 41;
else if ($mb_point >= 118000) $level = 40;
else if ($mb_point >= 113100) $level = 39;
else if ($mb_point >= 108300) $level = 38;
else if ($mb_point >= 103600) $level = 37;
else if ($mb_point >= 99000) $level = 36;
else if ($mb_point >= 94000) $level = 35;
else if ($mb_point >= 90000) $level = 34;
else if ($mb_point >= 85000) $level = 33;
else if ($mb_point >= 81600) $level = 32;
else if ($mb_point >= 77500) $level = 31;
else if ($mb_point >= 73500) $level = 30;
else if ($mb_point >= 69600) $level = 29;
else if ($mb_point >= 65800) $level = 28;
else if ($mb_point >= 62100) $level = 27;
else if ($mb_point >= 58500) $level = 26;
else if ($mb_point >= 55000) $level = 25;
else if ($mb_point >= 51600) $level = 24;
else if ($mb_point >= 48300) $level = 23;
else if ($mb_point >= 45100) $level = 22;
else if ($mb_point >= 42000) $level = 21;
else if ($mb_point >= 39000) $level = 20;
else if ($mb_point >= 36100) $level = 19;
else if ($mb_point >= 33300) $level = 18;
else if ($mb_point >= 30600) $level = 17;
else if ($mb_point >= 28000) $level = 16;
else if ($mb_point >= 25500) $level = 15;
else if ($mb_point >= 23100) $level = 14;
else if ($mb_point >= 20800) $level = 13;
else if ($mb_point >= 18600) $level = 12;
else if ($mb_point >= 16500) $level = 11;
else if ($mb_point >= 14500) $level = 10;
else if ($mb_point >= 12600) $level = 9;
else if ($mb_point >= 10800) $level = 8;
else if ($mb_point >= 9100) $level = 7;
else if ($mb_point >= 7500) $level = 6;
else if ($mb_point >= 6000) $level = 5;
else if ($mb_point >= 4600) $level = 4;
else if ($mb_point >= 3300) $level = 3;
else if ($mb_point >= 2100) $level = 2;
else if ($mb_point >= 4600) $level = 4;
else if ($mb_point >= 3300) $level = 3;
else if ($mb_point >= 2100) $level = 2;
else $level = 1;
$mb_icon = "<img src='".G5_IMG_URL."/level/".$level.".png' align='absmiddle' title='포인트레벨 ".$level."".number_format($mb_point)."점'>";
}
}
else {
// 비회원
$mb_icon = "<img src='".G5_IMG_URL."/level/lv_guest.png' align='absmiddle' title='손님'>";
}
return $mb_icon;
//echo $mb_icon;
}
?>
하... 다 넣어봤지만... 이번에는 깨지지는않는데 변화가 없네요
!-->이게 2100입니다
답변을 작성하시기 전에 로그인 해주세요.