Utilisation Zend_Feed

This commit is contained in:
Michael RICOIS 2012-04-20 08:25:24 +00:00
parent 8d144e8a26
commit 5d572d57cb

View File

@ -672,18 +672,17 @@ class IdentiteController extends Zend_Controller_Action
$items = array(); $items = array();
if ($googleNews!==false){ if ($googleNews!==false){
$url = 'http://news.google.fr/news?hl=fr&gl=fr&q='. $url = 'http://news.google.fr/news?hl=fr&gl=fr&q='.
urlencode($session->getRaisonSociale()).'&output=rss'; urlencode($session->getRaisonSociale()).'&output=rss';
define('MAGPIE_CACHE_ON', true);
define('MAGPIE_CACHE_DIR', APPLICATION_PATH . '/../cache/rss'); $canal = new Zend_Feed_Rss($url);
define('MAGPIE_CACHE_AGE', 60*60*24); $items = array();
define('MAGPIE_OUTPUT_ENCODING', 'UTF-8'); $i=0;
define('MAGPIE_INPUT_ENCODING', 'UTF-8'); foreach ($canal as $element) {
define('MAGPIE_DETECT_ENCODING', false); $items[] = $element;
require_once ('Vendors/magpierss/rss_fetch.inc'); $i++;
$rss = fetch_rss($url); if ($i==$nbNews) break;
if ($rss!==false){
$items = array_slice($rss->items, 0, 15);
} }
} }
$this->view->assign('items', $items); $this->view->assign('items', $items);