florian95 Posted May 15, 2012 Share Posted May 15, 2012 Bonjour, existe il un module qui permet de créer un flux rss de son site. le bloc rss produits fait le rss des produits mais sachant que j'ai une page blog avec des articles comment faire pour les mettres dans le rss ? Merci d'avance Link to comment Share on other sites More sharing options...
Ju972 Posted May 16, 2012 Share Posted May 16, 2012 Bonjour, j'ai le même problème. Est-il possible d'utiliser quand même ce module en modifiant le code ? Merci Link to comment Share on other sites More sharing options...
Ju972 Posted May 16, 2012 Share Posted May 16, 2012 Apparemment il suffit de mettre la ligne suivante en commentaire dans le fichier blockrss.php (dans modules/blockrss) /*elseif (stristr($urlfeed, $_SERVER['HTTP_HOST'].__PS_BASE_URI__)) $errors[] = $this->l('You have selected a feed URL on your own website. Please choose another URL');*/ S'il y avait une raison valable pour laquelle on ne peut pas mettre une adresse interne par défaut je suis preneur Link to comment Share on other sites More sharing options...
florian95 Posted May 17, 2012 Author Share Posted May 17, 2012 Bonjour ju972, j'ai mi cette ligne en commentaire mais je ne vois pas comment faire? ensuite dans ajouter url je n'arrive pas à mettre mon url. Comment faire? Link to comment Share on other sites More sharing options...
Ju972 Posted May 18, 2012 Share Posted May 18, 2012 Qu'est ce que tu veux dire par "je n'arrive pas", qu'est ce qu'il se passe quand tu saisis l'url ? Link to comment Share on other sites More sharing options...
florian95 Posted May 18, 2012 Author Share Posted May 18, 2012 Quand je met mon url ca me dis qu'on ne peux pas rajouter son url de site.. Link to comment Share on other sites More sharing options...
Ju972 Posted May 18, 2012 Share Posted May 18, 2012 Si tu as bien fait la modif et enregistré je ne vois pas... car c'est cette ligne qui crée l'erreur et affiche ce message... Link to comment Share on other sites More sharing options...
florian95 Posted May 18, 2012 Author Share Posted May 18, 2012 Voici mon blockrss.php : <?php /* * 2007-2011 PrestaShop * * NOTICE OF LICENSE * * This source file is subject to the Academic Free License (AFL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/afl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to [email protected] so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA <[email protected]> * @copyright 2007-2011 PrestaShop SA * @version Release: $Revision: 9385 $ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA */ if (!defined('_PS_VERSION_')) exit; include_once(_PS_CLASS_DIR_.'../tools/pear/PEAR.php'); include_once(_PS_PEAR_XML_PARSER_PATH_.'Parser.php'); class Blockrss extends Module { function __construct() { $this->name = 'blockrss'; $this->tab = 'front_office_features'; $this->need_instance = 0; parent::__construct(); $this->displayName = $this->l('RSS feed block'); $this->description = $this->l('Adds a block displaying an RSS feed.'); $this->version = '1.1'; $this->author = 'PrestaShop'; $this->error = false; $this->valid = false; } function install() { Configuration::updateValue('RSS_FEED_TITLE', $this->l('RSS feed')); Configuration::updateValue('RSS_FEED_NBR', 5); if (parent::install() == false OR $this->registerHook('leftColumn') == false OR $this->registerHook('header') == false) return false; return true; } public function getContent() { $output = '<h2>'.$this->displayName.'</h2>'; if (Tools::isSubmit('submitBlockRss')) { $errors = array(); $urlfeed = strval(Tools::getValue('urlfeed')); $title = strval(Tools::getValue('title')); $nbr = (int)(Tools::getValue('nbr')); if ($urlfeed AND !Validate::isUrl($urlfeed)) $errors[] = $this->l('Invalid feed URL'); elseif (!$title OR empty($title) OR !Validate::isGenericName($title)) $errors[] = $this->l('Invalid title'); elseif (!$nbr OR $nbr <= 0 OR !Validate::isInt($nbr)) $errors[] = $this->l('Invalid number of feeds'); /*elseif (stristr($urlfeed, $_SERVER['HTTP_HOST'].__PS_BASE_URI__)) $errors[] = $this->l('You have selected a feed URL on your own website. Please choose another URL');*/ elseif (!($contents = @file_get_contents($urlfeed))) $errors[] = $this->l('Feed is unreachable, check your URL'); /* Even if the feed was reachable, We need to make sure that the feed is well formated */ else { try { $xmlFeed = new XML_Feed_Parser($contents); } catch (XML_Feed_Parser_Exception $e) { $errors[] = $this->l('Invalid feed:').' '.$e->getMessage(); } } if (!sizeof($errors)) { Configuration::updateValue('RSS_FEED_URL', $urlfeed); Configuration::updateValue('RSS_FEED_TITLE', $title); Configuration::updateValue('RSS_FEED_NBR', $nbr); $output .= $this->displayConfirmation($this->l('Settings updated')); } else $output .= $this->displayError(implode('<br />', $errors)); } else { $errors = array(); if (stristr(Configuration::get('RSS_FEED_URL'), $_SERVER['HTTP_HOST'].__PS_BASE_URI__)) $errors[] = $this->l('You have selected a feed URL on your own website. Please choose another URL'); if (sizeof($errors)) $output .= $this->displayError(implode('<br />', $errors)); } return $output.$this->displayForm(); } public function displayForm() { $output = ' <form action="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'" method="post"> <fieldset><legend><img src="'.$this->_path.'logo.gif" alt="" title="" />'.$this->l('Settings').'</legend> <label>'.$this->l('Block title').'</label> <div class="margin-form"> <input type="text" name="title" value="'.htmlentities(Tools::getValue('title', Configuration::get('RSS_FEED_TITLE'))).'" /> <p class="clear">'.$this->l('Create a title for the block (default: \'RSS feed\')').'</p> </div> <label>'.$this->l('Add a feed URL').'</label> <div class="margin-form"> <input type="text" size="85" name="urlfeed" value="'.htmlentities(Tools::getValue('urlfeed', Configuration::get('RSS_FEED_URL'))).'" /> <p class="clear">'.$this->l('Add the URL of the feed you want to use (sample: http://news.google.com/?output=rss)').'</p> </div> <label>'.$this->l('Number of threads displayed').'</label> <div class="margin-form"> <input type="text" size="5" name="nbr" value="'.(int)Tools::getValue('nbr', Configuration::get('RSS_FEED_NBR')).'" /> <p class="clear">'.$this->l('Number of threads displayed by the block (default value: 5)').'</p> </div> <center><input type="submit" name="submitBlockRss" value="'.$this->l('Save').'" class="button" /></center> </fieldset> </form>'; return $output; } function hookLeftColumn($params) { global $smarty; // Conf $title = strval(Configuration::get('RSS_FEED_TITLE')); $url = strval(Configuration::get('RSS_FEED_URL')); $nb = (int)(Configuration::get('RSS_FEED_NBR')); // Getting data $rss_links = array(); if ($url && ($contents = @file_get_contents($url))) try { if (@$src = new XML_Feed_Parser($contents)) for ($i = 0; $i < ($nb ? $nb : 5); $i++) if (@$item = $src->getEntryByOffset($i)) $rss_links[] = array('title' => $item->title, 'url' => $item->link); } catch (XML_Feed_Parser_Exception $e) { Tools::dieOrLog(Tools::displayError('Error: invalid RSS feed in blockrss module').' '.$e->getMessage(), false); } // Display smarty $smarty->assign(array('title' => ($title ? $title : $this->l('RSS feed')), 'rss_links' => $rss_links)); return $this->display(__FILE__, 'blockrss.tpl'); } function hookRightColumn($params) { return $this->hookLeftColumn($params); } function hookHeader($params) { Tools::addCSS(($this->_path).'blockrss.css', 'all'); } } Merci encore pour vos réponses ! Link to comment Share on other sites More sharing options...
Ju972 Posted May 19, 2012 Share Posted May 19, 2012 désolé florian, j'ai la même chose et pour moi ca fonctionne. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now