cvs: smarty /docs/ru bookinfo.xml getting-started.xml language-defs.ent preface.xml

"Mehdi Achour" <[email protected]>
Newsgroups gmane.comp.php.cvs.smarty
Message-ID <cvsdidou1080637520@cvsserver>
didou		Tue Mar 30 04:05:20 2004 EDT

  Added files:                 
    /smarty/docs/ru	bookinfo.xml getting-started.xml language-defs.ent 
                   	preface.xml 
  Log:
  add RU docs
  # work from Sergei Suslenkov

-- 
Smarty CVS Mailing List (http://cvs.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
didou-20040330040520.txt (text/plain, 26.6 KB)
http://cvs.php.net/co.php/smarty/docs/ru/bookinfo.xml?r=1.1&p=1
Index: smarty/docs/ru/bookinfo.xml
+++ smarty/docs/ru/bookinfo.xml
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
 <bookinfo id="bookinfo">
  <title>Smarty - ìàøèíà ñáîðêè PHP øàáëîíîâ</title>
  <authorgroup id="authors">
   <author>
    <firstname>Monte</firstname><surname>Ohrt &lt;[email protected]&gt;</surname>
   </author>
   <author>
    <firstname>Andrei</firstname><surname>Zmievski &lt;[email protected]&gt;</surname>
   </author>
  </authorgroup>
  <authorgroup id="translators">
   <author>
    <firstname>Sergei</firstname><surname>Suslenkov &lt;[email protected]&gt;</surname>
   </author>
  </authorgroup>
  <pubdate>&build-date;</pubdate>
  <copyright>
   <year>2001-2004</year>
   <holder>ispi of Lincoln, Inc.</holder>
  </copyright>
 </bookinfo>

<!-- 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
-->

http://cvs.php.net/co.php/smarty/docs/ru/getting-started.xml?r=1.1&p=1
Index: smarty/docs/ru/getting-started.xml
+++ smarty/docs/ru/getting-started.xml
<part id="getting.started">
 <title>Ïðèñòóïàÿ ê ðàáîòå</title>

 <chapter id="what.is.smarty">
   <title>×òî òàêîå Smarty?</title>
   <para>
	 Smarty - øàáëîííûé äâèæîê äëÿ php. Áîëåå îïðåäåëåííî, îí ïðåäîñòàâëÿåò
	 óïðàâëÿåìûé ñïîñîá ðàçäåëåíèÿ ïðèêëàäíîé ëîãèêè è ñîäåðæàíèÿ îò
	 ïðåäñòàâëåíèÿ. Ýòî î÷åíü óäîáíî â ñèòóàöèÿõ, êîãäà ïðîãðàììèñò è
	 ïðîåêòèðîâùèê øàáëîíà èãðàþò ðàçëè÷íûå ðîëè, èëè â ÷àñòî - ýòî
	 ðàçëè÷íûå ëþäè. Íàïðèìåð, ñêàæåì, Âû ñîçäàåòå ñòðàíèöó, êîòîðàÿ 
	 ïîêàçûâàåò ãàçåòíóþ ñòàòüþ. Íàçâàíèå ñòàòüè, àâòîð è ñàìà ñòàòüÿ - 
	 åëåìåíòû, êîòîðûå íå ñîäðæàò íèêàêîé èíôîðìàöèè î òîì, êàê îíè
	 áóäóò ïðåäñòàâëåíû. Èõ ïåðåäàþò â Smarty â ïðèëîæåíèè, à ïðîåêòèðîâùèê 
	 øàáëîíà ðåäàêòèðóåò øàáëîíû è èñïîëüçóåò êîìáèíàöèþ òýãîâ HTML è 
	 òýãîâ øàáëîíà, ÷òîáû îòôîðìàòèðîâàòü ïðåäñòàâëåíèå ýòèõ ýëåìåíòîâ
	 (òàáëèöû HTML, ôîíîâûå öâåòà, ðàçìåðû øðèôòà, ñòèëÿ, è ò.ä.). Îäíàæäû
	 ïðîãðàììèñò çàõî÷åò èçìåíèòü ñïîñîá õðàíåíèÿ ñòàòüè (ñäåëàòü èçìåíåíèÿ
	 â ëîãèêå ïðèëîæåíèÿ.) Ýòî èçìåíåíèå íå çàòðàãèâàåò ïðîåêòèðîâùèêà øàáëîíîâ.
	 Ñîäåðæàíèå áóäåò âñå åùå ïåðåäàâàòüñÿ â øàáëîí òàêèì æå ñàìûì ñïîñîáîì.
	 Àíàëîãè÷íî, åñëè ïðîåêòèðîâùèê øàáëîíà õî÷åò ïîëíîñòüþ ïåðåïðîåêòèðîâàòü
	 øàáëîíû, ýòî íå ïîòðåáóåò íèêàêèõ èçìåíåíèé ê ïðèêëàäíîé ëîãèêå. Ïîýòîìó,
	 ïðîãðàììèñò ìîæåò äåëàòü èçìåíåíèÿ â ïðèêëàäíîé ëîãèêå áåç ïîòðåáíîñòè
	 èçìåíåíèÿ øàáëîíîâ, à ïðîåêòèðîâùèê øàáëîíà ìîæåò äåëàòü èçìåíåíèÿ â
	 øàáëîíàõ áåç èçìåíåíèÿ ïðèêëàäíîé ëîãèêè.
	</para>
	<para>
	 Òåïåðü êîðîòêî î òîì, ÷åãî íå ìîæåò Smarty. Îí íå ïûòàåòñÿ ïîëíîñòüþ
	 ðàçäåëèòü ëîãèêó îò øàáëîíîâ. Íåò íèêàêîé ïðîáëåìû ñ ëîãèêîé â âàøèõ 
	 øàáëîíàõ ïðè óñëîâèè, ÷òî ýòî ñòðîãî ëîãèêà ïðåäñòàâëåíèå. Ñîâåòà: 
	 äåðæèòå ïðèêëàäíóþ ëîãèêó âíå øàáëîíîâ, à ëîãèêó ïðåäñòàâëåíèÿ âíå
	 ïðèëîæåíèÿ. Òàê ïðîùå âñåãî ñîõðàíèòü ïðîåêò óïðàâëÿåìûì è ðàñøèðÿåìûì
	 â òå÷åíèå äîëãîãî âðåìåíè.
	</para>
	<para>
	 Îäèí èç óíèêàëüíûõ àñïåêòîâ â Smarty - êîìïèëèðîâàíèå øàáëîíîâ. Ýòî 
	 îçíà÷àåò, ÷òî Smarty ÷èòàåò ôàéëû øàáëîíîâ è ñîçäàåò php ñöåíàðèè èç íèõ.
	 Îíè ñîçäàþòñÿ îäèí ðàç è ïîòîì òîëüêî âûïîëíÿþòüñÿ. Ïîýòîìó íåòó
	 íåîáõîäèìîñòè îáðàáàòûâàòü ôàéë øàáëîíà äëÿ êàæäîãî çàïðîñà, è êàæäûé
	 øàáëîí ìîæåò ïîëüçîâàòüñÿ âñåìè ïðåèìóùåñòâàìè êýøèðóþøèõ ðåøåíèé
	 php êîìïèëÿòîðà òàêèõ, êàê Zend Accelerator
	(http://www.zend.com) èëè PHP Accelerator
	(http://www.php-accelerator.co.uk).
   </para>
   <para>
    Íåêîòîðûå âîçìîæíîñòè Smarty:
   </para>
   <itemizedlist>
    <listitem><para>Îí î÷åíü áûñòð.</para></listitem>
    <listitem><para>Îí ýôôåêòèâåí, òàê êàê PHP îáðàáîò÷èê äåëàåò ãðÿçíóþ
     ðàáîòó</para></listitem>
    <listitem><para>Íèêàêîé ëèøíåé îáðàáîòêè øàáëîíîâ, îíè êîìïèëèðóþòüñÿ 
     òîëüêî îäèí ðàç.</para></listitem>
    <listitem><para>Ïåðåêîìïèëèðóþòñÿ òîëüêî òå øàáëîíû, êîòîðûå
     èìåíèëèñü.</para></listitem>
    <listitem><para>Âû ìîæåòå ñîçäàâàòü ïîëüçîâàòåëüñêèå<link linkend="language.custom.functions">ôóíêöèè</link> and <link linkend="language.modifiers">ìîäèôèêàòîðû</link>, òàê ÷òî ÿçûê øàáëîíîâ ÷ðåçâû÷àéíî ðàñøèðÿåì.</para></listitem>
    <listitem><para>Íàñòðàèâàåìûå ðàçäåëèòåëè òýãîâ øàáëîíà, òî åñòü âû ìîæåòå
     èñïîëüçîâàòü {}, {{}}, &lt;!--{}--&gt;, è ò.ä..</para></listitem>
    <listitem><para>If/elseif/else/endif êîíñòðóêöèè ïåðåäàþòñÿ PHP îáðàáîò÷èêó,
     òàê ÷òî ñèíòàêñèñ {if ...} âûðàæåíèÿ ìîæåò áûòü íàñòîëüêî ïðîñòûì èëè
     êîìïëåêñíûì, êàê âàì íðàâèòñÿ.</para></listitem>
    <listitem><para>Äîïóñòèìî íåîãðàíè÷åííîå âëîæåíèå ñåêöèé, óñëîâèé è
     ò.ä.</para></listitem>
    <listitem><para>Âîçìîæíî âêëþ÷àòü php êîä ïðÿìî â âàø øàáëîí, õîòÿ ýòî
     íå äîëæíî òðåáîâàòüñÿ (íå ðåêîìåíäóåòñÿ), â ñèëó òîãî, ÷òî äâèæîê ãèáêî
     íàñòðàèâàåìûé.</para></listitem>
    <listitem><para>Âñòðîåíîå êýøèðîâàíèå</para></listitem>
    <listitem><para>Ïðîèçâîëüíûå èñòî÷íèêè øàáëîíà</para></listitem>
    <listitem><para>Ïðîèçâîëüíûå ôóíêöèè îáðàáîòêè êýøèðîâàíèÿ</para></listitem>
    <listitem><para>Ïîääåðæêà ïëàãèíîâ</para></listitem>
   </itemizedlist>
 </chapter>
 <chapter id="installation">
  <title>Èíñòàëÿöèÿ</title>

  <sect1 id="installation.requirements">
   <title>Òðåáîâàíèÿ</title>
   <para>
   Smarty íåîáõîäèì âåáñåðâåð ñ çàïóùåíûì PHP âåðñèè 4.0.6 èëè âûøå.
   </para>
  </sect1>

  <sect1 id="installing.smarty.basic">
    <title>Áàçîâàÿ èíñòàëÿöèÿ</title>
	<para>
	Èíñòàëèðóéòå áèáëèîòå÷íûé ôàéëû Smarty, êîòîðûå àíàõîäÿòñÿ â ïàïêå /libs/
	äèñòðèáóòèâà. Âû ÍÅ ÄÎËÆÍÛ ðåäàêòèðîâàòü ýòè ôàéëû. Îíè ðàçäåëåíû ñðåäè
	âñåõ ïðèëîæåíèé è ìîãóò èçìåíÿòüñÿ òîëüêî ïðè îáíîâëåíèè Smarty.
	</para>
	<example>
     <title>Áèáèëîòå÷íûå ôàéëû Smarty</title>
     <screen>
Smarty.class.php
Smarty_Compiler.class.php
Config_File.class.php
debug.tpl
/plugins/*.php (âñå ôàéëû!)</screen>
	</example>

	<para>
	Smarty èñïîëüçóåò PHP êîíñòàíòó <link
	linkend="constant.smarty.dir">SMARTY_DIR</link>, êîòîðàÿ óêàçûâàåò ïóòü ê
	áèáëèîòå÷íûì ôàéëàì Smarty. Îáû÷íî, åñëè ïðèëîæåíèå ìîæåò íàéòè ôàéë
	<emphasis>Smarty.class.php</emphasis>, òî íåò íåîáõîäèìîñòè óñòàíàâëèâàòü
	SMARTY_DIR, Èíà÷å, åñëè	<emphasis>Smarty.class.php</emphasis> íå â âàøåì
	include_path, èëè âû íå óêàçûâàëè àáñîëþòíûé ïóòü ê íåìó â ïðèëîæåíèè, òî 
	âû äîëæíû îïðåäåëèòü SMARTY_DIR âðó÷íóþ. SMARTY_DIR <emphasis>äîëæåí</emphasis>
	âêëþ÷àòü çàâåðøàþùèé ñëýø.
	</para>
	<para>
	Êàê íàäî ñîçäàâàòü îáåêò Smarty â âàøèõ PHP ñöåíàðèÿõ:
	</para>

	<example>
     <title>Ñîçäàíèå îáåêòà Smarty</title>
     <screen>
require('Smarty.class.php');
$smarty = new Smarty;</screen>
	</example>

	<para>
	 Ïîïðîáóéòå âûïîëíèòü âûøåóïîìÿíóòûé ñöåíàðèé. Åñëè Âû ïîëó÷àåòå îøèáêó î òîì,
	 ÷òî <emphasis>Smarty.class.php</emphasis> íå íàéäåí, âû äîëæíû ñåëàòü îäíî èç
	 ñëåäóþùåãî:
	</para>

	<example>
     <title>Óêàæèòå àáñîëþòíûé ïóòü ê áèáëèîòå÷íîìó êàòàëîãó</title>
     <screen>
require('/usr/local/lib/php/Smarty/Smarty.class.php');
$smarty = new Smarty;</screen>
	</example>

	<example>
     <title>Äîáàâüòå áèáëèîòå÷íûé êàòàëîã ê php_include ïóòè</title>
     <screen>
// Îòðåäàêòèðóéòå âàø php.ini ôàéë, äîáàâüòå áèáëèîòå÷íûé 
// êàòàëîã Smarty ê include_path è ïåðåçàóïñòèòå âåá ñåðâåð.
// Òîãäà ñëåäóþùåå äîëæíî ðàáîòàòü:
require('Smarty.class.php');
$smarty = new Smarty;</screen>
	</example>

	<example>
     <title>Óñòàíîâèòå SMARTY_DIR êîíñòàíòó âðó÷íóþ</title>
     <screen>
define('SMARTY_DIR','/usr/local/lib/php/Smarty/');
require(SMARTY_DIR.'Smarty.class.php');
$smarty = new Smarty;</screen>
	</example>

	<para>
	Òåïåðü, êîãäà áèáëèîòå÷íûå ôàéëû íàõîäÿòñÿ íà ìåñòå, ïðèøëî âðåìÿ 
	óñòàíîâêà êàòàëîãè Smarty äëÿ âàøåãî ïðèëîæåíèÿ. Smarty òðåáóåò 
	÷åòûðå êàòàëîãà, êîòîðûå (ïî óìîë÷àíèþ) íàçûâàþòñÿ
	<emphasis>templates</emphasis>,	<emphasis>templates_c</emphasis>, 
	<emphasis>configs</emphasis> è <emphasis>cache</emphasis>. Êàæäûé èç 
	íèõ îïðåäåëÿåì ñâîéñòâàìè êëàññà Smarty <emphasis>$template_dir</emphasis>,
	<emphasis>$compile_dir</emphasis>, <emphasis>$config_dir</emphasis>, è
	<emphasis>$cache_dir</emphasis> ñîîòâåòñòâåííî. Î÷åíü ðåêîìåíäóåòñÿ, ÷òîáû 
	âû óñòàíàâëèâàëè îòäåëüíûå íàáîðû ýòèõ êàòàëîãîâ äëÿ êàæäîãî ïðèëîæåíèÿ, 
	êîòîðîå áóäåò èñïîëüçîâàòü Smarty. 
	</para>
	<para>
	Óáåäèòåñü, ÷òî Âû çíàåòå ðàñïîëîæåíèå âàøåãî êîðíÿ äîêóìåíòà íà âåá 
	ñåðâåðå. Â íàøåì ïðèìåðå, êîðåíü äîêóìåíòà - "/web/www.mydomain.com/docs/".
	Ê êàòàëîãàì Smarty îáðàùàåòñÿ òîëüêî áèáëèîòåêà Ñìàðòè è íèêîãäà íå îáðàùàåò íåïîñðåäñòâåííî web-áðàóçåðîì. Ïîýòîìó, ÷òîáû èçáåæàòü ëþáûõ ïðåäïðèÿòèé(áåñïîêîéñòâ) çàùèòû, ðåêîìåíäóåò ðàçìåñòèòü ýòè êàòàëîãè â êàòàëîã îò êîðíÿ äîêóìåíòà. 

	Be sure you know the location of your web server document root. In our
	example, the document root is "/web/www.mydomain.com/docs/". The Smarty
	directories are only accessed by the Smarty library and never accessed
	directly by the web browser. Therefore to avoid any security concerns, it
	is recommended to place these directories in a directory
	<emphasis>off</emphasis> the document root.
	</para>
	<para>
	For our installation example, we will be setting up the Smarty environment
	for a guest book application. We picked an application only for the purpose
	of a directory naming convention. You can use the same environment for any
	application, just replace "guestbook" with the name of your app. We'll
	place our Smarty directories under
	"/web/www.mydomain.com/smarty/guestbook/".
	</para>
	<para>
	You will need as least one file under your document root, and that is the
	script accessed by the web browser. We will call our script "index.php",
	and place it in a subdirectory under the document root called
	"/guestbook/". It is convenient to setup the web server so that "index.php"
	can be identified as the default directory index, so if you access
	"http://www.mydomain.com/guestbook/", the index.php script will be executed
	without "index.php" in the URL. In Apache you can set this up by adding
	"index.php" onto the end of your DirectoryIndex setting (separate each
	entry with a space.)
	</para>
	
	<para>
	Lets take a look at the file structure so far:
	</para>

	<example>
     <title>Example file structure</title>
     <screen>
/usr/local/lib/php/Smarty/Smarty.class.php
/usr/local/lib/php/Smarty/Smarty_Compiler.class.php
/usr/local/lib/php/Smarty/Config_File.class.php
/usr/local/lib/php/Smarty/debug.tpl
/usr/local/lib/php/Smarty/plugins/*.php

/web/www.mydomain.com/smarty/guestbook/templates/
/web/www.mydomain.com/smarty/guestbook/templates_c/
/web/www.mydomain.com/smarty/guestbook/configs/
/web/www.mydomain.com/smarty/guestbook/cache/

/web/www.mydomain.com/docs/guestbook/index.php</screen>
	</example>

	<para>
	Smarty will need write access to the <emphasis>$compile_dir</emphasis> and
	<emphasis>$cache_dir</emphasis>, so be sure the web server user can write
	to them. This is usually user "nobody" and group "nobody". For OS X users,
	the default is user "www" and group "www". If you are using Apache, you can
	look in your httpd.conf file (usually in "/usr/local/apache/conf/") to see
	what user and group are being used.
	</para>

	<example>
     <title>Setting file permissions</title>
     <screen>

chown nobody:nobody /web/www.mydomain.com/smarty/guestbook/templates_c/
chmod 770 /web/www.mydomain.com/smarty/guestbook/templates_c/

chown nobody:nobody /web/www.mydomain.com/smarty/guestbook/cache/
chmod 770 /web/www.mydomain.com/smarty/guestbook/cache/</screen>
	</example>

	<note>
	 <title>Technical Note</title>
	 <para>
	 chmod 770 will be fairly tight security, it only allows user "nobody" and
	 group "nobody" read/write access to the directories. If you would like to
	 open up read access to anyone (mostly for your own convenience of viewing
	 these files), you can use 775 instead.
     </para>
	</note>

	<para>
	We need to create the index.tpl file that Smarty will load. This will be
	located in your $template_dir.
	</para>

	<example>
     <title>Editing /web/www.mydomain.com/smarty/guestbook/templates/index.tpl</title>
     <screen>

{* Smarty *}

Hello, {$name}!</screen>
	</example>


	<note>
	<title>Technical Note</title>
	<para>
		{* Smarty *} is a template comment. It is not required, but it is good
		practice to start all your template files with this comment. It makes
		the file easy to recognize regardless of the file extension. For
		example, text editors could recognize the file and turn on special
		syntax highlighting.
	</para>
	</note>

	<para>
	Now lets edit index.php. We'll create an instance of Smarty, assign a
	template variable and display the index.tpl file. In our example
	environment, "/usr/local/lib/php/Smarty" is in our include_path. Be sure you
	do the same, or use absolute paths.
	</para>

	<example>
     <title>Editing /web/www.mydomain.com/docs/guestbook/index.php</title>
     <screen>
// load Smarty library
require('Smarty.class.php');

$smarty = new Smarty;

$smarty->template_dir = '/web/www.mydomain.com/smarty/guestbook/templates/';
$smarty->compile_dir = '/web/www.mydomain.com/smarty/guestbook/templates_c/';
$smarty->config_dir = '/web/www.mydomain.com/smarty/guestbook/configs/';
$smarty->cache_dir = '/web/www.mydomain.com/smarty/guestbook/cache/';

$smarty->assign('name','Ned');

$smarty->display('index.tpl');</screen>
	</example>

	<note>
	 <title>Technical Note</title>
	 <para>
	 In our example, we are setting absolute paths to all of the Smarty
	 directories. If '/web/www.mydomain.com/smarty/guestbook/' is within your
	 PHP include_path, then these settings are not necessary. However, it is
	 more efficient and (from experience) less error-prone to set them to
	 absolute paths. This ensures that Smarty is getting files from the
	 directories you intended.
	 </para>
	</note>

	<para>
	Now load the index.php file from your web browser. You should see "Hello,
	Ned!"
	</para>
	<para>
	You have completed the basic setup for Smarty!
	</para>
   </sect1>
   <sect1 id="installing.smarty.extended">
   <title>Extended Setup</title>

   <para>
   This is a continuation of the <link
   linkend="installing.smarty.basic">basic installation</link>, please read
   that first!
   </para>
   <para>
   A slightly more flexible way to setup Smarty is to extend the class and
   initialize your Smarty environment. So instead of repeatedly setting
   directory paths, assigning the same vars, etc., we can do that in one place.
   Lets create a new directory "/php/includes/guestbook/" and make a new file
   called "setup.php". In our example environment, "/php/includes" is in our
   include_path. Be sure you set this up too, or use absolute file paths.
   </para>

   <example>
    <title>Editing /php/includes/guestbook/setup.php</title>
    <screen>

// load Smarty library
require('Smarty.class.php');

// The setup.php file is a good place to load
// required application library files, and you
// can do that right here. An example:
// require('guestbook/guestbook.lib.php');

class Smarty_GuestBook extends Smarty {

   function Smarty_GuestBook() {
   
   		// Class Constructor. These automatically get set with each new instance.

		$this->Smarty();

		$this->template_dir = '/web/www.mydomain.com/smarty/guestbook/templates/';
		$this->compile_dir = '/web/www.mydomain.com/smarty/guestbook/templates_c/';
		$this->config_dir = '/web/www.mydomain.com/smarty/guestbook/configs/';
		$this->cache_dir = '/web/www.mydomain.com/smarty/guestbook/cache/'; 
		
		$this->caching = true;
		$this->assign('app_name','Guest Book');
   }

}</screen>
   </example>

  <para>
  Now lets alter the index.php file to use setup.php:
  </para>
   
   <example>
    <title>Editing /web/www.mydomain.com/docs/guestbook/index.php</title>
    <screen>

require('guestbook/setup.php');

$smarty = new Smarty_GuestBook;

$smarty->assign('name','Ned');

$smarty->display('index.tpl');</screen>
   </example>

  <para>
  Now you see it is quite simple to bring up an instance of Smarty, just use
  Smarty_GuestBook which automatically initializes everything for our application.
  </para>
   
  </sect1>

 </chapter>
</part>

http://cvs.php.net/co.php/smarty/docs/ru/language-defs.ent?r=1.1&p=1
Index: smarty/docs/ru/language-defs.ent
+++ smarty/docs/ru/language-defs.ent
<!-- $Revision: 1.1 $ -->

<!ENTITY SMARTYManual      "Smarty Manual">
<!ENTITY SMARTYDesigners   "Smarty For Template Designers">
<!ENTITY SMARTYProgrammers "Smarty For Programmers">
<!ENTITY Appendixes        "Ïðèëîæåíèÿ">

http://cvs.php.net/co.php/smarty/docs/ru/preface.xml?r=1.1&p=1
Index: smarty/docs/ru/preface.xml
+++ smarty/docs/ru/preface.xml
 <preface id="preface">
  <title>Ïðåäèñëîâèå</title>
  <para>
   Íåñîìíåííî, îäèí èç íàèáîëåå ÷àñòîçàäàâàåìûõ âîðîñîâ â ñïèñêàõ ðàññûëêè ïî PHP:
   êàê ñäåëàòü, ÷òîáû ìîè PHP èñõîäíèêè áûëè íåçàâèñèìûìè îò îêðóæåíèÿ?
   
   Â òî âðåìÿ
   êàê PHP íàçûâàåòñÿ "HTML âëîæåííûé scripting ÿçûê", ïîñëå íàïèñàíèÿ 
   íåñêîëüêèõ ïðîåêòîâ, ãäå ñìåøàíû PHP è HTML, ìíîãèÿ ïîíèìàþò, ÷òî 
   ðàçäåëåíèå ôîðìû è ñîäåðæàíèÿ - õîðîøàÿ âåùü [TM]. Â äîïîëíåíèå, âî 
   ìíîãèõ äîëæíîñòè äèçàéíåðà è ïðîãðàììèñòà ðàçäåëüíûå. Èç ýòîãî ñëåäóåò 
   ïîèñê øàáëîííîãî ðåøåíèÿ.
   
   It is undoubtedly one of the most asked questions on the PHP mailing
   lists: how do I make my PHP scripts independent of the layout? While
   PHP is billed as "HTML embedded scripting language", after writing a
   couple of projects that mixed PHP and HTML freely one comes up with the
   idea that separation of form and content is a Good Thing [TM]. In
   addition, in many companies the roles of layout designer and programmer
   are separate. Consequently, the search for a templating solution
   ensues.
  </para>
  <para>
   Â íàøåé êîìïàíèè íàïðèìåð, ðàçâèòèå çàÿâëåíèÿ(ïðèìåíåíèÿ) ïðîäîëæàåòñÿ
   Ñëåäóþùèì îáðàçîì: Ïîñëå òîãî, êàê òðåáîâàíèÿ docs ñäåëàíû, èíòåðôåéñ
   Ïðîåêòèðîâùèê äåëàåò ìàêåòû èíòåðôåéñà è äàåò èì
   Ïðîãðàììèñò. Ïðîãðàììèñò îñóùåñòâëÿåò äåëîâóþ ëîãèêó â PHP è èñïîëüçîâàíèÿõ
   Ìàêåòû èíòåðôåéñà, ÷òîáû ñîçäàòü ñêåëåòíûå øàáëîíû. Ïðîåêò - òîãäà
   Âðó÷åííûé îò ÷åëîâåêó ðàñïîëîæåíèÿ ñòðàíèöû ïðîåêòèðîâùèêà/òêàíè HTML, êòî ïðèíîñèò
   Øàáëîíû äî èõ ïîëíîé ñëàâû. Ïðîåêò ìîæåò âîçâðàùàòüñÿ è äàëüøå
   Ìåæäó ïðîãðàììèðîâàíèåì/HTML ïàðà âðåìåí. Òàêèì îáðàçîì, ýòî âàæíî äëÿ
   Èìåéòå õîðîøóþ ïîääåðæêó øàáëîíà, ïîòîìó ÷òî ïðîãðàììèñòû íå õîòÿò ÷òî - íèáóäü ê
   Äåëàéòå ñ HTML, è íå õîòèòå ïðîåêòèðîâùèêîâ HTML mucking âîêðóã ñ PHP
   Êîäåêñ. Ïðîåêòèðîâùèêè íóæäàþòñÿ â ïîääåðæêå äëÿ config ôàéëîâ, äèíàìè÷åñêèõ áëîêîâ è
   Äðóãèå ïðîáëåìû(âûïóñêè) èíòåðôåéñà, íî îíè íå õîòÿò èìåòü íåîáõîäèìîñòü èìåòü äåëî
   Çàïóòàííîñòü PHP ïðîãðàììèðîâàíèå ÿçûêà.
  
  
   In our company for example, the development of an application goes on
   as follows: After the requirements docs are done, the interface
   designer makes mockups of the interface and gives them to the
   programmer. The programmer implements business logic in PHP and uses
   interface mockups to create skeleton templates. The project is then
   handed off to the HTML designer/web page layout person who brings the
   templates up to their full glory. The project may go back and forth
   between programming/HTML a couple of times. Thus, it's important to
   have good template support because programmers don't want anything to
   do with HTML and don't want HTML designers mucking around with PHP
   code. Designers need support for config files, dynamic blocks and
   other interface issues, but they don't want to have to deal with
   intricacies of the PHP programming language.
  </para>
  <para>
   Looking at many templating solutions available for PHP today, most of
   them provide a rudimentary way of substituting variables into templates
   and do a limited form of dynamic block functionality. But our needs
   required a bit more than that. We didn't want programmers to be dealing
   with HTML layout at ALL, but this was almost inevitable. For instance,
   if a designer wanted background colors to alternate on dynamic blocks,
   this had to be worked out with the programmer in advance. We also
   needed designers to be able to use their own configuration files, and
   pull variables from them into the templates. The list goes on.
  </para>
  <para>
   We started out writing out a spec for a template engine back in late
   1999.  After finishing the spec, we began to work on a template engine
   written in C that would hopefully be accepted for inclusion with PHP.
   Not only did we run into many complicated technical barriers, but there
   was also much heated debate about exactly what a template engine should
   and should not do. From this experience, we decided that the template
   engine should be written in PHP as a class, for anyone to use as they
   see fit. So we wrote an engine that did just that and
   <productname>SmartTemplate</productname> came into existence (note: this
   class was never submitted to the public). It was a class that did
   almost everything we wanted: regular variable substitution, supported
   including other templates, integration with config files, embedding PHP
   code, limited 'if' statement functionality and much more robust dynamic
   blocks which could be multiply nested. It did all this with regular
   expressions and the code turned out to be rather, shall we say,
   impenetrable. It was also noticably slow in large applications from all
   the parsing and regular expression work it had to do on each
   invocation. The biggest problem from a programmer's point of view was
   all the necessary work in the PHP script to setup and process templates
   and dynamic blocks. How do we make this easier?
  </para>
  <para>
   Then came the vision of what ultimately became Smarty. We know how fast
   PHP code is without the overhead of template parsing. We also know how
   meticulous and overbearing the PHP language may look to the average
   designer, and this could be masked with a much simpler templating
   syntax. So what if we combined the two strengths? Thus, Smarty was
   born...
  </para>
 </preface>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.