Jump to content

Valid XHTML problem


ChaosXero

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.
Link to comment
https://forums.phpfreaks.com/topic/18727-valid-xhtml-problem/
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.
Link to comment
https://forums.phpfreaks.com/topic/18727-valid-xhtml-problem/#findComment-80763
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]
Link to comment
https://forums.phpfreaks.com/topic/18727-valid-xhtml-problem/#findComment-80765
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).
Link to comment
https://forums.phpfreaks.com/topic/18727-valid-xhtml-problem/#findComment-80786
Share on other sites

Archived

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

×
×
  • Create New...

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.