Files
smarty/docs/ru/designers/language-variables/language-config-variables.xml
tony2001 64e51b0e1e multiple ws fixes
added EN-Revision tags everywhere
2004-07-19 13:11:36 +00:00

102 lines
2.3 KiB
XML

<?xml version="1.0" encoding="windows-1251"?>
<!-- $Revision$ -->
<!-- EN-Revision: 1.1 Maintainer: tony2001 Status: ready -->
<sect1 id="language.config.variables">
<title>Ïåðåìåííûå ôàéëîâ êîíôèãóðàöèè</title>
<para>
Äëÿ èñïîëüçîâàíèÿ ïåðåìåííûõ, ïîëó÷åííûõ èç ôàéëîâ êîíôèãóðàèè,
íåîáõîäèìî çàêëþ÷èòü èõ èìÿ ìåæäó çíàêàìè # èëè ÷åðåç ïåðåìåííóþ
<link linkend="language.variables.smarty.config">$smarty.config</link>.
Äëÿ óïîòðåáëåíèÿ èõ â êà÷åñòâå âíåäðåííûûõ ïåðåìåííûõ ìîæíî
èñïîëüçîâàòü òîëüêî âòîðîé ñïîñîá.
</para>
<example>
<title>Ïåðåìåííûå èç ôàéëîâ êîíôèãóðàöèè</title>
<programlisting>
<![CDATA[
foo.conf:
pageTitle = "This is mine"
bodyBgColor = "#eeeeee"
tableBorderSize = "3"
tableBgColor = "#bbbbbb"
rowBgColor = "#cccccc"
index.tpl:
{config_load file="foo.conf"}
<html>
<title>{#pageTitle#}</title>
<body bgcolor="{#bodyBgColor#}">
<table border="{#tableBorderSize#}" bgcolor="{#tableBgColor#}">
<tr bgcolor="{#rowBgColor#}">
<td>First</td>
<td>Last</td>
<td>Address</td>
</tr>
</table>
</body>
</html>
index.tpl: (alternate syntax)
{config_load file="foo.conf"}
<html>
<title>{$smarty.config.pageTitle}</title>
<body bgcolor="{$smarty.config.bodyBgColor}">
<table border="{$smarty.config.tableBorderSize}" bgcolor="{$smarty.config.tableBgColor}">
<tr bgcolor="{$smarty.config.rowBgColor}">
<td>First</td>
<td>Last</td>
<td>Address</td>
</tr>
</table>
</body>
</html>
OUTPUT: (same for both examples)
<html>
<title>This is mine</title>
<body bgcolor="#eeeeee">
<table border="3" bgcolor="#bbbbbb">
<tr bgcolor="#cccccc">
<td>First</td>
<td>Last</td>
<td>Address</td>
</tr>
</table>
</body>
</html>
]]>
</programlisting>
</example>
<para>
Ïåðåìåííûå èç ôàéëîâ êîíôèãóðàöèè íå ìîãóò áûòü èñïîëüçîâàíû,
ïîêà îíè íå áóäóò çàãðóæåíû. Ýòà ïðîöåäóðà îïèñàíà äàëåå
â äàííîì ðóêîâîäñòâå (<command>config_load</command>).
</para>
</sect1>
<!-- 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
-->