Posted by proc 5 years 4 weeks ago
When testing my site
http://proc.mobi
on ready.mobi I get a 3.66 / 5 result. The content shows up in both emulators. It is using php to grab content from a MYSQL database. I'm getting "Valid Markup" and XHTML-MP failures in the test but when I include the line as recommended
<?xml version="1.0" encoding="utf-8"?>
at the very top of the index.php file no content shows up at all.
If anyone could advise on any glarring errors Id hugely appreciate it.
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Event Guide</title>
<style>
body {
margin: 4px 4px 4px 4px;
padding: 0px;
scrollbar-face-color: #99cc00;
scrollbar-highlight-color: #99cc00;
scrollbar-3dlight-color: #99cc00;
scrollbar-darkshadow-color: #99cc0000;
scrollbar-shadow-color: #99cc00;
scrollbar-arrow-color: #FFFFFF;
scrollbar-track-color: #E7E5E5;
background-color: #E7E5E5;
}
#list{
padding: 2px;
margin: 0px;
font: normal 11px "Verdana", Geneva, sans-serif;
color: #333333;
border: 1px solid #CCCCCC;
background-color: White;
}
h1{
font: bold 11px "Verdana", Geneva, sans-serif;
text-transform: uppercase;
color: #FFFFFF;
text-align: center;
background-color: #CC0000;
padding: 5px;
margin: 0px 0px 5px 0px;
}
h2{
font: bold 11px "Verdana", Geneva, sans-serif;
color: #000000;
padding: 0px;
margin: 0px 0px 3px 0px;
}
h3{
font: normal 11px "MS Sans Serif", Geneva, sans-serif;
padding: 0px;
color: #CC0000;
margin:0px;
}
h4{
font: bold 11px "MS Sans Serif", Geneva, sans-serif;
color: #FFFFFF;
text-align: center;
background-color: #CC0000;
padding: 5px 0px 5px 0px;
margin: 5px 0px 5px 0px;
}
h5{
font: bold 11px "MS Sans Serif", Geneva, sans-serif;
color: #000000;
text-align: center;
background-color: #FFFFFF;
padding: 5px 0px 5px 0px;
margin: 5px 0px 5px 0px;
}
.break {
padding: 5px 0px 5px 0px;
margin: 5px 5px 5px 5px;
background-color: #FFFFFF;
border-bottom: 1px dotted #CCCCCC;
}
a {
font: bold 11px "MS Sans Serif", Geneva, sans-serif;
text-transform: uppercase;
text-decoration: none;
}
a:link{
color: White;
}
a:visited{
color: White;
}
a:hover{
color: #FFCC00;
}
</style>
</head>
<body>
<?php
include("dbinfo.inc.php");
MYSQL_CONNECT($hostname, $username, $password) OR DIE("Unable to connect");
@MYSQL_SELECT_DB("$dbName") OR DIE("Unable to select database");
if (!$show)
$show = date("Y-m-d");
$limityear = date(Y, mktime (0,0,0,date("m"),date("d")+13,date("Y")));
$limitmonth = date(m, mktime (0,0,0,date("m"),date("d")+13,date("Y")));
$limitday = date(d, mktime (0,0,0,date("m"),date("d")+13,date("Y")));
$limit = $limityear."-".$limitmonth."-".$limitday;
if ($show<=$limit)
{$perpage = 20;
if (!$start)
$start = 0;
$year = substr($show, 0, 4);
$month = substr($show, 5, 2);
$day = substr($show, 8, 2);
if (substr($day, 0, 1)=="0")
$day = substr($day, 1, 1);
$wkday = date(D, mktime (0,0,0,$month,$day,$year));
$month = date(M, mktime (0,0,0,$month,$day,$year));
print "<h1>$wkday $month $day $year</h1>";
print "<div id=\"list\">";
$query =
"select eventID, name, venue, date, time, endtime, admission, category, info, web, contact, email, showemail, img, catID, cname from events, event_categories where active=1 and category=catID and date='$show' order by catID, time, name limit $start, $perpage";
$result = MYSQL_QUERY($query);
while($row = mysql_fetch_array($result))
{$eventID = $row["eventID"];
$name = $row["name"];
$venue = $row["venue"];
$time = $row["time"];
print "<div class=\"break\">";
print "<h2>$name</h2>";
print "<h3>$venue: $time</h3>";
print "</div>";
}
print "</div>";
mysql_free_result($result);
$next = $start+$perpage;
$query = "select count(eventID) from events where active=1 and date='$show'";
$result =MYSQL_QUERY($query);
$row = mysql_fetch_array($result);
$total=$row["count(eventID)"];
if ($total==0)
print "<h4>No events currently appear in this section</h4>";
if ($next<$total)
print "<h4><a href=\"display.php?show=$date&start=$next\" target=\"_blank\">Next page</a></h4>";
if ($start > 0)
{$prev = $start-$perpage;
print "<h4><a href=\"display.php?show=$date&start=$prev\">Previous page</a></h4>";
}
}
else
print "<h2>No events currently appear in this section</h2>";
$year = date("Y"); ?>
<h4><a href="http://www.peoplesrepublicofcork.com/~peoplesr/eventguide/" >Go to EVENT GUIDE</a><a href="http://www.peoplesrepublicofcork.com/~peoplesr/eventguide/submit.php"><BR>Submit Event</a></h4>
</body>
</html>




Posted by proc 5 years ago
Sorry the code tags didnt fucnction the way I expected there.
The code Im having trouble with is here:
http://proc.mobi/index_as_text.txt
Posted by roland 5 years ago
I try to check your page with an XML validator, but it fails.
Here some tips for validating your page:
Posted by proc 5 years ago
Thanks for replying Roland.
The first post is a bit messy but basically what Im saying is that I tried to include the XML declaration but when I do the page returns a blank.
However, when I remove the stylesheet and XML declaration it passes the XHTML-Mobile-Profile test and Valid Markup test. It gets 5/5 even though I have NOT included a line at the top of the code declaring the XML type...
When I include the XML type the page blanks.
Posted by roland 5 years ago
the xml declaration starts with >? like php.
Print the xml declaration with php:
<?php print "<?xml...."; ?>
to avoid this problem.
Posted by Fritz 5 years ago
Use the following php-code as your first line of php:
header('content-type: text/html; charset=utf-8');
Had the same problem, the xml-declaration seems to confuse the php-interpreter. Keep in mind that the rest of the Xhtml should use the correct charset. This one works on my site.
Posted by proc 5 years ago
Thanks for the suggestions. Unfortunately neither worked. Its seems to be extremely finicky.
I tried your advice first Fritz. I put that line after all the other meta/head stuff just below <?php
but it caused this error:
Warning: Cannot modify header information - headers already sent by (output started at
/home/procmob/public_html/index.php:23) in /home/procmob/public_html/index.php on line 27
I cant make any sense of that. Theres nothing in the style sheet about xml or headers.
Alternatively if I put it in at the very top of my code (above everything) it just seems to ignore it and I still score 3.66 with the markup errors mentioned above.
Roland's suggestion appeared to work. It looked good in the PC browser and in the Openwave emulator.
However when I test it at ready.mobi it causes some kind of malfunction whereby the browser stalls on the "developer advice" waiting page.
Check it yourself here:
http://proc.mobi/index2.php - very weird....
Does anyone have any templates I could look at or any other suggestions?
Posted by roland 5 years ago
The xml declaration has still a missing
?>.Add:
xmllint found an encoding error in line 25:
Posted by proc 5 years ago
Scoring 5 out of 5 now.
Had a missing bracket in an IF statement in my php also.
The reported errors (like all coding) can be a little misleading.
Thank you.
Posted by MobiPonto 4 years ago
I am having the same problem. Can you explain how you have resolve yours.
I have create a php site flashscore.mobi.
I have place the
xml version="1.0" encoding="utf-8 or <?xml version="1.0" encoding="utf-8"?>
The page comes up blank. Without that the pages displays okay but scores only 3/5.
How to I solve that?
This what I presently have:
FlashScore - Live Scores and Results
Can somebody help me?
Joao
Posted by roland 4 years ago
If you use PHP and you add <?xml version="1.0" encoding="utf-8"?> into your document, be sure that
short_open_tagis set to Off.Search about
short_open_tagin yourphp.ini.If you do not want to change your php.ini, create the XML declaration with PHP:
Posted by kerben 4 years ago
the above code is missing the ? to close the xml.
correct code should be:
btw thanks a lot roland, for the snippet