답변 3개
가능한 부분이며, 추가로 페이지(코딩)를 따로 만드셔야 합니다~
참고)
<?php
include_once('./_common.php'); // 그누보드 공통 파일 포함
// 각 갤러리 게시판의 테이블 이름
$tables = ['gallery1', 'gallery2', 'gallery3', 'gallery4'];
$all_photos = [];
// 각 게시판의 데이터를 가져옵니다
foreach ($tables as $table) {
$sql = "SELECT * FROM {$g5['write_prefix']}{$table} ORDER BY wr_id DESC";
$result = sql_query($sql);
while ($row = sql_fetch_array($result)) {
$all_photos[] = $row;
}
}
// wr_datetime 기준으로 내림차순 정렬
usort($all_photos, function($a, $b) {
return strtotime($b['wr_datetime']) - strtotime($a['wr_datetime']);
});
?>
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<title>통합 갤러리</title>
<link rel="stylesheet" href="<?php echo G5_THEME_URL ?>/style.css">
</head>
<body>
<div id="gallery_all">
<h1>통합 갤러리</h1>
<div class="gallery_wrap">
<?php foreach ($all_photos as $photo) { ?>
<div class="gallery_item">
<a href="<?php echo get_view_href($photo['bo_table'], $photo['wr_id']) ?>">
<img src="<?php echo G5_DATA_URL ?>/file/<?php echo $photo['bo_table'] ?>/<?php echo $photo['bf_file'] ?>" alt="<?php echo $photo['wr_subject'] ?>">
<p><?php echo $photo['wr_subject'] ?></p>
</a>
</div>
<?php } ?>
</div>
</div>
</body>
</html>
댓글을 작성하려면 로그인이 필요합니다.
댓글을 작성하려면 로그인이 필요합니다.
<style>
.myimg{width:300px;}
</style>
<?php
$tableStr="'1','2','3','4'"; //<==갤러리 게시판이 1, 2, 3, 4
$qq=sql_query("select * from {$g5['board_file_table']} where bo_table IN($tableStr) order by bf_datetime desc, wr_id desc ");
while($row= sql_fetch_array($qq)){ $img = G5_DATA_URL.'/'.$row['bo_table'].'/'.$row['bf_file'];
<a href="링크 필요하면 넣기"><img src='<?php echo $img;?>' class='myimg'></a>
<?php }?>
썸네일 생성이라든지 클릭하면 큰 이미지보기라든지 몇가지 기능 추가가 필요하겠군요
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인