For Programmers: Free Programming Magazines  


Home > Archive > PHP Documentation > June 2006 > Recent manually built Extended CHM has a corrupt index page.









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Recent manually built Extended CHM has a corrupt index page.
Richard A. Quadling

2006-06-29, 3:58 am

Hi,
=20
phpdoc/htmlhelp/filter_files.php has a problem creating the new
_index.html file.
=20
The output currently is ...
=20
<a id=3D"user_notes"></a><div id=3D"pageNotes"></div><script
type=3D"text/javascript" language=3D"JavaScript1.2">
function displayNotes() { _displayNotes(); }
if (typeof loadNotes =3D=3D "function") { loadNotes(); }
</script><div id=3D"pageNav"><table width=3D"100%" border=3D"0"
cellspacing=3D"10" cellpadding=3D"0" class=3D"navigation"><tr =
align=3D"left"
valign=3D"middle"><td width=3D"30%"></td><td align=3D"center"
width=3D"40%"><span id=3D"navPath">Main</span></td><td align=3D"right"
width=3D"30%"><span id=3D"navNext"><a accesskey=3D"n"
href=3D"preface.html">Preface &gt;&gt;</a></span></td></tr><tr
align=3D"center" valign=3D"middle"><td colspan=3D"3"><span
id=3D"navOnline"><span id=3D"navThisOnline"><a
href=3D"java script:thisPageOnline();">This page online</a></span>  
<span id=3D"navReportBug"><a href=3D"java script:bugOnPage();">Report a
bug</a></span></span></td></tr></table></div></div></body></html>
=20
The code causing the problem is bizarre.
=20
filter_files.php // $Id: filter_files.php,v 1.17 2005/07/01 22:27:04
techtonik Exp $
=20
Lines 240-247 (Part of function newIndex ($content))
=20
// Get contents we need to build the _index.html file
preg_match("!^(.+)<hr>!s", $content, $_index1);
preg_match("!</div></div>(<a id=3D\"user_notes\">.+</html> )!s",
$content, $_index2);
=20
// Write out the two components to form a complete file
$fp =3D fopen("$HTML_TARGET/_index.html", "w");
fwrite($fp, $_index1[1] . $_index2[1]);
fclose($fp);

=20
Even though the $content DOES containt <hr>, then value in $_index1[1]
is blank.
=20
This is going to be one of those REALLY obvious problems which has
stumped me for ages. I can redo the code using string manipulation, but
why the regex doesn't work,I don't know.
=20
I'm using PHPV5.2.0-dev and am just downloading the latest snapshot.
=20
I can confirm that the expression works in my editor (I added a
file_put_contents('test.html', $content); and used that with the
expression - worked fine!).
=20
Regards,
=20
Richard Quadling.
=20
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com