Gossamer Forum
Home : Products : Gossamer Links : Discussions :

W3c validation - & causing errors

Quote Reply
W3c validation - & causing errors
Hi

I've tested a couple of my site pages with w3c validation tool and there are multiple errors and warnings caused by use of '&' in various positions within the html code, <title>, <description> and <keyword> tags in addition to within the link description.

The pages effected are both category and detailed pages.

This appears to happening because of my use of a link field named <%bbtype%> that has entries like B&B, Bed & Breakfast

Information from the W3c validation tool shows this: This is generally the sign of an ampersand that was not properly escaped for inclusion in an attribute, in a href for example. You will need to escape all instances of '&' into '&amp;'

Any suggestions on how to fix this?

thanks
Colin Thompson
Quote Reply
Re: [colintho] W3c validation - & causing errors In reply to
Yup, your best bet is to use stuff like &amp; for &, &quot; for " , etc.

For fields (like <%Title%>) you can use stuff like:

<%GT::CGI::html_escape($Title)%>

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] W3c validation - & causing errors In reply to
Many Thanks

that has fixed quite a number of W3c validation errors
Colin Thompson
Quote Reply
Re: [colintho] W3c validation - & causing errors In reply to
Np - I wouldn't worry too much about validation unless you are aiming to make it 100% compliant. I've found trhat fully w3 compliant sites take forever to get going, as it moans about so much :)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] W3c validation - & causing errors In reply to
OK

will just fix the ones that are easy to fix...I still have quite a large number that are being caused by the & used by people in descriptions, in the Link template I'm using 'trim field' like this:

<%Plugins::ULTRAGlobals::Trim_Field(0,350,$Description)%>


can the <%GT::CGI::html_escape($title)%> code be used with this?


regards


Colin
Colin Thompson
Quote Reply
Re: [colintho] W3c validation - & causing errors In reply to
Try:

Code:
<%set Description = Plugins::ULTRAGlobals::Trim_Field(0,350,$Description)%>
<%GT::CGI::html_escape($Description)%>

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] W3c validation - & causing errors In reply to
that works just fine, appreciate your support

Thanks Andy
Colin Thompson