I am having some problems with some code that I wrote. I have an array of links, each pointing to a file that is to be loaded and displayed to a layer upon click. Everything works fine for the first and last elements of the array but everything in the middle comes out like:
<a href="#" onclick="display.writeIt('test.
'); return false">test</a> |
with their being a stray \n as best i can tell between the end of the text to be displayed and the end quote. As I said, for the first and last elements in the array, everything works fine but anything in between suffers from this minor annoyance causing the links not to work. Here is the code that I am using:
foreach ($AboutLinks as $link) { if(file_exists($link)){
$fh = fopen($link, "r");
$linkText = addslashes( htmlspecialchars( fread( $fh, filesize( $link ))));
$linkKey = key($AboutLinks);
echo "\n<a href=\"#\" onclick=\"display.writeIt('$linkText'); return false\">$linkKey</a>"; if($i++!=$NoElem) echo " | ";
next($AboutLinks);
fclose($fh);
}
}