"회원아이콘 뽑아오기" 다시 질문입니다. 정보
"회원아이콘 뽑아오기" 다시 질문입니다.
본문
member_icon.lib.php 파일을 만들고 extend 디렉토리에 넣은 다음, 적용하고자 하는 스킨의 view_comment.skin.php 파일에서 <?=member_icon($list[$i][mb_id])?> 이렇게 넣었습니다.
근데 회원아이콘이 안나옵니다.
아래 소스를 어떻게 수정하면 될지 고수님들의 도움을 기다립니다. ^^*
======================= member_icon.lib.php =======================
//회원아이콘 뽑아오기
function member_icon($mb_id) {
global $config;
global $g4;
$title_name1 = $name1;
if ($mb_id) {
$tmp_name1 = "<span class='member'>$name1</span>";
if ($config['cf_use_member_icon']) {
$mb_dir = substr($mb_id,0,2);
$icon_file = "$g4[path]/data/member/$mb_dir/$mb_id.gif";
if (file_exists($icon_file)) {
$width = $config['cf_member_icon_width'];
$height = $config['cf_member_icon_height'];
$tmp_name1 = "<img src='$icon_file' width='$width' height='$height' align='absmiddle' border='0'>";
if ($config['cf_use_member_icon'] == 1) // 회원아이콘
$tmp_name1 = $tmp_name1 . " <span class='member'>$name1</span>";
}
}
$title_mb_id = "[$mb_id]";
} else {
$tmp_name1 = "<span class='guest'>$name1</span>";
$title_mb_id = "[비회원]";
}
return "<a href=\"javascript:;\" onClick=\"showSideView(this, '$mb_id', '$name', '$email', '$homepage');\" title=\"{$title_mb_id}{$title_name}\">$tmp_name1</a>";
}
=========================================================================
근데 회원아이콘이 안나옵니다.
아래 소스를 어떻게 수정하면 될지 고수님들의 도움을 기다립니다. ^^*
======================= member_icon.lib.php =======================
//회원아이콘 뽑아오기
function member_icon($mb_id) {
global $config;
global $g4;
$title_name1 = $name1;
if ($mb_id) {
$tmp_name1 = "<span class='member'>$name1</span>";
if ($config['cf_use_member_icon']) {
$mb_dir = substr($mb_id,0,2);
$icon_file = "$g4[path]/data/member/$mb_dir/$mb_id.gif";
if (file_exists($icon_file)) {
$width = $config['cf_member_icon_width'];
$height = $config['cf_member_icon_height'];
$tmp_name1 = "<img src='$icon_file' width='$width' height='$height' align='absmiddle' border='0'>";
if ($config['cf_use_member_icon'] == 1) // 회원아이콘
$tmp_name1 = $tmp_name1 . " <span class='member'>$name1</span>";
}
}
$title_mb_id = "[$mb_id]";
} else {
$tmp_name1 = "<span class='guest'>$name1</span>";
$title_mb_id = "[비회원]";
}
return "<a href=\"javascript:;\" onClick=\"showSideView(this, '$mb_id', '$name', '$email', '$homepage');\" title=\"{$title_mb_id}{$title_name}\">$tmp_name1</a>";
}
=========================================================================
댓글 전체
<?=member_icon($list[$i][mb_id])?> 리스트
<?=member_icon($view[mb_id])?> 보기
아래 댓글 드렸는데...ㅠ.ㅠ
위치를 보아야 할듯 합니다....코멘트라도...
<?=member_icon($view[mb_id])?> 보기
아래 댓글 드렸는데...ㅠ.ㅠ
위치를 보아야 할듯 합니다....코멘트라도...
위치는 회원이름 앞에 붙일겁니다.
아래 댓글에 말씀하신대로 해 보았더니 다른 회원이 글을 올렸는데도 같은 아이콘이 나와 버립니다.
아래 댓글에 말씀하신대로 해 보았더니 다른 회원이 글을 올렸는데도 같은 아이콘이 나와 버립니다.
일단... $name1 에 아무 정보도 들어있지 않습니다.
이름을 넘겨받을 인수를 함수에 하나 더 추가하셔야 할듯하네용~
이름을 넘겨받을 인수를 함수에 하나 더 추가하셔야 할듯하네용~
제가 무지해서 그러니 쬠만 더 자세히 가르쳐 주세용~~~~~
혹시... '회원아이콘만' 뽑아내시려 하는거라면... 아래 코드를 참조하세요.
(마침 저도 이와 비슷한것을 하다가 들어온지라... ^^;)
<?
function member_icon($mb_id) {
global $config;
global $g4;
$tmp_imo = "";
if ($mb_id) {
if ($config['cf_use_member_icon']) {
$mb_dir = substr($mb_id,0,2);
$icon_file = "$g4[path]/data/member/$mb_dir/$mb_id.gif";
if (file_exists($icon_file)) {
$width = $config['cf_member_icon_width'];
$height = $config['cf_member_icon_height'];
$tmp_imo = "<img src='$icon_file' width='$width' height='$height' align='absmiddle' border='0'>";
}
}
}
return $tmp_imo;
}
?>
(마침 저도 이와 비슷한것을 하다가 들어온지라... ^^;)
<?
function member_icon($mb_id) {
global $config;
global $g4;
$tmp_imo = "";
if ($mb_id) {
if ($config['cf_use_member_icon']) {
$mb_dir = substr($mb_id,0,2);
$icon_file = "$g4[path]/data/member/$mb_dir/$mb_id.gif";
if (file_exists($icon_file)) {
$width = $config['cf_member_icon_width'];
$height = $config['cf_member_icon_height'];
$tmp_imo = "<img src='$icon_file' width='$width' height='$height' align='absmiddle' border='0'>";
}
}
}
return $tmp_imo;
}
?>
view_comment.skin.php에 적용하시는 거라면...
원하는 위치에 <?=member_icon($list[$i]['mb_id'])?>을 넣어주시면 됩니다.
view.skin.php라면 $list[$i][mb_id], $view[mb_id] 상관없을듯...
원하는 위치에 <?=member_icon($list[$i]['mb_id'])?>을 넣어주시면 됩니다.
view.skin.php라면 $list[$i][mb_id], $view[mb_id] 상관없을듯...
회원아이콘만 별도로 뽑아오고자 합니다.
회원아이콘과 이름을 서로 다른 위치에 보여주려구요.
그리고 view_comment.skin.php, view.skin.php 둘다 적용할건데
<?=member_icon($list[$i]['mb_id'])?>해도 회원아이콘이 안나오네요.
"관리자 > 기본환경설정 > 회원아이콘 사용 > 미사용"을 선택했습니다.
그래야 이름을 보여주는 부분에서 회원아이콘을 안보여줄 수 있으니까요.
회원아이콘과 이름을 서로 다른 위치에 보여주려구요.
그리고 view_comment.skin.php, view.skin.php 둘다 적용할건데
<?=member_icon($list[$i]['mb_id'])?>해도 회원아이콘이 안나오네요.
"관리자 > 기본환경설정 > 회원아이콘 사용 > 미사용"을 선택했습니다.
그래야 이름을 보여주는 부분에서 회원아이콘을 안보여줄 수 있으니까요.
그누보드의 코멘트에서 회원 아이콘과 이름을 가져오면서 레이어를 출력 시키는
함수 입니다. 참고하셔서 약간만 수정하시면 아이콘만 출력이 가능 하겠네요.
lib/common.lib.php 의 평션
// 회원 레이어
function get_sideview($mb_id, $name="", $email="", $homepage="")
{
global $config;
global $g4;
$email = base64_encode($email);
$homepage = set_http($homepage);
$name = preg_replace("/\'/", "", $name);
$name = preg_replace("/\'/", "", $name);
$name = preg_replace("/\"/", """, $name);
$title_name = $name;
if ($mb_id) {
$tmp_name = "<span class='member'>$name</span>";
if ($config['cf_use_member_icon']) {
$mb_dir = substr($mb_id,0,2);
$icon_file = "$g4[path]/data/member/$mb_dir/$mb_id.gif";
//if (file_exists($icon_file) && is_file($icon_file)) {
if (file_exists($icon_file)) {
//$size = getimagesize($icon_file);
//$width = $size[0];
//$height = $size[1];
$width = $config['cf_member_icon_width'];
$height = $config['cf_member_icon_height'];
$tmp_name = "<img src='$icon_file' width='$width' height='$height' align='absmiddle' border='0'>";
if ($config['cf_use_member_icon'] == 2) // 회원아이콘+이름
$tmp_name = $tmp_name . " <span class='member'>$name</span>";
}
}
$title_mb_id = "[$mb_id]";
} else {
$tmp_name = "<span class='guest'>$name</span>";
$title_mb_id = "[비회원]";
}
return "<a href=\"javascript:;\" onClick=\"showSideView(this, '$mb_id', '$name', '$email', '$homepage');\" title=\"{$title_mb_id}{$title_name}\">$tmp_name</a>";
}
bbs/view_comment.php 에서
$tmp_name = get_text(cut_str($row[wr_name], $config[cf_cut_name])); // 설정된 자리수 만큼만 이름 출력
if ($board[bo_use_sideview])
$list[$i][name] = get_sideview($row[mb_id], $tmp_name, $row[wr_email], $row[wr_homepage]);
else
$list[$i][name] = "<span class='".($row[mb_id]?'member':'guest')."'>$tmp_name</span>";
스킨에서 코멘트작성자 이름 출력은
<?=$list[$i][name]?>
함수 입니다. 참고하셔서 약간만 수정하시면 아이콘만 출력이 가능 하겠네요.
lib/common.lib.php 의 평션
// 회원 레이어
function get_sideview($mb_id, $name="", $email="", $homepage="")
{
global $config;
global $g4;
$email = base64_encode($email);
$homepage = set_http($homepage);
$name = preg_replace("/\'/", "", $name);
$name = preg_replace("/\'/", "", $name);
$name = preg_replace("/\"/", """, $name);
$title_name = $name;
if ($mb_id) {
$tmp_name = "<span class='member'>$name</span>";
if ($config['cf_use_member_icon']) {
$mb_dir = substr($mb_id,0,2);
$icon_file = "$g4[path]/data/member/$mb_dir/$mb_id.gif";
//if (file_exists($icon_file) && is_file($icon_file)) {
if (file_exists($icon_file)) {
//$size = getimagesize($icon_file);
//$width = $size[0];
//$height = $size[1];
$width = $config['cf_member_icon_width'];
$height = $config['cf_member_icon_height'];
$tmp_name = "<img src='$icon_file' width='$width' height='$height' align='absmiddle' border='0'>";
if ($config['cf_use_member_icon'] == 2) // 회원아이콘+이름
$tmp_name = $tmp_name . " <span class='member'>$name</span>";
}
}
$title_mb_id = "[$mb_id]";
} else {
$tmp_name = "<span class='guest'>$name</span>";
$title_mb_id = "[비회원]";
}
return "<a href=\"javascript:;\" onClick=\"showSideView(this, '$mb_id', '$name', '$email', '$homepage');\" title=\"{$title_mb_id}{$title_name}\">$tmp_name</a>";
}
bbs/view_comment.php 에서
$tmp_name = get_text(cut_str($row[wr_name], $config[cf_cut_name])); // 설정된 자리수 만큼만 이름 출력
if ($board[bo_use_sideview])
$list[$i][name] = get_sideview($row[mb_id], $tmp_name, $row[wr_email], $row[wr_homepage]);
else
$list[$i][name] = "<span class='".($row[mb_id]?'member':'guest')."'>$tmp_name</span>";
스킨에서 코멘트작성자 이름 출력은
<?=$list[$i][name]?>
얼추 해결된듯 합니다.
======================= member_icon.lib.php =======================
//회원아이콘 뽑아오기
function member_icon($mb_id) {
global $config;
global $g4;
$tmp_imo = "";
if ($mb_id) {
if ($config['cf_use_member_icon'] == 0) { // 회원아이콘
$mb_dir = substr($mb_id,0,2);
$icon_file = "$g4[path]/data/member/$mb_dir/$mb_id.gif";
if (file_exists($icon_file)) {
$width = $config['cf_member_icon_width'];
$height = $config['cf_member_icon_height'];
$tmp_imo = "<img src='$icon_file' width='$width' height='$height' align='absmiddle' border='0'>";
}
}
}
return $tmp_imo;
}
======================================================================
view_comment.skin.php 파일에 <?=member_icon($list[$i]['mb_id'])?>
view.skin.php 파일에 <?=member_icon($view[mb_id])?>
======================= member_icon.lib.php =======================
//회원아이콘 뽑아오기
function member_icon($mb_id) {
global $config;
global $g4;
$tmp_imo = "";
if ($mb_id) {
if ($config['cf_use_member_icon'] == 0) { // 회원아이콘
$mb_dir = substr($mb_id,0,2);
$icon_file = "$g4[path]/data/member/$mb_dir/$mb_id.gif";
if (file_exists($icon_file)) {
$width = $config['cf_member_icon_width'];
$height = $config['cf_member_icon_height'];
$tmp_imo = "<img src='$icon_file' width='$width' height='$height' align='absmiddle' border='0'>";
}
}
}
return $tmp_imo;
}
======================================================================
view_comment.skin.php 파일에 <?=member_icon($list[$i]['mb_id'])?>
view.skin.php 파일에 <?=member_icon($view[mb_id])?>
환경설정을 미사용으로 하시면...
member_icon 함수에서 if ($config['cf_use_member_icon'])
조건을 없애고 사용하면 되긴하지만...
사용자들이 아이콘을 아예 올리지 못하게 되는 문제점이 발생할듯 하니...
member_icon() 의 if ($config['cf_use_member_icon']) 은 그냥 놔두시고,
common.lib.php의 위에 헐랭이님께서 올려주신 부분의
if ($config['cf_use_member_icon']) 을 if ($config['cf_use_member_icon'] && 0)
으로해서 sideview에 아이콘이 붙어나오지 않도록 하시는것도 방법인듯 합니다. ^^;
(일종의 주석처리... ^^;)
member_icon 함수에서 if ($config['cf_use_member_icon'])
조건을 없애고 사용하면 되긴하지만...
사용자들이 아이콘을 아예 올리지 못하게 되는 문제점이 발생할듯 하니...
member_icon() 의 if ($config['cf_use_member_icon']) 은 그냥 놔두시고,
common.lib.php의 위에 헐랭이님께서 올려주신 부분의
if ($config['cf_use_member_icon']) 을 if ($config['cf_use_member_icon'] && 0)
으로해서 sideview에 아이콘이 붙어나오지 않도록 하시는것도 방법인듯 합니다. ^^;
(일종의 주석처리... ^^;)
테스트 해봤는데 말씀하신것 처럼 하니 제대로 적용이 안됩니다.
오히려
if ($config['cf_use_member_icon'] == 0) { // 회원아이콘
이렇게 적용하니 사용자들이 회원아이콘도 올릴 수 있고 별 문제도 없습니다.
아직까지는요..... ^^a
오히려
if ($config['cf_use_member_icon'] == 0) { // 회원아이콘
이렇게 적용하니 사용자들이 회원아이콘도 올릴 수 있고 별 문제도 없습니다.
아직까지는요..... ^^a
앞으로도...
별 문제없이 잘 되길 바랍니다. ^^;
별 문제없이 잘 되길 바랍니다. ^^;
별 문제가 생기면 그때 다시 도움을........ ㅋㅋㅋ
고맙습니다.
고맙습니다.
답변해 주신 물안개님, Osama님, 헐랭이님께 감사의 마음을 전합니다.
고맙습니다.
고맙습니다.