new.php 기반으로 list를 만들어서
회원 sideview 클릭시 나오는 메뉴에서 게시물 보기 링크값으로 세팅했습니다.
그런데
$g5['title'] = '';
여기에
접속한 사용자의 mb_nick 이나 wr_name 이 아니라
게시물 보기로 누름당한(?) 사용자의 wr_name 값을 넣고 싶은데요;
어디서 끌어와야 할지 잘 모르겠네요;
아래 소스는 제가 임의로 만든 (new.php기반) 리스트 소스입니다
Copy
<?phpinclude_once('./_common.php'); $g5['title'] = '님 게시물'; // 여기에 지금 리스트를 보여주고 있는 사용자의 wr_name값을 넣고 싶습니다. 접속자의 wr_name 값말구요 ㅠㅠ include_once('./_head.php'); // 게시물 정보($write_row)를 출력하기 위하여 $list로 가공된 정보를 복사 및 가공function get_article($write_row, $board, $skin_url, $subject_len=40){ global $g5, $config; global $qstr, $page; //$t = get_microtime(); // 배열전체를 복사 $list = $write_row; unset($write_row); $board_notice = array_map('trim', explode(',', $board['bo_notice'])); $list['is_notice'] = in_array($list['wr_id'], $board_notice); if ($subject_len) $list['subject'] = conv_subject($list['wr_subject'], $subject_len, '…'); else $list['subject'] = conv_subject($list['wr_subject'], $board['bo_subject_len'], '…'); // 목록에서 내용 미리보기 사용한 게시판만 내용을 변환함 (속도 향상) : kkal3(커피)님께서 알려주셨습니다. if ($board['bo_use_list_content']) { $html = 0; if (strstr($list['wr_option'], 'html1')) $html = 1; else if (strstr($list['wr_option'], 'html2')) $html = 2; $list['content'] = conv_content($list['wr_content'], $html); } $list['comment_cnt'] = ''; if ($list['wr_comment']) { $list['comment_cnt'] = "<span class=\"cnt_cmt txt_red\">"."(".$list['wr_comment'].")"."</span>"; } // 당일인 경우 시간으로 표시함 $list['datetime'] = substr($list['wr_datetime'],0,10); $list['datetime2'] = $list['wr_datetime']; if ($list['datetime'] == G5_TIME_YMD) $list['datetime2'] = substr($list['datetime2'],11,5); else $list['datetime2'] = substr($list['datetime2'],5,5); // 4.1 $list['last'] = substr($list['wr_last'],0,10); $list['last2'] = $list['wr_last']; if ($list['last'] == G5_TIME_YMD) $list['last2'] = substr($list['last2'],11,5); else $list['last2'] = substr($list['last2'],5,5); $list['wr_homepage'] = get_text($list['wr_homepage']); $tmp_name = get_text(cut_str($list['wr_name'], $config['cf_cut_name'])); // 설정된 자리수 만큼만 이름 출력 $tmp_name2 = cut_str($list['wr_name'], $config['cf_cut_name']); // 설정된 자리수 만큼만 이름 출력 if ($board['bo_use_sideview']) $list['name'] = get_sideview($list['mb_id'], $tmp_name2, $list['wr_email'], $list['wr_homepage']); else $list['name'] = '<span class="'.($list['mb_id']?'sv_member':'sv_guest').'">'.$tmp_name.'</span>'; $reply = $list['wr_reply']; $list['reply'] = strlen($reply)*10; $list['icon_reply'] = ''; if ($list['reply']) $list['icon_reply'] = '<img src="'.$skin_url.'/img/icon_reply.gif" style="margin-left:'.$list['reply'].'px;" alt="답변글">'; $list['icon_link'] = ''; if ($list['wr_link1'] || $list['wr_link2']) $list['icon_link'] = '<img src="'.$skin_url.'/img/icon_link.gif" alt="관련링크">'; // 분류명 링크 $list['ca_name_href'] = G5_BBS_URL.'/board.php?bo_table='.$board['bo_table'].'&sca='.urlencode($list['ca_name']); $list['href'] = G5_BBS_URL.'/board.php?bo_table='.$board['bo_table'].'&wr_id='.$list['wr_id'].$qstr; $list['comment_href'] = $list['href']; $list['icon_new'] = ''; if ($board['bo_new'] && $list['wr_datetime'] >= date("Y-m-d H:i:s", G5_SERVER_TIME - ($board['bo_new'] * 3600))) $list['icon_new'] = '<img src="'.$skin_url.'/img/icon_new.gif" alt="새글">'; $list['icon_hot'] = ''; if ($board['bo_hot'] && $list['wr_hit'] >= $board['bo_hot']) $list['icon_hot'] = '<img src="'.$skin_url.'/img/icon_hot.gif" alt="인기글">'; $list['icon_secret'] = ''; if (strstr($list['wr_option'], 'secret')) $list['icon_secret'] = '<img src="'.$skin_url.'/img/icon_secret.gif" alt="비밀글">'; // 링크 for ($i=1; $i<=G5_LINK_COUNT; $i++) { $list['link'][$i] = set_http(get_text($list["wr_link{$i}"])); $list['link_href'][$i] = G5_BBS_URL.'/link.php?bo_table='.$board['bo_table'].'&wr_id='.$list['wr_id'].'&no='.$i.$qstr; $list['link_hit'][$i] = (int)$list["wr_link{$i}_hit"]; } // 가변 파일 if ($board['bo_use_list_file'] || ($list['wr_file'] && $subject_len == 255) /* view 인 경우 */) { $list['file'] = get_file($board['bo_table'], $list['wr_id']); } else { $list['file']['count'] = $list['wr_file']; } if ($list['file']['count']) $list['icon_file'] = '<img src="'.$skin_url.'/img/icon_file.gif" alt="첨부파일">'; return $list;} $list = array();$sql = " select * from {$g5['board_table']} ";$result1 = sql_query($sql); for ($i=0; $row1 = sql_fetch_array($result1); $i++) { $board = $row1; $bo_subject = get_text($board['bo_subject']); $tmp_write_table = $g5['write_prefix'] . $row1['bo_table']; // 게시판 테이블 전체이름 if($i == 0) { $sql = "(select * from {$tmp_write_table}, (select bo_table, bo_subject, gr_id from {$g5['board_table']} where bo_table = '".$board['bo_table']."' ) as temp where mb_id = '$mb_id'"; } else { $sql .= " union select * from {$tmp_write_table}, (select bo_table, bo_subject, gr_id from {$g5['board_table']} where bo_table = '".$board['bo_table']."' ) as temp where mb_id = '$mb_id'"; } /* if($i == 0) { $sql = " select * from {$tmp_write_table}, (select b.bo_subject as subject g.gr_subject as gsubject from {$g5['board_table']} as b left join {$g5['group_table']} as g on b.gr_id = g.gr_id where bo_table = '".$board['bo_table']."' ) where mb_id = 'admin'"; } else { $sql .= " union select * from {$tmp_write_table}, (select b.bo_subject as subject g.gr_subject as gsubject from {$g5['board_table']} as b left join {$g5['group_table']} as g on b.gr_id = g.gr_id where bo_table = '".$board['bo_table']."' ) where mb_id = 'admin'"; }*/}$sql .= ") as temp2 left join g5_group as gr on temp2.gr_id = gr.gr_id order by wr_datetime DESC"; $query1 = " select count(*) as cnt from ".$sql; $link = $g5['connect_db']; $result3 = @mysqli_query($link, $query1); $row5 = @mysqli_fetch_assoc($result3); $rows = G5_IS_MOBILE ? $config['cf_mobile_page_rows'] : $config['cf_new_rows']; $total_count = $row5['cnt']; $total_page = ceil($total_count / $rows); // 전체 페이지 계산if ($page < 1) $page = 1; // 페이지가 없으면 첫 페이지 (1 페이지)$from_record = ($page - 1) * $rows; // 시작 열을 구함 $query2 = " select * from ".$sql." LIMIT {$from_record}, {$rows}"; $result2 = @mysqli_query($link, $query2); for ($ii=0; $row2 = sql_fetch_array($result2); $ii++) { $list[$ii] = get_article($row2, $board, $latest_skin_url, $subject_len); $tmp_write_table = $g5['write_prefix'].$row2['bo_table']; if ($row2['wr_id'] == $row2['wr_parent']) { // 원글 $comment = ""; $comment_link = ""; $row3 = sql_fetch(" select * from {$tmp_write_table} where wr_id = '{$row2['wr_id']}' "); $list[$ii] = $row3; $name = get_sideview($row3['mb_id'], get_text(cut_str($row3['wr_name'], $config['cf_cut_name'])), $row3['wr_email'], $row3['wr_homepage']); // 당일인 경우 시간으로 표시함 $datetime = substr($row3['wr_datetime'],0,10); $datetime2 = $row3['wr_datetime']; if ($datetime == G5_TIME_YMD) { $datetime2 = substr($datetime2,11,5); } else { $datetime2 = substr($datetime2,5,5); } } else { // 코멘트 $comment = '<span>[댓글]</span>'; $comment_link = '#c_'.$row2['wr_id']; $row3 = sql_fetch(" select * from {$tmp_write_table} where wr_id = '{$row2['wr_parent']}' "); $row4 = sql_fetch(" select mb_id, wr_name, wr_email, wr_homepage, wr_datetime from {$tmp_write_table} where wr_id = '{$row2['wr_id']}' "); $list[$ii] = $row3; $list[$ii]['wr_id'] = $row2['wr_id']; $list[$ii]['mb_id'] = $row4['mb_id']; $list[$ii]['wr_name'] = $row4['wr_name']; $list[$ii]['wr_email'] = $row4['wr_email']; $list[$ii]['wr_homepage'] = $row4['wr_homepage']; $name = get_sideview($row4['mb_id'], get_text(cut_str($row4['wr_name'], $config['cf_cut_name'])), $row4['wr_email'], $row4['wr_homepage']); // 당일인 경우 시간으로 표시함 $datetime = substr($row4['wr_datetime'],0,10); $datetime2 = $row4['wr_datetime']; if ($datetime == G5_TIME_YMD) { $datetime2 = substr($datetime2,11,5); } else { $datetime2 = substr($datetime2,5,5); } } $list[$ii]['gr_id'] = $row2['gr_id']; $list[$ii]['bo_table'] = $row2['bo_table']; $list[$ii]['name'] = $name; $list[$ii]['comment'] = $comment; $list[$ii]['href'] = './board.php?bo_table='.$row2['bo_table'].'&wr_id='.$row3['wr_id'].$comment_link; $list[$ii]['datetime'] = $datetime; $list[$ii]['datetime2'] = $datetime2; $list[$ii]['gr_subject'] = $row2['gr_subject']; $list[$ii]['bo_subject'] = ((G5_IS_MOBILE && $row2['bo_mobile_subject']) ? $row2['bo_mobile_subject'] : $row2['bo_subject']); $list[$ii]['wr_subject'] = $row3['wr_subject'];} $write_pages = get_paging(G5_IS_MOBILE ? $config['cf_mobile_pages'] : $config['cf_write_pages'], $page, $total_page, "?gr_id=$gr_id&view=$view&mb_id=$mb_id&page="); include_once($new_skin_path.'/article_member.skin.php'); include_once('./_tail.php');?>
답변 1개 / 댓글 2개
채택된 답변
+20 포인트
2017-01-23 (월) 18:58:57
사용자가 로그인 되어있다는 가정하에 $member["mb_name"]으로 현재 접속자의 이름을 출력할수있습니다.
답변에 대한 댓글 2개
lacomparte
2017-01-23 (월) 21:04:51
답변을 작성하려면 로그인이 필요합니다.
게시물보기 버튼을 눌러서 나온 리스트(소스는 위의 소스입니다)의
wr_name를 출력하고 싶은거예요~