1:1 문의 최신글 스킨
1:1 문의 게시판은 작성자와 관리자만 열람이 가능하도록 제한하는 특징이 있습니다.
아래 라이브러리 파일과 스킨파일을 정해진 위치에 올리고 테스트 해보세요.
미리보기는 링크 오른쪽 하단에 1:1문의 입니다.
주)스킨 파일은 부트스트랩 코딩이라 미리보기와 다릅니다. 꼭 본인에 맞게 손보셔야 합니다.
----------------------------------------------------------
1. 스킨파일 /skin/latest/qa_basic_bs/latest.skin.php 에 위치하도록 폴더를 만들고 파일명도 맞춰서 업로드 하세요.
[code]
<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
// print_r2($list);
// 1:1 문의 최신글 - extend/qalatest.lib.php
?>
<ul class="list-group tooltip-qala">
<a class="list-group-item" href="<?php echo G5_BBS_URL ?>/qalist.php"><b><?php echo $qa_subject; ?></b><span class="pull-right" href="<?php echo G5_BBS_URL ?>/qalist.php">more</span></a>
<?php for ($i=0; $i<count($list); $i++) { ?>
<li class="list-group-item" >
<span class="subject"><a href="<?php echo $list[$i]['view_href']; ?>"><?php echo $list[$i]['qa_subject']; ?></a></span>
<span class="name"><?php echo $list[$i]['name']; ?></span>
<span class="time <?php echo ($list[$i]['qa_status'] ? 'txt_done' : 'txt_rdy'); ?>" data-toggle="tooltip" data-placement="top" title="<?php echo $list[$i]['qa_datetime']; ?>"><?php echo $list[$i]['date']; ?> [<?php echo ($list[$i]['qa_status'] ? '답변완료' : '답변대기'); ?>]</span>
</li>
<?php } ?>
<?php if (count($list) == 0) { //게시물이 없을 때 ?>
<li class="list-group-item">
<span class="subject"><a href="<?php echo G5_BBS_URL ?>/login.php" title="로그인 페이지로 이동">로그인 회원님 본인의 게시물만 보입니다.</a></span>
</li>
<?php } ?>
</ul>
[/code]
2. 라이브러리 파일 qalatest.lib.php 는 /extend/하위에 넣어주세요.
[code]
<?php
if (!defined('_GNUBOARD_')) exit;
// 1:1 문의 최신글 추출 - /skin/latest/qa_basic_bs
// $cache_time 캐시 갱신시간
function qalatest($skin_dir='', $qa_board, $rows=10, $subject_len=40, $cache_time=1, $options='')
{
global $config, $member, $g5, $is_admin, $is_member;
$qaconfig = get_qa_config();
$qa_subject = $qaconfig['qa_title'];
// $qa_subject = "1:1 질문답변";
$qa_board = $g5['qa_content_table'];
if (!$skin_dir) $skin_dir = 'qa_basic_bs'; // 강제지정
if(G5_IS_MOBILE) {
$qa_skin_path = G5_MOBILE_PATH.'/'.G5_SKIN_DIR.'/latest/'.$skin_dir;
$qa_skin_url = G5_MOBILE_URL.'/'.G5_SKIN_DIR.'/latest/'.$skin_dir;
} else {
$qa_skin_path = G5_SKIN_PATH.'/latest/'.$skin_dir;
$qa_skin_url = G5_SKIN_URL.'/latest/'.$skin_dir;
}
$cache_fwrite = false;
if(G5_USE_CACHE) {
$cache_file = G5_DATA_PATH."/cache/latest-qa-{$qa_board}-{$skin_dir}-{$rows}-{$subject_len}.php";
if(!file_exists($cache_file)) {
$cache_fwrite = true;
} else {
if($cache_time > 0) {
$filetime = filemtime($cache_file);
if($filetime && $filetime < (G5_SERVER_TIME - 3600 * $cache_time)) {
@unlink($cache_file);
$cache_fwrite = true;
}
}
if(!$cache_fwrite)
include($cache_file);
}
}
if(!G5_USE_CACHE || $cache_fwrite) {
$sql_common = " from {$qa_board} ";
$sql_search = " where qa_type = '0' ";
if(!$is_admin){
$sql_search .= " and mb_id = '{$member['mb_id']}' ";
}
$sql_order = " order by qa_num ";
$sql = " select *
$sql_common
$sql_search
$sql_order
limit 0, $rows ";
$result = sql_query($sql);
$list = array();
$subject_len = G5_IS_MOBILE ? $qaconfig['qa_mobile_subject_len'] : $qaconfig['qa_subject_len'];
for($i=0; $row=sql_fetch_array($result); $i++) {
// $list[$i] = get_list($row, $qa_board, $qa_skin_url, $subject_len);
$list[$i] = $row;
$list[$i]['category'] = get_text($row['qa_category']);
$list[$i]['subject'] = conv_subject($row['qa_subject'], $subject_len, '…');
if ($stx) {
$list[$i]['subject'] = search_font($stx, $list[$i]['subject']);
}
$list[$i]['view_href'] = G5_BBS_URL.'/qaview.php?qa_id='.$row['qa_id'].$qstr;
$list[$i]['icon_file'] = '';
if(trim($row['qa_file1']) || trim($row['qa_file2']))
$list[$i]['icon_file'] = '<img src="'.$qa_skin_url.'/img/icon_file.gif">';
$list[$i]['name'] = get_text($row['qa_name']);
$list[$i]['date'] = substr($row['qa_datetime'], 2, 8);
$list[$i]['num'] = $num - $i;
}
if($cache_fwrite) {
$handle = fopen($cache_file, 'w');
$cache_content = "<?php\nif (!defined('_GNUBOARD_')) exit;\n\$qa_subject='".$qa_subject."';\n\$list=".var_export($list, true)."?>";
fwrite($handle, $cache_content);
fclose($handle);
}
}
/*
// 같은 스킨은 .css 를 한번만 호출한다.
if (!in_array($skin_dir, $css) && is_file($qa_skin_path.'/style.css')) {
echo '<link rel="stylesheet" href="'.$qa_skin_url.'/style.css">';
$css[] = $skin_dir;
}
*/
ob_start();
include $qa_skin_path.'/latest.skin.php';
$content = ob_get_contents();
ob_end_clean();
return $content;
}
?>
[/code]
3. 최신글을 불러올때는 원하는 위치에 아래와 같이 호출 합니다.
[code]
<?php echo qalatest('qa_basic_bs','g5_qa_content_table', 5, 50); ?>
[/code]
아래 라이브러리 파일과 스킨파일을 정해진 위치에 올리고 테스트 해보세요.
미리보기는 링크 오른쪽 하단에 1:1문의 입니다.
주)스킨 파일은 부트스트랩 코딩이라 미리보기와 다릅니다. 꼭 본인에 맞게 손보셔야 합니다.
----------------------------------------------------------
1. 스킨파일 /skin/latest/qa_basic_bs/latest.skin.php 에 위치하도록 폴더를 만들고 파일명도 맞춰서 업로드 하세요.
[code]
<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
// print_r2($list);
// 1:1 문의 최신글 - extend/qalatest.lib.php
?>
<ul class="list-group tooltip-qala">
<a class="list-group-item" href="<?php echo G5_BBS_URL ?>/qalist.php"><b><?php echo $qa_subject; ?></b><span class="pull-right" href="<?php echo G5_BBS_URL ?>/qalist.php">more</span></a>
<?php for ($i=0; $i<count($list); $i++) { ?>
<li class="list-group-item" >
<span class="subject"><a href="<?php echo $list[$i]['view_href']; ?>"><?php echo $list[$i]['qa_subject']; ?></a></span>
<span class="name"><?php echo $list[$i]['name']; ?></span>
<span class="time <?php echo ($list[$i]['qa_status'] ? 'txt_done' : 'txt_rdy'); ?>" data-toggle="tooltip" data-placement="top" title="<?php echo $list[$i]['qa_datetime']; ?>"><?php echo $list[$i]['date']; ?> [<?php echo ($list[$i]['qa_status'] ? '답변완료' : '답변대기'); ?>]</span>
</li>
<?php } ?>
<?php if (count($list) == 0) { //게시물이 없을 때 ?>
<li class="list-group-item">
<span class="subject"><a href="<?php echo G5_BBS_URL ?>/login.php" title="로그인 페이지로 이동">로그인 회원님 본인의 게시물만 보입니다.</a></span>
</li>
<?php } ?>
</ul>
[/code]
2. 라이브러리 파일 qalatest.lib.php 는 /extend/하위에 넣어주세요.
[code]
<?php
if (!defined('_GNUBOARD_')) exit;
// 1:1 문의 최신글 추출 - /skin/latest/qa_basic_bs
// $cache_time 캐시 갱신시간
function qalatest($skin_dir='', $qa_board, $rows=10, $subject_len=40, $cache_time=1, $options='')
{
global $config, $member, $g5, $is_admin, $is_member;
$qaconfig = get_qa_config();
$qa_subject = $qaconfig['qa_title'];
// $qa_subject = "1:1 질문답변";
$qa_board = $g5['qa_content_table'];
if (!$skin_dir) $skin_dir = 'qa_basic_bs'; // 강제지정
if(G5_IS_MOBILE) {
$qa_skin_path = G5_MOBILE_PATH.'/'.G5_SKIN_DIR.'/latest/'.$skin_dir;
$qa_skin_url = G5_MOBILE_URL.'/'.G5_SKIN_DIR.'/latest/'.$skin_dir;
} else {
$qa_skin_path = G5_SKIN_PATH.'/latest/'.$skin_dir;
$qa_skin_url = G5_SKIN_URL.'/latest/'.$skin_dir;
}
$cache_fwrite = false;
if(G5_USE_CACHE) {
$cache_file = G5_DATA_PATH."/cache/latest-qa-{$qa_board}-{$skin_dir}-{$rows}-{$subject_len}.php";
if(!file_exists($cache_file)) {
$cache_fwrite = true;
} else {
if($cache_time > 0) {
$filetime = filemtime($cache_file);
if($filetime && $filetime < (G5_SERVER_TIME - 3600 * $cache_time)) {
@unlink($cache_file);
$cache_fwrite = true;
}
}
if(!$cache_fwrite)
include($cache_file);
}
}
if(!G5_USE_CACHE || $cache_fwrite) {
$sql_common = " from {$qa_board} ";
$sql_search = " where qa_type = '0' ";
if(!$is_admin){
$sql_search .= " and mb_id = '{$member['mb_id']}' ";
}
$sql_order = " order by qa_num ";
$sql = " select *
$sql_common
$sql_search
$sql_order
limit 0, $rows ";
$result = sql_query($sql);
$list = array();
$subject_len = G5_IS_MOBILE ? $qaconfig['qa_mobile_subject_len'] : $qaconfig['qa_subject_len'];
for($i=0; $row=sql_fetch_array($result); $i++) {
// $list[$i] = get_list($row, $qa_board, $qa_skin_url, $subject_len);
$list[$i] = $row;
$list[$i]['category'] = get_text($row['qa_category']);
$list[$i]['subject'] = conv_subject($row['qa_subject'], $subject_len, '…');
if ($stx) {
$list[$i]['subject'] = search_font($stx, $list[$i]['subject']);
}
$list[$i]['view_href'] = G5_BBS_URL.'/qaview.php?qa_id='.$row['qa_id'].$qstr;
$list[$i]['icon_file'] = '';
if(trim($row['qa_file1']) || trim($row['qa_file2']))
$list[$i]['icon_file'] = '<img src="'.$qa_skin_url.'/img/icon_file.gif">';
$list[$i]['name'] = get_text($row['qa_name']);
$list[$i]['date'] = substr($row['qa_datetime'], 2, 8);
$list[$i]['num'] = $num - $i;
}
if($cache_fwrite) {
$handle = fopen($cache_file, 'w');
$cache_content = "<?php\nif (!defined('_GNUBOARD_')) exit;\n\$qa_subject='".$qa_subject."';\n\$list=".var_export($list, true)."?>";
fwrite($handle, $cache_content);
fclose($handle);
}
}
/*
// 같은 스킨은 .css 를 한번만 호출한다.
if (!in_array($skin_dir, $css) && is_file($qa_skin_path.'/style.css')) {
echo '<link rel="stylesheet" href="'.$qa_skin_url.'/style.css">';
$css[] = $skin_dir;
}
*/
ob_start();
include $qa_skin_path.'/latest.skin.php';
$content = ob_get_contents();
ob_end_clean();
return $content;
}
?>
[/code]
3. 최신글을 불러올때는 원하는 위치에 아래와 같이 호출 합니다.
[code]
<?php echo qalatest('qa_basic_bs','g5_qa_content_table', 5, 50); ?>
[/code]
게시판 목록
영카트5 팁자료실
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 371 |
이로홀딩스
|
2년 전 | 1555 | |
| 370 |
페이투페이
|
2년 전 | 1557 | |
| 369 | 2년 전 | 1306 | ||
| 368 | 2년 전 | 1720 | ||
| 367 | 2년 전 | 2062 | ||
| 366 | 2년 전 | 2275 | ||
| 365 | 2년 전 | 2080 | ||
| 364 | 2년 전 | 1608 | ||
| 363 | 3년 전 | 1350 | ||
| 362 | 3년 전 | 3121 | ||
| 361 | 3년 전 | 1924 | ||
| 360 |
|
3년 전 | 2674 | |
| 359 | 3년 전 | 2431 | ||
| 358 | 3년 전 | 1591 | ||
| 357 |
welcome
|
3년 전 | 1321 | |
| 356 | 3년 전 | 1634 | ||
| 355 | 3년 전 | 1897 | ||
| 354 | 3년 전 | 1564 | ||
| 353 | 3년 전 | 1272 | ||
| 352 | 3년 전 | 1322 | ||
| 351 | 3년 전 | 1431 | ||
| 350 | 3년 전 | 2519 | ||
| 349 | 3년 전 | 1677 | ||
| 348 | 3년 전 | 3277 | ||
| 347 | 4년 전 | 4072 | ||
| 346 | 4년 전 | 2826 | ||
| 345 | 4년 전 | 4494 | ||
| 344 |
별지기천사
|
4년 전 | 3990 | |
| 343 | 4년 전 | 3413 | ||
| 342 | 4년 전 | 2029 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기