Back to top

Autore Topic: Fulltext nei feed rss  (Letto 1912 volte)

Offline megawatt

  • Esploratore
  • **
  • Post: 91
  • Sesso: Maschio
    • Mostra profilo
Fulltext nei feed rss
« il: 12 Ago 2012, 12:54:14 »
Salve a tutti,
Vorrei sapere come posso fare per farsi che nei feed rss del mio sito esca tutto il testo compreso quello dopo il readmore, mi serve questo perchè uso i feed per una app per android che legge i feeed e li adatta per il mobile, un feed di esempio è http://www.rollercoasterrevolution.eu/ultime-notizie.feed?type=rss
per i feed uso il modulo mod_syndicate

Grazie a tutti per l'aiuto
« Ultima modifica: 12 Ago 2012, 12:57:01 da megawatt »

Offline megawatt

  • Esploratore
  • **
  • Post: 91
  • Sesso: Maschio
    • Mostra profilo
Re:Fulltext nei feed rss
« Risposta #1 il: 13 Ago 2012, 11:41:13 »
Devo modificare questo file ?

Codice: [Seleziona]
<?php
/**
 * @version        $Id: rss.php 14401 2010-01-26 14:10:00Z louis $
 * @package        Joomla.Framework
 * @subpackage    Document
 * @copyright    Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
 * @license        GNU/GPL, see LICENSE.php
 * Joomla! is free software. This version may have been modified pursuant
 * to the GNU General Public License, and as distributed it includes or
 * is derivative of works licensed under the GNU General Public License or
 * other free or open source software licenses.
 * See COPYRIGHT.php for copyright notices and details.
 */

// Check to ensure this file is within the rest of the framework
defined('JPATH_BASE') or die();


 
/**
 * JDocumentRenderer_RSS is a feed that implements RSS 2.0 Specification
 *
 * @author    Johan Janssens <johan.janssens@joomla.org>
 *
 * @package     Joomla.Framework
 * @subpackage        Document
 * @see http://www.rssboard.org/rss-specification
 * @since    1.5
 */

class JDocumentRendererRSS extends JDocumentRenderer
{
    
/**
     * Renderer mime type
     *
     * @var        string
     * @access    private
     */
    
var $_mime "application/rss+xml";

    
/**
     * Render the feed
     *
     * @access public
     * @return    string
     */
    
function render()
    {
        
$now    =& JFactory::getDate();
        
$data    =& $this->_doc;

        
$uri =& JFactory::getURI();
        
$url $uri->toString(array('scheme''user''pass''host''port'));
        
$syndicationURL =& JRoute::_('&format=feed&type=rss');
        
        
$feed "<rss version=\"2.0\" xmlns:atom=\"http://www.w3.org/2005/Atom\">\n";
        
$feed.= "    <channel>\n";
        
$feed.= "        <title>".$data->title."</title>\n";
        
$feed.= "        <description>".htmlspecialchars($data->description)."</description>\n";
        
$feed.= "        <link>".str_replace(' ','%20',$url.$data->link)."</link>\n";
        
$feed.= "        <lastBuildDate>".htmlspecialchars($now->toRFC822(), ENT_COMPAT'UTF-8')."</lastBuildDate>\n";
        
$feed.= "        <generator>".$data->getGenerator()."</generator>\n";
    
        if (
$data->image!=null)
        {
            
$feed.= "        <image>\n";
            
$feed.= "            <url>".$data->image->url."</url>\n";
            
$feed.= "            <title>".htmlspecialchars($data->image->titleENT_COMPAT'UTF-8')."</title>\n";
            
$feed.= "            <link>".str_replace(' ','%20',$data->image->link)."</link>\n";
            if (
$data->image->width != "") {
                
$feed.= "            <width>".$data->image->width."</width>\n";
            }
            if (
$data->image->height!="") {
                
$feed.= "            <height>".$data->image->height."</height>\n";
            }
            if (
$data->image->description!="") {
                
$feed.= "            <description><![CDATA[".$data->image->description."]]></description>\n";
            }
            
$feed.= "        </image>\n";
        }
        if (
$data->language!="") {
            
$feed.= "        <language>".$data->language."</language>\n";
        }
        if (
$data->copyright!="") {
            
$feed.= "        <copyright>".htmlspecialchars($data->copyright,ENT_COMPAT'UTF-8')."</copyright>\n";
        }
        if (
$data->editorEmail!="") {
            
$feed.= "        <managingEditor>".htmlspecialchars($data->editorEmailENT_COMPAT'UTF-8').' ('.
                
htmlspecialchars($data->editorENT_COMPAT'UTF-8').")</managingEditor>\n";
        }
        if (
$data->webmaster!="") {
            
$feed.= "        <webMaster>".htmlspecialchars($data->webmasterENT_COMPAT'UTF-8')."</webMaster>\n";
        }
        if (
$data->pubDate!="") {
            
$pubDate =& JFactory::getDate($data->pubDate);
            
$feed.= "        <pubDate>".htmlspecialchars($pubDate->toRFC822(),ENT_COMPAT'UTF-8')."</pubDate>\n";
        }
        if (
$data->category!="") {
            
$feed.= "        <category>".htmlspecialchars($data->categoryENT_COMPAT'UTF-8')."</category>\n";
        }
        if (
$data->docs!="") {
            
$feed.= "        <docs>".htmlspecialchars($data->docsENT_COMPAT'UTF-8')."</docs>\n";
        }
        if (
$data->ttl!="") {
            
$feed.= "        <ttl>".htmlspecialchars($data->ttlENT_COMPAT'UTF-8')."</ttl>\n";
        }
        if (
$data->rating!="") {
            
$feed.= "        <rating>".htmlspecialchars($data->ratingENT_COMPAT'UTF-8')."</rating>\n";
        }
        if (
$data->skipHours!="") {
            
$feed.= "        <skipHours>".htmlspecialchars($data->skipHoursENT_COMPAT'UTF-8')."</skipHours>\n";
        }
        if (
$data->skipDays!="") {
            
$feed.= "        <skipDays>".htmlspecialchars($data->skipDaysENT_COMPAT'UTF-8')."</skipDays>\n";
        }

        for (
$i=0$i<count($data->items); $i++)
        {
            if ((
strpos($data->items[$i]->link'http://') === false) and (strpos($data->items[$i]->link'https://') === false)) {
                
$data->items[$i]->link str_replace(' ','%20',$url.$data->items[$i]->link);
            }
            
$feed.= "        <item>\n";
            
$feed.= "            <title>".htmlspecialchars(strip_tags($data->items[$i]->title), ENT_COMPAT'UTF-8')."</title>\n";
            
$feed.= "            <link>".str_replace(' ','%20',$data->items[$i]->link)."</link>\n";
            
$feed.= "            <guid>".str_replace(' ','%20',$data->items[$i]->link)."</guid>\n";
            
$feed.= "            <description><![CDATA[".$this->_relToAbs($data->items[$i]->description)."]]></description>\n";

            if (
$data->items[$i]->authorEmail!="") {
                
$feed.= "            <author>".htmlspecialchars($data->items[$i]->authorEmail ' (' 
                                        
$data->items[$i]->author ')'ENT_COMPAT'UTF-8')."</author>\n";
            }
            
/*
            // on hold
            if ($data->items[$i]->source!="") {
                    $data.= "            <source>".htmlspecialchars($data->items[$i]->source, ENT_COMPAT, 'UTF-8')."</source>\n";
            }
            */
            
if ($data->items[$i]->category!="") {
                
$feed.= "            <category>".htmlspecialchars($data->items[$i]->categoryENT_COMPAT'UTF-8')."</category>\n";
            }
            if (
$data->items[$i]->comments!="") {
                
$feed.= "            <comments>".htmlspecialchars($data->items[$i]->commentsENT_COMPAT'UTF-8')."</comments>\n";
            }
            if (
$data->items[$i]->date!="") {
            
$itemDate =& JFactory::getDate($data->items[$i]->date);
                
$feed.= "            <pubDate>".htmlspecialchars($itemDate->toRFC822(), ENT_COMPAT'UTF-8')."</pubDate>\n";
            }
            if (
$data->items[$i]->guid!="") {
                
$feed.= "            <guid>".htmlspecialchars($data->items[$i]->guidENT_COMPAT'UTF-8')."</guid>\n";
            }
            if (
$data->items[$i]->enclosure != NULL)
            {
                    
$feed.= "            <enclosure url=\"";
                    
$feed.= $data->items[$i]->enclosure->url;
                    
$feed.= "\" length=\"";
                    
$feed.= $data->items[$i]->enclosure->length;
                    
$feed.= "\" type=\"";
                    
$feed.= $data->items[$i]->enclosure->type;
                    
$feed.= "\"/>\n";
            }

            
$feed.= "        </item>\n";
        }
        
$feed.= "    </channel>\n";
        
$feed.= "</rss>\n";
        return 
$feed;
    }

    
/**
     * Convert links in a text from relative to absolute
     *
     * @access public
     * @return    string
     */
    
function _relToAbs($text)
    {
        
$base JURI::base();
          
$text preg_replace("/(href|src)=\"(?!http|ftp|https|mailto)([^\"]*)\"/""$1=\"$base\$2\""$text);

        return 
$text;
    }

 



Web Design Bolzano Kreatif