Post by bilbothecat » Sat Dec 05, 2009 10:21 pm

I have recently made two installs of OC 1.3.2 and neither validate for XHTML because they have whitespace before the XML and DOCTYPE dec. On one the space is two lines the other just one line.

Assuming that the layout.tpl is the governing file they are both as per the default doc and start with line 1 =

Code: Select all

<?php echo '<?xml version="1.0" encoding="utf-8"?>' . "\n"; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $language; ?>" lang="<?php echo $language; ?>" dir="<?php echo $direction; ?>">
My FTP program transfers .tpl as binary - which is the recommended default for this (I read Qphorias note about changing UTF-8 encoded docs to binary).

Any thoughts on this please.

Thanks in advance.

Newbie

Posts

Joined
Thu Oct 22, 2009 8:54 pm

Post by bilbothecat » Thu Dec 17, 2009 8:56 pm

Having been given a few pointers in the general direction I have now discovered the cause of the whitespace issue before the XML and DOCTYPE declaration when Opencart is viewed in Page Source and therefore unable to be validated.

The problem is caused by unwanted line spaces AFTER the closing

Code: Select all

?>
in language files. A number of the language files in the download for OC 1.3.2 contain these already so I would suggest checking these before upload, however the files that seem to be the likely offenders are the common files.

Open the 5 files in: catalog/language/common/ and remove any line spaces after the closing

Code: Select all

?>
in these files.

If your editor does not show line numbers you will literally have to click after the closing code and hit delete until any line spaces are removed.

This of course assumes that you have not added any before the opening

Code: Select all

<?php
which would also generate this problem. But they are easy to spot.

If the common language files do not fix this, then you will need to go through all of the language files one by one and check that there are no unwanted line spaces in those files.

Whitespace - removed, XHTML validation - sorted!

Newbie

Posts

Joined
Thu Oct 22, 2009 8:54 pm

Post by gggaudio » Fri Nov 23, 2012 3:44 pm

Just wanted to thank you for this. I had found an open <a in a file which was causing 2 W3C errors, and when I fixed that, I ended up with 110 errors (one for each product), the first error being "XML declaration allowed only at the start of the document"

I checked the catalog/language/common files, and 3 out of 4 had spaces at the end!! All errors gone, and it validated.

Newbie

Posts

Joined
Tue Jul 05, 2011 2:15 pm
Who is online

Users browsing this forum: No registered users and 52 guests