SitePoint Sponsor |
|
User Tag List
Results 1 to 14 of 14
Thread: "&" and valid html
-
May 17, 2004, 20:07 #1
"&" and valid html
I have a phone reviews site and I have AT&T. When I try to validate my site, the "&" causes all sorts of errors.
For example...
<LI>Line 151, column 52: entity was defined here
<td class="navnorm"><a class="navtop1" href="at&t.php">AT&T</a></td>
<LI>Line 151, column 63: cannot generate system identifier for general entity "T"
...class="navnorm"><a class="navtop1" href="at&t.php">AT&T</a></td>
anyone know how to fix this so my site validates? thanks!
-
May 17, 2004, 20:13 #2
- Join Date
- Nov 2003
- Location
- Maine USA
- Posts
- 3,781
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Simply use & any time you want &.
Ken Barbalace: EnvironmentalChemistry.com (Blog, Careers)
InternetSAR.org Volunteers Assist Search and Rescue via Internet
My Firefox Theme: Classic Compact
Based onFirefox's default theme but uses much less window space
-
May 17, 2004, 20:15 #3
- Join Date
- May 2003
- Location
- Auckland
- Posts
- 309
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
You really shouldn't use ampersand in your file names.
Change it to at-and-t.html or atandt.html
-
May 17, 2004, 20:19 #4
thanks for the advice guys!
-
May 17, 2004, 20:21 #5
- Join Date
- Nov 2003
- Location
- Maine USA
- Posts
- 3,781
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by Imminent
Ken Barbalace: EnvironmentalChemistry.com (Blog, Careers)
InternetSAR.org Volunteers Assist Search and Rescue via Internet
My Firefox Theme: Classic Compact
Based onFirefox's default theme but uses much less window space
-
May 18, 2004, 04:11 #6
- Join Date
- Apr 2003
- Posts
- 4,095
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Off Topic:
I seem to recall that there's a property you can set in .htaccess in Apache that will allow you to specify & instead of & for query string variables. I forget what it is specifically, and I'm not sure if there's one for IIS, but I thought I'd mention that.
-
May 18, 2004, 14:45 #7
- Join Date
- Nov 2003
- Location
- Maine USA
- Posts
- 3,781
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by compuwhiz7
?????
If you use & instead of & in the querystrings of links, the webbrowser will translate & into & and only submit & when a link is clicked on. There is no need for a special configuration Apache or IIS.Ken Barbalace: EnvironmentalChemistry.com (Blog, Careers)
InternetSAR.org Volunteers Assist Search and Rescue via Internet
My Firefox Theme: Classic Compact
Based onFirefox's default theme but uses much less window space
-
May 18, 2004, 14:48 #8
- Join Date
- Oct 2003
- Location
- Philadelphia
- Posts
- 209
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Also, an example:
you create a site with valid XHTML and CSS and want to include links at the bottom of the pages for each. If you copy and paste the url's (generated by the W3C site) of your validated pages into your links, don't forget that the url's have "&"s in them. Go through and change them to &'s or, technically, you will wind up with invalid XHTML despite just validating it (if that makes sense).
-
May 18, 2004, 14:52 #9
- Join Date
- Apr 2003
- Posts
- 4,095
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by KLB
-
May 18, 2004, 18:28 #10
- Join Date
- Jan 2004
- Location
- Glasgow, Scotland
- Posts
- 60
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
The & think in the w3c validator is a bug in the validation system. Though the & throughs an error, it's no actually invalid code. It's just that the vallidator script is not smart enough to work it out.
The w3c validator script is a tool to help you produce valid code. It is not the final word on what is actually valid or not. That is left to the various specifications and guidlines. When using a vallidator, it is more important to understand why your code fails and be able to make an informed decition based on the results than it is to get a clean sheet.
-
May 18, 2004, 19:00 #11
- Join Date
- Nov 2003
- Location
- Maine USA
- Posts
- 3,781
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by Rincewind
Ken Barbalace: EnvironmentalChemistry.com (Blog, Careers)
InternetSAR.org Volunteers Assist Search and Rescue via Internet
My Firefox Theme: Classic Compact
Based onFirefox's default theme but uses much less window space
-
May 18, 2004, 21:26 #12
- Join Date
- Jan 2004
- Location
- Glasgow, Scotland
- Posts
- 60
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Using & in your plain text is an error since & is the correct method. However, inside url's or as I often find inside my javascript code, the conventions of html do not and should not apply. The file naming conventions are determined by the operating system of you server not the w3c. If the OS allows AT&T.php as a file name the the URL to that file should be AT&T.php not AT&T.php. Your browser corrects the error of the & in the url and sends AT&T.php to the server. If you actually tried bypassing the browser (e.g. use an ftp, ssh or telnet client) and asked the server for the file AT&T.php then you'd get a 404 error. Thus using AT&T.php is incorrect file name.
-
May 19, 2004, 05:50 #13
- Join Date
- Oct 2001
- Location
- Estonia
- Posts
- 141
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
in php.ini
Code:arg_separator.output = "&"
Code:php_value arg_separator.output &
(2B) or (not 2B) = FF
-
May 19, 2004, 09:49 #14
- Join Date
- Jul 2002
- Location
- Ottawa, Canada
- Posts
- 1,766
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by Rincewind
True, & is not a part of the actual URL. But it is the correct way to reference the ampersand character in (X)HTML. Since you need to reference this character in the URL, you use & (because even though this is a URL, it's a part of an (X)HTML document). The browser knows this, so it translates it for you when it actually goes to this page.
Here it is in the XHTML recommendation:
Originally Posted by W3C on XHTML
Bookmarks