Buon giorno a tutti, ho scaricato feedcreator-1.8.0-dev l'ho installato,configurato e genera il file xml con le info che estrapolo da DB.
Sappiamo che i feed rss vengono letti attraverso l'uso di feed reader o di apposite applicazioni come google reader.
Si clicca sul link del feed rss, che rimanda al file rss.xml cosi ad ogni accesso, si avranno le ultime news aggiornate senza dover accedere al sito.
domanda: questo rss.xml, "dovrebbe" aggiornarsi in modo automatico?
Se si, come?
Come faccio ad estrapolare informazioni dal db senza cliccare su una pagina che mi generi il file rss.xml?
al momento faccio cosi:
Codice PHP:
//questa è la pagina official_demo.php, cliccando su un link vado ad estrapolare le info dal //db e creo il file rss.xml.
include("../include/feedcreator.class.php");
include("../../../../include/connect.php");
$rss = new UniversalFeedCreator();
$rss->useCached();
$rss->title = "MIO SITO news";
$rss->description = "daily news from the MIO SITO";
$rss->link = "http://www.miosito.it/news";
$rss->syndicationURL = "http://www.miosito.it/".$PHP_SELF;
$image = new FeedImage();
$image->title = "miosito.it logo";
$image->url = "http://www.miosito.it/images/loghi/miosito.png";
$image->link = "http://www.miosito.it";
$image->description = "Feed provided by miosito.it. Click to visit.";
$rss->image = $image;
// get your news items from somewhere, e.g. your database:
//mysql_select_db($dbHost, $dbUser, $dbPass);
$res = mysql_query("SELECT * FROM ".trim($DB).".TBNEWS ORDER BY nIdNews DESC LIMIT 10") or die(mysql_error());
while ($data = mysql_fetch_object($res)) {
$item = new FeedItem();
$item->title = $data->cTitolo;
// $item->link = $data->url;
//$item->description = $data->short;
$item->description = $data->cTesto;
//$item->date = $data->newsdate;
$item->source = "http://www.miosito.it";
$item->author = "John Doe";
$rss->addItem($item);
}
$rss->saveFeed("RSS1.0", "../news/rss.xml");
Grazie mille.
Buona giornata.