Extended chm php syntax manual DIY
1. Main Features of extended CHM
Customizable right-click menu
PHPCodeBlock highlighted by syntax
The function in the PHP code block carries the corresponding function manual link.
Clearer manual interface
You can customize the appearance style of the manual.
Supports skin replacement
More detailed manual content
With very practical user notes
Can be integrated into most IDE and Editor
For more information, visit
<Http://www.php.net/docs-echm.php>
2. Why DIY?
Somehow, such a good stuff has not been updated on the official PHP website for a long time (the latest official
Version 2003.9.6). Especially after PhP5 is released, many contents cannot be found.
In this way, we can only carry forward the DIY spirit and make our own. ^_^
3. Prerequisites
Use of the CVS client.
Basic operations in Linux and software compilation and installation.
4. software requirements
CVS client software:
We will use the CVS server on the official PHP website to obtain the latest phpdoc version.
Wincvs Chinese version is recommended in Windows
<Http://www.8848software.com/wi
NCVS/>
The Operating Systems in the Unix camp generally come with CVS clients,
You can directly type "CVS version" in the command line to check whether CVS is installed,
If not
<Http://www.cvshome.org> download the latest version
CVS Client
Windows:
Run Microsoft HTML Help Workshop on Windows to generate a CHM File.
You can also run wine in Linux to simulate windows
Microsoft HTML Help Workshop
Microsoft's tool for generating CHM files
<Microsoft HTML Help
Workshop>
Linux:
We need to compile and install the manual and some necessary software packages here,
You can also use other UNIX camp systems,
Or simply use cygwin, VMWare, and other software to simulate a Linux environment in windows.
Php4.0 or later:
PHP is used to compile and generate CHM files. Therefore, you need to compile and generate CHM files in Windows and Linux.
Install PHP.
Environment used in this article:
Two PCs with RedHat 9 and Windows 2000 Professional
5. Start DIY
First
Install openjada and opensp
Go to the Linux Console
Code :--------------------------------------------------------------------------------
$ Mkdir/home/phpdoc
$ CD/home/phpdoc
$ Wget "http://prdownloads.sourceforge.net/openjade/openjade-1.3.2.tar.gz"
$ Wget "http://prdownloads.sourceforge.net/openjade/OpenSP-1.5.1.tar.gz"
$ Tar-zxvf * .tar.gz
$ Openjade-1.3.2 CD
$./Configure
$ Make
$ Make install
$ CD ../OpenSP-1.5.1
$./Configure
$ Make
$ Make install
$ CD ../
--------------------------------------------------------------------------------
Then, we will obtain the latest phpdoc version from the official php cvs server.
Code :--------------------------------------------------------------------------------
$ Export cvsroot =: pserver: cvsread@cvs.php.net:/Repository
$ CVS-Z9 checkout phpdoc
$ CD phpdoc
$ CVS Update-DP-d "December 31,200 2 PM" XSL
$ CVS up-a XSL/version. xml XSL/docbook/html/chunker. XSL
--------------------------------------------------------------------------------
Set compilation Parameters
Code :--------------------------------------------------------------------------------
$ Autoconf
$./Configure -- With-CHM = yes -- With-lang = en
--------------------------------------------------------------------------------
In this case, make some minor corrections.
Open/home/phpdoc/XSL/htmlhelp-db.xsl in the editor
Search for "@ docbookxsl_html @" in this file @",
Replace it with "./docbook/html/Chunk. XSL" and save the disk and exit
Then open/home/phpdoc/XSL/html-common.xsl
Add the following code to the end of the file </XSL: stylesheet> and save the disk and exit.
Code :--------------------------------------------------------------------------------
<XSL: template match = "collabname" mode = "titlepage. mode">
<XSL: Apply-templates/>
</XSL: Template>
<XSL: Param name = "chunker.output.doc type-System"
Select = "'HTTP: // www.w3.org/tr/html4/loose.dtd'"/>
<XSL: Param name = "chunker.output.doc type-Public" select = "'-// W3C // DTD html
4.01 transitional // en' "/>
--------------------------------------------------------------------------------
Then proceed with the compilation operation,
Code :--------------------------------------------------------------------------------
$ Make chm_xsl
--------------------------------------------------------------------------------
After compilation, we need to obtain the latest PHP image site list and user note files.
Code :--------------------------------------------------------------------------------
$ CD htmlhelp
$ Wget "http://www.php.net/include/mirrors.inc"
$ Wget "http://www.php.net/backend/notes/all.bz2"
$ Bunzip2 all.bz2
CD ../
--------------------------------------------------------------------------------
You can pack the generated files and upload them to Windows.
Code :--------------------------------------------------------------------------------
Tar-czvf phpdoc.tar.gz./htmlhelp
--------------------------------------------------------------------------------
Now, you need to complete the operations on the Linux platform.
Now proceed to the Windows Environment
First, extract the phpdoc.tar.gz
The link to the related functions is incorrect in some files generated after compilation of the obtained version,
Modify the htmlhelp/filter_files.php file.
Add the following code to the header:
PHP code :--------------------------------------------------------------------------------
// Fix functions Link error
Function fix_function_link ($ m ){
$ Fname1 = 'function.'.strtolower(str_replace('_', '-', then m?1=}.'.html ';
$ Fname2 = 'function.'.strtolower(str_replace('_', '.', then m?1=}.'.html ';
If (file_exists ("html/". $ fname1 )){
Return '<a href = "'. $ fname1. '"> <B>'. $ M [1]. '() </B> </a> ';
} Elseif (file_exists ("html/". $ fname2 )){
Return '<a href = "'. $ fname2. '"> <B>'. $ M [1]. '() </B> </a> ';
} Else {
Return '<a href = "#" onclick = "Return false;"> <B> '. $ M [1]. '() </B> </a> ';
}
}
--------------------------------------------------------------------------------
Find the following code in the file:
PHP code :--------------------------------------------------------------------------------
// Read in the contents of the source file
$ Content = join ("", file ("$ html_src/$ FILENAME "));
--------------------------------------------------------------------------------
Change it
PHP code :--------------------------------------------------------------------------------
// Read in the contents of the source file
$ Content = join ("", file ("$ html_src/$ FILENAME "));
$ Content = str_replace ("& raquo;", "»", $ content );
$ Reg_fix = '/'. preg_quote ('<a href = "index.html"> <B> ',"/"). '(\ W + )\(\)'. preg_quote ('</B> </a> ',"/"). '/is ';
$ Content = preg_replace_callback ($ reg_fix, 'fix _ function_link ', $ content );
$ Reg_fix = '/'. preg_quote ('<a href = ""> <B> ',"/"). '(\ W + )\(\)'. preg_quote ('</B> </a> ',"/"). '/is ';
$ Content = preg_replace_callback ($ reg_fix, 'fix _ function_link ', $ content );
--------------------------------------------------------------------------------
After saving the disk, rename "htmlhelp \ local_vars.php.src"
"Htmlhelp \ local_vars.php"
Edit "htmlhelp \ local_vars.php ",
Set the $ help_workshop variable value to the installation directory of HTML Help Workshop.
Output
Add the directory of php.exe to the path environment variable.
In "run", Type CMD to enter console mode, and enter the release directory of phpdoc.tar.gz.
Code :--------------------------------------------------------------------------------
CD htmlhelp
Make_chm.bat
--------------------------------------------------------------------------------
After the execution, the extended chm php syntax manual is generated.
Stored in the htmlhelp/release directory
Download again
<Php_manual_prefs.exe> and save it to the manual directory.
Run thisProgramYou can set the right-click menu and skin used in the manual.
After setting, double-click php_manual_en.chm to browse the manual. (Source: viphot)