forked from tad0616/tad_web
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrss.php
More file actions
44 lines (39 loc) · 1.58 KB
/
Copy pathrss.php
File metadata and controls
44 lines (39 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
/*-----------引入檔案區--------------*/
require_once __DIR__ . '/header.php';
$plugin = 'news';
require_once __DIR__ . '/plugin_header.php';
require_once XOOPS_ROOT_PATH . '/header.php';
/*-----------function區--------------*/
$all_news = $tad_web_news->list_all('', 50, 'return');
// die(var_export($all_news['main_data']));
$item = '';
foreach ($all_news['main_data'] as $key => $news) {
# code...
$news['NewsTitle'] = htmlspecialchars($news['NewsTitle']);
$news['NewsDate'] = date('r', strtotime($news['NewsDate']));
$news['NewsContent'] = htmlspecialchars($news['NewsContent']);
$item .= '
<item>
<guid>' . XOOPS_URL . "/modules/tad_web/news.php?WebID={$news['WebID']}&NewsID={$news['NewsID']}</guid>
<title>{$news['NewsTitle']}</title>
<link>" . XOOPS_URL . "/modules/tad_web/news.php?WebID={$news['WebID']}&NewsID={$news['NewsID']}</link>
<pubDate>{$news['NewsDate']}</pubDate>
<description>{$news['NewsContent']}</description>
</item>
";
}
header('Content-type: application/rss+xml');
header('Access-Control-Allow-Origin: *');
echo '<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<atom:link href="' . XOOPS_URL . "/modules/tad_web/rss.php?WebID={$WebID}\" rel=\"self\" type=\"application/rss+xml\">
<title>{$WebTitle}</title>
<link>" . XOOPS_URL . "/modules/tad_web/index.php?WebID={$WebID}</link>
<description>{$WebTitle}</description>
<lastBuildDate>" . date('r') . "</lastBuildDate>
{$item}
</channel>
</rss>
";