cvs: phpdoc-cs / translation.xml /language control-structures.xml variables.xml
| From: | Lukas Jelinek | Date: | Mon, 03 Jun 2002 20:52:41 +0000 |
| Subject: | cvs: phpdoc-cs / translation.xml /language control-structures.xml variables.xml | ||
| Groups: | php.doc | ||
| Request: | Send a blank email to phpdoc+get-969346163@lists.php.net to get a copy of this message | ||
luk Mon Jun 3 16:52:41 2002 EDT
Modified files:
/phpdoc-cs translation.xml
/phpdoc-cs/language control-structures.xml variables.xml
Log:
Index: phpdoc-cs/translation.xml diff -u phpdoc-cs/translation.xml:1.6 phpdoc-cs/translation.xml:1.7 --- phpdoc-cs/translation.xml:1.6 Thu Apr 25 17:58:12 2002 +++ phpdoc-cs/translation.xml Mon Jun 3 16:52:41 2002 @@ -17,7 +17,6 @@ <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="language/control-structures.xml" person="luk" type="translation" /> <file name="language/oop.xml" person="luk" type="translation" /> <file name="language/types.xml" person="luk" type="translation" /> <file name="language/variables.xml" person="luk" type="translation" /> Index: phpdoc-cs/language/control-structures.xml diff -u phpdoc-cs/language/control-structures.xml:1.7 phpdoc-cs/language/control-structures.xml:1.8 --- phpdoc-cs/language/control-structures.xml:1.7 Thu May 23 17:07:57 2002 +++ phpdoc-cs/language/control-structures.xml Mon Jun 3 16:52:41 2002 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-2"?> -<!-- EN-Revision: 1.55 Maintainer: luk Status: mixed --> +<!-- EN-Revision: 1.55 Maintainer: luk Status: ready --> <chapter id="control-structures"> <title>Øídicí struktury</title> @@ -1107,16 +1107,16 @@ include 'vars.php'; - echo "A $color $fruit"; + echo "Vidím $color $fruit"; } -/* vars.php is in the scope of foo() so * - * $fruit is NOT available outside of this * - * scope. $color is because we declared it * - * as global. */ +/* vars.php je v kontextu foo(), tak¾e * + * $fruit NENÍ dostupná mimo tento kontext. * + * Naopak $color JE, proto¾e je deklarována * + * jako globální. */ -foo(); // A green apple -echo "A $color $fruit"; // A green +foo(); // Vidím zelené jablko +echo "Vidím $color $fruit"; // Vidím zelené ?> ]]> @@ -1124,79 +1124,76 @@ </example> </para> <simpara> - When a file is included, parsing drops out of PHP mode and - into HTML mode at the beginning of the target file, and resumes - again at the end. For this reason, any code inside the target - file which should be executed as PHP code must be enclosed within - <link linkend="language.basic-syntax.phpmode">valid PHP start - and end tags</link>. - </simpara> - <simpara> - If "<link linkend="ini.allow-url-fopen">URL fopen wrappers</link>" - are enabled in PHP (which they are in the default configuration), - you can specify the file to be included using an URL (via HTTP) - instead of a local pathname. If the target server interprets - the target file as PHP code, variables may be passed to the included - file using an URL request string as used with HTTP GET. This is - not strictly speaking the same thing as including the file and having - it inherit the parent file's variable scope; the script is actually - being run on the remote server and the result is then being - included into the local script. + Pøi vkládání souboru pøejde parsing na zaèátku souboru z PHP re¾imu do + módu HTML a na jeho konci se vrací zpìt do módu PHP. Z tohoho dùvodu + musí být provádìný PHP kód ve vkládaném souboru uzavøen mezi + <link linkend="language.basic-syntax.phpmode">platnou poèáteèní a + koncovou PHP znaèku</link>. + </simpara> + <simpara> + Pokud jsou v PHP povoleny + "<link linkend="ini.allow-url-fopen">URL fopen wrappery</link>" + (co¾ tak implicitnì je), mù¾ete specifikovat soubor ke vlo¾ení pomocí + URL (pøes HTTP) namísto lokálního umístìní. Pokud pøísku¹ný server + interpretuje po¾adovaný soubor jako PHP kód, promìnné mohou být odkazovány + pomocí øetìzce URL po¾adavku jako u HTTP GET. Není to úplnì toté¾ jako + vlo¾ení souboru s dìdìním kontextu promìnných od rodièovského souboru; + skript bì¾í na vzdáleném serveru a výsledek se potom vlo¾í do lokálního + skriptu. </simpara> <para> <example> - <title><function>include</function> through HTTP</title> + <title><function>include</function> pøes HTTP</title> <programlisting role="php"> <![CDATA[ <?php -/* This example assumes that www.example.com is configured to parse .php * - * files and not .txt files. Also, 'Works' here means that the variables * - * $foo and $bar are available within the included file. */ +/* Tento pøíklad pøedpokládá, ¾e www.example.com je konfigurován k parsování * + * souborù .php a nikoli souborù .txt. Tedy, 'funguje' zde znamená, ¾e * + * promìnné $foo a $bar jsou dostupné uvnitø vkládaného souboru. */ -// Won't work; file.txt wasn't handled by www.example.com as PHP +// Nefunguje; file.txt nebyl na www.example.com zpracován jako PHP include 'http://www.example.com/file.txt?foo=1&bar=2'; -// Won't work; looks for a file named 'file.php?foo=1&bar=2' on the -// local filesystem. +// Nefunguje; hledá soubor 'file.php?foo=1&bar=2' v lokálním systému souborù. include 'file.php?foo=1&bar=2'; -// Works. +// Funguje. include 'http://www.example.com/file.php?foo=1&bar=2'; $foo = 1; $bar = 2; -include 'file.txt'; // Works. -include 'file.php'; // Works. +include 'file.txt'; // Funguje. +include 'file.php'; // Funguje. ?> ]]> </programlisting> </example> - See also <link linkend="features.remote-files">Remote files</link>, - <function>fopen</function> and <function>file</function> for related - information. + Související informace -- viz také + <link linkend="features.remote-files">Vzdálené soubory</link>, + <function>fopen</function> a <function>file</function>. </para> <para> - Because <function>include</function> and <function>require</function> - are special language constructs, you must enclose them within a statement - block if it's inside a conditional block. + Proto¾e <function>include</function> a <function>require</function> + jsou speciální jazykové konstrukty, pokud se provádìjí podmínìnì, + musíte je uzavøít do bloku. </para> <para> <example> - <title>include() and conditional blocks</title> + <title>include() a podmínìné bloky</title> <programlisting role="php"> <![CDATA[ <?php -// This is WRONG and will not work as desired. +// Toto je ©PATNÌ a (jak bylo øeèeno) nebude to fungovat. if ($condition) include $file; else include $other; -// This is CORRECT. +// Tohle je SPRÁVNÌ. if ($condition) { include $file; } else { @@ -1209,22 +1206,21 @@ </example> </para> <simpara> - Handling Returns: It is possible to execute a <function>return</function> - statement inside an included file in order to terminate processing in that - file and return to the script which called it. Also, it's possible to return - values from included files. You can take the value of the include call as - you would a normal function. + Obsluha návratù: Uvnitø vkládaného souboru lze provést konstrukt + <function>return</function> k ukonèení provádìní souboru a návrat do + volajícího skriptu. Je tedy mo¾né z vlo¾ených souborù vracet hodnoty. + Mù¾ete vzít hodnotu volání include, jako by to byla normální funkce. </simpara> <note> <simpara> - In PHP 3, the return may not appear inside a block unless it's - a function block, in which case the <function>return</function> applies - to that function and not the whole file. + V PHP 3 se return nesmí objevit uvnitø bloku, pokud to není funkèní blok; + tehdy v¹ak se v¹ak <function>return</function> týká této funkce a ne + celého souboru. </simpara> </note> <para> <example> - <title><function>include</function> and the <function>return</function> statement</title> + <title><function>include</function> a konstrukt <function>return</function></title> <programlisting role="php"> <![CDATA[ return.php @@ -1248,11 +1244,11 @@ $foo = include 'return.php'; -echo $foo; // prints 'PHP' +echo $foo; // vypí¹e 'PHP' $bar = include 'noreturn.php'; -echo $bar; // prints 1 +echo $bar; // vypí¹e 1 ?> ]]> @@ -1260,19 +1256,19 @@ </example> </para> <simpara> - <literal>$bar</literal> is the value <literal>1</literal> because the include - was successful. Notice the difference between the above examples. The first uses - <function>return</function> within the included file while the other does not. - A few other ways to "include" files into variables are with - <function>fopen</function>, <function>file</function> or by using - <function>include</function> along with - <link linkend="ref.outcontrol">Output Control Functions</link>. + <literal>$bar</literal> má hodnotu <literal>1</literal>, proto¾e pøíkaz + include byl úspì¹ný. V¹imnìte si rozdílu mezi vý¹e uvedenými pøíklady. + První pou¾ívá ve vkládaném souboru <function>return</function>, druhý + nikoli. Dal¹ími zpùsoby, jak pøiøadit hodnotu souboru do promìnné, jsou + funkce <function>fopen</function>, <function>file</function> a pou¾ití + <function>include</function> spoleènì s + <link linkend="ref.outcontrol">funkcemi øízení výstupu</link>. </simpara> <simpara> - See also <function>require</function>, <function>require_once</function>, + Viz také <function>require</function>, <function>require_once</function>, <function>include_once</function>, <function>readfile</function>, - <function>virtual</function>, and + <function>virtual</function>, a <link linkend="ini.include-path">include_path</link>. </simpara> @@ -1281,75 +1277,70 @@ <sect1 id="function.require-once"> <title><function>require_once</function></title> <para> - The <function>require_once</function> statement includes and evaluates - the specified file during the execution of the script. - This is a behavior similar to the <function>require</function> statement, - with the only difference being that if the code from a file has already - been included, it will not be included again. See the documentation for - <function>require</function> for more information on how this statement - works. - </para> - <para> - <function>require_once</function> should be used in cases where - the same file might be included and evaluated more than once during a - particular execution of a script, and you want to be sure that it is - included exactly once to avoid problems with function redefinitions, - variable value reassignments, etc. - </para> - <para> - For examples on using <function>require_once</function> and - <function>include_once</function>, look at the - <ulink url="&url.php.pear;">PEAR</ulink> code included in the - latest PHP source code distributions. + Konstrukt <function>require_once</function> vlo¾í a ohodnotí specifikovaný + soubor bìhem provádìní skriptu. Chová se tedy podobnì jako + <function>require</function>, s tím rozdílem, ¾e pokud u¾ byl kód ze + souboru døíve vlo¾en do skriptu, nebude znovu vkládán. Více informací o + chování pøíkazu -- viz pøíkaz <function>require</function>. + </para> + <para> + Pøíkaz <function>require_once</function> by se mìl pou¾ívat v pøípadech, + kde by mohl být bìhem provádìní skriptu tentý¾ soubor vlo¾en a ohodnocen + víckrát, a pøitom chcete zajistit právì jedno vlo¾ení (je tøeba se vyhnout + redefinicím funkcí, novému pøiøazení hodnot atd.). + </para> + <para> + Pøíklady na pou¾ití <function>require_once</function> a + <function>include_once</function> najdete v kódu + <ulink url="&url.php.pear;">PEAR</ulink> pøilo¾eném v nejnovìj¹ích + distribucích zdrojových kódù PHP. </para> <note> <para> - <function>require_once</function> was added in PHP 4.0.1pl2 + Pøíkaz <function>require_once</function> byl pøidán v PHP 4.0.1pl2. </para> </note> <para> - See also: <function>require</function>, + Viz také: <function>require</function>, <function>include</function>, <function>include_once</function>, <function>get_required_files</function>, <function>get_included_files</function>, <function>readfile</function>, - and <function>virtual</function>. + a <function>virtual</function>. </para> </sect1> <sect1 id="function.include-once"> <title><function>include_once</function></title> <para> - The <function>include_once</function> statement includes and evaluates - the specified file during the execution of the script. - This is a behavior similar to the <function>include</function> statement, - with the only difference being that if the code from a file has already - been included, it will not be included again. As the name suggests, - it will be included just once. - </para> - <para> - <function>include_once</function> should be used in cases where - the same file might be included and evaluated more than once during a - particular execution of a script, and you want to be sure that it is - included exactly once to avoid problems with function redefinitions, - variable value reassignments, etc. - </para> - <para> - For more examples on using <function>require_once</function> and - <function>include_once</function>, look at the - <ulink url="&url.php.pear;">PEAR</ulink> code included in the latest - PHP source code distributions. + Konstrukt <function>include_once</function> vlo¾í a ohodnotí specifikovaný + soubor bìhem provádìní skriptu. Chová se tedy podobnì jako + <function>include</function> , s tím rozdílem, ¾e pokud u¾ byl kód ze + souboru døíve vlo¾en do skriptu, nebude znovu vkládán. Jak název napovídá, + bude vlo¾en právì jednou. + </para> + <para> + Pøíkaz <function>include_once</function> by se mìl pou¾ívat v pøípadech, + kde by mohl být bìhem provádìní skriptu tentý¾ soubor vlo¾en a ohodnocen + víckrát, a pøitom chcete zajistit právì jedno vlo¾ení (je tøeba se vyhnout + redefinicím funkcí, novému pøiøazení hodnot atd.). + </para> + <para> + Pøíklady na pou¾ití <function>require_once</function> and + <function>include_once</function> najdete v kódu + <ulink url="&url.php.pear;">PEAR</ulink> pøilo¾eném v nejnovìj¹ích + distribucích zdrojových kódù PHP. </para> <note> <para> - <function>include_once</function> was added in PHP 4.0.1pl2 + Pøíkaz <function>include_once</function> byl pøidán v PHP 4.0.1pl2. </para> </note> <para> - See also <function>include</function>, + Viz také <function>include</function>, <function>require</function>, <function>require_once</function>, <function>get_required_files</function>, <function>get_included_files</function>, <function>readfile</function>, - and <function>virtual</function>. + a <function>virtual</function>. </para> </sect1> Index: phpdoc-cs/language/variables.xml diff -u phpdoc-cs/language/variables.xml:1.1 phpdoc-cs/language/variables.xml:1.2 --- phpdoc-cs/language/variables.xml:1.1 Fri Apr 26 16:35:27 2002 +++ phpdoc-cs/language/variables.xml Mon Jun 3 16:52:41 2002 @@ -413,13 +413,13 @@ </simpara> <simpara> - Static variables also provide one way to deal with recursive - functions. A recursive function is one which calls itself. Care - must be taken when writing a recursive function because it is - possible to make it recurse indefinitely. You must make sure you - have an adequate way of terminating the recursion. The following - simple function recursively counts to 10, using the static - variable <varname>$count</varname> to know when to stop: + Statické promìnné také poskytují zpùsob, jak øe¹it rekurzívní funkce. + Rekurzívní funkce je taková funkce, která volá sama sebe. Psaní + rekurzívních funkcí je tøeba vìnovat zvlá¹tní péèi, proto¾e mù¾e vzniknout + nekoneèný cyklus volání. Musíte se ujistit, ¾e máte rekurzi adekvátnì + ukonèenu. Následující jednoduchá funkce rekurzívnì poèítá do 10 za pou¾ití + statické promìnné <varname>$count</varname> ke zji¹tìní okam¾iku pro + ukonèení: </simpara> <informalexample> @@ -443,42 +443,41 @@ </sect1> <sect1 id="language.variables.variable"> - <title>Variable variables</title> + <title>Promìnné s promìnnými názvy</title> <simpara> - Sometimes it is convenient to be able to have variable variable - names. That is, a variable name which can be set and used - dynamically. A normal variable is set with a statement such as: + Nìkdy je vhodné, aby se názvy promìnných mohly mìnit, tj. aby mohly být + dynamicky nastavovány a pou¾ívány. Normální promìnná se nastavuje + takovýmto konstruktem: </simpara> <informalexample> <programlisting role="php"> <![CDATA[ -$a = "hello"; +$a = "ahoj"; ]]> </programlisting> </informalexample> <simpara> - A variable variable takes the value of a variable and treats that - as the name of a variable. In the above example, - <emphasis>hello</emphasis>, can be used as the name of a variable - by using two dollar signs. i.e. + Promìnná s promìnným názvem vezme hodnotu promìnné a pou¾ije ji jako + název promìnné. Ve vý¹e uvedeném pøíkladu, + <emphasis>ahoj</emphasis> lze pou¾ít jako název promìnné uvedením dvou + symbolù dolaru: </simpara> <informalexample> <programlisting role="php"> <![CDATA[ -$$a = "world"; +$$a = "svìte"; ]]> </programlisting> </informalexample> <simpara> - At this point two variables have been defined and stored in the - PHP symbol tree: <varname>$a</varname> with contents "hello" and - <varname>$hello</varname> with contents "world". Therefore, this - statement: + V této chvíli byly definovány dvì promìnné a byly ulo¾eny do stromu + symbolù PHP: <varname>$a</varname> s obsahem "ahoj" a + <varname>$ahoj</varname> s obsahem "svìte". Proto konstrukt: </simpara> <informalexample> @@ -490,61 +489,58 @@ </informalexample> <simpara> - produces the exact same output as: + provede pøesnì toté¾ jako: </simpara> <informalexample> <programlisting role="php"> <![CDATA[ -echo "$a $hello"; +echo "$a $ahoj"; ]]> </programlisting> </informalexample> <simpara> - i.e. they both produce: <computeroutput>hello world</computeroutput>. + tedy oba vyprodukují: <computeroutput>ahoj svìte</computeroutput>. </simpara> <simpara> - In order to use variable variables with arrays, you have to - resolve an ambiguity problem. That is, if you write - <varname>$$a[1]</varname> then the parser needs to know if you - meant to use <varname>$a[1]</varname> as a variable, or if you - wanted <varname>$$a</varname> as the variable and then the [1] - index from that variable. The syntax for resolving this ambiguity - is: <varname>${$a[1]}</varname> for the first case and - <varname>${$a}[1]</varname> for the second. + Pøi pou¾ití promìnných s promìnnými názvy s poli musíte vyøe¹it problém + víceznaènosti. Tj. kdy¾ napí¹ete + <varname>$$a[1]</varname>, parser potøebuje vìdìt, máte-li na mysli pou¾ití + <varname>$a[1]</varname> jako promìnné nebo chcete <varname>$$a</varname> + jako promìnnou a potom index [1] v této promìnné. Syntaxe pro øe¹ení + této víceznaènosti je <varname>${$a[1]}</varname> pro první pøípad a + <varname>${$a}[1]</varname> pro druhý. </simpara> </sect1> <sect1 id="language.variables.external"> - <title>Variables from outside PHP</title> + <title>Prommìné zvenèí PHP</title> <sect2 id="language.variables.external.form"> - <title>HTML Forms (GET and POST)</title> + <title>HTML formuláøe (GET a POST)</title> <simpara> - When a form is submitted to a PHP script, any variables from that - form will be automatically made available to the script by - PHP. If the <link linkend="ini.track-vars">track_vars</link> - configuration option is turned on, then these variables will be - located in the associative arrays + Kdy¾ se ode¹le formuláø do PHP skriptu, jakékoli promìnné z tohoto + formuláøe budou automaticky dostupné v tomto skriptu. + Je-li zapnuta konfiguraèní volba + <link linkend="ini.track-vars">track_vars</link>, budou tyto promìnné + umístìny v asociativních polích <varname>$HTTP_POST_VARS</varname>, - <varname>$HTTP_GET_VARS</varname>, and/or - <varname>$HTTP_POST_FILES</varname>, according to the - source of the variable in question. + <varname>$HTTP_GET_VARS</varname>, a/nebo + <varname>$HTTP_POST_FILES</varname> v závislosti na zdroji promìnných. </simpara> <para> - For more information on these variables, please read <link - linkend="language.variables.predefined">Predefined - variables</link>. + Pro více informací o tìchto promìnných si laskavì pøeètìte <link + linkend="language.variables.predefined">Pøeddefinované promìnné</link>. </para> <para> <example> - <title>Simple form variable</title> + <title>Jednoduchá promìnná formuláøe</title> <programlisting role="php"> <![CDATA[ <form action="foo.php" method="post"> @@ -557,12 +553,12 @@ </para> <para> - When the above form is submitted, the value from the text input - will be available in - <varname>$HTTP_POST_VARS['username']</varname>. If the <link - linkend="ini.register-globals">register_globals</link> - configuration directive is turned on, then the variable will also - be available as <varname>$username</varname> in the global scope. + Kdy¾ se vý¹e uvedený formuláø ode¹le, hodnota vstupního textu bude + dostupná v <varname>$HTTP_POST_VARS['username']</varname>. Je-li + zapnuta konfiguraèní direktiva + <link linkend="ini.register-globals">register_globals</link>, + promìnná bude dostupná i jako <varname>$username</varname> v globálním + kontextu. </para> <note>
Index: phpdoc-cs/translation.xml diff -u phpdoc-cs/translation.xml:1.6 phpdoc-cs/translation.xml:1.7 --- phpdoc-cs/translation.xml:1.6 Thu Apr 25 17:58:12 2002 +++ phpdoc-cs/translation.xml Mon Jun 3 16:52:41 2002 @@ -17,7 +17,6 @@ <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="language/control-structures.xml" person="luk" type="translation" /> <file name="language/oop.xml" person="luk" type="translation" /> <file name="language/types.xml" person="luk" type="translation" /> <file name="language/variables.xml" person="luk" type="translation" /> Index: phpdoc-cs/language/control-structures.xml diff -u phpdoc-cs/language/control-structures.xml:1.7 phpdoc-cs/language/control-structures.xml:1.8 --- phpdoc-cs/language/control-structures.xml:1.7 Thu May 23 17:07:57 2002 +++ phpdoc-cs/language/control-structures.xml Mon Jun 3 16:52:41 2002 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-2"?> -<!-- EN-Revision: 1.55 Maintainer: luk Status: mixed --> +<!-- EN-Revision: 1.55 Maintainer: luk Status: ready --> <chapter id="control-structures"> <title>Øídicí struktury</title> @@ -1107,16 +1107,16 @@ include 'vars.php'; - echo "A $color $fruit"; + echo "Vidím $color $fruit"; } -/* vars.php is in the scope of foo() so * - * $fruit is NOT available outside of this * - * scope. $color is because we declared it * - * as global. */ +/* vars.php je v kontextu foo(), tak¾e * + * $fruit NENÍ dostupná mimo tento kontext. * + * Naopak $color JE, proto¾e je deklarována * + * jako globální. */ -foo(); // A green apple -echo "A $color $fruit"; // A green +foo(); // Vidím zelené jablko +echo "Vidím $color $fruit"; // Vidím zelené ?> ]]> @@ -1124,79 +1124,76 @@ </example> </para> <simpara> - When a file is included, parsing drops out of PHP mode and - into HTML mode at the beginning of the target file, and resumes - again at the end. For this reason, any code inside the target - file which should be executed as PHP code must be enclosed within - <link linkend="language.basic-syntax.phpmode">valid PHP start - and end tags</link>. - </simpara> - <simpara> - If "<link linkend="ini.allow-url-fopen">URL fopen wrappers</link>" - are enabled in PHP (which they are in the default configuration), - you can specify the file to be included using an URL (via HTTP) - instead of a local pathname. If the target server interprets - the target file as PHP code, variables may be passed to the included - file using an URL request string as used with HTTP GET. This is - not strictly speaking the same thing as including the file and having - it inherit the parent file's variable scope; the script is actually - being run on the remote server and the result is then being - included into the local script. + Pøi vkládání souboru pøejde parsing na zaèátku souboru z PHP re¾imu do + módu HTML a na jeho konci se vrací zpìt do módu PHP. Z tohoho dùvodu + musí být provádìný PHP kód ve vkládaném souboru uzavøen mezi + <link linkend="language.basic-syntax.phpmode">platnou poèáteèní a + koncovou PHP znaèku</link>. + </simpara> + <simpara> + Pokud jsou v PHP povoleny + "<link linkend="ini.allow-url-fopen">URL fopen wrappery</link>" + (co¾ tak implicitnì je), mù¾ete specifikovat soubor ke vlo¾ení pomocí + URL (pøes HTTP) namísto lokálního umístìní. Pokud pøísku¹ný server + interpretuje po¾adovaný soubor jako PHP kód, promìnné mohou být odkazovány + pomocí øetìzce URL po¾adavku jako u HTTP GET. Není to úplnì toté¾ jako + vlo¾ení souboru s dìdìním kontextu promìnných od rodièovského souboru; + skript bì¾í na vzdáleném serveru a výsledek se potom vlo¾í do lokálního + skriptu. </simpara> <para> <example> - <title><function>include</function> through HTTP</title> + <title><function>include</function> pøes HTTP</title> <programlisting role="php"> <![CDATA[ <?php -/* This example assumes that www.example.com is configured to parse .php * - * files and not .txt files. Also, 'Works' here means that the variables * - * $foo and $bar are available within the included file. */ +/* Tento pøíklad pøedpokládá, ¾e www.example.com je konfigurován k parsování * + * souborù .php a nikoli souborù .txt. Tedy, 'funguje' zde znamená, ¾e * + * promìnné $foo a $bar jsou dostupné uvnitø vkládaného souboru. */ -// Won't work; file.txt wasn't handled by www.example.com as PHP +// Nefunguje; file.txt nebyl na www.example.com zpracován jako PHP include 'http://www.example.com/file.txt?foo=1&bar=2'; -// Won't work; looks for a file named 'file.php?foo=1&bar=2' on the -// local filesystem. +// Nefunguje; hledá soubor 'file.php?foo=1&bar=2' v lokálním systému souborù. include 'file.php?foo=1&bar=2'; -// Works. +// Funguje. include 'http://www.example.com/file.php?foo=1&bar=2'; $foo = 1; $bar = 2; -include 'file.txt'; // Works. -include 'file.php'; // Works. +include 'file.txt'; // Funguje. +include 'file.php'; // Funguje. ?> ]]> </programlisting> </example> - See also <link linkend="features.remote-files">Remote files</link>, - <function>fopen</function> and <function>file</function> for related - information. + Související informace -- viz také + <link linkend="features.remote-files">Vzdálené soubory</link>, + <function>fopen</function> a <function>file</function>. </para> <para> - Because <function>include</function> and <function>require</function> - are special language constructs, you must enclose them within a statement - block if it's inside a conditional block. + Proto¾e <function>include</function> a <function>require</function> + jsou speciální jazykové konstrukty, pokud se provádìjí podmínìnì, + musíte je uzavøít do bloku. </para> <para> <example> - <title>include() and conditional blocks</title> + <title>include() a podmínìné bloky</title> <programlisting role="php"> <![CDATA[ <?php -// This is WRONG and will not work as desired. +// Toto je ©PATNÌ a (jak bylo øeèeno) nebude to fungovat. if ($condition) include $file; else include $other; -// This is CORRECT. +// Tohle je SPRÁVNÌ. if ($condition) { include $file; } else { @@ -1209,22 +1206,21 @@ </example> </para> <simpara> - Handling Returns: It is possible to execute a <function>return</function> - statement inside an included file in order to terminate processing in that - file and return to the script which called it. Also, it's possible to return - values from included files. You can take the value of the include call as - you would a normal function. + Obsluha návratù: Uvnitø vkládaného souboru lze provést konstrukt + <function>return</function> k ukonèení provádìní souboru a návrat do + volajícího skriptu. Je tedy mo¾né z vlo¾ených souborù vracet hodnoty. + Mù¾ete vzít hodnotu volání include, jako by to byla normální funkce. </simpara> <note> <simpara> - In PHP 3, the return may not appear inside a block unless it's - a function block, in which case the <function>return</function> applies - to that function and not the whole file. + V PHP 3 se return nesmí objevit uvnitø bloku, pokud to není funkèní blok; + tehdy v¹ak se v¹ak <function>return</function> týká této funkce a ne + celého souboru. </simpara> </note> <para> <example> - <title><function>include</function> and the <function>return</function> statement</title> + <title><function>include</function> a konstrukt <function>return</function></title> <programlisting role="php"> <![CDATA[ return.php @@ -1248,11 +1244,11 @@ $foo = include 'return.php'; -echo $foo; // prints 'PHP' +echo $foo; // vypí¹e 'PHP' $bar = include 'noreturn.php'; -echo $bar; // prints 1 +echo $bar; // vypí¹e 1 ?> ]]> @@ -1260,19 +1256,19 @@ </example> </para> <simpara> - <literal>$bar</literal> is the value <literal>1</literal> because the include - was successful. Notice the difference between the above examples. The first uses - <function>return</function> within the included file while the other does not. - A few other ways to "include" files into variables are with - <function>fopen</function>, <function>file</function> or by using - <function>include</function> along with - <link linkend="ref.outcontrol">Output Control Functions</link>. + <literal>$bar</literal> má hodnotu <literal>1</literal>, proto¾e pøíkaz + include byl úspì¹ný. V¹imnìte si rozdílu mezi vý¹e uvedenými pøíklady. + První pou¾ívá ve vkládaném souboru <function>return</function>, druhý + nikoli. Dal¹ími zpùsoby, jak pøiøadit hodnotu souboru do promìnné, jsou + funkce <function>fopen</function>, <function>file</function> a pou¾ití + <function>include</function> spoleènì s + <link linkend="ref.outcontrol">funkcemi øízení výstupu</link>. </simpara> <simpara> - See also <function>require</function>, <function>require_once</function>, + Viz také <function>require</function>, <function>require_once</function>, <function>include_once</function>, <function>readfile</function>, - <function>virtual</function>, and + <function>virtual</function>, a <link linkend="ini.include-path">include_path</link>. </simpara> @@ -1281,75 +1277,70 @@ <sect1 id="function.require-once"> <title><function>require_once</function></title> <para> - The <function>require_once</function> statement includes and evaluates - the specified file during the execution of the script. - This is a behavior similar to the <function>require</function> statement, - with the only difference being that if the code from a file has already - been included, it will not be included again. See the documentation for - <function>require</function> for more information on how this statement - works. - </para> - <para> - <function>require_once</function> should be used in cases where - the same file might be included and evaluated more than once during a - particular execution of a script, and you want to be sure that it is - included exactly once to avoid problems with function redefinitions, - variable value reassignments, etc. - </para> - <para> - For examples on using <function>require_once</function> and - <function>include_once</function>, look at the - <ulink url="&url.php.pear;">PEAR</ulink> code included in the - latest PHP source code distributions. + Konstrukt <function>require_once</function> vlo¾í a ohodnotí specifikovaný + soubor bìhem provádìní skriptu. Chová se tedy podobnì jako + <function>require</function>, s tím rozdílem, ¾e pokud u¾ byl kód ze + souboru døíve vlo¾en do skriptu, nebude znovu vkládán. Více informací o + chování pøíkazu -- viz pøíkaz <function>require</function>. + </para> + <para> + Pøíkaz <function>require_once</function> by se mìl pou¾ívat v pøípadech, + kde by mohl být bìhem provádìní skriptu tentý¾ soubor vlo¾en a ohodnocen + víckrát, a pøitom chcete zajistit právì jedno vlo¾ení (je tøeba se vyhnout + redefinicím funkcí, novému pøiøazení hodnot atd.). + </para> + <para> + Pøíklady na pou¾ití <function>require_once</function> a + <function>include_once</function> najdete v kódu + <ulink url="&url.php.pear;">PEAR</ulink> pøilo¾eném v nejnovìj¹ích + distribucích zdrojových kódù PHP. </para> <note> <para> - <function>require_once</function> was added in PHP 4.0.1pl2 + Pøíkaz <function>require_once</function> byl pøidán v PHP 4.0.1pl2. </para> </note> <para> - See also: <function>require</function>, + Viz také: <function>require</function>, <function>include</function>, <function>include_once</function>, <function>get_required_files</function>, <function>get_included_files</function>, <function>readfile</function>, - and <function>virtual</function>. + a <function>virtual</function>. </para> </sect1> <sect1 id="function.include-once"> <title><function>include_once</function></title> <para> - The <function>include_once</function> statement includes and evaluates - the specified file during the execution of the script. - This is a behavior similar to the <function>include</function> statement, - with the only difference being that if the code from a file has already - been included, it will not be included again. As the name suggests, - it will be included just once. - </para> - <para> - <function>include_once</function> should be used in cases where - the same file might be included and evaluated more than once during a - particular execution of a script, and you want to be sure that it is - included exactly once to avoid problems with function redefinitions, - variable value reassignments, etc. - </para> - <para> - For more examples on using <function>require_once</function> and - <function>include_once</function>, look at the - <ulink url="&url.php.pear;">PEAR</ulink> code included in the latest - PHP source code distributions. + Konstrukt <function>include_once</function> vlo¾í a ohodnotí specifikovaný + soubor bìhem provádìní skriptu. Chová se tedy podobnì jako + <function>include</function> , s tím rozdílem, ¾e pokud u¾ byl kód ze + souboru døíve vlo¾en do skriptu, nebude znovu vkládán. Jak název napovídá, + bude vlo¾en právì jednou. + </para> + <para> + Pøíkaz <function>include_once</function> by se mìl pou¾ívat v pøípadech, + kde by mohl být bìhem provádìní skriptu tentý¾ soubor vlo¾en a ohodnocen + víckrát, a pøitom chcete zajistit právì jedno vlo¾ení (je tøeba se vyhnout + redefinicím funkcí, novému pøiøazení hodnot atd.). + </para> + <para> + Pøíklady na pou¾ití <function>require_once</function> and + <function>include_once</function> najdete v kódu + <ulink url="&url.php.pear;">PEAR</ulink> pøilo¾eném v nejnovìj¹ích + distribucích zdrojových kódù PHP. </para> <note> <para> - <function>include_once</function> was added in PHP 4.0.1pl2 + Pøíkaz <function>include_once</function> byl pøidán v PHP 4.0.1pl2. </para> </note> <para> - See also <function>include</function>, + Viz také <function>include</function>, <function>require</function>, <function>require_once</function>, <function>get_required_files</function>, <function>get_included_files</function>, <function>readfile</function>, - and <function>virtual</function>. + a <function>virtual</function>. </para> </sect1> Index: phpdoc-cs/language/variables.xml diff -u phpdoc-cs/language/variables.xml:1.1 phpdoc-cs/language/variables.xml:1.2 --- phpdoc-cs/language/variables.xml:1.1 Fri Apr 26 16:35:27 2002 +++ phpdoc-cs/language/variables.xml Mon Jun 3 16:52:41 2002 @@ -413,13 +413,13 @@ </simpara> <simpara> - Static variables also provide one way to deal with recursive - functions. A recursive function is one which calls itself. Care - must be taken when writing a recursive function because it is - possible to make it recurse indefinitely. You must make sure you - have an adequate way of terminating the recursion. The following - simple function recursively counts to 10, using the static - variable <varname>$count</varname> to know when to stop: + Statické promìnné také poskytují zpùsob, jak øe¹it rekurzívní funkce. + Rekurzívní funkce je taková funkce, která volá sama sebe. Psaní + rekurzívních funkcí je tøeba vìnovat zvlá¹tní péèi, proto¾e mù¾e vzniknout + nekoneèný cyklus volání. Musíte se ujistit, ¾e máte rekurzi adekvátnì + ukonèenu. Následující jednoduchá funkce rekurzívnì poèítá do 10 za pou¾ití + statické promìnné <varname>$count</varname> ke zji¹tìní okam¾iku pro + ukonèení: </simpara> <informalexample> @@ -443,42 +443,41 @@ </sect1> <sect1 id="language.variables.variable"> - <title>Variable variables</title> + <title>Promìnné s promìnnými názvy</title> <simpara> - Sometimes it is convenient to be able to have variable variable - names. That is, a variable name which can be set and used - dynamically. A normal variable is set with a statement such as: + Nìkdy je vhodné, aby se názvy promìnných mohly mìnit, tj. aby mohly být + dynamicky nastavovány a pou¾ívány. Normální promìnná se nastavuje + takovýmto konstruktem: </simpara> <informalexample> <programlisting role="php"> <![CDATA[ -$a = "hello"; +$a = "ahoj"; ]]> </programlisting> </informalexample> <simpara> - A variable variable takes the value of a variable and treats that - as the name of a variable. In the above example, - <emphasis>hello</emphasis>, can be used as the name of a variable - by using two dollar signs. i.e. + Promìnná s promìnným názvem vezme hodnotu promìnné a pou¾ije ji jako + název promìnné. Ve vý¹e uvedeném pøíkladu, + <emphasis>ahoj</emphasis> lze pou¾ít jako název promìnné uvedením dvou + symbolù dolaru: </simpara> <informalexample> <programlisting role="php"> <![CDATA[ -$$a = "world"; +$$a = "svìte"; ]]> </programlisting> </informalexample> <simpara> - At this point two variables have been defined and stored in the - PHP symbol tree: <varname>$a</varname> with contents "hello" and - <varname>$hello</varname> with contents "world". Therefore, this - statement: + V této chvíli byly definovány dvì promìnné a byly ulo¾eny do stromu + symbolù PHP: <varname>$a</varname> s obsahem "ahoj" a + <varname>$ahoj</varname> s obsahem "svìte". Proto konstrukt: </simpara> <informalexample> @@ -490,61 +489,58 @@ </informalexample> <simpara> - produces the exact same output as: + provede pøesnì toté¾ jako: </simpara> <informalexample> <programlisting role="php"> <![CDATA[ -echo "$a $hello"; +echo "$a $ahoj"; ]]> </programlisting> </informalexample> <simpara> - i.e. they both produce: <computeroutput>hello world</computeroutput>. + tedy oba vyprodukují: <computeroutput>ahoj svìte</computeroutput>. </simpara> <simpara> - In order to use variable variables with arrays, you have to - resolve an ambiguity problem. That is, if you write - <varname>$$a[1]</varname> then the parser needs to know if you - meant to use <varname>$a[1]</varname> as a variable, or if you - wanted <varname>$$a</varname> as the variable and then the [1] - index from that variable. The syntax for resolving this ambiguity - is: <varname>${$a[1]}</varname> for the first case and - <varname>${$a}[1]</varname> for the second. + Pøi pou¾ití promìnných s promìnnými názvy s poli musíte vyøe¹it problém + víceznaènosti. Tj. kdy¾ napí¹ete + <varname>$$a[1]</varname>, parser potøebuje vìdìt, máte-li na mysli pou¾ití + <varname>$a[1]</varname> jako promìnné nebo chcete <varname>$$a</varname> + jako promìnnou a potom index [1] v této promìnné. Syntaxe pro øe¹ení + této víceznaènosti je <varname>${$a[1]}</varname> pro první pøípad a + <varname>${$a}[1]</varname> pro druhý. </simpara> </sect1> <sect1 id="language.variables.external"> - <title>Variables from outside PHP</title> + <title>Prommìné zvenèí PHP</title> <sect2 id="language.variables.external.form"> - <title>HTML Forms (GET and POST)</title> + <title>HTML formuláøe (GET a POST)</title> <simpara> - When a form is submitted to a PHP script, any variables from that - form will be automatically made available to the script by - PHP. If the <link linkend="ini.track-vars">track_vars</link> - configuration option is turned on, then these variables will be - located in the associative arrays + Kdy¾ se ode¹le formuláø do PHP skriptu, jakékoli promìnné z tohoto + formuláøe budou automaticky dostupné v tomto skriptu. + Je-li zapnuta konfiguraèní volba + <link linkend="ini.track-vars">track_vars</link>, budou tyto promìnné + umístìny v asociativních polích <varname>$HTTP_POST_VARS</varname>, - <varname>$HTTP_GET_VARS</varname>, and/or - <varname>$HTTP_POST_FILES</varname>, according to the - source of the variable in question. + <varname>$HTTP_GET_VARS</varname>, a/nebo + <varname>$HTTP_POST_FILES</varname> v závislosti na zdroji promìnných. </simpara> <para> - For more information on these variables, please read <link - linkend="language.variables.predefined">Predefined - variables</link>. + Pro více informací o tìchto promìnných si laskavì pøeètìte <link + linkend="language.variables.predefined">Pøeddefinované promìnné</link>. </para> <para> <example> - <title>Simple form variable</title> + <title>Jednoduchá promìnná formuláøe</title> <programlisting role="php"> <![CDATA[ <form action="foo.php" method="post"> @@ -557,12 +553,12 @@ </para> <para> - When the above form is submitted, the value from the text input - will be available in - <varname>$HTTP_POST_VARS['username']</varname>. If the <link - linkend="ini.register-globals">register_globals</link> - configuration directive is turned on, then the variable will also - be available as <varname>$username</varname> in the global scope. + Kdy¾ se vý¹e uvedený formuláø ode¹le, hodnota vstupního textu bude + dostupná v <varname>$HTTP_POST_VARS['username']</varname>. Je-li + zapnuta konfiguraèní direktiva + <link linkend="ini.register-globals">register_globals</link>, + promìnná bude dostupná i jako <varname>$username</varname> v globálním + kontextu. </para> <note>