brent123456 Posted July 11, 2007 Share Posted July 11, 2007 I am having some trouble with my script I am direct linking from my feed. $output .= "<link>http://localhost/mrlumber/site_pages/index.php?do=viewtheproduct&pid=$row[product_id]</link>\n"; $output .= "<guid isPermaLink=\"false\">" . $row['product_id'] . "</guid>"; It is breaking on the ampersand and will not print out the feed. If I just use the root url it works fine. Anyone know a way I can fix this? Thanks, Brent Quote Link to comment Share on other sites More sharing options...
brent123456 Posted July 12, 2007 Author Share Posted July 12, 2007 Can anyone help me out with this? Thanks Quote Link to comment Share on other sites More sharing options...
cmgmyr Posted July 12, 2007 Share Posted July 12, 2007 try: $output .= "<link>http://localhost/mrlumber/site_pages/index.php?do=viewtheproduct&pid=".$row[product_id]."</link>\n"; $output .= "<guid isPermaLink=\"false\">" . $row['product_id'] . "</guid>"; Quote Link to comment Share on other sites More sharing options...
brent123456 Posted July 12, 2007 Author Share Posted July 12, 2007 Thanks cmgmyr, Worked like a charm Quote Link to comment Share on other sites More sharing options...
SharkBait Posted July 12, 2007 Share Posted July 12, 2007 The other thing you might want to look at is the <![CDATA[ ]]> for XML (or rss feeds) that will ignore special characters and display them as is. It took me forever to figure it out but various characters can break the validation of XML and using the above worked for me. Example: <?php $feed = "<item>\n <title>{$blog['title']}</title>\n <description><![CDATA[{$description}]]?</description>\n <link>http://www.tyleringram.com/blog/{$url}</link>\n <pubDate>{$pubDate}</pubDate>\n <guid>http://www.tyleringram.com/blog/{$url}</guid>\n </item>\n\n"; ?> Now because $description is my blog's content it has various special characters that would invalidate or break the XML. Hope this helps a bit too. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.