Avatar billede Slettet bruger
21. juli 2005 - 13:17 Der er 9 kommentarer og
1 løsning

Hvad betyder 'prolog' i denne sammenhæng

Jeg får en del fejlmeldinger ved validering, hvad betyder prolog i denne sammenhæng, og hvor kan jeg finde en hjælp.



Line 37, column 0: character "$" not allowed in prolog

$_GET['idx']=-1;
Avatar billede Slettet bruger
21. juli 2005 - 13:49 #1
Måske skal der lidt mere code til for at give en forståelse:

//Search
if(isset($searchtxt) && strlen($searchtxt)<3)
{
$err="Search at least 3 characters.";
$_GET['idx']=-1;
$aFound=array();
}
elseif(isset($searchtxt) && $searchtxt!="")
{
$_GET['idx']=-1;
$aFound=array();
for($a=0;$a<$nMaxCate;$a++)
    {
    $nFirst=0;
    $ccfile=$currdir."/".$aCategory[$a];
    $fp=@fopen($ccfile,"r");
    if(!@fp) {print "Error reading ".$currdir."/".$aCategory[$a]; exit;}
    $QorA=0;
    $cnt=1;
    $TempQ="";
    $okenter=0;
    while(!feof($fp))
        {
        $ln=fgets($fp,5000);
        if(trim($ln)!="")
            {

                if(stristr($ln,$searchtxt) || $okenter==1)
                {
                    if($nFirst==0)
                    {
                        $cCate=str_replace("_"," ",$aCategory[$a]);
                        $cCate=substr(substr($cCate,1),0,-4);
               
                        $aFound[]="@CATEGORY@$cCate";
                        $nFirst=1;
                    }
Avatar billede myplacedk Nybegynder
21. juli 2005 - 14:20 #2
Du må nok vise koden helt fra starten, jeg kan i hvert fald ikke se nogen syntax-problemer.
Avatar billede Slettet bruger
21. juli 2005 - 14:58 #3
<?php
$err="";
$totfound=0;
if(!isset($_GET['idx'])) $_GET['idx']=0;
function QuestionHere($cnt,$Q)
{
    print "<b>$cnt. $Q</b><br>";
}

function AnswerHere($cnt,$A)
{
    print "$A <font size=1><br><br></font>";
}

//read all with .faq ext.
$currdir=getcwd();
$dir=@opendir($currdir);
if(!$dir) print "Error dir $currdir";
$aCategory=array();
$n=0;
while($file=@readdir($dir))
    {
    if(substr($file,-4)==".faq")
        {
        $aCategory[]=$file;
        //print substr($file,-4)." = $n. $aCategory[$n]<br>"; $n++;
        }
    }

sort($aCategory);
$nMaxCate=count($aCategory);

//Search
if(isset($searchtxt) && strlen($searchtxt)<3)
{
$err="Search at least 3 characters.";
$_GET['idx']=-1;
$aFound=array();
}
elseif(isset($searchtxt) && $searchtxt!="")
{
$_GET['idx']=-1;
$aFound=array();
for($a=0;$a<$nMaxCate;$a++)
    {
    $nFirst=0;
    $ccfile=$currdir."/".$aCategory[$a];
    $fp=@fopen($ccfile,"r");
    if(!@fp) {print "Error reading ".$currdir."/".$aCategory[$a]; exit;}
    $QorA=0;
    $cnt=1;
    $TempQ="";
    $okenter=0;
    while(!feof($fp))
        {
        $ln=fgets($fp,5000);
        if(trim($ln)!="")
            {

                if(stristr($ln,$searchtxt) || $okenter==1)
                {
                    if($nFirst==0)
                    {
                        $cCate=str_replace("_"," ",$aCategory[$a]);
                        $cCate=substr(substr($cCate,1),0,-4);
               
                        $aFound[]="@CATEGORY@$cCate";
                        $nFirst=1;
                    }

           
                    if($QorA==0) //Question
                        {
                        $QorA=1;
                        $okenter=1;
                        $totfound++;
                        }
                    else
                        {
                        $QorA=0;
                        if($okenter==0)
                            {
                            $totfound++;
                            $TempQ=str_replace($searchtxt,"<font color='000080'>$searchtxt</font>",$TempQ);
                            $aFound[]=$TempQ;
                            }
                        $okenter=0;
                        }
                    $ln=str_replace($searchtxt,"<font color='000080'>$searchtxt</font>",$ln);
                    $aFound[]=$ln;

                }
                else
                {
                    if($QorA==0) {$TempQ=$ln; $QorA=1;}
                    elseif($QorA==1) {$QorA=0; $TempQ="";}
                }
            }
   
        }
    }
}

?>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>FAQ</title>
<STYLE type="text/css">
<!--
A { text-decoration:none; color: #0000cc }
-->
</STYLE>

<style fprolloverstyle>A:hover {color: #cc0000;}</style>

</head>

<body>
<center>
<table border="0" width="750" style="font-family: Arial; font-size: 10pt" cellspacing="0" cellpadding="5">
  <tr>
    <td width="100%" bgcolor="#000080">
      <p align="center"><font color="#FFFFFF" size="4"><b>FAQ</b></font></td>
  </tr>
  <tr>
    <td width="100%">
      <p align="center"><b>Categories :</b><br>&nbsp;

<?php
for($a=0;$a<$nMaxCate;$a++)
{
$cCate=str_replace("_","<font color=#ffffff>_</font>",$aCategory[$a]);
$cCate=substr(substr($cCate,1),0,-4);
$$cCate=strtoupper($file);

if($a==$_GET['idx']) {print "[<b><font color='#008080'>$cCate</font></b>] &nbsp;"; $cSelectedCate=$cCate;}
else print "[<a href='faq.php?idx=$a'>$cCate</a>] &nbsp;";
}
?>

</p>
    </td>
  </tr>
  <tr>
    <td width="100%">
<form method="POST" action="faq.php">

      <p align="center"><b>Search :</b>
        <input type="text" name="searchtxt" size="20" style="font-family: Arial; font-size: 8pt">
      <input type="submit" value="Go" name="Search" style="font-family: Arial; font-size: 8pt">
      </form>
      </p>
    </td>
  </tr>
  <tr>
    <td width="100%">
      <hr width="95%" size="1" color="#777777">


<?php
if($_GET['idx']>=0)
{
print "<font size='3' color='#008080'><b>$cSelectedCate<br><br></b></font>";

$fp=@fopen($aCategory[$_GET['idx']],"r");
if(!$fp) {print "Error reading ".$currdir."/".$aCategory[$a]; exit;}
$QorA=0;
$cnt=1;
while(!feof($fp))
    {
    $ln=fgets($fp,500);
    if(trim($ln)!="")
        {
        if($QorA==0) {QuestionHere($cnt,$ln); $QorA=1;}
        else {AnswerHere($cnt,$ln); $QorA=0; $cnt++;}
        }
    }
}
else
{ // SEARCH MODULE
$nMaxFound=count($aFound);

if($nMaxFound==0)
{
if($err!="") print "<br><font color='cc0000'>$err</font>";
else print "No search found for <b>$searchtxt</b>";
}

else
    {
    print "<font color=#000080 size=3>Search \"<b>$searchtxt</b>\", found <b>$totfound</b> topics.<br></font>";
    $cnt=1;
    $QorA=0;
    for($a=0;$a<$nMaxFound;$a++)
        {
        if(substr($aFound[$a],0,10)=="@CATEGORY@")
            {
            $cSelectedCate=substr($aFound[$a],10);
            print "<br><font size='3' color='#008080'><b>$cSelectedCate<br></b></font>";   
            $QorA=0;       
            }
        else
            {
            if($QorA==0) {QuestionHere($cnt,$aFound[$a]); $QorA=1;}
            else {AnswerHere($cnt,$aFound[$a]); $QorA=0; $cnt++;}
            }       
        }

    }
}
?>

<br><br><font size=1>Powered by <a href='http://smallcapitalbusiness.com'>SmallCapitalBusiness.com</a></font>
</td>
  </tr>
</table>

</body>

</html>
Avatar billede Slettet bruger
21. juli 2005 - 14:59 #4
Funktionen kan ses på www.3my.frac.dk
Avatar billede myplacedk Nybegynder
21. juli 2005 - 15:17 #5
Jeg kan ikke fremprovokere fejlen hverken på min egen maskine eller på din test-url. Skal man gøre noget bestemt?
Avatar billede Slettet bruger
21. juli 2005 - 15:41 #6
Når jeg laver en validate fra frac med denne får jeg andre fejl som jeg endnu ikke har rettet:
http://validator.w3.org/check?verbose=1&uri=http%3A//www.3my.frac.dk/tips/faq.php#result
..............

Jeg bruger TSW-webcoder og validerer jeg derfra kommer der 15 fejl lig den jeg har skrevet først.

Har du mulighed for validering af script 14:58:12
Avatar billede Slettet bruger
21. juli 2005 - 15:45 #7
Valideret med TSW-webcoder

Below are the results of attempting to parse this document with an SGML parser.

Line 7, column 14: character "$" not allowed in prolog

print "<b>$cnt. $Q</b><br>";

&#9993;

Line 22, column 4: character "{" not allowed in prolog

{

&#9993;

Line 35, column 0: character "{" not allowed in prolog

{

&#9993;

Line 48, column 4: character "$" not allowed in prolog

$fp=@fopen($ccfile,"r");

&#9993;

Line 60, column 16: character "i" not allowed in prolog

if(stristr($ln,$searchtxt) || $okenter==1)

&#9993;

Line 67, column 24: character "$" not allowed in prolog

$aFound[]="@CATEGORY@$cCate";

&#9993;

Line 77, column 24: character "}" not allowed in prolog

}

&#9993;

Line 85, column 28: character "$" not allowed in prolog

$aFound[]=$TempQ;

&#9993;

Line 93, column 16: character "e" not allowed in prolog

else

&#9993;

Line 118, column 22: "FPROLLOVERSTYLE" is not a member of a group specified for any attribute

<style fprolloverstyle>A:hover {color: #cc0000;}</style>

&#9993;

Line 118, column 22: required attribute "TYPE" not specified

<style fprolloverstyle>A:hover {color: #cc0000;}</style>

The 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>.

&#9993;

Line 136, column 51: end tag for element "FONT" which is not open

$cCate=str_replace("_","<font color=#ffffff>_</font>",$aCategory[$a]);

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 occured in a script section of your document, you should probably read this FAQ entry.

&#9993;

Line 156, column 9: end tag for element "P" which is not open

</p>

&#9993;

Line 161, column 37: there is no attribute "COLOR"

<hr width="95%" size="1" color="#777777">

You have used the attribute named above in your document, but the document type you are using does not support that attribute for this element. This error is often caused by incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Transitional" document type to get the "target" attribute), or by using vendor proprietary extensions such as "marginheight" (this is usually fixed by using CSS to achieve the desired effect instead).

This error may also result if the element itself is not supported in the document type you are using, as an undefined element will have no supported attributes; in this case, see the element-undefined error message for further information.

How to fix: check the spelling and case of the element and attribute, (Remember XHTML is all lower-case) and/or check that they are both allowed in the chosen document type, and/or use CSS instead of this attribute.

&#9993;

Line 195, column 23: an attribute value must be a literal unless it contains only name characters

print "<font color=#000080 size=3>Search \"<b>$searchtxt</b>\", found <b>$to

You have used a character that is not considered a "name character" in an attribute value. Which characters are considered "name characters" varies between the different document types, but a good rule of thumb is that unless the value contains only lower or upper case letters in the range a-z you must put quotation marks around the value. In fact, unless you have extreme file size requirements it is a very very good idea to always put quote marks around your attribute values. It is never wrong to do so, and very often it is absolutely necessary.

&#9993;

Line 222, column 6: end tag for "CENTER" omitted, but its declaration does not permit this

</body>

&#9993;

Line 123, column 0: start tag was here

<center>
Avatar billede myplacedk Nybegynder
21. juli 2005 - 15:55 #8
Tilsyneladende kører du PHP-kode gennem en HTML-validator. Lad være med det, giv den HTML. ;-)

Det kan du fx. gøre ved at give validatoren en URL (som du gjorde i din kommentar kl. 15:41:59).

Hvis du så har spørgsmål ang. de HTML-fejl HTML-validatoren giver, så spørger under emnet "HTML", ikke "PHP".
Avatar billede Slettet bruger
21. juli 2005 - 16:16 #9
Ja den kører hele doc. gennem HTML-validator, det er ikke sådan når man ikke er klogere og har den fornødne indsigt.
Men det lærte jeg så:

Læg lige et svar, det er lektionen vær
Avatar billede myplacedk Nybegynder
21. juli 2005 - 17:47 #10
> det er ikke sådan når man ikke er klogere

Det er den bedste årsag til at spørge. ;-)
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Vi tilbyder markedets bedste kurser inden for webudvikling

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester