Hi,
I am re-doing my templates and I want them to be totally w3c compliant. Much as I would lke to make them xhtml I accept the fact that shopsite only writes html (take that as a request for the "wish list" please).
I copied the code from the instructions:
#### Mini Cart Summary Display ####
#### YOU CAN CHANGE THESE VALUES IF NEEDED ####
[-- IF PAGE.LinkColor --]
[-- VAR.MiniCartTextColor PAGE.LinkColor --]
# [-- VAR.MiniCartBackgroundColor PAGE.BackgroundColor --]
[-- VAR.MiniCartBackgroundColor "transparent" --]
[-- ELSE --]
[-- VAR.MiniCartTextColor MORE_INFO.LinkColor --]
# [-- VAR.MiniCartBackgroundColor MORE_INFO.BackgroundColor --]
[-- VAR.MiniCartBackgroundColor "transparent" --]
[-- END_IF --]
[-- VAR.ShowCart "no" --]
[-- VAR.MiniCartColor "black" --]
[-- VAR.TextAlign "left" --]
#### DON'T CHANGE ANYTHING BELOW HERE ####
<script language="javascript">
var cookies=document.cookie; //read in all cookies
var start = cookies.indexOf("ss_cart_[-- STORE_Serial_Number --]=");
var cartvalues = "";
var linecount = 0;
var start1;
var end1;
var tmp;
// Start Output
document.write("<div style=\"color: [-- VAR.MiniCartTextColor --];");
document.write("background-color: [-- VAR.MiniCartBackgroundColor --];");
document.write("text-align: [-- VAR.TextAlign --];");
document.write("font-family: Verdana, Arial, Helvetica, sans-serif;");
document.write("font-size: 8pt;");
document.write("\">\n");
[-- IF VAR.ShowCart "yes" --]
document.write("<a href=\"[-- SHOPPING_CART_URL --]\"");
document.write("style=\"text-decoration: underline;");
document.write("color: [-- VAR.MiniCartTextColor --];");
document.write("\">");
document.write("<img src=\"[-- OUTPUT_DIRECTORY_URL --]/media/themesmedia/cart-[-- VAR.MiniCartColor --].gif\" border=\"0\" name=\"cart\" align=\"top\">");
document.write("</a> ");
[-- END_IF --]
document.write("<a href=\"[-- SHOPPING_CART_URL --]\"");
document.write("style=\"text-decoration: underline;");
document.write("color: [-- VAR.MiniCartTextColor --];");
document.write("\">");
document.write("[-- STORE.SC_YourShoppingCart --]");
document.write("</a>");
if (start == -1) //No cart cookie
{
document.write("</div>\n");
}
else //cart cookie is present
{
start = cookies.indexOf("=", start) +1;
var end = cookies.indexOf(";", start);
if (end == -1)
{
end = cookies.length;
}
cartvalues = unescape(cookies.substring(start,end)); //read in just the cookie data
start = 0;
while ((start = cartvalues.indexOf("|", start)) != -1)
{
start++;
end = cartvalues.indexOf("|", start);
if (end != -1)
{
linecount++;
if (linecount == 2) // Total Quantity of Items
{
tmp = cartvalues.substring(start,end);
colon = tmp.indexOf(":", 0);
document.write("<br>[-- STORE.Contains --] <b>");
document.write(tmp.substring(colon+1,end - start));
document.write("</b>");
if ((tmp.substring(colon+1,end - start)) == 1 )
{
document.write(" [-- STORE.Item --]");
}
else
{
document.write(" [-- STORE.Items --]");
}
}
if (linecount == 3) // Product Subtotal
{
tmp = cartvalues.substring(start,end);
colon = tmp.indexOf(":", 0);
document.write("<br>[-- STORE.Subtotal --]: <b>");
document.write(tmp.substring(colon+1,end - start));
document.write("</b>");
}
start = end;
}
else
break;
}
} // end while loop
//close minicart HTML
document.write("</div>\n");
</script>
Now the validator has come up with a few errors. The first was that the line <script language="javascript"> didn't contain a type. Even though the instructions say don't make any changes below these lines I figured that adding <script language="javascript" type="javascript"> would be okay.
after that there are several lines with errors. The errors are as follows:
Line 186, column 23: end tag for "SCRIPT" omitted, but its declaration does not permit this
document.write("</div>\n");
Error end tag for element X which is not open
The Validator found an end tag for the above element, but that element is not currently open. This is often caused by a leftover end tag from an element that was removed during editing, or by an implicitly closed element (if you have an error related to an element being used where it is not allowed, this is almost certainly the case). In the latter case this error will disappear as soon as you fix the original problem.
If this error occurred in a script section of your document, you should probably read this FAQ entry.
* Line 182, column 19: end tag for element "A" which is not open
document.write("</a>");
* Line 244, column 8: end tag for element "SCRIPT" which is not open
</script>
* Line 247, column 5: end tag for element "DIV" which is not open
</div>
* Line 335, column 5: end tag for element "DIV" which is not open
</div>
In each case w3c suggests changing the code to be <\/div> instead of </div> --or whatever the tag is. I am very hesitant to add a \ into a script - I don't want to mess up the cart. Can anyone make a suggestion as to how to proceed? Thanks for your help!