PDA

View Full Version : Validation error


dhdesign
04-17-2007, 11:10 AM
Trying to validate the HTML in my photoblog, and keep coming up with this error from the validator:

This page is not Valid XHTML 1.0 Transitional!

Below are the results of checking this document for XML well-formedness and validity.

1. Error Line 1 column 0: character "" not allowed in prolog.

��<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www

I switched to the simple template, then the horizon template, and am getting the same validation error for both of them as well.

There are no characters preceding the DOCTYPE in any of the templates, and I've searched the code in index.php and cannot find where this is coming from.

I have an old test install of v1.5, so I checked the validation on it, and it comes up clean - no errors and validates.

Any ideas on where these characters are coming from???

Dkozikowski
04-17-2007, 11:12 AM
A link to your site would be helpful

dhdesign
04-17-2007, 11:16 AM
Here's the link to the 1.6 install: http://www.kpimages.net/index.php

austriaka
04-17-2007, 12:05 PM
you have some strange chars before the doctype declaration:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

you see it when I wrap PHP tags around it:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

Besides you should remove the meta charset <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
Pixelpost is UTF-8 compliant, you should not change that

KArin

dhdesign
04-17-2007, 12:31 PM
I know there are characters preceding the DOCTYPE - that's what is causing the validation error. What I do not know is where those characters are coming from. It happens with my template, and with both of the templates that are included in 1.6 (simple and horizon). I have searched every file that I can think of to check, and cannot find anything.

When I do "view source", select all, and paste it into my text editor (EditPadLite), I see a '?' before DOCTYPE and get this warning:

The text you typed in contains some characters that cannot be represented in the file's character set. They have been replaced with question marks. Select Convert|Text Encoding in the menu to select a character set that contains the characters you are trying to type.

When I try to change the encoding of the file, it is coming up and showing the original encoding as Windows 1252: Western European.

I've brought up all of the template files and index.php, and have converted the encoding to UNICODE, UTF-8, saved and reuploaded them to the server, and I'm still getting the validation error.

Any other ideas?

PS/ I did change the character set back to utf8. I temporarily changed it to see if it would solve the validation issue.

austriaka
04-17-2007, 12:55 PM
Do you see the strange character in the template files too?
Do you have a line break or something like that there?
Remove the <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" /> in the template.
Some editors try to change the encoding by some charset coding they find in the text (my UltraEdit does this with Unicode for example).
Try converting everything to UTF-8 and delete everything before the first "<".
Try to delete both lines before <head> and retype it by hand.
Try a different editor and a fresh download.

dhdesign
04-17-2007, 02:56 PM
Do you see the strange character in the template files too?
No, there are no characters before the opening < for the doctype code.
Do you have a line break or something like that there?
No, there is no line break before the doctype code.
Remove the <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" /> in the template. Some editors try to change the encoding by some charset coding they find in the text (my UltraEdit does this with Unicode for example).
Already did that. The 'PS/' in my previous post explains why. It's been changed back to UTF8.
Try converting everything to UTF-8 and delete everything before the first "<".
I've already converted all of the template files and index.php to UNICODE UTF-8 encoding in my text editor, reuploaded to the server, and revalidated, no change. There is nothing before the first "<" in the template files.
Try to delete both lines before <head> and retype it by hand.
Did that - no change.
Try a different editor and a fresh download.
I had downloaded a fresh copy yesterday. I opened the zip file, and extracted just the index.php file to the same folder. I did not open it with a text editor at all. I uploaded it to my server, and revalidated the page - same problem.

If you go to my contact page, that is one that I've done using my regular editor. The text encoding is UNICODE, UTF-8, the charset is UTF-8, and that page validates just fine.

The validator warns that the file has a Unicode Byte-Order Mark (BOM) in it. The error message at the top states:


Byte-Order Mark found in UTF-8 File.

The Unicode Byte-Order Mark (BOM) in UTF-8 encoded files is
known to cause problems for some text editors and older browsers.
You may want to consider avoiding its use until it is better supported.


I made sure to set the preferences in my text editor NOT to insert a BOM at the beginning of the file. None of the files I've edited (template files or PP index.php) have any weird characters at the beginning of them. The template files all start with '<!DOCTYPE' and the index.php file starts with '<?php'.

I've opened them in Notepad, and there are no unusual characters or symbols at the beginning of any of them.

I'm getting the same validation errors with both default templates that came with PP1.6 (simple and horizon), and I've never opened any of those files since downloading them.

Using my template, this last round of validations gave these results:
- index.php (image_template.html) - failed with the same original error.
- index.php?x=about (about_template.html) - passed but with same BOM warning.
- index.php?x=browse (browse_template.html_ - passed but with same BOM warning.
- index.php?x=archivecalendar (archivecalendar_template.html) - passed but with same BOM warning.

I really don't know what else to do to fix the validation error I'm getting with the image_template.html. I can't delete what I can't find. :(

Dkozikowski
04-17-2007, 03:04 PM
Turn all your addons off or temporarily rename the addons folder and see if that corrects the issue.

dhdesign
04-17-2007, 03:26 PM
Thanks for the suggestion.

I tried both - renamed the folder and revalidated, then tried turn them all off in the admin panel and revalidated. Unfortunately, I got the same error for the page that uses the image_template.html both times.

I tried turning back on only the addons that come as default with 1.6 - no change. :(

I really do appreciate all the suggestions from both of you in trying to help me track down and resolve this issue.

GeoS
04-17-2007, 09:19 PM
Maybe your text file editor added some garbage chars to the files?

PS Check if it doesnt add "BOM" (Byte Order Mark) for UTF8 file recognition!!!
http://en.wikipedia.org/wiki/Byte_Order_Mark

dhdesign
04-18-2007, 12:55 AM
No, there are no garbage characters in the file.

I've checked the settings for my text editor for configuring file types, and here's what they are set at for html files (and all other file types listed as well):

http://www.kpimages.net/screenshots/editpadlite-filetypesettings.jpg

Note that I have it set to detect UTF8 files without a BOM, and I have the setting for adding a BOM to the file unchecked.

I've pretty much given up being able to track this down right now. Maybe I'll stumble on what the problem is in the next few days. If I do, I'll post back here and let all of you know.

Thanks again everyone for all the help and suggestions - it is much appreciated! :)

austriaka
04-18-2007, 10:25 AM
Ok, it looks as if your image template file is the banger.

Which FTP client do you use? Did you upload the index.php and template files as ASCII? Could it be possible the client does some changes like adding a BOM? Try using FileZilla, it is free.

If you want you can email me your template files to 2ATkg3.de and I'll check them with my editor.

If it is the same with a new FTP client and after proving your files, last question is your ISP... perhaps the hoster has some server-side "BOMming" (don't know if this is even possible)

dakwegmo
04-18-2007, 02:36 PM
I don't think it is the template. If you validate the image_template.html, you get errors, but the validator isn't seeing the BOM that's causing the validator to break. My guess would be that an addon is causing the trouble. You might want to disable all your addons then revalidate. If it validates with them turned off you know you know where the problem is, you'll just have to turn them on, one by one, revalidating after each. Once you get the error you know which addon is causing the error.

dhdesign
04-19-2007, 11:18 AM
Dakwegmo - I've already tried turning off all the addons (http://forum.pixelpost.org/showpost.php?p=45077&postcount=9), and there was no change - the page still wouldn't validate.

Austriaka - I'll get the template files zipped up and in the mail to you shortly.

The webhost where this is installed is TextDrive, and they only allow SFTP, which means I have to use WinSCP to upload to the server. I've checked the settings in the WinSCP client, and I've made sure that the transfer mode is set to auto-detect the file type.

I had taken a look at FileZilla before, but really didn't care for it.

Will have to ask in TxD's forum if it's possible that they are adding something, but the fact that I was able to get this issue resolved for all the template files except image_template.html leads me to believe it's something on my end.

I really appreciate all the help! :)

dakwegmo
04-19-2007, 12:19 PM
Have you tried validating either of the templates that come with PP1.6? If you don't get an error with either of those, then I think you can be sure the issue is with the custom template you're using.

dhdesign
04-19-2007, 12:42 PM
I just ran the validator again after changing the theme in the admin panel, first to Simple, then to Horizon. Here are the results:

Simple:
image_template.html - failed with the same error (weird characters at the beginning)
about_template.html - passed validation
browse_template.html - passed validation

Horizon:
image_template.html - failed with the same error (weird characters at the beginning)
about_template.html - passed validation
browse_template.html - passed validation

The issue seems to be with the image_template.html file in all 3 templates (Simple, Horizon, and mine).

Where in the code is the image_template.html file called to display the images? I've looked, and can't find it.

dakwegmo
04-19-2007, 01:32 PM
It's going to be a bit of a chore tracking this down. The image_template.html is called from the index.php look around line 258. However, every time a new tag is implemented the contents of the template are changed.

If you haven't already done so, I would consider setting up a test environment on another directory with another database, to see if the issue still occurs in a completely clean install of PP.

dhdesign
04-23-2007, 06:09 PM
After exhausting all other methods of finding the problem, including Austriaka taking a look at my template files, I finally broke down and did a clean install as a test to see if I could track down the issue.

Before doing this, I had noticed that my template, along with the 2 default ones, were having a 25px margin added to the top of the page that uses image_template.html - the same page that I was having the problems with the weird characters showing up before the doctype when I would validate the page. This margin only showed up in IE6. Firefox 2.0.0.3 and Opera 9.0 displayed the page just fine.

Going on advice given by Schonhose in another thread (http://forum.pixelpost.org/showthread.php?t=6498) this AM regarding an ASCII text editor, I downloaded and installed Programmers Notepad on my laptop. I then made sure all of the settings were correct for the encoding and the line endings. Outlined below is the step-by-step method that I used to set up the test install:

1. I downloaded a fresh copy of Pixelpost 1.6 this morning. I used FileZip to open the archive and extract the files to a folder.

2. I used Programmers Notepad to open pixelpost.php and enter my database information. I did not open or edit any of the other files that are part of Pixelpost.

3. I used SmartFTP to upload the files to my server (made sure the file transfer setting was for "automatic" for filetype, and codepage was set to "utf8"). I changed the permissions on images and thumbnails to 777. I went through the installation process, then deleted install.php from the admin directory.

4. I logged into the admin section, went to Options, and made sure those were set properly. I left the template set for Simple.

5. I uploaded 1 image, adding the requested information.

6. I opened the test install in Firefox 2.0.0.3 and the page rendered correctly. Using the validation tool in the Web Developer Toolbar, I validated the html for the page that uses image_template.html. This time, it validated, with no weird characters at the beginning and no warning that there was a byte order mark in the file. I also validated the browse and about pages, with the same results. This template works fine in IE6 - no margin at the top of the image page.

7. I then switched to the Horizon template, and went through the validation process again, with all pages passing validation, and no byte order marks in the files. However, there is one issue with the Horizon template that needs to be fixed. In IE6, on all 3 pages, the area of the header on the right that has the website name is cut off on the bottom. There is no font-size specified in the css file for this <h1> tag, so IE6 is using the default size and the font is too large, causing it to be cut off on the bottom. I would recommend adding a font-size of 20 or 22 pixels to resolve the issue in IE.

I have one other question though. Since doing this test install, I opened the lang-english.php and admin-lang-english.php files using Programmers Notepad, and noticed that in lang-english.php, there are both CR and LF at the end of each line. In the admin-lang-english.php file, there are only LF at the end of each line. Most other language files only had LF, but there were a few that had both CR and LF at the end of each line. Are the CR supposed to be in there or not? If not, how do I get rid of them???

Dennis
04-23-2007, 07:29 PM
For the last question: save as unix format. That should do it.

dhdesign
04-23-2007, 07:48 PM
That fixed it - thanks!! :)