luk             Thu Mar 14 18:17:34 2002 EDT

  Added files:                 
    /phpdoc/cs/faq      using.xml 
    /phpdoc/cs/language references.xml 

  Modified files:              
    /phpdoc/cs  translation.xml 
    /phpdoc/cs/faq      installation.xml 
  Log:
  
  
  
Index: phpdoc/cs/translation.xml
diff -u phpdoc/cs/translation.xml:1.2 phpdoc/cs/translation.xml:1.3
--- phpdoc/cs/translation.xml:1.2       Tue Mar 12 16:21:52 2002
+++ phpdoc/cs/translation.xml   Thu Mar 14 18:17:32 2002
@@ -14,11 +14,18 @@
  </translators>
  
  <work-in-progress>
-  <file name="appendices/phpdevel.xml"  person="luk"      type="translation" />
-  <file name="faq/installation.xml"     person="luk"      type="translation" />
-  <file name="faq/mailinglist.xml"      person="luk"      type="translation" />  
-  <file name="faq/using.xml"            person="luk"      type="translation" />
-  <file name="functions/mysql.xml"      person="costra"   type="translation" />  
+  <file name="appendices/phpdevel.xml"        person="luk"      type="translation" />
+  <file name="appendices/predefined.xml"      person="luk"      type="translation" />
+  <file name="appendices/resources.xml"       person="luk"      type="translation" />
+  <file name="functions/mysql.xml"            person="costra"   type="translation" /> 
+ 
+  <file name="language/control-structures.xml person="luk"      type="translation" />
+  <file name="language/expressions.xml        person="luk"      type="translation" />
+  <file name="language/functions.xml          person="luk"      type="translation" />
+  <file name="language/operators.xml          person="luk"      type="translation" />
+  <file name="language/oop.xml                person="luk"      type="translation" />
+  <file name="language/references.xml         person="luk"      type="translation" />
+  <file name="language/types.xml              person="luk"      type="translation" />
+  <file name="language/variables.xml          person="luk"      type="translation" />
  </work-in-progress>
 
 </translation>
Index: phpdoc/cs/faq/installation.xml
diff -u phpdoc/cs/faq/installation.xml:1.1 phpdoc/cs/faq/installation.xml:1.2
--- phpdoc/cs/faq/installation.xml:1.1  Wed Mar 13 16:43:21 2002
+++ phpdoc/cs/faq/installation.xml      Thu Mar 14 18:17:33 2002
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="iso-8859-2"?>
-<!-- EN-Revision: 1.13 Maintainer: luk Status: mixed -->
+<!-- EN-Revision: 1.13 Maintainer: luk Status: ready -->
 
  <chapter id="faq.installation">
   <title>Instalace</title>
@@ -23,25 +23,25 @@
    <qandaentry id="faq.installation.phpini">
     <question>
      <para>
-      Unix/Windows: Where should my php.ini file be located?
+      Unix/Windows: Kde by měl být uložen soubor php.ini?
      </para>
     </question>
     <answer>
      <para>
-      By default on UNIX it should be in <filename>/usr/local/lib</filename>. 
-      Most people will want to change this at compile-time with the 
-      <link 
linkend="install.configure.with-config-file-path">--with-config-file-path</link>
-      flag. You would, for example, set it with something like:
+      V UNIXu má být implicitně v adresáři <filename>/usr/local/lib</filename>.
+      Mnoho lidí to bude chtít při kompilaci změnit pomocí parametru
+      <link 
+linkend="install.configure.with-config-file-path">--with-config-file-path</link>.
+      Mohli byste ho, například, nastavit zhruba takto:
       <programlisting>
 --with-config-file-path=/etc
       </programlisting>
-      And then you would copy <filename>php.ini-dist</filename> from 
-      the distribution to <filename>/etc/php.ini</filename> and
-      edit it to make any local changes you want.
+      Pak byste zkopírovali soubor <filename>php.ini-dist</filename> z
+      distribuce do <filename>/etc/php.ini</filename> a upravili tak, jak
+      chcete.
      </para>
      <para>
-      On Windows the default path for the <filename>php.ini</filename>
-      file is the Windows directory.
+      Pod Windows je soubor <filename>php.ini</filename> implicintě umístěn
+      v adresáři systému Windows.
      </para>
     </answer>
    </qandaentry>
@@ -49,23 +49,22 @@
    <qandaentry id="faq.installation.nodata">
     <question>
      <para>
-      Unix: I installed PHP, but every time I load a document, I get the 
-      message 'Document Contains No Data'! What's going on here?
+      UNIX: Nainstaloval jsem PHP, ale vždy, když načítám dokument, dostanu
+      zprávu 'Document Contains No Data'! O co jde?
      </para>
     </question>
     <answer>
      <para>
-      This probably means that PHP is having some sort of problem
-      and is core-dumping. Look in your server error log to see if
-      this is the case, and then try to reproduce the problem with
-      a small test case. If you know how to use 'gdb', it is very
-      helpful when you can provide a backtrace with your bug report
-      to help the developers pinpoint the problem.  If you are using
-      PHP as an Apache module try something like:
+      Pravděpobně to znamená, že PHP má nějaký problém a padá. Podívejte se
+      do protokolu chyb, zda se jedná o tento případ a pak zkuste problém
+      reprodukovat malým testem. Pokud víte, jak používat 'gdb', velmi pomůže,
+      když můžete s vaším hlášením chyby poskytnout výpis (backtrace).
+      Vývojáři tak mohou snadněji lokalizovat problém. Používáte-li PHP jako
+      modul do serveru Apache, zkuste něco jako:
       <itemizedlist>
        <listitem>
         <para>
-         Stop your httpd processes
+         Zastavte httpd procesy
         </para>
        </listitem>
        <listitem>
@@ -75,7 +74,7 @@
        </listitem>
        <listitem>
         <para>
-         Stop your httpd processes
+         Zastavte httpd procesy
         </para>
        </listitem>
        <listitem>
@@ -85,7 +84,7 @@
        </listitem>
        <listitem>
         <para>
-         Then fetch the URL causing the problem with your browser
+         Potom načtěte do prohlížeče URL, kde se vyskytl problém         
         </para>
        </listitem>      
        <listitem>
@@ -95,28 +94,28 @@
        </listitem>      
        <listitem>
         <para>
-         If you are getting a core dump, gdb should inform you of this now
+         Dostanete-li core dump (PHP spadne), gdb by vás o tom měl informovat
         </para>
        </listitem>      
        <listitem>
         <para>
-         type: bt
+         napište: bt
         </para>
        </listitem>
        <listitem>
         <para>
-         You should include your backtrace in your bug report. This should be 
submitted to 
+         Získaný výpis (backtrace) byste měli přiložit k hlášení chyby.
+         To by se mělo poslat na 
          <ulink url="&faqurl.php.bugs;">&faqurl.php.bugs;</ulink> 
         </para>
        </listitem>
       </itemizedlist>
      </para>
      <para>
-      If your script uses the regular expression functions
-      (<function>ereg</function> and friends), you should make sure 
-      that you compiled PHP and Apache with the same regular 
-      expression package. This should happen automatically with
-      PHP and Apache 1.3.x
+      Pokud váš skript používá funkce pro regulární výrazy
+      (<function>ereg</function> a další), měli byste se ujistit, že jste
+      zkompilovali PHP a Apache se stejným balíčkem pro regulární výrazy.
+      S PHP a Apachem 1.3.x by se to mělo dít automaticky.
      </para>
     </answer>
    </qandaentry>
@@ -124,15 +123,16 @@
    <qandaentry id="faq.installation.processing">
     <question>
      <para>
-      Unix: I installed PHP using RPMS, but Apache isn't processing the 
-      PHP pages! What's going on here?
+      UNIX: Instaloval jsem PHP z balíčků RPM, ale Apache nezpracovává stránky
+      s PHP! O co tu jde?
      </para>
     </question>
     <answer>
      <para>
-      Assuming you installed both Apache and PHP from RPM packages, 
-      you need to uncomment or add some or all of the following lines
-      in your <filename>http.conf</filename> file:
+      Za předpokladu, že se obojí, jak Apache, tak PHP, instalovalo z
+      balíčků RPM, bude třeba "odkomentovat" nebo přidat do souboru
+      <filename>http.conf</filename> některé z následujících řádků (nebo
+      všechny):
       <programlisting>
 # Extra Modules
 AddModule mod_php.c
@@ -141,17 +141,17 @@
 
 # Extra Modules
 LoadModule php_module         modules/mod_php.so
-LoadModule php3_module        modules/libphp3.so     /* for PHP 3 */
-LoadModule php4_module        modules/libphp4.so     /* for PHP 4 */
+LoadModule php3_module        modules/libphp3.so     /* pro PHP 3 */
+LoadModule php4_module        modules/libphp4.so     /* pro PHP 4 */
 LoadModule perl_module        modules/libperl.so
       </programlisting>
-      And add:
+      Přidejte také:
       <programlisting>
-AddType application/x-httpd-php3 .php3    /* for PHP 3 */
-AddType application/x-httpd-php .php      /* for PHP 4 */
+AddType application/x-httpd-php3 .php3    /* pro PHP 3 */
+AddType application/x-httpd-php .php      /* pro PHP 4 */
       </programlisting>
-      ... to the global properties, or to the properties of the 
-      VirtualDomain you want to have PHP support added to.
+      ... do globálních vlastností nebo do vlastností virtuální domény
+      (VirtualDomain) by se měla přidat podpora PHP.
      </para>
     </answer>
    </qandaentry>
@@ -159,37 +159,37 @@
    <qandaentry id="faq.installation.compile">
     <question>
      <para>
-      Unix: I installed PHP 3 using RPMS, but it doesn't compile with
-      the database support I need! What's going on here?
+      UNIX: Instaloval jsem PHP 3 z balíčků RPM, ale nekompiluje se s podporou
+      databáze, kterou potřebuji! O co tu jde?
      </para>
     </question>
     <answer>
      <para>
-      Due to the way PHP 3 built, it is not easy to build a
-      complete flexible PHP RPM.  This issue is addressed in PHP 4.
-      For PHP 3, we currently suggest you use the mechanism described in the
-      INSTALL.REDHAT file in the PHP distribution.  If you insist on using
-      an RPM version of PHP 3, read on...
+      Kvůli tomu, jak se PHP 3 budovalo, není snadné sestavit kompletní
+      flexibilní RPM balíček s PHP. Problém je vyřešen v PHP 4. Pro PHP 3
+      nyní doporučujeme používat mechanismus popsaný v souboru
+      INSTALL.REDHAT v distribuci PHP. Pokud trváte na použití RPM verze PHP 3,
+      čtěte dál...
      </para>
      <para>
-      The RPM packagers are setting up the RPMS to install
-      without database support to simplify installations <emphasis>and</emphasis>
-      because RPMS use /usr/ instead of the standard /usr/local/ directory for
-      files. You need to tell the RPM spec file which databases to support
-      and the location of the top-level of your database server.
+      RPM pakovače jsou nastaveny na tvorbu RPM balíčků k instalaci bez
+      podpory databází kvůli zjednodušení instalací <emphasis>a</emphasis>
+      proto, že RPM používá adresář /usr/ namísto standardního /usr/local/.
+      Musít sdělit RPM souboru spec, které databáze podporovat a umístění
+      adresáře nejvyšší úrovně databázového serveru.
      </para>
      <para>
-      This example will explain the process of adding support for the
-      popular MySQL database server, using the mod installation for Apache.
+      Tento příklad vysvětluje proces přidání podpory populárního databázového
+      serveru MySQL, pro instalaci PHP jako modulu do Apache.
      </para>
      <para>
-      Of course all of this information can be adjusted for any database
-      server that PHP supports. We will assume you installed MySQL and Apache
-      completely with RPMS for this example as well.
+      Všechny tyto informace smaozřejmě mohou být upraveny pro libovolný
+      databázový server, který PHP podporuje. Pro tento příklad budeme
+      předpokládat, že jste instalovali MySQL a Apache plně z balíčků RPM.
       <itemizedlist>
        <listitem>
              <para>
-         First remove mod_php3 : 
+         Nejdříve odstraňte mod_php3 : 
          <programlisting>
 rpm -e mod_php3
          </programlisting>
@@ -197,7 +197,7 @@
             </listitem>
             <listitem>
              <para>
-         Then get the source rpm and INSTALL it, NOT --rebuild
+         Potom vezměte zdrojový balíček RPM a spusťte na něm, NE --rebuild
          <programlisting>
 rpm -Uvh mod_php3-3.0.5-2.src.rpm
          </programlisting>
@@ -205,17 +205,19 @@
             </listitem>
             <listitem>
              <para>
-              Then edit the <filename>/usr/src/redhat/SPECS/mod_php3.spec</filename> 
file
+              Upravte soubor
+               <filename>/usr/src/redhat/SPECS/mod_php3.spec</filename>
              </para>
              <para>
-         In the %build section add the database support you want, and the path.
+         V sekci %build přidejte databázovou podporu, kterou chcete, a nastavte
+         cestu.
              </para>
              <para>
-         For MySQL  you would add
+         Pro MySQL byste přidali
          <programlisting>
 --with-mysql=/usr \
          </programlisting>
-         The %build section will look something like this:
+         Sekce %build bude vypadat přibližně takto:
          <programlisting>
        ./configure --prefix=/usr \
        --with-apxs=/usr/sbin/apxs \
@@ -230,7 +232,7 @@
             </listitem>
             <listitem>
              <para>
-              Once this modification is made then build the binary rpm as follows:
+              Poté, co jsou provedeny tyto změny, zkompilujte balíček takto:
          <programlisting>
 rpm -bb /usr/src/redhat/SPECS/mod_php3.spec
          </programlisting>
@@ -238,17 +240,17 @@
             </listitem>
             <listitem>
              <para>
-              Then install the rpm
+              Potom balíček nainstalujte:
          <programlisting>
 rpm -ivh /usr/src/redhat/RPMS/i386/mod_php3-3.0.5-2.i386.rpm
          </programlisting>
              </para>
             </listitem>
       </itemizedlist>
-      Make sure you restart Apache, and you now have PHP 3 with MySQL support
-      using RPM's. Note that it is probably much easier to just build
-      from the distribution tarball of PHP 3 and follow the instructions in
-      <filename>INSTALL.REDHAT</filename> found in that distribution.
+      Ujistěte se, že jste restartovali Apache, a nyní již máte PHP 3 s
+      podporou MySQL. Uvědomte si, že je pravděpodobně mnohem jednodušší
+      zkompilovat distribuční balíček tar a držet se instrukcí v souboru
+      <filename>INSTALL.REDHAT</filename> z distribuce.
         </para>
     </answer>
    </qandaentry>
@@ -256,17 +258,17 @@
    <qandaentry id="faq.installation.frontpage">
     <question>
      <para>
-      Unix: I patched Apache with the FrontPage extensions patch, and
-      suddenly PHP stopped working. Is PHP incompatible with the
-      Apache FrontPage extensions?
+      UNIX: Přidal jsem do Apache patch pro FrontPage Extension a PHP náhle
+      přestalo pracovat. Je PHP nekompatibilní s FrontPage Extension pro
+      Apache?
      </para>
     </question>
     <answer>
      <para>
-      No, PHP works fine with the FrontPage extensions. The problem
-      is that the FrontPage patch modifies several Apache structures,
-      that PHP relies on. Recompiling PHP (using 'make clean ; make')
-      after the FP patch is applied would solve the problem.
+      Ne, PHP pracuje dobře i s FrontPage Extension. Problém je v tom, že
+      FrontPage patch modifikuje některé struktury Apache, na které PHP
+      spoléhá. Překompilování PHP (použitím 'make clean ; make') po instalaci
+      FP patche by mělo problém vyřešit.
      </para>
     </answer>
    </qandaentry>
@@ -274,18 +276,16 @@
    <qandaentry id="faq.installation.blankscreen">
     <question>
      <para>
-      Unix/Windows: I have installed PHP, but when I try to
-      access a PHP script file via my browser, I get a blank screen.
+      UNIX/Windows: Nainstaloval jsem PHP, ale při pokusu načíst soubor PHP
+      skriptu do prohlížeče se zobrazí pouze prázdná obrazovka.
      </para>
     </question>
     <answer>
      <para>
-      Do a 'view source' in the web browser and you will probably
-      find that you can see the source code of your PHP script.
-      This means that the web server did not send the script to
-      PHP for interpretation. Something is wrong with the server
-      configuration - double check the server configuration against
-      the PHP installation instructions.
+      V prohlížeči vyberte funkci 'zobrazit zdrojový kód', nejspíš uvidíte
+      zdrojový kód vašeho PHP skriptu. To znamená, že server neposílá skript
+      k interpretaci. Chyba je někde v konfiguraci serveru - raději dvakrát
+      zkontrolujte konfiguraci podle instrukcí k instalaci PHP.
      </para>
     </answer>
    </qandaentry>
@@ -293,24 +293,20 @@
    <qandaentry id="faq.installation.500error">
     <question>
      <para>
-      Unix/Windows: I have installed PHP, but when try to
-      access a PHP script file via my browser, I get a
-      server 500 error.
+      UNIX/Windows: Nainstaloval jsem PHP a když chci načíst PHP soubor do
+      prohlížeče, objeví se "500 Internal Server Error".      
      </para>
     </question>
     <answer>
      <para>
-      Something went wrong when the server tried to run PHP. To
-      get to see a sensible error message, from the command line,
-      change to the directory containing the PHP executable
-      (<filename>php.exe</filename> on Windows) and run
-      <literal>php -i</literal>. If PHP has any problems running,
-      then a suitable error message will be displayed which will
-      give you a clue as to what needs to be done next. If you
-      get a screen full of html codes (the output of the
-      <function>phpinfo</function> function) then PHP is working,
-      and your problem may be related to your server configuration
-      which you should double check.
+      Při pokusu spustit PHP došlo k nějaké chybě. Abyste viděli detailnější
+      chybovou zprávu, z příkazové řádky, přejděte do adresáře se souborem
+      PHP (pod Windows <filename>php.exe</filename>) a spusťte
+      <literal>php -i</literal>. Pokud při běhu PHP dojde k chybě, bude
+      zobrazena odpovídající chybovou zpráva, která vám řekne, co se má dál
+      udělat. Pokud získáte obrazovku plnou HTML kódu (výstup funkce
+      <function>phpinfo</function>), pak PHP funguje a váš problém může
+      souviset s konfigurací serveru, kterou je pak třeba dobře zkontrolovat.
      </para>
     </answer>
    </qandaentry>
@@ -318,8 +314,8 @@
    <qandaentry id="faq.installation.undefinedsyms">
     <question>
      <para> 
-      Some operating systems: I have installed PHP without errors,
-      but when I try to start apache I get undefined symbol errors:
+      Některé operační systémy: Nainstaloval jsem PHP bez chyb, ale nyní,
+      když zkusím spustit Apache, ohlásí se chyby o nedefinovaných symbolech:
       <programlisting>
 [mybox:user /src/php4] root# apachectl configtest
  apachectl: /usr/local/apache/bin/httpd Undefined symbols:
@@ -330,9 +326,9 @@
     </question>
     <answer>
      <para>
-      This has actually nothing to do with PHP, but with the MySQL
-      client libraries. Some need --with-zlib, others do not. This
-      is also covered in the MySQL FAQ.
+      To aktuálně nemá nic společného s PHP, ale s knihovnami klienta MySQL.
+      Některé potřebují --with-zlib, jiné nikoli. Tímto se zabývá také
+      MySQL FAQ.
      </para>
     </answer>
    </qandaentry>
@@ -340,8 +336,8 @@
    <qandaentry id="faq.installation.cgierror">
     <question>
      <para>
-      Windows: I have installed PHP, but when I to access
-      a PHP script file via my browser, I get the error:
+      Windows: Nainstaloval jsem PHP, ale při načtení stránky do prohlížeče
+      se zobrazí chyba:
       <programlisting>
 cgi error:
  The specified CGI application misbehaved by not
@@ -352,42 +348,38 @@
     </question>
     <answer>
      <para>
-      This error message means that PHP failed to output anything
-      at all. To get to see a sensible error message, from the
-      command line, change to the directory containing the PHP
-      executable (<filename>php.exe</filename> on Windows) and run
-      <literal>php -i</literal>. If PHP has any problems running,
-      then a suitable error message will be displayed which will
-      give you a clue as to what needs to be done next. If you
-      get a screen full of html codes (the output of the
-      <function>phpinfo</function> function) then PHP is working.
+      Tato chybová zpráva znamená, že z PHP nemohou vycházet žádná data.
+      Abyste viděli detailnější
+      chybovou zprávu, z příkazové řádky, přejděte do adresáře se souborem
+      PHP (pod Windows <filename>php.exe</filename>) a spusťte
+      <literal>php -i</literal>. Pokud při běhu PHP dojde k chybě, bude
+      zobrazena odpovídající chybovou zpráva, která vám řekne, co se má dál
+      udělat. Pokud získáte obrazovku plnou HTML kódu (výstup funkce
+      <function>phpinfo</function>), PHP funguje.
      </para>
      <para>
-      Once PHP is working at the command line, try accessing the
-      script via the browser again. If it still fails then it
-      could be one of the following:
+      Jestliže PHP pracuje v příkazové řádce, zkuste to znovu z prohlížeče.
+      Pokud to stále nefunguje, může to být jedním z těchto důvodů:
      </para>
      <itemizedlist>
       <listitem>
        <simpara>
-        File permissions on your PHP script,
+        Nastavení přístupových práv k souboru se skriptem, k
         <filename>php.exe</filename>, <filename>php4ts.dll</filename>,
-        <filename>php.ini</filename> or any PHP extensions you are
-        trying to load are such that the anonymous internet user
-        <literal>ISUR_&lt;machinename&gt;</literal> cannot access them.
+        <filename>php.ini</filename> nebo nějakému rozšíření PHP, které se
+        pokoušíte načíst, je takové, že k nim anonymní internetový uživatel
+        <literal>ISUR_&lt;machinename&gt;</literal> nemá přístup.
        </simpara>
       </listitem>
       <listitem>
        <simpara>
-        The script file does not exist (or possibly isn't where you
-        think it is relative to your web root directory). Note that
-        for IIS you can trap this error by ticking the 'check file
-        exists' box when setting up the script mappings in the
-        Internet Services Manager. If a script file does not exist
-        then the server will return a 404 error instead. There is
-        also the additional benefit that IIS will do any
-        authentication required for you based on the NTLanMan
-        permissions on your script file.
+        Soubor se skriptem neexistuje (nebo případně není tam, kde si myslíte,
+        že je, relativně ke kořenovému adresáři webu). Uvědomte si, že
+        na IIS můžete tuto chybu zachytit zaškrtnutím volby 'check file
+        exists' při nastavování skriptových služeb v Internet Services
+        Manageru. Pokud skript neexistuje, server vrátí chybu 404. Další
+        výhodou je to, že IIS provede na souboru se skriptem všechny potřebné
+        autentikace založené NTLanMan.
        </simpara>
       </listitem>
      </itemizedlist>
@@ -397,18 +389,18 @@
    <qandaentry id="faq.install.phpandiis">
     <question>
      <para>
-      Windows: I've followed all the instructions, but still can't
-      get PHP and IIS to work together!
+      Windows: Dodržel jsem všechny instrukce, ale PHP a IIS stále odmítají
+      spolupracovat!
      </para>
     </question>
     <answer>
      <para>
-      Make sure any user who needs to run a PHP script has the rights
-      to run <filename>php.exe</filename>! IIS uses an anonymous user
-      which is added at the time IIS is installed. This user needs
-      rights to <filename>php.exe</filename>. Also, any authenticated
-      user will also need rights to execute <filename>php.exe</filename>.
-      And for IIS4 you need to tell it that PHP is a script engine.
+      Ujistěte se, že každý uživatel, který potřebuje spouštět PHP skripty má
+      práva pro spouštění <filename>php.exe</filename>! IIS používá anonymního
+      uživatele, který se přidá při instalaci IIS. Tento uživatel potřebuje
+      práva k <filename>php.exe</filename>. Také každý autentikovaný uživatel
+      bude potřebovat práva na spouštění <filename>php.exe</filename>.
+      A IIS4 musíte sdělit, že PHP je skriptovací engine.
      </para>
     </answer>
    </qandaentry>

Index: phpdoc/cs/faq/using.xml
+++ phpdoc/cs/faq/using.xml
<?xml version="1.0" encoding="iso-8859-2"?>
<!-- EN-Revision: 1.14 Maintainer: luk Status: ready -->

<chapter id="faq.using">
  <title>Používání PHP</title>
  <titleabbrev>Používání PHP</titleabbrev>

  <para>
   Tato část shrnuje nejčastější chyby, se kterými se můžete setkat při psaní
   PHP skriptů.
  </para>

  <qandaset>
   <qandaentry id="faq.using.anyform">
    <question>
     <para>
      Chtěl bych napsat generický PHP skript, který by uměl zpracovat data
      z jakéhokoli formuláře. Jak se dozvím, které proměnné metody POST jsou
      k dispozici?
     </para>
    </question>
    <answer>
     <para>
      Ujistěte se, že máte v souboru <filename>php.ini</filename> zapnuto
      <link linkend="ini.track-vars">track_vars</link>
      Od PHP 4.0.3 je tato možnost vždy zapnuta. Pokud tomu tak je, vytvoří
      se nějaká asociativní pole, z nichž nejdůležitější je
      <literal>$HTTP_POST_VARS</literal>. Takže pro psaní generického skriptu
      pro obsluhu proměnných metody POST budete potřebovat přibližně toto:
      <programlisting role="php">
<![CDATA[
foreach ($HTTP_POST_VARS as $var => $value) {
    echo "$var = $value<br>\n";
}
]]>
      </programlisting>
     </para>
    </answer>
   </qandaentry>

   <qandaentry id="faq.using.singlequotes">
    <question>
     <para>
      Potřebuji převést všechny apostrofy (') na zpětná lomítka následovaná
      apostrofy. Jak se to dá udělat pomocí regulárního výrazu?
     </para>
    </question>
    <answer>
     <para>
      Nejdříve se podívejte na funkci <function>addslashes</function>.
      Dělá přesně to, co potřebujete. Měli byste se také podívat na
      direktivu <link linkend="ini.magic-quotes-gpc">magic_quotes_gpc</link> 
      v souboru <filename>php.ini</filename>.
     </para>
    </answer>
   </qandaentry>

   <qandaentry id="faq.using.wrong-order">
    <question>
     <para>
      Když napíšu následující kód, výstup se tiskne v nesprávném pořadí:
     <programlisting role="php">
function myfunc($argument)
{
    echo $argument + 10;
}
$variable = 10;
echo "myfunc($variable) = " . myfunc($variable);
    </programlisting>
     what's going on?
     </para>
    </question>
    <answer>
     <para>
      Pro použití výsledků vaší funkce ve výrazu (jako je spojení s jiným
      řetězcem v příkladu výše), musíte hodnotu <emphasis>vracet</emphasis>
      (pomocí <emphasis>vracet</emphasis>), ne <function>tisknout</function> 
      (pomocí <function>echo</function>).
     </para>
    </answer>
   </qandaentry>

   <qandaentry id="faq.using.newlines">
    <question>
     <para>
      Hej, co se stalo s mými konci řádků?
      <programlisting role="php">
<![CDATA[
<pre>
<?php echo "Tohle by měl být první řádek."; ?>
<?php echo "Tohle by se mělo ukázat na novém řádku."; ?>
</pre>
]]>
      </programlisting>
     </para>
    </question>
    <answer>
     <para>
      V PHP se blok kódu zakončuje buď "?&gt;", nebo "?&gt;\n" (kde \n
      znamená nový řádek). Takže ve výše uvedeném příkladu budou vypsané
      věty na jediném řádku, protože PHP vynechává konce řádků za koncem
      bloku. To znamená, že musíte přidávat zvláštní konce řádků za každý
      blok PHP kódu, aby se vytisklo odřádkování jediné.
     </para>
     <para>
      Proč to PHP dělá? Při formátování normálního HTML to obvykle
      zjednodušuje život, protože nechcete konce řádků, nýbrž chcete
      vytvořit extrémně dlouhé řádky nebo jinak znečitelnit zdrojový kód.
     </para>
    </answer>
   </qandaentry>

   <qandaentry id="faq.using.headers-sent">
    <question>
     <para>
      Zobrazila se mi zpráva 'Warning: Cannot send session cookie - headers already
      sent...' nebo 'Cannot add header information - headers already sent...'.
     </para>
    </question>
    <answer>
     <para>
      Funkce <function>header</function>,
      <function>set_cookie</function> a funkce session musí do výstupu přidat
      hlavičky. Hlavičky je možno posílat pouze před vlastním obsahem. Funkce
      to udělají, pokud PHP běží jako modul Apache. Následující kus kódu
      zobrazí všechny hlavičky v požadavku:
      <programlisting role="php">
<![CDATA[
$headers = getallheaders();
foreach ($headers as $name => $content) {
    echo "headers[$name] = $content<br>\n";
}
]]>
      </programlisting>
     </para>
    </answer>
   </qandaentry>

   <qandaentry id="faq.using.header">
    <question>
     <para>
      Potřebuji přímo přistupovat k hlavičce požadavku. Jak to udělat?
     </para>
    </question>
    <answer>
     <para>
      Funkce <function>getallheaders</function> to udělá, pokud PHP běží jako
      modul do Apache. Následující kus kódu zobrazí všechny hlavičky
      v požadavku:
      <programlisting role="php">
<![CDATA[
$headers = getallheaders();
foreach ($headers as $name => $content) {
    echo "headers[$name] = $content<br>\n";
}
]]>
      </programlisting>
     </para>
    </answer>
   </qandaentry>

   <qandaentry id="faq.using.authentication">
    <question>
     <para>
      Když zkusím autentikaci s IIS, dostanu 'No Input file specified'.
     </para>
    </question>
    <answer>
     <para>
      Bezpečnostní model IIS je s tím na štíru. Je to problém společný všem
      CGI programům běžícím pod IIS. Řešením je vytvořit obyčejný HTML
      soubor (neparsovaný PHP) jako vstupní stránku do autentikovaného
      adresáře. Potom se použije META tag k přesměrování na PHP stránku nebo
      odkaz k ručnímu přechodu. PHP pak autentikaci zpracuje správně. S
      modulem ISAPI toto není problémem. Jiných NT webovských serverů
      se problém netýká. Více informací - viz 
      <ulink url="&faqurl.iis;">&faqurl.iis;</ulink>.
     </para>
    </answer>
   </qandaentry>

   <qandaentry id="faq.using.netscape">
    <question>
     <para>
      Můj PHP skript pracuje na IE a Lynxu, ale v Netscapu část výstupu
      mizí. Když si zapnu "Zobrazit zdrojový kód", v IE vidím obsah,
      v Netscapu nikoliv.
     </para>
    </question>
    <answer>
     <para>
      Netscape je striktnější ohledně HTML tagů (např. tabulek) něž IE.
      Kontrola HTML výstupu pomocí HTML validátoru, jako je 
      <ulink url="&faqurl.w3.validator;">validator.w3.org</ulink>, může být
      nápomocna. Například chybějící &lt;/table&gt; způsobuje výše uvedený
      problém.
     </para>
     <para>
      IE i Lynx také ignorují jakékoliv nulové (<literal>\0</literal>) znaky
      v HTML proudu, Netscape nikoli. Nejlepší cestou k ověření je zkompilovat
      verzi PHP pro <link linkend="commandline">příkazovou řádku</link>
      (známou jako CGI verze) a spustit skript z příkazové řádky. Na *NIXech
      to přesměrujte do <literal>od -c</literal> a hledejte znaky
      <literal>\0</literal>.  Pod Windows musíte najít editor nebo jiný
      program, který umožňuje prohlížení binárních souborů. Když Netscape
      uvidí v souboru nulový znak, typicky nic dalšího nezobrazí, ačkoli
      IE i Lynx ano. 
     </para>
    </answer>
   </qandaentry>

   <qandaentry id="faq.using.mixml">
    <question>
     <para>
      Jaké jsou předpoklady míchání XML a PHP? Stěžuje si to na moje 
      &lt;?xml&gt; tagy!
     </para>
    </question>
    <answer>
     <para>
      Musíte vypnout krátké tagy v souboru <filename>php.ini</filename>
      nastavením <link linkend="ini.short-open-tag">short_tags</link> na 0
      nebo použitím odpovídající direktivy Apache. Můžete také použít sekci
      &lt;File&gt; k selektivnímu nastavení.
     </para>
    </answer>
   </qandaentry>

   <qandaentry id="faq.using.editor">
    <question>
     <para>
      Jak mohu použít PHP s FrontPagem nebo jiným HTML editorem, který trvá
      na odsunutí mého kódu?
     </para>
    </question>
    <answer>
     <para>
      Jedním z nejjednodušších způsobů je povolit použití ASP tagů v PHP
      kódu. To umožní používat oddělovače v ASP stylu (&lt;% a %&gt;).
      Některé populární HTML editory s pracují (v tuto chvíli) inteligentněji.
      K zapnutí ASP tagů musíte v souboru <filename>php.ini</filename> nastavit
      proměnnou <link linkend="ini.asp-tags">asp_tags</link> nebo použít
      příslušnou direktivu Apache.
     </para>
    </answer>
   </qandaentry>

   <qandaentry id="faq.using.variables">
    <question>
     <para>
      Kde najdi úplný seznam dostupných přednastavených proměnných, a proč
      to není zdokumentováno v dokumentaci PHP?
     </para>
    </question>
    <answer>
     <para>
      Nejlepší metodou je vložit do stránky
      <literal>&lt;?php phpinfo(); ?&gt;</literal> a načíst to do prohlížeče.
      Zobrazí se informace  všeho druhu o nainstalovaném PHP, včetně seznamu
      proměnných prostředí i speciálních proměnných nastavovaných HTTP
      serverem. Tento seznam opravdu nemůže být zdokumentován v dokumentaci
      k PHP, protže se liší server od serveru.
     </para>
    </answer>
   </qandaentry>

   <qandaentry id="faq.using.cgi-vars">
    <question>
     <para>
      Zkouším přistupovat k jedné ze standardních CGI proměnných (jako je
      $DOCUMENT_ROOT nebo $HTTP_REFERER) v uživatelsky definované funkci,
      a nemůže ji to najít. Co je špatně?
     </para>
    </question>
    <answer>
     <para>
      Proměnné prostředí jsou normální globální proměnné, takže je musíte
      buď deklarovat ve funkci jako globální proměnné (například použitím
      "<literal>global $DOCUMENT_ROOT;</literal>") nebo použít pole globálních
      proměnných (např. "<literal>$GLOBALS["DOCUMENT_ROOT"]</literal>").
     </para>
    </answer>
   </qandaentry>

  </qandaset>
 </chapter>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/cs/language/references.xml
+++ phpdoc/cs/language/references.xml
<?xml version="1.0" encoding="iso-8859-2"?>
<!-- EN-Revision: 1.22 Maintainer: luk Status: mixed -->

 <chapter id="language.references">
  <title>Vysvětlení referencí (odkazů)</title>

  <sect1 id="language.references.whatare">
   <title>Co jsou reference</title>
   <simpara>    
    References are a means in PHP to access the same variable content 
    by different names. They are not like C pointers, they are symbol
    table aliases. Note that in PHP, variable name and variable content 
    are different, so the same content can have different names.
    The most close analogy is with Unix filenames and files -
    variable names are directory entries, while variable contents is
    the file itself. References can be thought of as hardlinking in
    Unix filesystem.
   </simpara>
  </sect1>

  <sect1 id="language.references.whatdo">
   <title>What References Do</title>
   <para>
    PHP references allow you to make two variables to refer to the
    same content. Meaning, when you do:
    <informalexample>
     <programlisting role="php">
<![CDATA[
$a =& $b 
]]>
     </programlisting>
    </informalexample>
    it means that <varname>$a</varname> and <varname>$b</varname>
    point to the same variable.
    <note>
     <para>
      <varname>$a</varname> and <varname>$b</varname> are completely
      equal here, that's not <varname>$a</varname> is pointing to
      <varname>$b</varname> or vice versa, that's
      <varname>$a</varname> and <varname>$b</varname> pointing to the
      same place.
     </para>
    </note>
   </para>
   <para>
   The same syntax can be used with functions, that return references,
   and with <literal>new</literal> operator (in PHP 4.0.4 and later):
    <informalexample>
     <programlisting role="php">
<![CDATA[
$bar =& new fooclass();
$foo =& find_var ($bar);
]]>
    </programlisting>
    </informalexample>
    </para>
    <note>
     <para>
     Not using the <literal>&amp;</literal> operator causes a copy of the
     object to be made. If you use <literal>$this</literal> in the class it
     will operate on the current instance of the class. The assignment without
     <literal>&amp;</literal> will copy the instance (i.e. the object) and
     <literal>$this</literal> will operate on the copy, which is not always
     what is desired. Usually you want to have a single instance to work with,
     due to performance and memory consumption issues.
     </para>
   </note>
   <para>
    The second thing references do is to pass variables
    by-reference. This is done by making a local variable in a function and
    a variable in the calling scope reference to the same content. Example:
    <informalexample>
     <programlisting role="php">
<![CDATA[
function foo (&$var)
{
    $var++;
}

$a=5;
foo ($a);
]]>
     </programlisting>
    </informalexample>
    will make <varname>$a</varname> to be 6. This happens because in
    the function <varname>foo</varname> the variable
    <varname>$var</varname> refers to the same content as
    <varname>$a</varname>. See also more detailed explanations about <link
    linkend="language.references.pass">passing by reference</link>.
   </para>
   <simpara>
    The third thing reference can do is <link
    linkend="language.references.return">return by reference</link>.
   </simpara>
  </sect1>

  <sect1 id="language.references.arent">
   <title>What References Are Not</title>
   <para>
    As said before, references aren't pointers. That means, the
    following construct won't do what you expect:
    <informalexample>
     <programlisting role="php">
<![CDATA[
function foo (&$var)
{
    $var =& $GLOBALS["baz"];
}
foo($bar); 
]]>
     </programlisting>
    </informalexample>
   </para>
   <simpara>
    What happens is that <varname>$var</varname> in
    <varname>foo</varname> will be bound with
    <varname>$bar</varname> in caller, but then it will be
    re-bound with <varname>$GLOBALS["baz"]</varname>. There's no way
    to bind <varname>$bar</varname> in the calling scope to something else
    using the reference mechanism, since <varname>$bar</varname> is not
    available in the function <varname>foo</varname> (it is represented by
    <varname>$var</varname>, but <varname>$var</varname> has only
    variable contents and not name-to-value binding in the calling
    symbol table).
   </simpara>
  </sect1>

  <sect1 id="language.references.pass">
   <title>Passing by Reference</title>
   <para>
   You can pass variable to function by reference, so that function could modify
   its arguments. The syntax is as follows:
    <informalexample>
     <programlisting role="php">
<![CDATA[
function foo (&$var)
{
    $var++;
}

$a=5;
foo ($a);
// $a is 6 here
]]>
     </programlisting>
    </informalexample>
  Note that there's no reference sign on function call - only on
  function definition. Function definition alone is enough to
  correctly pass the argument by reference. 
  </para>
  <para>
  Following things can be passed by reference:
   <itemizedlist>
    <listitem>
     <simpara>
      Variable, i.e. <literal>foo($a)</literal>
     </simpara>
    </listitem>
    <listitem>
     <simpara>
      New statement, i.e. <literal>foo(new foobar())</literal>
     </simpara>
    </listitem>
    <listitem>
     <para>
      Reference, returned from a function, i.e.:
    <informalexample>
     <programlisting role="php">
<![CDATA[
function &bar()
{
    $a = 5;
    return $a;
}
foo(bar());
]]>
     </programlisting>
    </informalexample>
    See also explanations about <link
    linkend="language.references.return">returning by reference</link>. 
     </para>
    </listitem>
  </itemizedlist>
  </para>
  <para>
  Any other expression should not be passed by reference, as the
  result is undefined. For example, the following examples of passing
  by reference are invalid:
    <informalexample>
     <programlisting role="php">
<![CDATA[
function bar() // Note the missing &
{
    $a = 5;
    return $a;
}
foo(bar());

foo($a = 5) // Expression, not variable
foo(5) // Constant, not variable
]]>
     </programlisting>
    </informalexample>
                These requirements are for PHP 4.0.4 and later.
  </para>
  </sect1>

  <sect1 id="language.references.return">
   <title>Returning References</title>
   <para>
    Returning by-reference is useful when you want to use a function
    to find which variable a reference should be bound to. When
    returning references, use this syntax:
    <informalexample>
     <programlisting role="php">
<![CDATA[
function &find_var ($param)
{
    ...code...
    return $found_var;
}

$foo =& find_var ($bar);
$foo->x = 2; 
]]>
     </programlisting>
    </informalexample>
    In this example, the property of the object returned by the
    <varname>find_var</varname> function would be set, not the
    copy, as it would be without using reference syntax.
   </para>
   <note>
    <simpara>
     Unlike parameter passing, here you have to use
     <literal>&amp;</literal> in both places - to indicate that you
     return by-reference, not a copy as usual, and to indicate that
     reference binding, rather than usual assignment, should be done
     for <varname>$foo</varname>.
    </simpara>
   </note>
  </sect1>

  <sect1 id="language.references.unset">
   <title>Unsetting References</title>
   <para>
    When you unset the reference, you just break the binding between
    variable name and variable content. This does not mean that
    variable content will be destroyed. For example:
    <informalexample>
     <programlisting role="php">
<![CDATA[
$a = 1;
$b =& $a;
unset ($a); 
]]>
     </programlisting>
    </informalexample>
    won't unset <varname>$b</varname>, just <varname>$a</varname>. 
   </para>
   <simpara>
    Again, it might be useful to think about this as analogous to Unix
    <command>unlink</command> call.
   </simpara>
  </sect1>

  <sect1 id="language.references.spot">
   <title>Spotting References</title>
   <simpara>
    Many syntax constructs in PHP are implemented via referencing
    mechanisms, so everything told above about reference binding also
    apply to these constructs. Some constructs, like passing and
    returning by-reference, are mentioned above. Other constructs that
    use references are:
   </simpara>

   <sect2 id="references.global">
    <title><literal>global</literal> References</title>
    <para>
     When you declare variable as <command>global $var</command> you
     are in fact creating reference to a global variable. That means,
     this is the same as:
     <informalexample>
      <programlisting role="php">
<![CDATA[
$var =& $GLOBALS["var"];
]]>
      </programlisting>
     </informalexample>
    </para>
    <simpara>
     That means, for example, that unsetting <varname>$var</varname>
     won't unset global variable.
    </simpara>
   </sect2>

   <sect2 id="references.this">
    <title><literal>$this</literal></title>
    <simpara>
     In an object method, <varname>$this</varname> is always reference
     to the caller object.
    </simpara>
   </sect2>
  </sect1>

 </chapter>
 
 <!-- Keep this comment at the end of the file
 Local variables:
 mode: sgml
 sgml-omittag:t
 sgml-shorttag:t
 sgml-minimize-attributes:nil
 sgml-always-quote-attributes:t
 sgml-indent-step:1
 sgml-indent-data:t
indent-tabs-mode:nil
 sgml-parent-document:nil
 sgml-default-dtd-file:"../manual.ced"
 sgml-exposed-tags:nil
 sgml-local-catalogs:nil
 sgml-local-ecat-files:nil
 End:
 -->

Reply via email to