Date: 01/19/02
- Next message: shlomi loubaton: "[PHP-DOC] cvs: phpdoc /he Translators"
- Previous message: Yasuo Ohgaki: "[PHP-DOC] Re: Misleading session_register() documentation"
- Next in thread: Gabor Hojtsy: "Re: [PHP-DOC] cvs: phpdoc /he/language basic-syntax.xml"
- Reply: Gabor Hojtsy: "Re: [PHP-DOC] cvs: phpdoc /he/language basic-syntax.xml"
- Maybe reply: shlomi loubaton: "[PHP-DOC] cvs: phpdoc /he/language basic-syntax.xml"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
shlomi Sat Jan 19 01:14:10 2002 EDT
Added files:
/phpdoc/he/language basic-syntax.xml
Log:
initial translation
Index: phpdoc/he/language/basic-syntax.xml
+++ phpdoc/he/language/basic-syntax.xml
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<chapter id="language.basic-syntax">
<title>תחביר בסיסי</title>
<!--
NOTE: Last modified: 2001-05-16 13:00 GMT
the language part is currently under heavy revision. Please do not
not make any heavy (i.e. structural) modifications to this part
for a moment.
You'd also better not start any translation yet.
Comments are always welcome at phpdoc <email protected>
Progress:
intro : DOESN'T EXIST - yet?
new chapter, with some introductionary remarks?
Will be discussed on the ML soon.
basic-syntax:
FINISHED
except maybe moving the 'advanced escaping'
to a better place?
TODO:
- nada
types : Being revised. Added all new types
Boolean and Integer are more or less finished.
The rest isn't.
TODO:
- why is $foo[bar] bad syntax?
- what's the difference between unset($bla) and
$bla = NULL; (it is different!)
- $obj->{expr} syntax
- (unset) cast?????
- $bla = unset <== should've been nuked, don't mention it
- $str{offset} syntax, rather than $str[offset]
- read notes and apply when any of them are useful
- remove notes which have been included here.
- ...
the rest: Not yet started with.
TODO:
- ?
oop : has been revised by Kristian, DONE.
-->
<sect1 id="language.basic-syntax.phpmode">
<title>מעבר ממצב HTML למצב PHP</title>
<para>
כאשר PHP מפרשת קובץ, היא פולטת את הטקסט שבו, עד לרגע
שבו תמצא תגיות מיוחדות שמסמנות לה את סוף הטקסט ותחילת
הקוד של PHP. המפרש יבצע את כל פקודות ה PHP שימצא עד תגית
הסגירה הבאה, שתסמן למפרש את סוף הקוד ותחילת הטקסט וברגע זה
שוב תתבצע שליחה של הטקסט אל הפלט. מנגנון זה מאפשר את שילוב
הקוד במסמך HTML: כל מה שמחוץ לתגיות ה PHP נחשב לפלט רגיל בעוד
שכל מה שנמצא בתוכן מעובד כקוד.
</para>
<para>
ישנן ארבע דרכים לסמן את תגיות הפתיחה וסגירה של קוד PHP. מהן
רק שתיים (<?php. . .?> ו <script
language="php">. . .</script>).
פעילות תמיד. באחרות אפשר להשתמש לאחר שינוי הגדרות בקובץ
ההגדרות <filename>php.ini</filename>.
למרות שתגיות ה PHP הקצרות והתגיות בסגנון ASP יותר נוחות
לשימוש, הן לא מתאימות לשימוש בחלק מהמקרים, לדוגמה - אם
ברצונך לשלב קוד PHP ב XML או XHTML, אתה חייב להשתמש בתגיות
הארוכות <?php. . .?> כדי לא להתנגש עם תגיות XML.
</para>
<para>
התגיות הנתמכות ב PHP הן:
</para>
<para>
<example>
<title>דרכים לעבור ממצב HTML למצב PHP</title>
<programlisting role="php">
<![CDATA[
1. <? echo ("this is the simplest, an SGML processing instruction\n"); ?>
<?= expression ?> This is a shortcut for "<? echo expression ?>"
2. <?php echo("if you want to serve XHTML or XML documents, do like this\n"); ?>
3. <script language="php">
echo ("some editors (like FrontPage) don't
like processing instructions");
</script>
4. <% echo ("You may optionally use ASP-style tags"); %>
<%= $variable; # This is a shortcut for "<% echo . . ." %>
]]>
</programlisting>
</example>
</para>
<para>
הדרך הראשונה תפעל רק אם התמיכה בתגיות קצרות הופעלה. כדי
אפשר להפעיל תמיכה זו(ב PHP 3 ) על-ידי שימוש בפונקציה
<function>short_tags</function>, תוך הפעלת האפשרות <link
linkend="ini.short-open-tag">short_open_tag</link> בקובץ
ההגדרות של PHP, או על-ידי הידור של PHP עם האופציה
--enable-short-tags בהרצת ה <command>configure</command>.
</para>
<para>
ושוב יש לציין כי הדרך השנייה מועדפת מאחר ואינה גורמת
להתנגשות עם מסמכים מסוג XML כדוגמת XHTML.
</para>
<para>
הדרך הרביעית תפעל רק אם סגנון תגיות ה ASP מאופשר על-ידי
ההגדרה <link linkend="ini.asp-tags">asp_tags</link>
בקובץ ההגדרות.
<note>
<para>תמיכה בתגיות בסיגנון ASP אפשרית רק מגרסה 3.0.4 ומעלה.</para>
</note>
</para>
<para>
תגיות הסגירה של בלוק יכללו את תו השורה החדשה העוקב, אם
קיים כזה. כמו כן, תגיות סגירה מסמנות את סופה של ביטוי או
פקודה בקוד ה PHP ואין הכרח להוסיף ; בשורה האחרונה של הקוד.
</para>
<para>
PHP מתירה שימוש במבנה כמו זה:
<example><title>מעבר מצבים מתקדם</title>
<programlisting role="php">
<![CDATA[
<?php
if ($expression) {
?>
<strong>This is true.</strong>
<?php
} else {
?>
<strong>This is false.</strong>
<?php
}
?>
]]>
</programlisting>
</example>
כצפוי, קוד זה יפעל, כי כאשר PHP מוצאת את תגגיות הסגירה, היא
פשוט מתחילה מתחילה לשלוח את הטקסט כפלט עד שתמצא את תגית
הפתיחה הבאה. הדוגמה הנתונה היא פשוטה, אך כאשר מדובר בשליחת קטעי
טקסט גדולים לפלט, תגיות הפתיחה וסגירה יעילות יותר מאשר הדפסת
הפלט בעזרת הפונקציה <function>echo</function> או הפונקציה
<function>print</function> או פונקציה דומה.
</para>
</sect1>
<sect1 id="language.basic-syntax.instruction-separation">
<title>הפרדת הוראות</title>
<simpara>
הפרדת הוראות ב PHP מתבצעת בצורה זהה לזו שקיימת בשפת C או פרל -
כל הוראה מסתיימת בסמיקולון ; .</simpara>
<para>
תגית הסגירה מסמנת גם את סוף ההוראה וכך במקה הבא, שתי
ההוראות זהות ותקינות:
<informalexample>
<programlisting role="php">
<![CDATA[
<?php
echo "This is a test";
?>
<?php echo "This is a test" ?>
]]>
</programlisting>
</informalexample>
</para>
</sect1>
<sect1 id="language.basic-syntax.comments">
<title>הערות בקוד</title>
<para>
PHP תומכת בסיגנון ההערות של שפת C, C++ ומעטפת יוניקס. לדוגמה:
<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
?>
]]>
</programlisting>
</informalexample>
</para>
<simpara>
הערת ה "one-line" תכלול את כל הטקסט עד סוף השורה או עד
תגית סגירה של PHP.
</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'.
]]>
</programlisting>
</informalexample>
<simpara>
הזהר לא לקנן הערות בסגנון 'C' אשר יגרמו לבעיה כאשר
תרצה להפוך בלוק גדול של קוד להערה
</simpara>
<informalexample>
<programlisting role="php">
<![CDATA[
<?php
/*
echo "This is a test"; /* This comment will cause a problem */
*/
?>
]]>
</programlisting>
</informalexample>
</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:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
- Next message: shlomi loubaton: "[PHP-DOC] cvs: phpdoc /he Translators"
- Previous message: Yasuo Ohgaki: "[PHP-DOC] Re: Misleading session_register() documentation"
- Next in thread: Gabor Hojtsy: "Re: [PHP-DOC] cvs: phpdoc /he/language basic-syntax.xml"
- Reply: Gabor Hojtsy: "Re: [PHP-DOC] cvs: phpdoc /he/language basic-syntax.xml"
- Maybe reply: shlomi loubaton: "[PHP-DOC] cvs: phpdoc /he/language basic-syntax.xml"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

