| verzia 1.1, 2004/11/27 22:52:06 |
verzia 1.2, 2004/11/28 22:30:31 |
|
|
| <!-- $Platon: $ --> |
<!-- $Platon: phpMyEdit/doc/sgml/hints-and-tips.sgml,v 1.1 2004/11/27 22:52:06 nepto Exp $ --> |
| |
|
| <chapter id="hints-and-tips"> |
<chapter id="hints-and-tips"> |
| <title id="hints-and-tips.title">Hints & tips</title> |
<title id="hints-and-tips.title">Hints & tips</title> |
|
|
| <title id="hints-and-tips.overview.title">Overview</title> |
<title id="hints-and-tips.overview.title">Overview</title> |
| <para> |
<para> |
| |
|
| In this chapter you can find several useful tips, hints and other advices how |
In this chapter you can find several useful tips, hints and other advices on |
| to accomplish more or less difficult particular database tasks using &name; |
how to accomplish more or less difficult database tasks using &name; project. |
| project. |
|
| |
|
| </para> |
</para> |
| <para> |
<para> |
| |
|
| &name; is an open-souce application developed by open community. This |
&name; is an open-source application developed by open community. This |
| community is proud of this project and is happy to share its knowledge with |
community is proud of this project and is happy to share its knowledge with |
| others. So may be you. Please share with us your knowledge and contribute |
others. Please share with us your knowledge and contribute |
| interesting examples of &name; usage, if you found some. You can do so by |
interesting examples of &name; usage, if you found some. You can do so by |
| using our <xref linkend="other-information.bug-tracking-system" |
using our <xref linkend="other-information.bug-tracking-system" |
| endterm="other-information.bug-tracking-system"> |
endterm="other-information.bug-tracking-system"> |
| Riadok 28 endterm="other-information.bug-tracking- |
|
| Riadok 27 endterm="other-information.bug-tracking- |
|
| <title id="hints-and-tips.national-characters.title">Handling national characters</title> |
<title id="hints-and-tips.national-characters.title">Handling national characters</title> |
| <para> |
<para> |
| |
|
| &name; is used accros the whole world by many users of various nationalities |
&name; is used across the whole world by many users of various nationalities |
| speaking and writting several different languages. The most common problem |
speaking and writing several different languages. The most common problem |
| occured for these people located in the east, central or north Europe, Asia, |
that occured for people located in the east, central or north Europe, Asia |
| but also in other countries is, that &name; does not handle their national |
and other countries is, that &name; does not handle their national |
| language characters correctly. |
language characters correctly. |
| |
|
| </para> |
</para> |
| <para> |
<para> |
| |
|
| The reason for this is very simple. In order to simplify &name; integration |
The reason for this is very simple. In order to simplify &name; integration |
| into larger production systems, generated code does not contain by default any |
into larger production systems, the generated code does not contain by default |
| HTML header or footer. But even if HTML header and footer is turned on, |
any HTML header or footer. But even if the HTML header and footer is turned |
| generated META tags does not contain any entry defining proper type of content |
on, the generated META tags do not contain any entry defining the proper type |
| and character set. It's up to you to send this kind information with the |
of content and character set. It's up to you to send this kind information |
| served page. You can do this using HTTP protocol headers or HTML META tags. |
with the served page. You can do this using HTTP protocol headers or HTML META |
| |
tags. |
| |
|
| </para> |
</para> |
| <para> |
<para> |
| |
|
| Here follows two examples how to define <constant>iso-8859-2</constant> |
Below are two examples how to define an <constant>iso-8859-2</constant> |
| character set for the HTML page. This charset is most suitable for countries |
character set for the HTML page. This charset is most suitable for countries |
| in the central Europe, such as Slovakia, Czech republic, Poland, and so on. |
in central Europe, such as Slovakia, Czech republic, Poland, and so on. |
| For your country you will certainly need to set different appropriate |
For your country you will certainly need to determine the appropriate |
| character set. |
character set. |
| |
|
| <example><title>Charset defined with META tag</title> |
<example><title>Charset defined with META tag</title> |
|
|
| <title id="hints-and-tips.data-removal-protection.title">Data removal protection</title> |
<title id="hints-and-tips.data-removal-protection.title">Data removal protection</title> |
| <para> |
<para> |
| |
|
| One very old database mainteinace rule basically says: |
One very old database maintenance rule basically says: |
| |
|
| </para> |
</para> |
| <para> |
<para> |
| |
|
| <blockquote> |
<blockquote> |
| <attribution>unknown author</attribution> |
<attribution>unknown author</attribution> |
| <simpara>No entry should by removed from database, but just marked as deleted.</simpara> |
<simpara>No entry should by removed from a database, but just marked as deleted.</simpara> |
| </blockquote> |
</blockquote> |
| |
|
| </para> |
</para> |
| Riadok 93 According to this rule, we may want to i |
|
| Riadok 93 According to this rule, we may want to i |
|
| </para> |
</para> |
| <para> |
<para> |
| |
|
| Firstaval we need to set-up &name; to list only valid non-deleted records. |
First of all we need to set-up &name; to list only valid non-deleted records. |
| This can be accomplished using <varname>$opts['filters']</varname> |
This can be accomplished using <varname>$opts['filters']</varname> |
| configuration option. We suppose that we have table where |
configuration option. We suppose that we have table where a column named |
| <varname>deleted</varname> column says if record is deleted or not. |
<varname>deleted</varname> indicates if record is deleted or not. |
| |
|
| <example><title>Non-deleted records listing</title> |
<example><title>Non-deleted records listing</title> |
| <programlisting><![CDATA[ |
<programlisting><![CDATA[ |
| Riadok 107 $opts['filters'] = 'deleted IS NULL OR d |
|
| Riadok 107 $opts['filters'] = 'deleted IS NULL OR d |
|
| </para> |
</para> |
| <para> |
<para> |
| |
|
| Than we have to create delete before trigger and we are done. Trigger PHP code |
Than we have to create a "delete before" trigger and we are done. Trigger PHP code |
| should similarly looks like this one: |
should look similar to this example: |
| |
|
| <example><title>Trigger for marking records as deleted</title> |
<example><title>Trigger for marking records as deleted</title> |
| <programlisting><![CDATA[ |
<programlisting><![CDATA[ |
|
|
| </para> |
</para> |
| <para> |
<para> |
| |
|
| To recover particular record just change value in <varname>deleted</varname> |
To recover a particular record just change the value in the <varname>deleted</varname> |
| column from <constant>1</constant> to <constant>0</constant> |
column from <constant>1</constant> to <constant>0</constant> |
| using your SQL client or interface. |
using your SQL client or interface (for example using |
| |
<application>phpMyAdmin</application>). |
| |
|
| </para> |
</para> |
| </sect1> |
</sect1> |
| Riadok 135 using your SQL client or interface. |
|
| Riadok 136 using your SQL client or interface. |
|
| <para> |
<para> |
| |
|
| To integrate &name; into <ulink url="http://www.phpnuke.org/">PHP-Nuke</ulink> |
To integrate &name; into <ulink url="http://www.phpnuke.org/">PHP-Nuke</ulink> |
| content management system, just add <varname>name</varname> variable |
content management system, just add a <varname>name</varname> variable |
| with <varname>$module_name</varname> value into set of &name; |
with a <varname>$module_name</varname> value into a set of &name; |
| persistent variables. |
persistent variables. |
| |
|
| <example><title>&name; integrated into PHP-Nuke</title> |
<example><title>&name; integrated into PHP-Nuke</title> |
| Riadok 150 $opts['cgi']['persist']['name'] = $modul |
|
| Riadok 151 $opts['cgi']['persist']['name'] = $modul |
|
| <para> |
<para> |
| |
|
| Integration into <ulink url="http://www.postnuke.com/">PostNuke</ulink> |
Integration into <ulink url="http://www.postnuke.com/">PostNuke</ulink> |
| content management system is most like very similar to <xref |
content management system is most likely very similar to <xref |
| endterm="hint-and-tips.integration.php-nuke" |
endterm="hint-and-tips.integration.php-nuke" |
| linkend="hint-and-tips.integration.php-nuke">. |
linkend="hint-and-tips.integration.php-nuke">. |
| |
|
| Riadok 158 linkend="hint-and-tips.integration.php-n |
|
| Riadok 159 linkend="hint-and-tips.integration.php-n |
|
| <bridgehead>other systems</bridgehead> |
<bridgehead>other systems</bridgehead> |
| <para> |
<para> |
| |
|
| If you know useful information how to integrate &name; with particular |
If you know useful information about how to integrate &name; with a particular |
| system, please notify project developers. |
system, please notify project developers. |
| |
|
| </para> |
</para> |