Inspired by this:
Pohape manual updatedI personally find it more convenient to use the CHM version of the PHP manual — a quick search is convenient, and the Internet is not always available. But official help has no built-in user comments, which are often very useful. Previously, they were in the Extended version of the manual, but now it is no longer supported.
Climbing in Google, I did not find the updated version of the manual with comments. I had to make my own, and this process can be repeated by anyone.
Required (everything is done under Windows):
- unpack all.bz2 somewhere, for example in the tmp folder
- We decompile there too chm:
')
hh -decompile TMP php_manual_en.chm
get the files: all, php_manual_en.hhc, php_manual_en.hhk and the RES folder with all html help files.
- Embed comments in HTML using a simple PHP script:
$notes=fopen( 'tmp/all' , 'r' );
while ($note=fgets($notes))
{
list($id, $sect, $rate, $time, $user, $text)=explode( '|' , $note);
// PHP
$text=highlight_string(base64_decode($text), true );
//
$text=preg_replace( '/(?<=\w)[&]nbsp;(?=\w)/' , ' ' , $text);
$file=file_get_contents( 'tmp/res/' .$sect. '.html' );
$note_body= '
<div id="usernotes">
<div class="note">
<span>' .strftime( '%d.%m.%y %H:%M' , $time). '</span> <strong>' .$user. '</strong><br />
<div class="text">
<div class="phpcode">
<code>
' .$text. '
</code>
</div>
</div>
</div>
</div>
' ;
// -
$file=preg_replace( '%(?=<hr /><div class="manualnavbar")%' , $note_body, $file);
file_put_contents( 'tmp/res/' .$sect. '.html' , $file);
}
* This source code was highlighted with Source Code Highlighter .
Create a file php_manual_en_notes.hhp in the TMP folder:
[OPTIONS]
Binary TOC=Yes
Compatibility=1.1 or later
Compiled file=php_manual_notes_en.chm
Contents file=php_manual_en.hhc
Default Window=manual
Display compile progress=No
Full-text search=Yes
Index file=php_manual_en.hhk
Language=0x409 ()
Title=PHP Manual
[WINDOWS]
manual="PHP Manual","php_manual_en.hhc","php_manual_en.hhk","res/index.html","res/index.html",,,,,0x2520,,0x386e,,0x30000,,,,,,0
[INFOTYPES]
Open the created file in HTML Help Workshop. Compile and get the finished CHM file.
And by the way ... no, not quite ready :) When compiling, two errors occurred:
HHC5013: Error: URL reference in the TOC cannot be resolved: "res\pharfileinfo.chmod.html".
HHC5013: Error: URL reference in the TOC cannot be resolved: "res\function.chmod.html".
If you look at the .hhc and .hhk files, you can assume that the matter is not in the wrong slash, but in fact it is not. Experiments have shown that HTML Help Workshop produces such an error if the file name contains the string ".chm". Therefore, we will rename the files to pharfileinfo_chmod.html and function_chmod.html and replace the links to them in the .hhc and .hhk files.
Now compiled without errors.
Download the finished file (current on 08/18/09)
here .
UPD: file updated, code highlighting added, long lines fixed
The file should be 23 mb - I apologize, the file in 10 mb was going wrong.