PDA

View Full Version : Fix template validation errors



articleck
10-25-2011, 12:56 PM
Hello,

My template has 44 errors... actually it has the same error 44 times.

The error is this...
…images/icons/pixel_trans.gif" class="img" alt="" width="100%" height="10"></td>

You may have neglected to close an element, or perhaps you meant to "self-close" an element, that is, ending it with "/>" instead of ">".

So every time an image is used I get another validation error, simply because the image tag is not closed correctly. It should be
images/icons/pixel_trans.gif" class="img" alt="" width="100%" height="10" />

Can anyone tell how to fix this?

ridexbuilder
10-25-2011, 02:19 PM
http://wiki.oscdox.com/getting_started
http://wiki.oscdox.com/bts_docs
Reading the above should demonstrate that what you ask is trivial.

articleck
10-25-2011, 02:49 PM
I have tried a few other "off the shelf" templates and it seems that they all have this problem.
So looks like it is a problem with the code itself and nothing that I have done.

The script does not create HTML 4.01 Transitional valid pages.

I cannot find how these errors are coded into the templates in order to fix them, so oI asked for help here.

If it is trivial, why not just show me how to globally change this so that my pages are vaild?

articleck
10-25-2011, 02:51 PM
BTW, it was your templates at HTTP Error 403 (http://ejsolutions.co.uk) that I tried...

they contain 102 vaildation errors!! Mine only has 44 and I want to fix them.

articleck
10-25-2011, 02:57 PM
No help in the links that you sent...

The W3C Markup Validation Service (http://validator.w3.org)

Check your sites here and you will see the problem. For the life on me, I cannot find where or how to edit the function that inserts
images into the template files. a / needs adding before the > to make /> in the image code in order to make HTML 4.01 Transitional valid pages

This is not trivial... anything that you can do to optimise your site and improve search engine rankings should be done IMO

ridexbuilder
10-25-2011, 03:09 PM
Try this - take a backup!
Edit catalog/includes/functions/html_output.php, line 107

function tep_draw_separator($image = 'pixel_black.gif', $width = '100%', $height = '1', /) {

If that doesn't work, then

function tep_draw_separator($image = 'pixel_black.gif', $width = '100%', $height = '1', '/') {

articleck
10-25-2011, 03:09 PM
I'm not sure this will help, but I did find this osCommerce: Easy validate osC HTML (http://www.oscommerce.com/community/contributions,2027/page,19)
so seems that is not only me who cares about validation.

This seems to be dealing with a different error though.

Going to try to install it. I'll post here if it works out, but if anyone knows how to fix this please let me know.

Thanks
Dan

articleck
10-25-2011, 03:11 PM
Try this - take a backup!
Edit catalog/includes/functions/html_output.php, line 107
PHP Code:
function tep_draw_separator($image = 'pixel_black.gif', $width = '100%', $height = '1', /) {
If that doesn't work, then
PHP Code:
function tep_draw_separator($image = 'pixel_black.gif', $width = '100%', $height = '1', '/') {

Thanks!

I tried both those fixes, they do not work. The store displays a blank page.


Sorry, my post above was before I saw your reply.

ridexbuilder
10-25-2011, 03:16 PM
// Output a separator either through whitespace, or with an image
function tep_draw_separator($image = 'pixel_black.gif', $width = '100%', $height = '1') {
if(is_file(DIR_WS_TEMPLATES . 'images/icons/' . $image)) {
return tep_image(DIR_WS_TEMPLATES . 'images/icons/' . $image, '', $width, $height, '/');
} else {
return tep_image(DIR_WS_IMAGES . 'icons/' . $image, '', $width, $height, '/');
}
}


Gives:

NET-enabling start-tag requires SHORTTAG YES
…mages/icons/pixel_trans.gif" class="img" alt="" width="100%" height="1" /></td>
So... you'd need to go through ALL the template files (plus other 'hidden' php files) and change DOCTYPE !!!

ridexbuilder
10-25-2011, 03:27 PM
OK. Take it back - not trivial but the problem is actually more widespread in that some tags are Transitional, others Strict eg.
<br/>
... which I tend to be guilty of doing. :(

ridexbuilder
10-25-2011, 03:31 PM
BTW, it was your templates at HTTP Error 403 (http://ejsolutions.co.uk) that I tried...

they contain 102 vaildation errors!! Mine only has 44 and I want to fix them.
In my defence, I didn't "pen" those, just converted them. ;)

articleck
10-25-2011, 03:42 PM
If it is just doctype that needs changing wouldn't editing main_page.tpl.php suffice?

But change it to what?

articleck
10-25-2011, 03:49 PM
In my defence, I didn't "pen" those, just converted them. ;)

Not sure it is actually a problem with the template. There should be a setting in osc to define this I think...
Whether the template requires > or /> as a closing tag.

BTW the link http://demo.oscmax.co.uk/ on your site is broken.

ridexbuilder
10-25-2011, 04:22 PM
BTW the link http://demo.oscmax.co.uk/ on your site is broken.
Thanks. Had moved some stuff to another Cloud and forgot about that. Will take a while for DNS to catch up now.

[I don't pretend to be an expert on HTML (doctypes in particular) but a Google search appears to suggest Strict. HTML pages are defined in many places throughout osC (and hence 'Max).]

articleck
10-25-2011, 04:29 PM
one way to get rid of some of the errors would be to remove
<?php echo tep_draw_separator('pixel_trans.gif', '100%', '1'); ?>

Is this code important for anything other aesthetics?

Will I break anything down the line by removing it?

This will not solve the problem as every image on the site has the same issue.

OK, my site does not look any different because of these errors I know, but
I know that I will get better rankings if I have valid pages... at least I know
that this can be a factor. All other things being equal with your competition,
validation has to count!

Somewhere in this script code the tags are closed with a > surely?

can't that just be a simple edit? or better still a setting to define in the admin area?

pgmarshall
10-26-2011, 05:37 AM
Why would you want to remove this? It should not produce any validation errors!

Demo (http://php5.osCmax.com/dev21/catalog/)

The default template should have no validation errors in it - any errors have been more than likely introduced by you or the template.

Regards.

articleck
10-27-2011, 05:12 PM
Dude, you seem really agressive. I added you as a friend here anyway.

The main reason why you would want to remove a redundant image is to reduce http requests and therefore
pageload time. Most browsers can download 12 objects at a time with no problem, but most webpages have
more than 12 objects. If you can eliminate an object that is a good thing and can actually dramatically improve
your page load time.

See Web Page Analyzer - free website optimization tool website speed test check website performance report from web site optimization (http://www.websiteoptimization.com/services/analyze/) for more info

Can you just answer my question please and not question why?

Does this image serve any purpose if so what is the purpose that it serves? Actually, my question is not actually that deep.

Can I remove it?

ridexbuilder
10-27-2011, 10:37 PM
Dude, you seem really agressive. I added you as a friend here anyway.
.... Can I remove it?
Me? Yep, that I get - I'm a grumpy git! PGM? Nah, the most placid, helpful person. :)
Look at the name of the function and it tells you everything: tep_draw_separator

pgmarshall
10-28-2011, 05:11 AM
The osCmax fallback template validates just fine on all pages. Any errors are introduced by this template - either you have the doctype set incorrectly or you have introduced the error yourself.

I care a lot about validation and have spent a lot of time fixing validation errors and e_notice errors in osCmax!

osCmax Demo (http://php5.osCmax.com/dev21/catalog/)

If you open the above link and use HTML Validator plugin for firefox (which allows you to verify every page you open in your browser) you will see that they all validate just fine.

Ps. I don't think i am grumpy! However, I have found from answering thousands of questions on this board that asking a simple 'why' normal prevents unnecessary sidetracking. Your initial premise was incorrect - so I questioned why you thought it was invalid - probably, and I am guessing, that you have tried to use XHTML doctype. But heyho, if you don't want the help that is up to you.

Pps. Firebug and yslow are much better than the web analyser - will let smush the image and optimise your pages
Regards.

articleck
11-01-2011, 12:11 PM
Why would you want to remove this? It should not produce any validation errors!

Demo (http://php5.osCmax.com/dev21/catalog/)

The default template should have no validation errors in it - any errors have been more than likely introduced by you or the template.

Regards.

The compromise template has 58 errors isn't that a default template too?

ridexbuilder
11-01-2011, 12:13 PM
The compromise template has 58 errors isn't that a default template too?
No. Compromise is an example template, akin to the previous aabox one.
http://en.wikipedia.org/wiki/Default_(computer_science) :p

michael_s
11-01-2011, 05:33 PM
The only supported templates are fallback and fallback html. Compromise has not been updated yet (low priority as we are considering dropping it from the package).

Feel free to correct the validation errors in Compromise and submit the corrections in the bug tracker. The templates are scheduled to revamped and modernized for the 2.5.x release (post 2.5 stable).

niallb
11-11-2011, 03:02 AM
"Compromise has not been updated yet (low priority as we are considering dropping it from the package)." Nooooo, please dont drop Compromise, I think it looks great, nice and simple. Admittedly it doesnt have much in the bells & whistles department but it is a very clean template

michael_s
11-11-2011, 05:56 AM
"Compromise has not been updated yet (low priority as we are considering dropping it from the package)." Nooooo, please dont drop Compromise, I think it looks great, nice and simple. Admittedly it doesnt have much in the bells & whistles department but it is a very clean template

Compromise was just a proof of concept template. I had no intentions beyond that. I had just added the new template tag system and wanted to see how quickly I could convert a standard html/css template to osCmax BTS-HTML. I decided to add it to the download as an example on how to implement the tags. The Fallback-HTML template now does the job better.

niallb
11-23-2011, 01:08 PM
Would I be able to upload a copy of Compromise into 2.5 when its done or would I be creating problems for myself?