Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    New to the CF scene
    Join Date
    Jul 2012
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question RSS problem with xml

    Hello,
    when im trying to go at mywebpage/rss.php I get this error:

    XML Parsing Error: not well-formed
    Location: http://xguitar.eu/rss.xml
    Line Number 1, Column 2:<?xml version="1.0" encoding="utf-8"?>
    -^

    The code or rss.php is :

    PHP Code:
    <?php
    /*
    =====================================================
     DataLife Engine - by SoftNews Media Group 
    -----------------------------------------------------
     http://dle-news.ru/
    -----------------------------------------------------
     Copyright (c) 2004,2012 SoftNews Media Group
    =====================================================
         
    =====================================================
     : rss.php
    -----------------------------------------------------
     :  
    =====================================================
    */

    define'DATALIFEENGINE'true );
    define'ROOT_DIR''..' );
    define'ENGINE_DIR'dirname__FILE__ ) );

    @
    error_reporting E_ALL E_WARNING E_NOTICE );
    @
    ini_set 'display_errors'true );
    @
    ini_set 'html_errors'false );
    @
    ini_set 'error_reporting'E_ALL E_WARNING E_NOTICE );

    include 
    ENGINE_DIR '/data/config.php';

    if( 
    $config['http_home_url'] == "" ) {
        
        
    $config['http_home_url'] = explode"engine/rss.php"$_SERVER['PHP_SELF'] );
        
    $config['http_home_url'] = reset$config['http_home_url'] );
        
    $config['http_home_url'] = "http://" $_SERVER['HTTP_HOST'] . $config['http_home_url'];

    }

    require_once 
    ENGINE_DIR '/classes/mysql.php';
    include_once 
    ENGINE_DIR '/data/dbconfig.php';
    include_once 
    ENGINE_DIR '/modules/functions.php';
    require_once 
    ENGINE_DIR '/classes/templates.class.php';
    include_once 
    ROOT_DIR '/language/' $config['langs'] . '/website.lng';

    check_xss();
    $_TIME time() + ($config['date_adjust'] * 60);

    $tpl = new dle_template( );
    $tpl->dir ROOT_DIR '/templates';
    define'TEMPLATE_DIR'$tpl->dir );

    //####################################################################################################################
    //                        
    //####################################################################################################################
    $cat_info get_vars"category" );

    if( ! 
    $cat_info ) {
        
    $cat_info = array ();
        
        
    $db->query"SELECT * FROM " PREFIX "_category ORDER BY posi ASC" );
        while ( 
    $row $db->get_row() ) {
            
            
    $cat_info[$row['id']] = array ();
            
            foreach ( 
    $row as $key => $value ) {
                
    $cat_info[$row['id']][$key] = $value;
            }
        
        }
        
    set_vars"category"$cat_info );
        
    $db->free();
    }
    //#################   
    $user_group get_vars"usergroup" );

    if( ! 
    $user_group ) {
        
    $user_group = array ();
        
        
    $db->query"SELECT * FROM " USERPREFIX "_usergroups ORDER BY id ASC" );
        
        while ( 
    $row $db->get_row() ) {
            
            
    $user_group[$row['id']] = array ();
            
            foreach ( 
    $row as $key => $value ) {
                
    $user_group[$row['id']][$key] = $value;
            }
        
        }
        
    set_vars"usergroup"$user_group );
        
    $db->free();
    }

    $member_id['user_group'] = 5;

    if( isset( 
    $_REQUEST['year'] ) ) $year intval$_GET['year'] ); else $year '';
    if( isset( 
    $_REQUEST['month'] ) ) $month = @$db->safesqlstrip_tagsstr_replace'/'''$_GET['month'] ) ) ); else $month '';
    if( isset( 
    $_REQUEST['day'] ) ) $day = @$db->safesqlstrip_tagsstr_replace'/'''$_GET['day'] ) ) ); else $day '';
    if( isset( 
    $_REQUEST['user'] ) ) $user = @$db->safesqlstrip_tagsstr_replace'/'''urldecode$_GET['user'] ) ) ) ); else $user '';
    if( isset( 
    $_REQUEST['news_name'] ) ) $news_name = @$db->safesqlstrip_tagsstr_replace'/'''$_GET['news_name'] ) ) ); else $news_name '';
    if( isset( 
    $_REQUEST['newsid'] ) ) $newsid intval$_GET['newsid'] ); else $newsid 0;
    if( isset( 
    $_REQUEST['news_page'] ) ) $news_page intval$_GET['news_page'] ); else $news_page 0;
    if( isset( 
    $_REQUEST['category'] ) ) $category = @$db->safesqlstrip_tagsstr_replace'/'''$_GET['category'] ) ) ); else $category '';
    if (isset ( 
    $_REQUEST['catalog'] )) $catalog = @$db->safesql substr strip_tags str_replace '/'''urldecode $_GET['catalog'] ) ) ), 0) ); else $catalog '';

    if( isset( 
    $_REQUEST['category'] ) ) {
        if( 
    substr$_GET['category'], - 1) == '/' $_GET['category'] = substr$_GET['category'], 0, - );
        
    $category explode'/'$_GET['category'] );
        
    $category end$category );
        
    $category $db->safesqlstrip_tags$category ) );
    } else
        
    $category '';

    if( 
    $category != '' $category_id get_ID$cat_info$category );
    else 
    $category_id false;

    $view_template "rss";

    $config['allow_cache'] = true;
    $config['allow_banner'] = false;
    $config['rss_number'] = intval$config['rss_number'] );
    $config['rss_format'] = intval$config['rss_format'] );
    $cstart 0;

    if ( 
    $user $config['allow_cache'] = false;

    if( 
    $_GET['subaction'] == 'allnews' $config['home_title'] = $lang['show_user_news'] . ' ' htmlspecialchars$user ) . " - " $config['home_title'];
    elseif( 
    $_GET['do'] == 'cat' $config['home_title'] = stripslashes$cat_info[$category_id]['name'] ) . " - " $config['home_title'];

    $rss_content = <<<XML
    <?xml version="1.0" encoding="{$config['charset']}"?>
    <rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel>
    <title>
    {$config['home_title']}</title>
    <link>
    {$config['http_home_url']}</link>
    <language>en</language>
    <description>
    {$config['home_title']}</description>
    <generator>DataLife Engine</generator>
    XML;

    if( 
    $config['site_offline'] == "yes" or ! $config['allow_rss'] ) {
        
        
    $rss_content .= <<<XML
    <item>
    <title>RSS in offline mode</title>
    <guid isPermaLink="true"></guid>
    <link></link>
    <description>RSS in offline mode</description>
    <category>undefined</category>
    <dc:creator>DataLife Engine</dc:creator>
    <pubDate>DataLife Engine</pubDate>
    </item>
    XML;

    } else {
        
        if( 
    $config['rss_format'] == ) {
            
            
    $tpl->template = <<<XML
    <item>
    <title>{title}</title>
    <guid isPermaLink="true">{rsslink}</guid>
    <link>{rsslink}</link>
    <description><![CDATA[{short-story}]]></description>
    <category><![CDATA[{category}]]></category>
    <dc:creator>{rssauthor}</dc:creator>
    <pubDate>{rssdate}</pubDate>
    </item>
    XML;
        
        } elseif( 
    $config['rss_format'] == ) {
            
            
    $rss_content = <<<XML
    <?xml version="1.0" encoding="{$config['charset']}"?>
    <rss xmlns:yandex="http://news.yandex.ru" xmlns:media="http://search.yahoo.com/mrss/" version="2.0">
    <channel>
    <title>
    {$config['home_title']}</title>
    <link>
    {$config['http_home_url']}</link>
    <language>ru</language>
    <description>
    {$config['home_title']}</description>
    <image>
    <url>
    {$config['http_home_url']}yandexlogo.gif</url>
    <title>
    {$config['home_title']}</title>
    <link>
    {$config['http_home_url']}</link>
    </image>
    <generator>DataLife Engine</generator>
    XML;
            
            
    $tpl->template = <<<XML
    <item>
    <title>{title}</title>
    <link>{rsslink}</link>
    <description>{short-story}</description>
    <category>{category}</category>
    <pubDate>{rssdate}</pubDate>
    <yandex:full-text>{full-story}</yandex:full-text>
    </item>
    XML;
        
        } else {
            
            
    $tpl->template = <<<XML
    <item>
    <title>{title}</title>
    <guid isPermaLink="true">{rsslink}</guid>
    <link>{rsslink}</link>
    <description>{short-story}</description>
    <category>{category}</category>
    <dc:creator>{rssauthor}</dc:creator>
    <pubDate>{rssdate}</pubDate>
    </item>
    XML;
        
        }
        
        
    $tpl->copy_template $tpl->template;
        
        include_once 
    ENGINE_DIR '/engine.php';
        
        
    $rss_content .= $tpl->result['content'];
    }

    $rss_content .= '</channel></rss>';

    header'Content-type: application/xml' );
    echo 
    $rss_content;

    ?>
    Im using datalife engine and php 5.3. What should i do?

  • #2
    Senior Coder
    Join Date
    Sep 2010
    Posts
    1,990
    Thanks
    15
    Thanked 233 Times in 233 Posts
    I seem to remember that it needs to be UTF-8, in upper case. A little thing, but .xml is very fussy.

  • #3
    New to the CF scene
    Join Date
    Jul 2012
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by DrDOS View Post
    I seem to remember that it needs to be UTF-8, in upper case. A little thing, but .xml is very fussy.
    Hello, i changed it but still nothing...

  • #4
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,536
    Thanks
    45
    Thanked 259 Times in 256 Posts
    Can you link us or post the resulting XML?

  • #5
    Senior Coder
    Join Date
    Sep 2010
    Posts
    1,990
    Thanks
    15
    Thanked 233 Times in 233 Posts
    Refresh you page, it's working for me now. Keleth he has a link up top, it just starting working now.

  • #6
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,536
    Thanks
    45
    Thanked 259 Times in 256 Posts
    He's linked rss.xml but says his code is in rss.php, so I assumed it was a different page.

  • #7
    New to the CF scene
    Join Date
    Jul 2012
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I fixed it, but what i have to do to look it like this: http://www.dlestarter.com/rss.xml ? Thanks.

  • #8
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,536
    Thanks
    45
    Thanked 259 Times in 256 Posts
    To get what to look like that?

  • #9
    New to the CF scene
    Join Date
    Jul 2012
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Keleth View Post
    To get what to look like that?
    I want my (xguitar.eu/rss.xml) to look like this http://www.dlestarter.com/rss.xml. What should i do?
    Last edited by Qwaization; 07-27-2012 at 05:01 PM.

  • #10
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,536
    Thanks
    45
    Thanked 259 Times in 256 Posts
    Is the code you put above for rss.php or rss.xml? I'm not quite sure what you're trying to do anymore. If you want it to look like that, copy the code?

  • #11
    New to the CF scene
    Join Date
    Jul 2012
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Damm it... When i change php version to 5.2 rss works, when i change it to 5.3 or 5.4 it writes error:

    XML Parsing Error: not well-formed
    Location: http://xguitar.eu/rss.xml
    Line Number 1, Column 2:<?xml version="1.0" encoding="utf-8"?>
    -^

    Is there something wrong with the rss.php file?

  • #12
    Senior Coder
    Join Date
    Sep 2010
    Posts
    1,990
    Thanks
    15
    Thanked 233 Times in 233 Posts
    Interesting, that's the parser telling you something. It's pointing right at the question mark in the tag. You may have to add a standalone line to the declaration.
    Code:
    <?xml version="1.0" standalone="no"  encoding="UTF-8"?>
    Or maybe yes. Something in the declarations is wrong for one of the parsers.

  • #13
    New to the CF scene
    Join Date
    Jul 2012
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    noew it shows error:

    XML Parsing Error: not well-formed
    Location: http://xguitar.eu/rss.xml
    Line Number 1, Column 2:<?xml version="1.0" standalone="no" encoding="UTF-8"?>
    -^

    ....

  • #14
    Senior Coder
    Join Date
    Sep 2010
    Posts
    1,990
    Thanks
    15
    Thanked 233 Times in 233 Posts
    I really don't know any specific reason, just try different stuff, maybe it needs a !DOCTYPE statement, it's really just that one of the parsers doesn't like the coding.

  • #15
    Senior Coder
    Join Date
    Aug 2006
    Posts
    1,267
    Thanks
    10
    Thanked 277 Times in 276 Posts
    What's the purpose of 'standalone="no"' in that header? I'd remove that unless it's doing something useful.

    Dave


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

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