Quanta RefreshDoc: Difference between revisions

From KDE Wiki Sandbox
(Markup edit)
(Tweaked formatting of displayed Input)
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<languages />
<languages />
<translate>
<translate>
==This is a tutorial howto get the quanta-php-documentation up-to-date.==
==This is a tutorial howto get the quanta-php-documentation up-to-date.== <!--T:1-->


<!--T:2-->
Please follow the step-by-step guide.
Please follow the step-by-step guide.


=== First: Install php-documentation ===
=== First: Install php-documentation === <!--T:3-->
First, you have to install the php-documentation packet for your Distribution.
First, you have to install the php-documentation packet for your Distribution.


<!--T:4-->
In Ubuntu, type:
In Ubuntu, type:
{{Input|1= sudo apt-get install php-doc}}
{{Input|1= sudo apt-get install php-doc}}




=== Second: Download newest php-documentation ===
=== Second: Download newest php-documentation === <!--T:5-->


<!--T:6-->
{{Note|1= If you do as proposed, the doc-files will have user-rights. In this case that is not important.}}
{{Note|1= If you do as proposed, the doc-files will have user-rights. In this case that is not important.}}


<!--T:7-->
* Visit http://www.php.net/download-docs.php and download the "Many HTML files  "-archive for your prefered language.
* Visit http://www.php.net/download-docs.php and download the "Many HTML files  "-archive for your prefered language.
* Extract that package into your home-directory, so you have a directory /home/user/html
* Extract 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)<br />
* Copy these files into the doc-dir. (in Ubuntu: /usr/share/doc/php-doc/html)<br />
{{Input|1= # rm -fr /usr/share/doc/php-doc/html
{{Input|1= # rm -fr /usr/share/doc/php-doc/html
# mv /home/user/html /usr/share/doc/php-doc/html}}<br />
# mv /home/user/html /usr/share/doc/php-doc/html}}<br />
* Execute
* Execute
{{Input|1= # chmod -R o+rwx /usr/share/doc/php-doc/html}}
{{Input|1= # chmod -R o+rwx /usr/share/doc/php-doc/html}}




=== Third: refresh docrc-file, so that Quanta has a new index ===
=== Third: refresh docrc-file, so that Quanta has a new index === <!--T:8-->


<!--T:9-->
Install '''php-cli'''
Install '''php-cli'''


<!--T:10-->
In Ubuntu, type:
In Ubuntu, type:
{{Input|1=sudo apt-get install php-cli}}
{{Input|1=sudo apt-get install php-cli}}


<!--T:11-->
Copy the code from [[Quanta_RefreshDoc_script|this page]] and save it into the quanta-doc dir as /usr/share/apps/quanta/doc/gendoc.php
Copy the code from [[Quanta_RefreshDoc_script|this page]] and save it into the quanta-doc dir as /usr/share/apps/quanta/doc/gendoc.php


<!--T:12-->
The script uses the '''php-XML-Reader'''. Because of that you have to make some html-files XML-valid:
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
* Open /usr/share/apps/quanta/doc/php/index.html and /usr/share/apps/quanta/doc/php/funcref.html
* Change the line
* Change the line
{{Output|1=<meta http-equiv="content-type" content="text/html; charset=UTF-8">}}
{{Input|1=<meta http-equiv="content-type" content=<nowiki>"text/html; charset=UTF-8"</nowiki>>}}
into
into
{{Input|1=<meta http-equiv="content-type" content="text/html; charset=UTF-8" />}}
{{Input|1=<meta http-equiv="content-type" content=<nowiki>"text/html; charset=UTF-8"</nowiki> />}}
* cd into /usr/share/apps/quanta/doc/
* cd into /usr/share/apps/quanta/doc/
* Execute (as root)
* Execute (as root)
{{Input|1=php gendoc.php php}}
{{Input|1=php gendoc.php php}}


<!--T:13-->
That script will update '''php.docrc''' and create '''php_fref.docrc'''.
That script will update '''php.docrc''' and create '''php_fref.docrc'''.


<!--T:14-->
'''php.docrc''' is the file for the normal index of the php-documentation.
'''php.docrc''' is the file for the normal index of the php-documentation.


<!--T:15-->
'''php-fref.docrc''' is an additional index file for all pages, functions are listed in it. I thought it could be convenient.
'''php-fref.docrc''' is an additional index file for all pages, functions are listed in it. I thought it could be convenient.




=== Fourth: Optional: Get better look-and-feel for the pages ===
=== Fourth: Optional: Get better look-and-feel for the pages === <!--T:16-->


<!--T:17-->
It's possible to use a css-file on the documentation. Install and open '''KFileReplace'''.
It's possible to use a css-file on the documentation. Install and open '''KFileReplace'''.


* Click ''Customize Search/Replace Session''
<!--T:18-->
* Change ''Location'' to /usr/share/doc/php-doc/html
* Click <menuchoice>Customize Search/Replace Session</menuchoice>
* Set ''Filter'' to    *.html
* Change <menuchoice>Location</menuchoice> to /usr/share/doc/php-doc/html
* Set <menuchoice>Filter</menuchoice> to    *.html
* Disable including subfolders
* Disable including subfolders
* Set Encoding to utf8
* Set <menuchoice>Encoding</menuchoice> to utf8
* Don't type anything in ''Search'' or ''Replace''
* Don't type anything in <menuchoice>Search</menuchoice> or <menuchoice>Replace</menuchoice>
* Click <menuchoice>Search Later</menuchoice>
* Click <menuchoice>Search Later</menuchoice>
* Click on the <menuchoice>Add string</menuchoice> Button in main window
* Click on the <menuchoice>Add string</menuchoice> Button in main window
* Activate ''Search and replace'' mode
* Activate <menuchoice>Search and replace</menuchoice> mode
* Search for:
* <menuchoice>Search</menuchoice> for:
{{Output|1= <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
{{Input|1= <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" <nowiki>"http://www.w3.org/TR/html4/loose.dtd"</nowiki>>
  <html>
  <html>
   <head>
   <head>
   <meta http-equiv="content-type" content="text/html; charset=UTF-8"}}<br />
   <meta http-equiv="content-type" content="text/html; charset=UTF-8"}}<br />
* Replace with:
* <menuchoice>Replace</menuchoice> with:
{{Input|1= <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
{{Input|1= <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" <nowiki>"http://www.w3.org/TR/html4/loose.dtd"</nowiki>>
  <html>
  <html>
   <head>
   <head>
Line 76: Line 89:
   <meta http-equiv="content-type" content="text/html; charset=UTF-8"}}
   <meta http-equiv="content-type" content="text/html; charset=UTF-8"}}


<!--T:19-->
{{Warning|1=Make sure that you don't have a newline at the end!}}
{{Warning|1=Make sure that you don't have a newline at the end!}}
* Click on the -> arrow.
* Click on the <menuchoice>-> arrow</menuchoice>.
* Click <menuchoice>OK</menuchoice>
* Click <menuchoice>OK</menuchoice>
* Click on the <menuchoice>Replace</menuchoice> Button (not ''Simulate'') in the main window.
* Click on the <menuchoice>Replace</menuchoice> Button (not <menuchoice>Simulate</menuchoice>) in the main window.
* Create a style.css-File in /usr/share/doc/php-doc/html
* Create a style.css-File in /usr/share/doc/php-doc/html


<!--T:20-->
Here you could modify the appearance.
Here you could modify the appearance.


<!--T:21-->
If you like the php.net-style, download it from  
If you like the php.net-style, download it from  
  http://www.php.net/styles/site.css and modify it. Maybe you want to make the font-size smaller etc.
  http://www.php.net/styles/site.css
and modify it. Maybe you want to make the font-size smaller etc.


<!--T:22-->
Good luck
Good luck


<!--T:23-->
[[Category:Development]]
[[Category:Development]]
[[Category:Tutorials]]
[[Category:Tutorials]]
</translate>
</translate>

Latest revision as of 08:25, 14 November 2010

Other languages:

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

Note
If you do as proposed, the doc-files will have user-rights. In this case that is not important.


  • Visit http://www.php.net/download-docs.php and download the "Many HTML files "-archive for your prefered language.
  • Extract 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


  • 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 and 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 it. I thought it could be convenient.


Fourth: Optional: Get better look-and-feel for the pages

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

  • Click 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 the 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"
Warning
Make sure 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 want to make the font-size smaller etc.

Good luck