ProcessWire - RSS Feed
Wenn man einen RSS Feed benötigt gibt es im Core von ProcessWire bereits ein Modul.
MarkupRSS
Es kann bei den Core Modulen aktiviert werden.
Im Template kann an es so z.B. nutzen:
Beispiel TV Altötting <syntaxhighlight lang="php"> <?php namespace ProcessWire;
$departmentName = strstr($page->template->name,'-',true); $limit = 10; // default limit $sort = '-modified'; // default sort
// feed on? if($page->fp_feed && $page->fp_feed->opt_1){
echo('Der Feed ist für diese Seite nicht aktiv. Du kannst ihn in den Seiteneinstellungen aktivieren');
exit();
} // feed count if($page->fp_feed && $page->fp_feed->feed_count) $limit = $page->fp_feed->feed_count;
$departmentPostTemplate = $departmentName.'-post'; $feedTitle = $page->title.' - Aktuelles'; $rss = $modules->get("MarkupRSS");
$selector = "template=$departmentPostTemplate, limit=$limit, sort=$sort";
// configure the feed. see the actual module file for more optional config options. $rss->title =$feedTitle; $rss->description = "Aktuelle Informaionen"; $rss->itemContentField = 'infotext'; $rss->itemDescriptionField ='infotext'; $rss->itemDateField = 'date_begin';
// find the pages you want to appear in the feed. // this can be any group of pages returned by $pages->find() or $page->children(), etc. $items = $pages->find($selector); // send the output of the RSS feed, and you are done $rss->render($items); exit();
</php>