Results 1 to 7 of 7
  1. #1
    Join Date
    May 2006
    Location
    Montana
    Posts
    291
    Plugin Contributions
    20

    Default template_default jQuery loader does not validate at http://validator.w3.org

    I am not sure this is officially a "bug report" or not, but posting it here for lack of a better place to do it

    Vanilla install of 1.5.4 gives me 11 errors and 5 warnings as posted by Melanie Prough in another thread. Validation report is here:

    HOWEVER, if I use CSS JS loader on my install, i get a clean validation with no errors.

    My problem is that I am worried that the code in includes/templates/template_default/common/html_header.php which is causing all the validation errors - specifically:
    Code:
    /** CDN for jQuery core **/
    ?>
      <script>window.jQuery || document.write('<script src="//code.jquery.com/jquery-1.11.1.min.js"><\/script>');</script>
      <script>window.jQuery || document.write('<script src="<?php echo $template->get_template_dir('.js',DIR_WS_TEMPLATE, $current_page_base,'jscript'); ?>/jquery.min.js"><\/script>');</script>
    is not being called when using css js loader and that this has something to do with PCI compliance and is necessary code.

    If I move the 1.5.4 core includes/templates/template_default/jscript folder into the classic directory, I get one error
    as can be seen here

    Can you help? I have a new site for a client scheduled today and I do not want to do it in 1.5.4 if there are going to be validation errors, or if my installing the css js loader is going to break PCI compliance if that is what these scripts are being used for.

    Thanks to anyone who can help!

  2. #2
    Join Date
    Jan 2004
    Posts
    66,419
    Blog Entries
    7
    Plugin Contributions
    277

    Default Re: template_default jQuery loader does not validate at http://validator.w3.org

    The <script> syntax is perfectly valid for HTML5.
    (and yes, I understand that ZC v1.5.4 ships with an XHTML template).

    So ... if you're not putting an HTML5 template onto your site and you need it to pass XHTML validation in the W3C validator,
    then there are 2 sets of changes to make:

    1. /includes/templates/template_default/jscript/jscript_framework.php, line 9:
    Code:
    <script type="text/javascript">
    and line 15:
    Code:
      options.url = options.url.replace("&amp;", unescape("&amp;"));
    and line 67:
    Code:
            if (jqXHR.status === 200 * contentType.toLowerCase().indexOf("text/html") >= 0) {
    2. /includes/templates/template_default/common/html_header.php, around line 106 change this:
    Code:
    /** CDN for jQuery core **/
    ?>
      <script>window.jQuery || document.write('<script src="//code.jquery.com/jquery-1.11.1.min.js"><\/script>');</script>
      <script>window.jQuery || document.write('<script src="<?php echo $template->get_template_dir('.js',DIR_WS_TEMPLATE, $current_page_base,'jscript'); ?>/jquery.min.js"><\/script>');</script>
    to this:
    Code:
    /** CDN for jQuery core **/
    ?>
    <script type="text/javascript">window.jQuery || document.write(unescape('%3Cscript type="text/javascript" src="//code.jquery.com/jquery-1.11.1.min.js"%3E%3C/script%3E'));</script>
    <script type="text/javascript">window.jQuery || document.write(unescape('%3Cscript type="text/javascript" src="<?php echo $template->get_template_dir('.js',DIR_WS_TEMPLATE, $current_page_base,'jscript'); ?>/jquery.min.js"%3E%3C/script%3E'));</script>
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Jan 2004
    Posts
    66,419
    Blog Entries
    7
    Plugin Contributions
    277

    Default Re: template_default jQuery loader does not validate at http://validator.w3.org

    (Unfortunately, the way the W3C validator assesses things (and ostensibly also the XHTML spec), it's not just a simple matter of adding type="text/javascript" to the <script> tags. Hence the reworked post above, and removal of prior discussion.)
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  4. #4
    Join Date
    May 2006
    Location
    Montana
    Posts
    291
    Plugin Contributions
    20

    Default Re: template_default jQuery loader does not validate at http://validator.w3.org

    Got it THANKS TONS!! This helps me TREMENDOUSLY with upgrading sites that do not have html5 templates! I was also able to incorporate the js code into css js loader's html_header.php file.

  5. #5
    Join Date
    Dec 2009
    Location
    Amersfoort, The Netherlands
    Posts
    2,845
    Plugin Contributions
    25

    Default Re: template_default jQuery loader does not validate at http://validator.w3.org

    Quote Originally Posted by stellarweb View Post
    Got it THANKS TONS!! This helps me TREMENDOUSLY with upgrading sites that do not have html5 templates! I was also able to incorporate the js code into css js loader's html_header.php file.
    If you are using the css js loader, then you do not need to put those line in the html_header.php file. You can set the jquery files through the autoloader files

  6. #6
    Join Date
    Jan 2004
    Posts
    66,419
    Blog Entries
    7
    Plugin Contributions
    277

    Default Re: template_default jQuery loader does not validate at http://validator.w3.org

    css js loader
    I've always had bad experiences using the css/js loader addons. Total chaos and impossible upgradability.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  7. #7
    Join Date
    Dec 2009
    Location
    Amersfoort, The Netherlands
    Posts
    2,845
    Plugin Contributions
    25

    Default Re: template_default jQuery loader does not validate at http://validator.w3.org

    Quote Originally Posted by DrByte View Post
    I've always had bad experiences using the css/js loader addons. Total chaos and impossible upgradability.
    That's debatable :) I know most people do not like it, but I have always been a fan of it. Once you get used to it, it is easy to work with, and I find it to have better control over what files you want to load and when.

 

 

Similar Threads

  1. v154 validator.w3.org Validation Errors
    By Haggis in forum Templates, Stylesheets, Page Layout
    Replies: 10
    Last Post: 21 Jul 2016, 07:08 PM
  2. w3.org html validator error - no character encoding found
    By foteek in forum General Questions
    Replies: 2
    Last Post: 10 Jan 2009, 06:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR