Extended CHM PHP Grammar manual DIY

Source: Internet
Author: User
Tags bz2 end functions net php file php code version variable
Syntax Extended CHM PHP Grammar manual DIY

1. Main characteristics of Extended CHM
Customizable right button menu
PHP code blocks highlighted in syntax
Functions in the PHP code block with the corresponding function manual link
A clearer manual interface
You can customize the appearance style of a manual
Support Skin changing function
More detailed manual content
Comes with very useful user notes
Can be integrated in most IDES and editors
For more information, visit
<


2. Why to DIY
Somehow, such good stuff has not been updated on the official PHP website for a long time (the latest official
Version was released in 2003.9.6). Especially after the release of PHP5 is a lot of content can not be found, the
In order to carry forward the DIY spirit, to make their own. ^_^

3. Preliminary knowledge
The use of CVS clients.
The basic operation in Linux environment, as well as the compilation and installation of software.

4. Software Requirements
CVS Client software:
We want to get the latest version of Phpdoc through the CVS server in the PHP official website.
Wincvs Chinese version recommended in Windows environment
<Ncvs/>>
The Unix camp's operating system typically has its own CVS client,
You can simply type "CVS version" at the command line to check if CVS is installed,
If you do not install the
<Ben's CVS Client
Windows Operating System:
You need to run Microsoft Html help Workshop in a Windows system to generate a CHM file
You can also run wine under Linux to simulate Windows
Microsoft Html Help Workshop
Microsoft releases a tool for generating CHM files
<<microsoft Html Help
Workshop>>
Linux Operating System:
We need to compile the manuals and some prerequisite software packages here,
You can also use other Unix-camp systems,
Or simply use Cygwin, VMware and other software to simulate a Linux environment under Windows
PHP4.0 version or above:
PHP is needed to compile and generate CHM files so you need to reuse Windows and Linux
PHP is installed.
The environment used in this article:
Two PCs, each equipped with Redhat 9 and Windows Professional

5. Start DIY
First, in the Linux machine
Install Openjada and OPENSP
Access 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
$CD openjade-1.3.2
$./configure
$make
$make Install
$CD. /opensp-1.5.1
$./configure
$make
$make Install
$CD. /
--------------------------------------------------------------------------------

Then we're going to get the latest version of Phpdoc from the official CVS server in PHP

Code:--------------------------------------------------------------------------------
$export cvsroot=:p server:cvsread@cvs.php.net:/repository
$CVS-z9 Checkout Phpdoc
$CD Phpdoc
$cvs update-dp-d "December, 2002 11:00pm" XSL
$cvs up-a Xsl/version.xml xsl/docbook/html/chunker.xsl
--------------------------------------------------------------------------------

Set compilation parameters

Code:--------------------------------------------------------------------------------
$autoconf
$./configure--with-chm=yes--with-lang=en
--------------------------------------------------------------------------------

At this point, we need to make some minor corrections.
Open/home/phpdoc/phpdoc/xsl/htmlhelp-db.xsl with editor
Search for "@DOCBOOKXSL_HTML @" in this file,
Replace it with "./docbook/html/chunk.xsl", side-by-side disk exit
And then open/home/phpdoc/phpdoc/xsl/html-common.xsl.
Add the following code to the end of the file </xsl:stylesheet> line, and exit

Code:--------------------------------------------------------------------------------
<xsl:template match= "Collabname" mode= "Titlepage.mode" >
<xsl:apply-templates/>
</xsl:template>
<xsl:param name= "Chunker.output.doctype-system"
select= "' Http://www.w3.org/TR/html4/loose.dtd '"/>
<xsl:param name= "Chunker.output.doctype-public" select= "-//w3c//dtd HTML
4.01 transitional//en ' "/>
--------------------------------------------------------------------------------

And then proceed to the compile operation,

Code:--------------------------------------------------------------------------------
$make chm_xsl
--------------------------------------------------------------------------------

At the end of the compilation, we need to get the latest list of PHP mirror sites, and user note files

Code:--------------------------------------------------------------------------------
$CD HTMLHelp
$wget "Http://www.php.net/include/mirrors.inc"
$wget "HTTP://WWW.PHP.NET/BACKEND/NOTES/ALL.BZ2"
$bunzip 2 all.bz2
Cd.. /
--------------------------------------------------------------------------------

You can pack the generated files and pass them on to the Windows machine.

Code:--------------------------------------------------------------------------------
TAR-CZVF phpdoc.tar.gz./htmlhelp
--------------------------------------------------------------------------------

Here, the operation needed to be performed on the Linux platform is complete.
Now go to the Windows environment
First, unzip the phpdoc.tar.gz that you just generated
Because of some of the files that I have built after compiling, the links to the related functions are wrong.
So you need to change the htmlhelp/filter_files.php file.
First add the following code to its head

PHP Code:--------------------------------------------------------------------------------
Fix functions Link Error
function Fix_function_link ($m) {
$fname 1 = ' function. ' Strtolower (Str_replace (' _ ', '-', $m [1])). HTML ';
$fname 2 = ' function. ' Strtolower (Str_replace (' _ ', '. ', $m [1])). HTML ';
if (file_exists ("html/". $fname 1)) {
Return ' <a href= '. $fname 1. ' " ><b> '. $m [1]. ' () </b></a> ';
}elseif (file_exists ("html/". $fname 2)) {
Return ' <a href= '. $fname 2. ' " ><b> '. $m [1]. ' () </b></a> ';
}else{
Return ' <a href= ' # "onclick=" return false; ><b> '. $m [1]. ' () </b></a> ';
}
}

--------------------------------------------------------------------------------

Then 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 to

PHP Code:--------------------------------------------------------------------------------
Read in the contents of the source file
$content = Join ("", File ("$HTML _src/$filename"));
$content = Str_replace ("»", "»", $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 you save the disk, rename "Htmlhelp\local_vars.php.src" to
"Htmlhelp\local_vars.php"
Edit "htmlhelp\local_vars.php",
Set the $HELP _workshop variable value to the installation directory of Html help WORKSHOP, save
Out
Add the Php.exe directory to the PATH environment variable.
Type cmd into console mode in "Run" and enter the phpdoc.tar.gz release directory

Code:--------------------------------------------------------------------------------
CD HTMLHelp
Make_chm.bat
--------------------------------------------------------------------------------

After its execution, the Extended CHM version of the PHP grammar manual is generated.
stored in the Htmlhelp/release directory
and then download
<<php_manual_prefs.exe>>, and save in the manual directory
This program can be used to set the right menu in the manual, the skin, and so on.
When the settings are complete, double-click Php_manual_en.chm to browse the manual.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.