cvs: phpdoc-si /language basic-syntax.xml

From: Date: Thu, 01 Aug 2002 11:29:50 +0000
Subject: cvs: phpdoc-si /language basic-syntax.xml
Groups: php.doc.sl 
Request: Send a blank email to doc-sl+get-14@lists.php.net to get a copy of this message
mitja Thu Aug 1 07:29:50 2002 EDT Modified files: /phpdoc-si/language basic-syntax.xml Log: First translation

Index: phpdoc-si/language/basic-syntax.xml diff -u phpdoc-si/language/basic-syntax.xml:1.2 phpdoc-si/language/basic-syntax.xml:1.3 --- phpdoc-si/language/basic-syntax.xml:1.2 Sun Jul 28 20:29:50 2002 +++ phpdoc-si/language/basic-syntax.xml Thu Aug 1 07:29:50 2002 @@ -1,8 +1,8 @@ <?xml version="1.0" encoding="iso-8859-2"?> -<!-- $Revision: 1.2 $ --> -<!-- EN-Revision: 1.33 Maintainer: black Status: pending --> +<!-- $Revision: 1.3 $ --> +<!-- EN-Revision: 1.33 Maintainer: mitja Status: pending --> <chapter id="language.basic-syntax"> - <title>Basic syntax</title> + <title>Osnovna sintaksa</title> <!-- @@ -48,148 +48,150 @@ --> <sect1 id="language.basic-syntax.phpmode"> - <title>Escaping from HTML</title> + <title>Preklop iz HTML</title> <para> - When PHP parses a file, it simply passes the text of the file - through until it encounters one of the special tags which tell it - to start interpreting the text as PHP code. The parser then - executes all the code it finds, up until it runs into a PHP - closing tag, which tells the parser to just start passing the text - through again. This is the mechanism which allows you to embed PHP - code inside HTML: everything outside the PHP tags is left utterly - alone, while everything inside is parsed as code. + Ko PHP prebira datoteko, ne obdeluje vsebine dokler ne naleti + ene izmed posebnih znaèk, ki mu povejo, naj zaéne vsebino + obdelovati kot kodo PHP. Nato izvaja ukaze, ki sledijo, dokler + ne naleti na znaèko, ki mu pove, da naj ponovno ne obdeluje + besedila, ki sledi. S tem mehanizmom lahko kodo PHP vkljuèite + znotraj kode HTML: PHP se ne dotakne nièesar izven PHPjevih znaèk, + kodo, ki je znotraj le-teh, pa izvede. </para> <para> - There are four sets of tags which can be used to denote blocks of - PHP code. Of these, only two (&lt;?php. . .?&gt; and &lt;script - language="php"&gt;. . .&lt;/script&gt;) are always available; the - others can be turned on or off from the - &php.ini; configuration file. While the - short-form tags and ASP-style tags may be convenient, they are not - as portable as the longer versions. Also, if you intend to embed - PHP code in XML or XHTML, you will need to use the - &lt;?php. . .?&gt; form to conform to the XML. + Obstajajo ¹tirje pari znaèk, s katerimi oznaèujemo bloke kode. + Od teh sta vedno na voljo samo dva (&lt;?php. . .?&gt; in + &lt;script language="php"&gt;. . .&lt;/script&gt;), druga dva + pa lahko vklapljamo in izklapljamo v nastavitveni datoteki + &php.ini;. Èeprav sta kratka oblika in oblika ASP priroèni, nista + tako prenosljivi kot dalj¹i obliki. Poleg tega morate uporabljati + obliko &lt;?php. . .?&gt; kadar nameravate kodo PHP vkljuèiti + v datoteke XML ali XHTML, saj se sicer ne dr¾ite pravil XMLja. </para> <para> - The tags supported by PHP are: + Znaèke, ki jih podpira PHP: </para> <para> <example> - <title>Ways of escaping from HTML</title> + <title>Naèini za izhod iz HTML</title> <programlisting role="php"> <![CDATA[ -1. <?php echo("if you want to serve XHTML or XML documents, do like this\n"); ?> +1. <?php echo("èe ¾elite servirati dokumente XHTML ali XML, naredite + takole\n"; ?> -2. <? echo ("this is the simplest, an SGML processing instruction\n"); ?> - <?= expression ?> This is a shortcut for "<? echo expression ?>" +2. <? echo ("takole je najpreprosteje, v obliki SGML ukaza + za procesiranje\n"); ?> + <?= izraz ?> je okraj¹ava za "<? echo izraz ?>" 3. <script language="php"> - echo ("some editors (like FrontPage) don't - like processing instructions"); + echo ("nekateri urejevalci (npr. FrontPage) ne marajo + ukazov za procesiranje"); </script> -4. <% echo ("You may optionally use ASP-style tags"); %> - <%= $variable; # This is a shortcut for "<% echo . . ." %> +4. <% echo ("Uporabljate lahko tudi znaèke oblike ASP"); %> + <%= $spremenljivka; %> je okraj¹ava za "<% echo . . ." %> ]]> </programlisting> </example> </para> <para> - The first way, &lt;?php. . .?&gt;, is the preferred method, as it - allows the use of PHP in XML-conformant code such as XHTML. + Najbolj¹i naèin je prvi - &lt;?php. . .?&gt;, saj omogoèa uporabo + PHPja na naèin, ki je v skladu s pravili XML, recimo znotraj datotek + XHTML. </para> <para> - The second way is not available always. Short tags are available - only when they have been enabled. This can be done via the - <function>short_tags</function> function (PHP 3 only), by enabling - the <link linkend="ini.short-open-tag">short_open_tag</link> - configuration setting in the PHP config file, or by compiling PHP - with the --enable-short-tags option to - <command>configure</command>. Even if it is enabled by default in - php.ini-dist, use of short tags are discouraged. + Drugi naèin ni vedno na voljo. Kratke znaèke so na voljo samo + kadar so vklopljene. To lahko naredimo s funkcijo + <function>short_tags</function> (na voljo samo v PHP 3), + z vklopom direktive <link + linkend="ini.short-open-tag">short_open_tag</link> v + PHPjevi nastavitveni datoteki, ali pa s prevajanjem PHPja + s parametrom --enable-short-tags ukazu <command>configure</command>. + Uporabo kratkih znaèk odsvetujemo, èeprav so v php.ini-dist + privzeto vklopljene. </para> <para> - The fourth way is only available if ASP-style tags have been - enabled using the <link linkend="ini.asp-tags">asp_tags</link> - configuration setting. + Èetrti naèin je na voljo samo v primeru, da je vklopljen + z uporabo nastavitvene direktive <link + linkend="ini.asp-tags">asp_tags</link>. <note> - <para>Support for ASP-style tags was added in 3.0.4.</para> + <para>Podpora znaèkam oblike ASP je na voljo od razlièice 3.0.4 naprej.</para> </note> </para> <note> <para> - Using short tags should be avoided when developing applications - or libraries that are meant for redistribution, or deployment on - PHP servers which are not under your control, because short tags - may not be supported on the target server. For portable, - redistributable code, be sure not to use short tags. + Kadar razvijate aplikacije ali knji¾nice, ki jih nameravate + distribuirati ali uporabljati na stre¾nikih, nad katerimi nimate + nadzora, se izognite uporabi kratkih znaèk, saj morda ne bodo + delovale na stre¾nikih, na katerih se bodo va¹i programi + izvajali. Za razvoj prenosljive kode nikakor ne uporabljajte + kratkih znaèk. </para> </note> <para> - The closing tag for the block will include the immediately - trailing newline if one is present. Also, the closing tag - automatically implies a semicolon; you do not need to have a - semicolon terminating the last line of a PHP block. + Èe zapiralni znaèki neposredno sledi konec vrstice, se ¹teje + kot del zapiralne znaèke. Prav tako zapiralna znaèka implicitno + vsebuje podpièje; zadnjega stavka v bloku PHP kode ni potrebno + zakljuèiti s podpièjem. </para> <para> - PHP allows you to use structures like this: - <example><title>Advanced escaping</title> + PHP dovoljuje uporabo tak¹nih struktur: + <example><title>Napredni izhodi</title> <programlisting role="php"> <![CDATA[ <?php -if ($expression) { +if ($izraz) { ?> - <strong>This is true.</strong> + <strong>To je res.</strong> <?php } else { ?> - <strong>This is false.</strong> + <strong>To ni res.</strong> <?php } ?> ]]> </programlisting> </example> - This works as expected, because when PHP hits the ?&gt; closing - tags, it simply starts outputting whatever it finds until it hits - another opening tag. The example given here is contrived, of - course, but for outputting large blocks of text, dropping out of - PHP parsing mode is generally more efficient than sending all of - the text through <function>echo</function> or - <function>print</function> or somesuch. + Primer deluje, kot bi prièakovali, ker zaène PHP po znaèki + ?&gt; preprosto kopirati tekst dokler spet ne najde odpiralne + znaèke. Éeprav je ta primer rahlo dolgoèasen, je tak naèin + izpisovanja velikih kosov kode HTML uèinkovitej¹i kot izpis + vsega besedila preko funkcij <function>echo</function>, + <function>print</function> in podobnih. </para> </sect1> <sect1 id="language.basic-syntax.instruction-separation"> - <title>Instruction separation</title> + <title>Loèevanje ukazov</title> <simpara> - Instructions are separated the same as in C or Perl - terminate - each statement with a semicolon.</simpara> + Ukaze v PHPju loèujemo enako kot v jezikih C in Perl - vsak + stavek zakljuèimo s podpièjem..</simpara> <para> - The closing tag (?&gt;) also implies the end of the statement, so - the following are equivalent: + Zapiralna znaèka (?&gt;) ravno tako implicira konec stavka, tako + da sta naslednja dva primera ekvivalentna: <informalexample> <programlisting role="php"> <![CDATA[ <?php - echo "This is a test"; + echo "To je test"; ?> -<?php echo "This is a test" ?> +<?php echo "To je test" ?> ]]> </programlisting> </informalexample> @@ -197,20 +199,21 @@ </sect1> <sect1 id="language.basic-syntax.comments"> - <title>Comments</title> + <title>Komentarji</title> <para> - PHP supports 'C', 'C++' and Unix shell-style comments. For example: + PHP podpira komentarje v stilu jezikov C in C++ in tudi komentarje, kot + jih najdemo v programih za Unixove ¹koljke. Na primer: <informalexample> <programlisting role="php"> <![CDATA[ <?php - echo "This is a test"; // This is a one-line c++ style comment - /* This is a multi line comment - yet another line of comment */ - echo "This is yet another test"; - echo "One Final Test"; # This is shell-style style comment + echo "To je test"; // To je enovrstièni komentar oblike C++ + /* To je veèvrstièni komentar, + ki je dolg dve vrstici */ + echo "©e en test"; + echo "Zadnji test"; # To je komentar iz Unixovih ¹koljk ?> ]]> </programlisting> @@ -218,22 +221,21 @@ </para> <simpara> - The "one-line" comment styles actually only comment to the end of - the line or the current block of PHP code, whichever comes - first. + Enovrstièni komentar dejansko komentira samo do konca vrstice + ali do konca trenutnega bloka kode PHP, kar se zgodi prej. </simpara> <informalexample> <programlisting role="php"> <![CDATA[ -<h1>This is an <?php # echo "simple";?> example.</h1> -<p>The header above will say 'This is an example'. +<h1>To je <?php # echo "preprost";?> primer.</h1> +<p>Zgornji naslov pravi 'To je primer'. ]]> </programlisting> </informalexample> <simpara> - You should be careful not to nest 'C' style comments, which can - happen when commenting out large blocks. + Pazite, da ne boste gnezdili komentarje oblike C (/*...*/), kar + se lahko zgodi kadar se zakomentira dolge bloke. </simpara> <informalexample> @@ -241,7 +243,7 @@ <![CDATA[ <?php /* - echo "This is a test"; /* This comment will cause a problem */ + echo "To je test"; /* Ta komentar bo povzroèil problem */ */ ?> ]]> @@ -249,10 +251,10 @@ </informalexample> <simpara> - The one-line comment styles actually only comment to the end - of the line or the current block of PHP code, whichever comes first. - This means that HTML code after // ?> WILL be printed: ?> skips out of - the PHP mode and returns to HTML mode, and // cannot influence that. + Ker enovrstièni komentarji veljajo samo do izhodne znaèke, èe je ta + v isti vrstici, se bo morebiten HTML, ki sledi takemu komentarju + vseeno izpisal. ?&gt; povroèi prehod nazaj na HTML in // nanj + nima vpliva. </simpara> </sect1> </chapter>
« previous php.doc.sl (#14) next »