cloudy cloudy

Author Topic: Solving W3C 3in1 Validation Problem  (Read 2536 times)

0 Members and 1 Guest are viewing this topic.

Offline gwwilk

  • Posts: 682
  • Lincoln, NE
  • OS/Browser:
  • Win 7/Srvr 2008R2
  • Chrome 23.0.1271.95
    • Southeast Lincoln Weather
Solving W3C 3in1 Validation Problem
« on: December 01, 2012, 03:38:04 PM »
I awoke this morning with an idea about solving the 3in1 W3C validation problem, and it worked!  I've restored the validation links on my 3in1 page, so there's one less problem page on my site.

It occurred to me that 3in1's output shouldn't be parsed as standard html, so a '<![CDATA[...]]>' exclusion is needed.  After enclosing the 3in1 'echo' statements in the cdata statement I was left with only 2 validation exceptions, both <script> declarations without types.  Here is what the main-copy code in my template looks like:
Code: [Select]
<div id="main-copy" style="width:870px; border:inset">
 
    <div style="width:<?php echo $mainwidth ?>px;font: 72% Tahoma;">
<![CDATA[
    <?php
    
# Header with name & update-times (optional)
    
echo $wxallupdated;
    echo 
'<h2>'.get_lang("WXSIM Forecast for:").' '.$wxallcity.'</h2>';
    
    
# Theese can be used stand alone or together

    
echo $wxalltop;     # "Top-forecast"
    
echo $wxallgraph;   # Graph
    
echo $wxallmain;    # Tabs
    
?>

]]>
    </div>
<?php
    
echo $wxallfooter;
    
?>

</div><!-- end main-copy -->

The untyped script declarations occurred in wxall.lastret.php's $wxallhead and $wxallfooter declarations.  This is the revised code:
Code: [Select]
$wxallhead = '
<script type="text/javascript">
// COMMERCIAL USE OF THIS FORECAST-SCRIPT STRICTLY FORBIDDEN.
var docready=[],$=function(){return{ready:function(fn){docready.push(fn)}}};
</script>
<link rel="stylesheet" type="text/css" media="screen" href="'.$wxallmainfolder.'css/wxall.css?'.$cssage.'" />
';
if($useustemp==1){$wxallhead.= '<link rel="stylesheet" type="text/css" media="screen" href="'.$wxallmainfolder.'css/US/wxall.css" />';}
$wxallfooter = '
<script type="text/javascript" src="'.$wxallmainfolder.'js/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="'.$wxallmainfolder.'js/jquery-ui-1.9.1.min.js"></script>
<script type="text/javascript">$=jQuery;jQuery(document).ready(function(){for(n in docready){docready[n]()}});</script>
<script type="text/javascript" src="'.$wxallmainfolder.'js/highcharts.js"></script>
<script type="text/javascript" src="'.$wxallmainfolder.'js/wxsim.js"></script>
';

Validation is now successful! :D
Regards, Jerry Wilkins
[email protected]

Offline ed2kayak

  • CoCoRaHS PA-CD-6, Weather Underground KPAMECHA7, CWOP DW5425
  • Posts: 458
  • Mechanicsburg PA
  • OS/Browser:
  • Win 7/Srvr 2008R2
  • Chrome 23.0.1271.64
    • Cumberland Valley Weather
Re: Solving W3C 3in1 Validation Problem
« Reply #1 on: December 01, 2012, 03:50:23 PM »
Jerry,
Thanks for sharing. More incremental knowledge for me to file away.
Ed
CoCoRaHS PA-CD-6,  Weather Underground KPAMECHA7, CWOP DW5425

Offline weatherc

  • Posts: 1,983
  • Salo, Finland
  • OS/Browser:
  • Win 7/Srvr 2008R2
  • Firefox 15.3.1
    • Weatherstation Salo,FI
Re: Solving W3C 3in1 Validation Problem
« Reply #2 on: December 02, 2012, 09:48:43 AM »
I don't have those validation-problems here and it validates OK. Note tought, its HTML5.

// Henkka

Offline gwwilk

  • Posts: 682
  • Lincoln, NE
  • OS/Browser:
  • Win 7/Srvr 2008R2
  • Chrome 23.0.1271.95
    • Southeast Lincoln Weather
Re: Solving W3C 3in1 Validation Problem
« Reply #3 on: December 02, 2012, 12:16:25 PM »
I don't have those validation-problems here and it validates OK. Note tought, its HTML5.

// Henkka

I'm curious as to the validator you are using.  For me even sivu2.php fails at validator.w3c.org with one error and 10 warnings.
« Last Edit: December 02, 2012, 12:31:35 PM by gwwilk »
Regards, Jerry Wilkins
[email protected]

Offline weatherc

  • Posts: 1,983
  • Salo, Finland
  • OS/Browser:
  • Win 7/Srvr 2008R2
  • Firefox 15.3.1
    • Weatherstation Salo,FI
Re: Solving W3C 3in1 Validation Problem
« Reply #4 on: December 02, 2012, 03:48:42 PM »
I'm curious as to the validator you are using.  For me even sivu2.php fails at validator.w3c.org with one error and 10 warnings.

This one: http://html5.validator.nu
Have never got the W3-validator to work for HTML5 yet....

http://www.nordicweather.net/ennuste.php?fi validates in that except for a few small things what not depend on 3in1 (mainly my dynamic sidemenu).

// Henkka

Offline i_fiorentino

  • Alessandro Bardi
  • Posts: 1,705
  • 150 mls Candeglia (Pt), Tuscany, Italy
  • OS/Browser:
  • Win 7/Srvr 2008R2
  • Firefox 21.0
    • Meteopistoia.it
Re: Solving W3C 3in1 Validation Problem
« Reply #5 on: June 22, 2013, 01:48:18 PM »
Hi Gerry,
i've changed my wxsim page with your code to fix w3c validations but it remains the code like the image below:



What's wrong?
I've attached my .php file.
Thanks in advance,

Alessandro

Offline gwwilk

  • Posts: 682
  • Lincoln, NE
  • OS/Browser:
  • Win 7/Srvr 2008R2
  • Chrome 27.0.1453.116
    • Southeast Lincoln Weather
Re: Solving W3C 3in1 Validation Problem
« Reply #6 on: June 22, 2013, 07:12:40 PM »
Comment out the CDATA closure like this:
<!--]]>-->

When I discovered the problem and the solution, I forgot to modify my post above.  Sorry about that. #-o
Regards, Jerry Wilkins
[email protected]

Offline i_fiorentino

  • Alessandro Bardi
  • Posts: 1,705
  • 150 mls Candeglia (Pt), Tuscany, Italy
  • OS/Browser:
  • Win 7/Srvr 2008R2
  • Firefox 21.0
    • Meteopistoia.it
Re: Solving W3C 3in1 Validation Problem
« Reply #7 on: June 22, 2013, 09:15:28 PM »
Comment out the CDATA closure like this:
<!--]]>-->

When I discovered the problem and the solution, I forgot to modify my post above.  Sorry about that. #-o

Fixed!
Thanks you so much for your fast reply.
Regards,


Alessandro

 

cumulus