Forums

RSS Feed Adding <html> and <head> tags (23 posts)

  1. staypuff
    Member
    Posted 3 years ago #

    It appears that the rss feed for my site has died at some point. Running it through a validator (http://feedvalidator.org) it says my xml contains '<html>' and '</head>' code which I don't think is right.

    My rss url is:
    http://staypuff.net/wordpress/wp-rss2.php

    For comments, which is also broken:
    http://staypuff.net/wordpress/wp-commentsrss2.php

    If anyone can shed some light on the problem, that would really help. No doubt it is a small error somewhere that needs correcting.

    Thanks in advance.

  2. kmessinger
    Member
    Posted 3 years ago #

    No doubt it is a small error somewhere that needs correcting.

    Wish it were. You have many errors that can be seen here, http://validator.w3.org/.

    You will have to remove the 2 copywrite symbols at the bottom before validating the code so you can see the errors.

  3. staypuff
    Member
    Posted 3 years ago #

    I removed the copyright signs and its displayed a whole raft of errors. The strange thing is, my rss feed only broke after updating to WordPress 2.7.1.

  4. staypuff
    Member
    Posted 3 years ago #

    Actually, the rss side of things looks fine, so why is WordPress importing all my html into the rss feed once the rss finishes?

  5. kmessinger
    Member
    Posted 3 years ago #

    Maybe because of errors in your code?

    It is impossible to figure out problems while the code is bad.

    In functions.php or in your config.php you may have an extra white space but that is moot while your code is incorrect.

  6. staypuff
    Member
    Posted 3 years ago #

    Hmm... I don't touch my rss code. WordPress does everything, I merely point to it.

    The RSS seems fine, its just that WordPress also includes a version of my blog's html in at the bottom. I'm stumped if I know why.

  7. kmessinger
    Member
    Posted 3 years ago #

    The strange thing is, my rss feed only broke after updating to WordPress 2.7.1.

    Disable your plugins and see how it works.

  8. staypuff
    Member
    Posted 3 years ago #

    I've disabled all plugins but still no success.

  9. kmessinger
    Member
    Posted 3 years ago #

    The code being added is from your signin, register page. So it may be in how you have that set up.

  10. staypuff
    Member
    Posted 3 years ago #

    Yes... seems to be that. I'll have a play around with a few things and see how it goes.

    I appreciate your help. I'm sure problem solving like this isn't an easy thing.

  11. staypuff
    Member
    Posted 3 years ago #

    Ok, I've managed to clear the RSS side of things in the code. That's fine.

    The problem is that when WordPress is asked for the wp-rss2.php file, its exporting the rss fine, and then adding my index.php HTML code afterwards, killing it in almost all RSS readers (as you'd expect).

    I've toggled around with the index.php (even to the point where it was empty) but it still inserts all the HTML tags.

    I've added the code below, but the links are in the opening post.

    # <?xml version="1.0" encoding="utf-8"?>
    # <rss version="2.0"
    # xmlns:content="http://purl.org/rss/1.0/modules/content/"
    # xmlns:wfw="http://wellformedweb.org/CommentAPI/"
    # xmlns:dc="http://purl.org/dc/elements/1.1/"
    # xmlns:atom="http://www.w3.org/2005/Atom"
    # xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
    # >
    #
    # <channel>
    # <title>Staypuff.net</title>
    # <atom:link href="http://staypuff.net/?feed=rss2" rel="self" type="application/rss+xml" />
    # <link>http://staypuff.net</link>
    # <description>The life and time of David, an Australian bloke, making his way through life in Korea</description>
    # <pubDate>Tue, 03 Mar 2009 02:26:38 +0000</pubDate>
    # <generator>http://wordpress.org/?v=2.7.1</generator>
    # <language>en</language>
    # <sy:updatePeriod>hourly</sy:updatePeriod>
    # <sy:updateFrequency>1</sy:updateFrequency>
    # <item>
    # <title>Muffins for the teachers.</title>
    # <link>http://staypuff.net/?p=2912</link>
    # <comments>http://staypuff.net/?p=2912#comments</comments>
    # <pubDate>Tue, 03 Mar 2009 01:55:23 +0000</pubDate>
    # <dc:creator>David</dc:creator>
    
    etc...
    
    #  <wfw:commentRss>http://staypuff.net/?feed=rss2&amp;p=2895</wfw:commentRss>
    # </item>
    # </channel>
    # </rss>
    
    # <body topmargin="0" leftmargin="0">
    #
    # <table border="0" width="100%" cellspacing="0" cellpadding="0" height="95%">
    #  <tr>
    #    <td width="30" bgcolor="#C0C0C0">&nbsp;</td>
    #    <td style="border: 1 solid #000000; padding: 0">
    #      <table border="0" width="100%" cellspacing="0" cellpadding="0">
    #        <tr>
    #          <td background="images/banner.jpg" height="215" align="right" valign="bottom"><div id="search">
    
    etc...
    
    </body>

    Really I don't know why its doing this.

  12. kmessinger
    Member
    Posted 3 years ago #

    As long as your html has errors, it is just guessing in trying to fix rss.

    then adding my index.php HTML

    What html in your index.php file? There should be no html there.

  13. milehighlife
    Member
    Posted 3 years ago #

    I'm having the same issue.

    The XML of my posts flow in fine. But immediately following the XML is all of the markup for my index.php file, causing the XML parse error.

    I was thinking it might be a permalink issue. I checked my .htaccess file (Mac OS X Server Apache):

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /blog/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /blog/index.php [L]
    # set the canonical url
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^mysite\.com$ [NC]
    RewriteRule ^(.*)$ http://www.mysite.com/$1 [R=301,L]
    </IfModule>
  14. kmessinger
    Member
    Posted 3 years ago #

    all of the markup for my index.php file

    What markup in your index.php file? It has 2 lines of php and that is all it should have.

    What is your url?

  15. milehighlife
    Member
    Posted 3 years ago #

    I have a custom index.php file (which has been continually modified since WP 1.2 using 'The Loop') and replaced it with the WP 2.7 default index.php file and... viola! The feed works fine.

    So, now I need to figure out how to use my old index.php. Is it as simple as placing it into a theme folder?

    Thanks in advance.

  16. kmessinger
    Member
    Posted 3 years ago #

    Is it as simple as placing it into a theme folder?

    I don't know. Normally that file is pretty simple. You can try it.

    What is in your index file that can't be in the header file? Most of the html goes there.

  17. milehighlife
    Member
    Posted 3 years ago #

    The index file has markup that echoes the theme of the entire website--structural div's, ad zone includes, additional CSS. Is it time to move all of this formatting to a template file for my styled index page to work as before?

  18. kmessinger
    Member
    Posted 3 years ago #

    It sounds like you could move all that to a new css and then call it from the header.php or try placing it at the bottom of the header.php.

    I have css, scripts, and divs in my header file that work ok and verify.

    The header file is much like an html index file anyway.

  19. milehighlife
    Member
    Posted 3 years ago #

    kmessinger, thanks for your feedback.

    So, are you referring to the file wp-blog-header.php?

    Thanks again.

  20. staypuff
    Member
    Posted 3 years ago #

    Well that actually answers my inital question, too.

    So you're basically saying, and excuse my ignorance on the topic as I'm hardly an expert, is that you can have no HTML in your WordPress code (such as setting margins and tables, etc...). It has to be all php?

    I've been using WordPress for years with HTML in my index.php (I realised what I just said) and never had a problem until now.

    Life just got a little more difficult. :(

  21. kmessinger
    Member
    Posted 3 years ago #

    First, I am no expert at all especially on php. The file I am refering to is header.php which is in your theme's root.

    I don't know if you can have html in wp code. I would think certainly not in the core files but in the header and footer files that come with your theme you can do much with html.

    I was just pointing out that index.php is very unlike the normal index.html page. The closest to index.html would be header.php called from your theme by index.php.

    Is it wrong to put html in your index.php? I really don't know but, it would solve the problem we started with (I hope) of html from that file appearing in your rss feed.

    Life just got a little more difficult. :(

    It shouldn't. It is just as easy to put code, css, scripts, java, etc. in the header as it is to use the index file. Where is all your meta? It should be in theme/yourtheme/header.php

    I would hope, if I am totally of course here a mod might jump in. It works fine for me though. Validates and I have no problems with RSS.

  22. staypuff
    Member
    Posted 3 years ago #

    Oh, I'm sure the changes in WordPress have made things easier for the mainstream, but for me its all about learning new tricks, which I'm happy to do.

    You've been a great help and now that I know where my problems are, I now have the task to try and fix it up.

    Thanks for all your help. :)

  23. milehighlife
    Member
    Posted 3 years ago #

    @ kmessinger

    The file I am refering to is header.php which is in your theme's root.

    So, I looked through the index.php, header.php and footer.php files of the default theme and, when combined, make a very similar page to my custom index.

    So, I'm basically going to breakup my old index.php file to fit into these three files and create a theme.

    Thanks again for your help!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags