mirror of
https://github.com/Chouchen/ShikiryuRSS.git
synced 2024-11-22 07:48:51 +01:00
Update and rename README.MD to README.md
This commit is contained in:
parent
9ba24eaadd
commit
3825c11863
@ -20,7 +20,7 @@ Or looping them :
|
|||||||
|
|
||||||
foreach($rss as $article)
|
foreach($rss as $article)
|
||||||
{
|
{
|
||||||
echo '<a href="'.$article->link.'">'. SRSSTools::formatDate('d/m/y', $item->pubDate).' '.$item->title.'';
|
echo '<a href="'.$article->link.'">'. SRSSTools::formatDate('d/m/y', $item->pubDate).' '.$item->title.'';
|
||||||
}
|
}
|
||||||
|
|
||||||
If you like arrays, you can transform the RSS into an array :
|
If you like arrays, you can transform the RSS into an array :
|
||||||
@ -49,12 +49,12 @@ Those 3 are mandatory to validate your RSS, other options can be added.
|
|||||||
Then, you can add articles. Let's imagine $content contains an array from your database.
|
Then, you can add articles. Let's imagine $content contains an array from your database.
|
||||||
|
|
||||||
foreach($content as $item){
|
foreach($content as $item){
|
||||||
$rssitem= new SRSSItem; // we create an item
|
$rssitem= new SRSSItem; // we create an item
|
||||||
$rssitem->title = $item["title"]; // adding title (option)
|
$rssitem->title = $item["title"]; // adding title (option)
|
||||||
$rssitem->link = $item['link']; // adding link (option)
|
$rssitem->link = $item['link']; // adding link (option)
|
||||||
$rssitem->pubDate = $item["date"]; // date automatically transformed into RSS format (option)
|
$rssitem->pubDate = $item["date"]; // date automatically transformed into RSS format (option)
|
||||||
$rssitem->description = $item["text"]; // adding description (mandatory)
|
$rssitem->description = $item["text"]; // adding description (mandatory)
|
||||||
$rss->addItem($rssitem); // we add the item into our RSS
|
$rss->addItem($rssitem); // we add the item into our RSS
|
||||||
}
|
}
|
||||||
|
|
||||||
There are 2 functions to add item.
|
There are 2 functions to add item.
|
Loading…
Reference in New Issue
Block a user