parent
2fbe6fd9f0
commit
21596160e9
@ -0,0 +1,47 @@ |
||||
<?php |
||||
|
||||
declare(strict_types = 1); |
||||
|
||||
/** |
||||
* @author Robert Strutts <Bob_586@Yahoo.com> |
||||
* @copyright (c) 2025, Robert Strutts |
||||
* @license MIT |
||||
*/ |
||||
namespace Project\controllers\app; |
||||
|
||||
class rss_ctrl { |
||||
|
||||
public function feed() { |
||||
$root = [ |
||||
"feed_link" => "https://example.com/app/rss/feed", |
||||
"title" => "Example News", |
||||
"description" => "Cool New Stuff...", |
||||
"site_link" => "https://example.com", |
||||
"lang" => "en-us", |
||||
"pub_date" => "Tue, 29 Jul 2025 22:08:18 +0000", // DATE_RSS format |
||||
"last_build_date" => date(DATE_RSS), |
||||
]; |
||||
// Should be populating items from a Database... |
||||
$items = [ |
||||
[ |
||||
'title' => 'First Article', |
||||
'link' => 'http://example.com/article1', |
||||
'description' => 'This is the description of the first article.', |
||||
'pubDate' => date(DATE_RSS, strtotime('-2 days')), |
||||
'guid' => 'http://example.com/article1', |
||||
'author' => 'author@example.com (John Doe)' |
||||
], |
||||
[ |
||||
'title' => 'Second Article', |
||||
'link' => 'http://example.com/article2', |
||||
'description' => 'This is the description of the second article.', |
||||
'pubDate' => date(DATE_RSS, strtotime('-1 day')), |
||||
'guid' => 'http://example.com/article2', |
||||
'author' => 'author@example.com (Jane Smith)' |
||||
] |
||||
]; |
||||
$rss = \CodeHydrater\rss_feed::generate_rss_feed($root, $items); |
||||
\CodeHydrater\rss_feed::output_rss($rss); |
||||
// \CodeHydrater\rss_feed::save_to_xml_file($rss); // this would make feed.xml in the Public folder... |
||||
} |
||||
} |
||||
Loading…
Reference in new issue