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
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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.