close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 or 2018 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

HTML Encode- problem with feed validation

Thread began 4/21/2017 9:24 am by Nathon Jones Web Design | Last modified 4/24/2017 7:11 pm by Ray Borduin | 122 views | 7 replies |

Nathon Jones Web Design

HTML Encode- problem with feed validation

Hi,

How do I add HTML Encode to data from a recordset so that it convert characters to the correct format?

<?php echo $row['newsTITLE']; ?>



....is not validating correctly when the title includes, for example, an ampersand.

Thank you.
NJ

Sign in to reply to this post

Ray BorduinWebAssist

php:
<?php echo(htmlentities($row['newsTITLE'])); ?>
Sign in to reply to this post

Nathon Jones Web Design

Thank you Ray.

If we have "£" in the database table field this renders as "&pound;" in the validator which, even with htmlentities, produces the parsing error. The data is submitted using a textarea form field so I'm not sure why it's not validating properly.
https://validator.w3.org/feed/check.cgi?url=http%3A%2F%2Fwww.gallowayfisheriestrust.org%2Frss-fisheries-trust-news.php

Any idea what could be causing this?
Much appreciated
NJ

Sign in to reply to this post

Ray BorduinWebAssist

It will allow you to use ampersands in your content if you escape it with a CDATA tag like:

<item> <![CDATA[ Smith & Wesson ]]> </item>

Sign in to reply to this post

Nathon Jones Web Design

So...

<item><![CDATA[<?php echo(htmlentities($row['newsTITLE'])); ?>]]></item>



Will give that a try anyway. Thank you Ray.
NJ

Sign in to reply to this post

Ray BorduinWebAssist

That looks right.

Sign in to reply to this post

Nathon Jones Web Design

It's now validating, but it's still finding a problem with &amp;

https://validator.w3.org/feed/check.cgi?url=http%3A%2F%2Fwww.gallowayfisheriestrust.org%2Frss-fisheries-trust-news.php

RSS feeds. Does anyone even use these any more?

Sign in to reply to this post

Ray BorduinWebAssist

Try using: htmlspecialchars()
instead of: htmlentities()

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...