그누보드 리빌더 주간 인기 게시물을 추출하여 웹진 형식으로 보여 주고 싶어요
Copy
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>주간 인기 게시물</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 20px;
background-color: #f9f9f9;
}
.webzine_board {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
gap: 20px;
padding: 20px;
max-width: 1200px;
margin: auto;
}
.webzine_item {
border: 1px solid #ddd;
border-radius: 10px;
overflow: hidden;
background: #fff;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
transition: transform 0.3s ease-in-out;
}
.webzine_item:hover {
transform: translateY(-5px);
}
.webzine_item img {
width: 100%;
height: 200px;
object-fit: cover;
}
.webzine_content {
padding: 15px;
}
.webzine_content h3 {
font-size: 18px;
margin: 0 0 10px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.webzine_content p {
font-size: 14px;
color: #666;
height: 50px;
overflow: hidden;
text-overflow: ellipsis;
}
.webzine_content a {
display: inline-block;
margin-top: 10px;
font-size: 14px;
color: #007bff;
text-decoration: none;
}
.webzine_content a:hover {
text-decoration: underline;
}
</style>
</head>
<body>
<div class="bbs_main">
<h2 class="font-B">주간 인기 게시물</h2>
<div class="webzine_board">
<?php
// 주간 인기 게시물 가져오기
$popular_posts = rb_latest_popular('basic', 10, 99, 7, 0);
if ($popular_posts) {
foreach ($popular_posts as $post) {
$img_src = !empty($post['img']) ? $post['img'] : 'default.jpg'; // 기본 이미지 처리
$title = htmlspecialchars($post['wr_subject']); // 제목
$content = mb_substr(strip_tags($post['wr_content']), 0, 100, 'UTF-8') . '...'; // 본문 요약
$url = $post['wr_link']; // 게시물 URL
?>
<div class="webzine_item">
<a href="<?php echo $url; ?>">
<img src="<?php echo $img_src; ?>" alt="<?php echo $title; ?>">
</a>
<div class="webzine_content">
<h3><a href="<?php echo $url; ?>"><?php echo $title; ?></a></h3>
<p><?php echo $content; ?></p>
<a href="<?php echo $url; ?>">더보기 →</a>
</div>
</div>
<?php
}
} else {
echo '<p>인기 게시물이 없습니다.</p>';
}
?>
</div>
</div>
</body>
</html>
위 소스는 그누보드 리빌더 주간 인기 게시물을 추출하여 웹진 게시판 형식으로 보여 주려고 작성한 코드 입니다. 그러나 작동을 안하네요. 뭐가 문제 일까요?
답변 3개
댓글을 작성하려면 로그인이 필요합니다.
10개월 전
rb_latest_popular 이 함수를 들여다 봐야 합니다. 어디서 자료를 가져오는지...
로그인 후 평가할 수 있습니다
댓글을 작성하려면 로그인이 필요합니다.
10개월 전
f12 누르셔서 어디에서 오류가 나는지 채크하세요.
해당 사이트를 직접 보지 않는이상 저건 챗GPT 도 못찾아냅니다.
로그인 후 평가할 수 있습니다
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인