cfmgrv4 init...3
This commit is contained in:
parent
fc3135b2e7
commit
6e3e41d0b9
@ -1,10 +1,16 @@
|
|||||||
<?= $this->extend(LAYOUTS[$viewDatas['layout']]['path']) ?>
|
<?= $this->extend(LAYOUTS[$viewDatas['layout']]['path']) ?>
|
||||||
<?= $this->section('content') ?>
|
<?= $this->section('content') ?>
|
||||||
<div class="layout_top"><?= $this->include(LAYOUTS[$viewDatas['layout']]['path'] . '/top'); ?></div>
|
<div class="layout_top"><?= $this->include(LAYOUTS[$viewDatas['layout']]['path'] . '/top'); ?></div>
|
||||||
|
<!-- Layout Middle Start -->
|
||||||
<table class="layout_middle">
|
<table class="layout_middle">
|
||||||
<tr>
|
<tr>
|
||||||
<td class="layout_left"><?= $this->include(LAYOUTS[$viewDatas['layout']]['path'] . '/left_menu'); ?></td>
|
<td class="layout_left">
|
||||||
|
<!-- Layout Left Start -->
|
||||||
|
<?= $this->include(LAYOUTS[$viewDatas['layout']]['path'] . '/left_menu'); ?>
|
||||||
|
<!-- Layout Left End -->
|
||||||
|
</td>
|
||||||
<td class="layout_right">
|
<td class="layout_right">
|
||||||
|
<!-- Layout Right Start -->
|
||||||
<?= $this->include("templates/{$viewDatas['layout']}/index_header"); ?>
|
<?= $this->include("templates/{$viewDatas['layout']}/index_header"); ?>
|
||||||
<div id="container" class="layout_content">
|
<div id="container" class="layout_content">
|
||||||
<link href="/css/<?= $viewDatas['layout'] ?>/index.css" media="screen" rel="stylesheet" type="text/css" />
|
<link href="/css/<?= $viewDatas['layout'] ?>/index.css" media="screen" rel="stylesheet" type="text/css" />
|
||||||
@ -50,9 +56,11 @@
|
|||||||
<script type="text/javascript" src="/js/<?= $viewDatas['layout'] ?>/index.js"></script>
|
<script type="text/javascript" src="/js/<?= $viewDatas['layout'] ?>/index.js"></script>
|
||||||
</div>
|
</div>
|
||||||
<div class="layout_footer"><?= $this->include("templates/{$viewDatas['layout']}/index_footer"); ?></div>
|
<div class="layout_footer"><?= $this->include("templates/{$viewDatas['layout']}/index_footer"); ?></div>
|
||||||
|
<!-- Layout Right End -->
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
<!-- Layout Middle End -->
|
||||||
<div class="layout_bottom">
|
<div class="layout_bottom">
|
||||||
<?= $this->include(LAYOUTS[$viewDatas['layout']]['path'] . '/bottom'); ?>
|
<?= $this->include(LAYOUTS[$viewDatas['layout']]['path'] . '/bottom'); ?>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -1,12 +1,19 @@
|
|||||||
<?= $this->extend(LAYOUTS[$viewDatas['layout']]['path']) ?>
|
<?= $this->extend(LAYOUTS[$viewDatas['layout']]['path']) ?>
|
||||||
<?= $this->section('content') ?>
|
<?= $this->section('content') ?>
|
||||||
<div class="layout_top"><?= $this->include(LAYOUTS[$viewDatas['layout']]['path'] . '/top'); ?></div>
|
<div class="layout_top"><?= $this->include(LAYOUTS[$viewDatas['layout']]['path'] . '/top'); ?></div>
|
||||||
|
<!-- Layout Middle Start -->
|
||||||
<table class="layout_middle">
|
<table class="layout_middle">
|
||||||
<tr>
|
<tr>
|
||||||
<td class="layout_left"><?= $this->include(LAYOUTS[$viewDatas['layout']]['path'] . '/left_menu'); ?></td>
|
<td class="layout_left">
|
||||||
|
<!-- Layout Left Start -->
|
||||||
|
<?= $this->include(LAYOUTS[$viewDatas['layout']]['path'] . '/left_menu'); ?>
|
||||||
|
<!-- Layout Left End -->
|
||||||
|
</td>
|
||||||
<td class="layout_right">
|
<td class="layout_right">
|
||||||
|
<!-- Layout Right Start -->
|
||||||
<?= $this->include("templates/{$viewDatas['layout']}/index_header"); ?>
|
<?= $this->include("templates/{$viewDatas['layout']}/index_header"); ?>
|
||||||
<div id="container" class="layout_content">
|
<div id="container" class="layout_content">
|
||||||
|
<!-- RSS Feed Start -->
|
||||||
<style>
|
<style>
|
||||||
.news-container {
|
.news-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -32,27 +39,8 @@
|
|||||||
color: #666;
|
color: #666;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<div
|
<div class="news-container" id="newsContainer"><!-- RSS 피드 항목들이 여기에 동적으로 추가됩니다 --></div>
|
||||||
style="display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 20px; border-bottom: 2px solid #007bff; padding-bottom: 10px;">
|
|
||||||
<h2 style="color: #007bff; font-size: 24px; margin: 0;">최신 뉴스</h2>
|
|
||||||
<small style="color: #6c757d; font-size: 14px;">최근 업데이트: <span id="lastUpdate"></span></small>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
function updateLastUpdateTime() {
|
|
||||||
const now = new Date();
|
|
||||||
const options = {
|
|
||||||
year: 'numeric',
|
|
||||||
month: '2-digit',
|
|
||||||
day: '2-digit',
|
|
||||||
hour: '2-digit',
|
|
||||||
minute: '2-digit',
|
|
||||||
second: '2-digit',
|
|
||||||
hour12: false
|
|
||||||
};
|
|
||||||
document.getElementById('lastUpdate').textContent = now.toLocaleString('ko-KR', options);
|
|
||||||
}
|
|
||||||
|
|
||||||
// fetchRSS 함수 정의
|
// fetchRSS 함수 정의
|
||||||
function fetchRSS() {
|
function fetchRSS() {
|
||||||
fetch('/RSSFeed/getITWorld')
|
fetch('/RSSFeed/getITWorld')
|
||||||
@ -61,12 +49,10 @@
|
|||||||
const newsContainer = document.getElementById('newsContainer');
|
const newsContainer = document.getElementById('newsContainer');
|
||||||
newsContainer.innerHTML = '';
|
newsContainer.innerHTML = '';
|
||||||
data.forEach(item => {
|
data.forEach(item => {
|
||||||
// console.log('RSS 항목:', item); // 디버깅을 위한 로그
|
|
||||||
const pubDate = new Date(item.pubDate);
|
const pubDate = new Date(item.pubDate);
|
||||||
const newsItem = document.createElement('div');
|
const newsItem = document.createElement('div');
|
||||||
newsItem.className = 'news-item';
|
newsItem.className = 'news-item';
|
||||||
|
|
||||||
// 이미지 URL 추출 및 변환
|
|
||||||
let imageUrl = item.imageUrl || extractImageFromContent(item.content);
|
let imageUrl = item.imageUrl || extractImageFromContent(item.content);
|
||||||
imageUrl = convertToAbsoluteUrl(imageUrl, item.link);
|
imageUrl = convertToAbsoluteUrl(imageUrl, item.link);
|
||||||
|
|
||||||
@ -77,12 +63,10 @@
|
|||||||
`;
|
`;
|
||||||
newsContainer.appendChild(newsItem);
|
newsContainer.appendChild(newsItem);
|
||||||
});
|
});
|
||||||
updateLastUpdateTime(); // RSS 피드를 가져온 후 시간 업데이트
|
|
||||||
})
|
})
|
||||||
.catch(error => console.error('RSS 피드를 가져오는 중 오류 발생:', error));
|
.catch(error => console.error('RSS 피드를 가져오는 중 오류 발생:', error));
|
||||||
}
|
}
|
||||||
|
|
||||||
// RSS 내용에서 이미지 URL 추출
|
|
||||||
function extractImageFromContent(content) {
|
function extractImageFromContent(content) {
|
||||||
const parser = new DOMParser();
|
const parser = new DOMParser();
|
||||||
const doc = parser.parseFromString(content, 'text/html');
|
const doc = parser.parseFromString(content, 'text/html');
|
||||||
@ -90,11 +74,10 @@
|
|||||||
return img ? img.src : null;
|
return img ? img.src : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 상대 URL을 절대 URL로 변환
|
|
||||||
function convertToAbsoluteUrl(url, baseUrl) {
|
function convertToAbsoluteUrl(url, baseUrl) {
|
||||||
if (!url) return null;
|
if (!url) return null;
|
||||||
if (url.startsWith('http://') || url.startsWith('https://')) {
|
if (url.startsWith('http://') || url.startsWith('https://')) {
|
||||||
return url; // 이미 절대 URL인 경우
|
return url;
|
||||||
}
|
}
|
||||||
const base = new URL(baseUrl);
|
const base = new URL(baseUrl);
|
||||||
if (url.startsWith('/')) {
|
if (url.startsWith('/')) {
|
||||||
@ -103,23 +86,18 @@
|
|||||||
return `${base.protocol}//${base.hostname}${base.pathname.substring(0, base.pathname.lastIndexOf('/') + 1)}${url}`;
|
return `${base.protocol}//${base.hostname}${base.pathname.substring(0, base.pathname.lastIndexOf('/') + 1)}${url}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 페이지 로드 시 초기 시간 설정 및 RSS 피드 가져오기
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
updateLastUpdateTime();
|
fetchRSS();
|
||||||
fetchRSS();
|
setInterval(fetchRSS, 3600000);
|
||||||
|
});
|
||||||
// 1시간마다 RSS 피드 업데이트
|
|
||||||
setInterval(fetchRSS, 3600000);
|
|
||||||
</script>
|
</script>
|
||||||
<div class="news-container" id="newsContainer">
|
<!-- RSS Feed End -->
|
||||||
<!-- RSS 피드 항목들이 여기에 동적으로 추가됩니다 -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="layout_footer"><?= $this->include("templates/{$viewDatas['layout']}/index_footer"); ?></div>
|
<div class="layout_footer"><?= $this->include("templates/{$viewDatas['layout']}/index_footer"); ?></div>
|
||||||
|
<!-- Layout Right End -->
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<div class="layout_bottom">
|
<!-- Layout Middle End -->
|
||||||
<?= $this->include(LAYOUTS[$viewDatas['layout']]['path'] . '/bottom'); ?>
|
<div class="layout_bottom"><?= $this->include(LAYOUTS[$viewDatas['layout']]['path'] . '/bottom'); ?></div>
|
||||||
</div>
|
|
||||||
<?= $this->endSection() ?>
|
<?= $this->endSection() ?>
|
||||||
Loading…
Reference in New Issue
Block a user