Jump to content

Archived

This topic is now archived and is closed to further replies.

ChaosXero

Valid XHTML problem

Recommended Posts

I use Amazon Ads on a site that I maintain (it's for a library) and when I try to validate the XHTML, it goes haywire on the ad.

http://validator.w3.org/check?uri=http%3A%2F%2Fnormaltac.org%2F&charset=%28detect+automatically%29&doctype=XHTML+1.0+Transitional

Anyone know why this happens and if I can fix it.  It irks me when my pages dont validate.

Share this post


Link to post
Share on other sites
As you are using XHTML Doctype you must close all tags. If you have tags that dont have a closing tag you have to have [b](space)/[/b] before >

So for the link tag it should be this:
<link href="final.css" rel="stylesheet" type="text/css" />

the same for meta, input, hr, br tags etc or any other tag that doesnt have a closing tag.

As for the errors with the Amazon Ads. You cant really fix them.

Share this post


Link to post
Share on other sites
[code]<link href="final.css" rel="stylesheet" type="text/css">[/code]

Should be:

[code]link href="final.css" rel="stylesheet" type="text/css"/>[/code]

That'll fix the errors with link, meta tags etc.

You can fix the Amazon errors (almost certainly). The problem is caused by the ampersands.  They need to be changed from & to &amp; either by manual editing or by changing the argument separator as described at http://www.w3.org/QA/2005/04/php-session

[code]ini_set('arg_separator.output','&amp;');[/code]

Share this post


Link to post
Share on other sites
Thanks a lot, I was wondering about that, didn't realize I needed a space.  I'll look into the amazon ads.

I'm unfamiliar with INI_SET will I have to run that once, and will it make my adresses site.org/?var=etc&ampvar2=etc?

Share this post


Link to post
Share on other sites
No, &amp ; (without the space) is the html entity of & (ampersand)

The link will be this in your html:
[code]mysite.com/page.php?var=foo&amp;var2=bar[/code]
However when you hover over the link it'll display as:
[code]mysite.com/page.php?var=foo&var2=bar[/code]
It allows you to keep your page XHTML valid.

However I dont think this will help, as this will only afect urls to your site and not urls going to other sites (amazon).

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.