Code: Select all
$fp = fopen('names.txt','r');
$id = "ID=\"first-XML-item\"";
$nf = fopen("c://apache//htdocs//names//start.htm", "a");
while (!feof($fp))
{
$line = fgets($fp, 1024);
list ($name, $namefile) = split ('\;', $line);
echo '
<table>
<tr>
<td>'.$name.'</td>
<td>'.$namefile.'</td>
</tr>
</table>';
if ($line[0] == true)
{
$content2=
"
<DIV CLASS=\"button\" ".$id."
onMouseOver=\"over(this)\"
onMouseOut=\"out(this)\"
onClick='changeXML(\"".$namefile."\"); select(\"xml\",this)'>
".$name."<SPAN CLASS=\"arrow\">4</SPAN>
</DIV>";
}
else
{
$content2=
"
<DIV CLASS=\"button\"
onMouseOver=\"over(this)\"
onMouseOut=\"out(this)\"
onClick='changeXML(\"".$namefile."\"); select(\"xml\",this)'>
".$name."<SPAN CLASS=\"arrow\">4</SPAN>
</DIV>";
}
$fp++;
fwrite ($nf, $content2);
}
fclose($nf);
fclose($fp);Code: Select all
name1;name1.xml
name2;name2.xml
name3;name3.xmlCode: Select all
<DIV CLASS="button" ID="first-XML-item"
onMouseOver="over(this)"
onMouseOut="out(this)"
onClick='changeXML("name1.xml"); select("xml",this)'>
name1<SPAN CLASS="arrow">4</SPAN>
</DIV>
<DIV CLASS="button"
onMouseOver="over(this)"
onMouseOut="out(this)"
onClick='changeXML("name2.xml"); select("xml",this)'>
name2<SPAN CLASS="arrow">4</SPAN>
</DIV>
<DIV CLASS="button"
onMouseOver="over(this)"
onMouseOut="out(this)"
onClick='changeXML("name3.xml"); select("xml",this)'>
name3<SPAN CLASS="arrow">4</SPAN>
</DIV>
but the html outcome does not come like this.
either it comes with ID="first-XML-item" on all the items or it does not come with ID="..." whatsoever (ID is bolded).
what should I change in order to get the desired html outcome?