vinny388
06-27-2007, 04:06 PM
Hi, hope this is the correct place.
I have a site that uses a fairly simple ( i say simple, i know nothing about php!) image swap script based on the current day.
<?php
$url = "http://www.cecilsrentarookie.co.uk/assets/images/spedeworth-fixtures/";
$monImage = "$url"."fix-3.jpg";
$tueImage = "$url"."fix-3.jpg";
$wedImage = "$url"."fix-1.jpg";
$thurImage = "$url"."fix-2.jpg";
$friImage = "$url"."fix-2.jpg";
$satImage = "$url"."fix-2.jpg";
$sunImage = "$url"."fix-2.jpg";
$d = date("D");
//Function that switches between date images based on the actual day of the week in $d
switch ($d)
{
case Mon:
echo "<img src=$monImage>\n";
break;
case Tue:
echo "<img src=$tueImage>\n";
break;
case Wed:
echo "<img src=$wedImage>\n";
break;
case Thu:
echo "<img src=$thurImage>\n";
break;
case Fri:
echo "<img src=$friImage>\n";
break;
case Sat:
echo "<img src=$satImage>\n";
break;
case Sun:
echo "<img src=$sunImage>\n";
}
?>
Now it all works a treat, but the issue being that the site doesnt validate due to 4 errors relating to this script. I have tried and tried and cannot suss out what the problem is or how to fix it?
Errors:
Below are the results of checking this document for XML well-formedness and validity.
Error Line 149 column 9: an attribute value specification must be an attribute value literal unless SHORTTAG YES is specified.
<img src=http://www.cecilsrentarookie.co.uk/assets/images/spedeworth-fixtures/fi✉
Error Line 149 column 15: NET-enabling start-tag not immediately followed by null end-tag.
<img src=http://www.cecilsrentarookie.co.uk/assets/images/spedeworth-fixtures/fiThis error may occur when there is a mistake in how a self-closing tag is closed, e.g '.../ >'. The proper syntax is '... />' (note the position of the space).
✉
Error Line 149 column 15: required attribute "alt" not specified.
<img src=http://www.cecilsrentarookie.co.uk/assets/images/spedeworth-fixtures/fiThe attribute given above is required for an element that you've used, but you have omitted it. For instance, in most HTML and XHTML document types the "type" attribute is required on the "script" element and the "alt" attribute is required for the "img" element.
Typical values for type are type="text/css" for <style> and type="text/javascript" for <script>.
✉
Error Line 149 column 15: end tag for "img" omitted, but OMITTAG NO was specified.
<img src=http://www.cecilsrentarookie.co.uk/assets/images/spedeworth-fixtures/fiYou may have neglected to close an element, or perhaps you meant to "self-close" an element, that is, ending it with "/>" instead of ">".
site is www.cecilsrentarookie.co.uk if u need too view.
thanks
I have a site that uses a fairly simple ( i say simple, i know nothing about php!) image swap script based on the current day.
<?php
$url = "http://www.cecilsrentarookie.co.uk/assets/images/spedeworth-fixtures/";
$monImage = "$url"."fix-3.jpg";
$tueImage = "$url"."fix-3.jpg";
$wedImage = "$url"."fix-1.jpg";
$thurImage = "$url"."fix-2.jpg";
$friImage = "$url"."fix-2.jpg";
$satImage = "$url"."fix-2.jpg";
$sunImage = "$url"."fix-2.jpg";
$d = date("D");
//Function that switches between date images based on the actual day of the week in $d
switch ($d)
{
case Mon:
echo "<img src=$monImage>\n";
break;
case Tue:
echo "<img src=$tueImage>\n";
break;
case Wed:
echo "<img src=$wedImage>\n";
break;
case Thu:
echo "<img src=$thurImage>\n";
break;
case Fri:
echo "<img src=$friImage>\n";
break;
case Sat:
echo "<img src=$satImage>\n";
break;
case Sun:
echo "<img src=$sunImage>\n";
}
?>
Now it all works a treat, but the issue being that the site doesnt validate due to 4 errors relating to this script. I have tried and tried and cannot suss out what the problem is or how to fix it?
Errors:
Below are the results of checking this document for XML well-formedness and validity.
Error Line 149 column 9: an attribute value specification must be an attribute value literal unless SHORTTAG YES is specified.
<img src=http://www.cecilsrentarookie.co.uk/assets/images/spedeworth-fixtures/fi✉
Error Line 149 column 15: NET-enabling start-tag not immediately followed by null end-tag.
<img src=http://www.cecilsrentarookie.co.uk/assets/images/spedeworth-fixtures/fiThis error may occur when there is a mistake in how a self-closing tag is closed, e.g '.../ >'. The proper syntax is '... />' (note the position of the space).
✉
Error Line 149 column 15: required attribute "alt" not specified.
<img src=http://www.cecilsrentarookie.co.uk/assets/images/spedeworth-fixtures/fiThe attribute given above is required for an element that you've used, but you have omitted it. For instance, in most HTML and XHTML document types the "type" attribute is required on the "script" element and the "alt" attribute is required for the "img" element.
Typical values for type are type="text/css" for <style> and type="text/javascript" for <script>.
✉
Error Line 149 column 15: end tag for "img" omitted, but OMITTAG NO was specified.
<img src=http://www.cecilsrentarookie.co.uk/assets/images/spedeworth-fixtures/fiYou may have neglected to close an element, or perhaps you meant to "self-close" an element, that is, ending it with "/>" instead of ">".
site is www.cecilsrentarookie.co.uk if u need too view.
thanks