상단 스킨 호출 문의 드립니다. 채택완료
메인 페이지에서는 호출이 잘되는데...
게시판페이지 list, view, write 에서는
500 (Internal Server Error)
에러가 발생하네요
그래서 각 페이지마다
<?php
include_once(G5_THEME_PATH.'/blog_skin/Blog_top_1.php');
include_once(G5_THEME_PATH.'/blog_skin/Blog_top_2.php');
?>
이렇게 해서 추가해도 나타나지 않고...흠 제가 뭘 잘못햇을까요...
head.php
</strong></p>
<p><main class="container"></p>
<p><?php</p>
<p>include_once(G5_THEME_PATH.'/blog_skin/Blog_top_1.php');</p>
<p>include_once(G5_THEME_PATH.'/blog_skin/Blog_top_2.php');</p>
<p>?></p>
<p><div class="row"></p>
<p> <div class="col-12 col-lg-8"> </p>
<p> </p>
<p><strong>
tail.php
</strong></p>
<p></div></p>
<p> <div class="col-12 col-lg-4"></p>
<p> <div class="p-4 mb-3 bg-body-tertiary rounded"></p>
<p> <h4 class="fst-italic">소개</h4></p>
<p> <p class="mb-0">내용입력</p></p>
<p> </div></p>
<p> <?php</p>
<p> include_once(G5_THEME_PATH.'/blog_skin/Blog_Sidebar1.php');</p>
<p> ?></p>
<p> </div></p>
<p></div></p>
<p></main></p>
<p><strong>
Blog_top_1.php
</strong></p>
<p><?php</p>
<p>if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가</p>
<p> </p>
<p>include_once(G5_LIB_PATH.'/thumbnail.lib.php');</p>
<p> </p>
<p>$boards = ['free', 'notice', 'qna'];</p>
<p>$posts_per_board = 5;</p>
<p>$desc_length = 80;</p>
<p>$thumb_width = 210;</p>
<p>$thumb_height = 150;</p>
<p>$background_size = 'cover';</p>
<p>$all_posts = [];</p>
<p>foreach ($boards as $board) {</p>
<p> $sql = "SELECT *, '{$board}' as bo_table FROM {$g5['write_prefix']}{$board} ORDER BY wr_id DESC LIMIT $posts_per_board";</p>
<p> $result = sql_query($sql);</p>
<p> while ($row = sql_fetch_array($result)) {</p>
<p> $all_posts[] = $row;</p>
<p> }</p>
<p>}</p>
<p> </p>
<p>usort($all_posts, function($a, $b) {</p>
<p> return strtotime($b['wr_datetime']) - strtotime($a['wr_datetime']);</p>
<p>});</p>
<p> </p>
<p>$latest_posts = array_slice($all_posts, 0, 5);</p>
<p>?></p>
<p> </p>
<p><div class="container-fluid p-4 p-md-5 mb-4 rounded bg-body-secondary custom-bg"></p>
<p> <div class="row"></p>
<p> <?php foreach ($latest_posts as $post): ?></p>
<p> <?php</p>
<p> preg_match_all("/<img[^>]*src=[\"']?([^>\"']+)[\"']?[^>]*>/i", $post['wr_content'], $matches);</p>
<p> $img = !empty($matches[1]) ? $matches[1][0] : 'your-image-url-here.jpg';</p>
<p> $title = strip_tags($post['wr_subject']);</p>
<p> $content = cut_str(strip_tags($post['wr_content']), $desc_length);</p>
<p> $link = G5_BBS_URL."/board.php?bo_table=".$post['bo_table']."&wr_id=".$post['wr_id'];</p>
<p> ?></p>
<p> <div class="col-12 col-lg-6 px-0 d-none post" data-bg-image="<?php echo $img; ?>" style="background-size: <?php echo $background_size; ?>;"></p>
<p> <div class="text-white p-4"></p>
<p> <h1 class="h4 fst-italic title"><?php echo $title; ?></h1></p>
<p> <p class="lead my-3"><?php echo $content; ?></p></p>
<p> <a href="<?php echo $link; ?>" class="btn btn-secondary">더보기</a></p>
<p> </div></p>
<p> </div></p>
<p> <?php endforeach; ?></p>
<p> </div></p>
<p></div></p>
<p> </p>
<p><style></p>
<p>.custom-bg {</p>
<p> background-size: <?php echo $background_size; ?>;</p>
<p> background-position: center center;</p>
<p> background-repeat: no-repeat;</p>
<p>}</p>
<p> </p>
<p>.title {</p>
<p> white-space: nowrap;</p>
<p> overflow: hidden;</p>
<p> text-overflow: ellipsis;</p>
<p> max-width: 100%</p>
<p>}</p>
<p> </p>
<p>@media (max-width: 992px) {</p>
<p> .custom-bg .row {</p>
<p> flex-direction: column-reverse;</p>
<p> }</p>
<p> .custom-bg {</p>
<p> padding-bottom: 100%;</p>
<p> }</p>
<p>}</p>
<p></style></p>
<p> </p>
<p><script></p>
<p>window.onload = function() {</p>
<p> let currentPost = 0;</p>
<p> const posts = document.querySelectorAll('.post');</p>
<p> const customBg = document.querySelector('.custom-bg');</p>
<p> const displayDuration = 15000;</p>
<p> </p>
<p> function showNextPost() {</p>
<p> posts[currentPost].classList.add('d-none');</p>
<p> currentPost = (currentPost + 1) % posts.length;</p>
<p> const nextBgImageUrl = posts[currentPost].getAttribute('data-bg-image');</p>
<p> customBg.style.backgroundImage = `linear-gradient(to right, rgba(255,255,255,0.7), transparent 50%), url('${nextBgImageUrl}')`;</p>
<p> posts[currentPost].classList.remove('d-none');</p>
<p> }</p>
<p> </p>
<p> if (posts.length > 0) {</p>
<p> customBg.style.backgroundImage = `linear-gradient(to right, rgba(255,255,255,0.7), transparent 50%), url('${posts[0].getAttribute('data-bg-image')}')`;</p>
<p> posts[0].classList.remove('d-none');</p>
<p> setInterval(showNextPost, displayDuration);</p>
<p> }</p>
<p>};</p>
<p></script></p>
<p> </p>
<p><strong>
Blog_top_1.php
</strong></p>
<p><?php</p>
<p>if (!defined('_GNUBOARD_')) exit;</p>
<p>include_once(G5_LIB_PATH.'/thumbnail.lib.php');</p>
<p>$board_sql = "SELECT bo_table, bo_subject FROM {$g5['board_table']}";</p>
<p>$board_result = sql_query($board_sql);</p>
<p>$board_names = [];</p>
<p>while ($board_row = sql_fetch_array($board_result)) {</p>
<p> $board_names[$board_row['bo_table']] = $board_row['bo_subject'];</p>
<p>}</p>
<p>$boards = ['free', 'notice', 'qna'];</p>
<p>$posts_per_board = 5;</p>
<p>$desc_length = 40;</p>
<p>$thumb_width = 200;</p>
<p>$thumb_height = 250;</p>
<p>$all_posts = [];</p>
<p>foreach ($boards as $board) {</p>
<p> $sql = "SELECT * FROM {$g5['write_prefix']}{$board} ORDER BY wr_id DESC LIMIT {$posts_per_board}";</p>
<p> $result = sql_query($sql);</p>
<p> while ($row = sql_fetch_array($result)) {</p>
<p> preg_match_all("/<img[^>]*src=[\"']?([^>\"']+)[\"']?[^>]*>/i", $row['wr_content'], $matches);</p>
<p> $img = !empty($matches[1]) ? $matches[1][0] : 'your-image-url-here.jpg';</p>
<p> $full_title = strip_tags($row['wr_subject']);</p>
<p> $title = $full_title;</p>
<p> $content = cut_str(strip_tags($row['wr_content']), $desc_length);</p>
<p> $content = html_entity_decode($content);</p>
<p> $link = G5_BBS_URL."/board.php?bo_table={$board}&wr_id=".$row['wr_id'];</p>
<p> $date = $row['wr_datetime'];</p>
<p> $all_posts[] = [</p>
<p> 'board' => $board_names[$board],</p>
<p> 'img' => $img,</p>
<p> 'title' => $title,</p>
<p> 'content' => $content,</p>
<p> 'link' => $link,</p>
<p> 'date' => $date</p>
<p> ];</p>
<p> }</p>
<p>}</p>
<p>usort($all_posts, function($a, $b) {</p>
<p> return strtotime($b['date']) - strtotime($a['date']);</p>
<p>});</p>
<p>$latest_posts = array_slice($all_posts, 0, $posts_per_board);</p>
<p>?></p>
<p> </p>
<p><style></p>
<p>.post-item img { transition: opacity 0.5s ease; }</p>
<p>.post-item img.fade-out { opacity: 0; visibility: hidden; }</p>
<p> </p>
<p>.thumbnail-img {</p>
<p> display: block;</p>
<p> width: <?php echo $thumb_width; ?>px;</p>
<p> height: <?php echo $thumb_height; ?>px;</p>
<p> object-fit: cover;</p>
<p> object-position: center;</p>
<p>}</p>
<p></style></p>
<p> </p>
<p><div class="row mb-2"></p>
<p> <?php for ($i = 0; $i < 2; $i++): ?></p>
<p> <?php</p>
<p> $post = $latest_posts[$i];</p>
<p> ?></p>
<p> <div class="col-md-6 post-item"></p>
<p> <div class="d-flex flex-nowrap g-0 border rounded overflow-hidden mb-4 shadow-sm h-md-250 position-relative"></p>
<p> <div class="col p-4 d-flex flex-column position-static"></p>
<p> <strong class="d-inline-block mb-2 text-primary"><?php echo $post['board']; ?></strong></p>
<p> <h4 class="mb-0 text-nowrap text-truncate"><?php echo htmlspecialchars($post['title']); ?></h4></p>
<p> <div class="mb-1 text-muted"><?php echo $post['date']; ?></div></p>
<p> <p class="card-text mb-auto"><?php echo $post['content']; ?></p></p>
<p> <a href="<?php echo $post['link']; ?>" class="stretched-link">더보기</a></p>
<p> </div></p>
<p> <div class="col-auto d-none d-lg-block overflow-hidden"></p>
<p> <img class="thumbnail-img" src="<?php echo $post['img']; ?>" alt="Thumbnail" style="width: <?php echo $thumb_width; ?>px; height: <?php echo $thumb_height; ?>px;"></p>
<p> </div></p>
<p> </div></p>
<p> </div></p>
<p> <?php endfor; ?></p>
<p></div></p>
<p> </p>
<p><script></p>
<p>document.addEventListener("DOMContentLoaded", function() {</p>
<p> let currentPostIndex = 1;</p>
<p> const posts = document.querySelectorAll('.post-item');</p>
<p> const postData = <?php echo json_encode($latest_posts); ?>;</p>
<p> const displayDuration = 15000;</p>
<p> </p>
<p> function showNextPost() {</p>
<p> const leftPost = posts[0];</p>
<p> const rightPost = posts[1];</p>
<p> leftPost.innerHTML = rightPost.innerHTML;</p>
<p> currentPostIndex = (currentPostIndex + 1) % postData.length;</p>
<p> const nextPost = postData[currentPostIndex];</p>
<p> const oldImage = rightPost.querySelector('.col-auto img');</p>
<p> if (oldImage) {</p>
<p> oldImage.classList.add('fade-out');</p>
<p> }</p>
<p> setTimeout(() => {</p>
<p> if (oldImage) {</p>
<p> oldImage.src = nextPost.img;</p>
<p> oldImage.classList.remove('fade-out');</p>
<p> oldImage.style.visibility = 'visible';</p>
<p> }</p>
<p> }, 500);</p>
<p> const titleElement = rightPost.querySelector('h4.mb-0');</p>
<p> const dateElement = rightPost.querySelector('.mb-1 text-muted');</p>
<p> const contentElement = rightPost.querySelector('.card-text.mb-auto');</p>
<p> const linkElement = rightPost.querySelector('a.stretched-link');</p>
<p> </p>
<p> if (titleElement) {</p>
<p> titleElement.textContent = nextPost.title;</p>
<p> }</p>
<p> if (dateElement) {</p>
<p> dateElement.textContent = nextPost.date;</p>
<p> }</p>
<p> if (contentElement) {</p>
<p> contentElement.textContent = nextPost.content;</p>
<p> }</p>
<p> if (linkElement) {</p>
<p> linkElement.href = nextPost.link;</p>
<p> }</p>
<p> }</p>
<p> setInterval(showNextPost, displayDuration);</p>
<p>});</p>
<p></script></p>
<p><strong>
답변 2개
답변에 대한 댓글 1개
댓글을 작성하려면 로그인이 필요합니다.
혹시 몰라서 남깁니다 위 스킨 사용시
$boards = ['free', 'notice', 'qna'];
이 부분때문에 글작성이나 목록 이동시
마지막 qna 테이블로 모든 게시판이 연결되네요
그러니 혹시라도 위에 스킨은 사용하지 마시고 사용하실거면
https://sir.kr/g5_tip/4103 이페이지 최신글 호출 사용해서
스킨페이지 수정하시면 글작성, 목록 이동이 정상적으로 이동됩니다
혹시 모르고 사용하실까봐 댓글 남겨요
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인