Utilisation Zend_Feed

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

View File

@ -69,7 +69,7 @@ class IdentiteController extends Zend_Controller_Action
if ($infos === false) $this->_forward('soap', 'error');
} else {
$infos = $this->getRequest()->getParam('infos');
}
}
//Mise en session
$session = new SessionEntreprise($this->siret, $this->id, true);
@ -672,19 +672,18 @@ class IdentiteController extends Zend_Controller_Action
$items = array();
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';
define('MAGPIE_CACHE_ON', true);
define('MAGPIE_CACHE_DIR', APPLICATION_PATH . '/../cache/rss');
define('MAGPIE_CACHE_AGE', 60*60*24);
define('MAGPIE_OUTPUT_ENCODING', 'UTF-8');
define('MAGPIE_INPUT_ENCODING', 'UTF-8');
define('MAGPIE_DETECT_ENCODING', false);
require_once ('Vendors/magpierss/rss_fetch.inc');
$rss = fetch_rss($url);
if ($rss!==false){
$items = array_slice($rss->items, 0, 15);
}
$canal = new Zend_Feed_Rss($url);
$items = array();
$i=0;
foreach ($canal as $element) {
$items[] = $element;
$i++;
if ($i==$nbNews) break;
}
}
$this->view->assign('items', $items);
} else {