Results 1 to 4 of 4

Thread: rss not working

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2005
    Posts
    1,170

    rss not working

    I keep getting this error from the feed:

    Code:
    Invalid xml declaration.
     Line: 2 Character: 3
    
    <?xml version="2.0" encoding="ISO-8859-1"?>
    and my php is:

    PHP Code:
    <?php

    //header("Content-type: application/xml; charset={$config['encoding']}");

    include 'config.php';

    //$query = "SELECT n.*,a.* FROM news AS n LEFT JOIN authors AS a ON a.aid=n.n_author_id ORDER BY
    //(is_numeric($config['headlines']) && $config['headlines']>0 ? " LIMIT {$config['headlines']}" : null));
    //
    //$result = mysql_query($query) or die ('Error' . mysql_error());

    $news_headlines mysql_query("SELECT n.*,a.* FROM news AS n LEFT JOIN authors AS a ON a.aid=n.n_author_id ORDER BY n.n_time DESC".(is_numeric($config['headlines']) && $config['headlines']>" LIMIT {$config['headlines']}null));
    $items_output    null;

    if(
    mysql_num_rows($news_headlines))
    {
        while(
    $headline mysql_fetch_assoc($news_headlines))
        {
            
    $link            htmlentities("http://example.com/index.php?act=news&id={$headline['nid']}");
            
    $pubdate        gmdate('r',$headline['n_time']);
            
    $author            $config['show_author_info'] ? "nttt<author>{$headline['a_email']} ({$headline['a_name']})</author>" null;
            
    $description    nl2br($headline['n_body']);

            
    $items_output .= <<<EOF

            <item>
                <title>
    {$headline['n_title']}</title>
                <description>
                    
    {$description}
                </description>
                <link>
    {$link}</link>
                <pubDate>
    {$pubdate}</pubDate>{$author}
            </item>
    EOF;
        }
    }

    $config['encoding']    = empty($config['encoding']) ? 'ISO-8859-1' $config['encoding'];
    $copyright            = empty($config['copyright']) ? null "ntt<copyright>".str_replace('{year}',date('Y'),$config['copyright'])."</copyright>";
    $pubdate            $config['show_feed_pubdate'] ? "ntt<pubDate>".gmdate('r')."</pubDate>" null;
    $language            = empty($config['language']) ? null "ntt<language>{$config['language']}</language>";
    $output = <<<EOF
    <?xml version="2.0" encoding="{$config['encoding']}"?>
    <rss version="2.0">
        <channel>
            <title>
    {$config['feed_title']}</title>
            <link>
    {$config['link']}</link>
            <description>
    {$config['description']}</description>{$copyright}{$pubdate}{$language}{$items_output}
        </channel>
    </rss>

    EOF;
    echo 
    $output;
    ?>

  2. #2
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    Re: rss not working

    I'm not good with XML, so I can't help much. spit it out as plain text (rather than XML like I'm assuming you're doing now) and have a look at it. is it proper XML? is anything missing from the stuff you're putting out? anything going wrong or unexpected?

  3. #3
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: rss not working

    There is no XML version 2.0, only 1.0.

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2005
    Posts
    1,170

    Re: rss not working

    Yeah i fixed that and put 1.0 instead, still got the problem

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width