게시판 상단 내용에 아래와 같은걸 입력해서 나오게 하고싶어요.
어떻게 적용해야 할까요?
해당 스킨에다가 해야한다면 대충 그누보드 기본 기준 어디에다 해야할까요?
그누보드 내용관리에서 넣으면 되더라구요. 게시판 상단에 적용하면 안되더라구요
부탁드립니다. ㅠㅠ
<!DOCTYPE html>
<html> <head>
<title>서버 정보</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f3f3f3;
margin: 0;
padding: 0;
}
.header {
text-align: center;
padding: 20px;
padding-top: 100px;
font-family: 'GUGI',cursive;
background-image: url('https://mc-heads.net/avatar/서버아이디/600');
background-size: cover;
background-position: center 400px;
color: black;
margin-bottom: 20px;
height: 200px;
}
.server-info-container {
max-width: 800px;
margin: 20px auto;
padding: 20px;
background-color: #fff;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
text-align: center;
}
.survive-server-category {
border: 2px solid orange;
padding: 10px 20px;
width: fit-content;
border-radius: 6px;
margin-bottom: 20px;
display: inline-block;
text-align: center;
}
.server-icon {
max-width: 100px;
border-radius: 50%;
margin-bottom: 20px;
display: block;
margin: 0 auto;
}
.server-info {
text-align: center;
}
.server-info h3 {
margin-top: 0;
}
.error-message {
color: red;
text-align: center;
}
</style>
<link href="https://fonts.googleapis.com/css2?family=Gugi&display=swap" rel="stylesheet">
</head><body>
<div class="header">
<h1>서버 정보</h1>
<h7>Made By.</h7>
</div>
<div class="server-info-container">
<div class="survive-server-category" style="margin-top: 20px;">
<h2>서버이름</h2>
<img
id="serverIcon"
class="server-icon"
src="https://api.mcsrvstat.us/icon/서버주소"
alt="서버 아이콘">
<div id="serverInfo" class="server-info"></div>
<script>
const serverIp = '서버주소';
const serverPort = '25565';
const serverIconElement = document.getElementById('serverIcon');
const serverInfoElement = document.getElementById('serverInfo');
function queryServer() {
const url = `https://api.mcsrvstat.us/2/${serverIp}:${serverPort}`;
fetch(url)
.then(response => response.json())
.then(data => {
if (data.online) {
serverInfoElement.innerHTML = `
<h3>서버 상태: 온라인</h3>
<h3>온라인 플레이어 수: ${data.players.online}/${data.players.max}</h3>
<h3>서버 버전: ${data.version}</h3>
`;
} else {
serverInfoElement.innerHTML = `
<h3>서버 상태: 오프라인</h3>
`;
}
})
.catch(error => {
serverInfoElement.innerHTML = '<p class="error-message">서버 정보를 가져오는 중 오류가 발생했습니다.</p>';
console.error('서버 정보를 가져오는 중 오류:', error);
});
}
queryServer();
setInterval(queryServer, 60000);
</script>
</body>
</html>
답변 4개 / 댓글 7개
답변에 대한 댓글 3개
상단내용에 넣어보세요.스크립트가 적용될려나 모르겠네요
답변에 대한 댓글 4개
[code]
<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
// 게시판 관리의 상단 내용
if (G5_IS_MOBILE) {
// 모바일의 경우 설정을 따르지 않는다.
include_once(G5_BBS_PATH.'/_head.php');
echo run_replace('board_mobile_content_head', $board['bo_mobile_content_head'], $board);
} else {
// 상단 파일 경로를 입력하지 않았다면 기본 상단 파일도 include 하지 않음
if (trim($board['bo_include_head'])) {
if (is_include_path_check($board['bo_include_head'])) { //파일경로 체크
@include ($board['bo_include_head']);
} else { //파일경로가 올바르지 않으면 기본파일을 가져옴
include_once(G5_BBS_PATH.'/_head.php');
}
}
echo run_replace('board_content_head', $board['bo_content_head'], $board);
}
[/code]
답변을 작성하려면 로그인이 필요합니다.
