1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

RSS for joomla custom component

Discussion in 'XML & RSS' started by ener, Apr 26, 2012.

  1. #1
    Hi,
    I use Joomla 1.5 custom component and I tried to add rss feeds. I dont know whats problem, but no data is displayed in firefox google reader.
    I tested with chrome and there are displayed information, but just only like html (not styled maybe). And if I tried google reader with chrome, then no information again.

    Only what appears in google reader, is the site description.
    This is the file, whats going to take rss or smth. Maybe somebody can understand, why is there no information displayed or whats wrong with my code:).


    $xml = new XMLWriter();
    $xml->openURI('php://output');
    $xml->startDocument("1.0");
    $xml->setIndent(true);
    
    $xml->startElement('rss');
    $xml->writeAttribute('version', '2.0');
    $xml->writeAttribute('xmlns:g', 'http://base.google.com/ns/1.0'); 
    $xml->startElement("channel");
    $xml->writeElement("title", $mainframe->getCfg('sitename'));
    $xml->writeElement("description", $mainframe->getCfg('MetaDesc'));
    $xml->writeElement("link", JURI::root());
    
    if($this->projects){
       // start listings
       foreach ($this->projects as $project){
    
          $xml->startElement("item");
            $xml->writeElement("g:title", $project[title] );
            $xml->writeElement("g:description", $project[description] );
            $xml->endElement();
       }
    }
    
    $xml->endElement(); // rss
    $xml->endDocument();
    $xml->flush();
    PHP:

     
    ener, Apr 26, 2012 IP