Quanta RefreshDoc

From KDE Wiki Sandbox
Revision as of 13:41, 18 April 2009 by Phaiax (talk | contribs) (New page: =This is a tutorial howto get the quanta-php-documentation up-to-date.= Please follow the step-by-step guide. == First: Install php-documentation == First, you have to install the php-do...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This is a tutorial howto get the quanta-php-documentation up-to-date.

Please follow the step-by-step guide.

First: Install php-documentation

First, you have to install the php-documentation packet for your Distribution.

In Ubuntu, type:

$ sudo apt-get install php-doc

Second: Download newest php-documentation

Visit http://www.php.net/download-docs.php and download the "Many HTML files "-archive for your prefered language.

Enzip that package into your home-directory, so you have a directory /home/user/html

Copy these files into the doc-dir. (in Ubuntu: /usr/share/doc/php-doc/html)

# rm -fr /usr/share/doc/php-doc/html
# mv /home/user/html /usr/share/doc/php-doc/html

Please notice, that if you do as proposed, the doc-files will have user-rights. I don't care about that. Execute

# chmod -R o+rwx /usr/share/doc/php-doc/html

Third: refresh docrc-file, so that Quanta has a new index

Install php-cli

In Ubuntu, type:

$ sudo apt-get install php-cli

Copy the code from this page: Quanta_RefreshDoc_script

Save it into the quanta-doc dir as /usr/share/apps/quanta/doc/gendoc.php

The script uses the php-XML-Reader. Because of that you have to make some html-files XML-valid: Open /usr/share/apps/quanta/doc/php/index.html and /usr/share/apps/quanta/doc/php/funcref.html Change the line

 <meta http-equiv="content-type" content="text/html; charset=UTF-8">

into

 <meta http-equiv="content-type" content="text/html; charset=UTF-8" />


cd into /usr/share/apps/quanta/doc/

Execute (as root)

# php gendoc.php php

That script will update php.docrc and create php_fref.docrc.

php.docrc is the file for the normal index of the php-documentation.

php-fref.docrc is an additional index file for all pages, functions are listed in. I thought, it could be convenient.

Fourth: Optional: Get better look&feel for the pages

It's possible to use a css-file on the documentation. Install and open KFileReplace.

Klick "Customize Search/Replace Session"

Change Location to /usr/share/doc/php-doc/html

Set Filter to *.html

Disable including subfolders

Set Encoding to utf8

Don't type anything in Search or Replace

Click "Search Later"

Click on "Add string"-Button in main window

Activate Search and replace-mode

Search for:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8"

Replace with:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <link rel="stylesheet" type="text/css" href="style.css" />
  <meta http-equiv="content-type" content="text/html; charset=UTF-8"

Be shure that you don't have a newline at the end!

Click on the -> arrow.

Click OK

Click on the "Replace"-Button (not simulate) in the main window.

Create a style.css-File in /usr/share/doc/php-doc/html

Here you could modify the appearance.

If you like the php.net-style, download it from

http://www.php.net/styles/site.css

and modify it. Maybe you wants to make the font-size smaller etc.

Good luck