cvs: smarty /docs/en/designers/language-variables language-assigned-variables.xml language-config-variables.xml language-variables-smarty.xml
[email protected] ("Peter 'Mash' Morgan") Tue, 26 Sep 2006 03:44:02 -0000
| Newsgroups | php.smarty.cvs |
|---|---|
| Message-ID | <cvspete_morgan1159242242@cvsserver> |
pete_morgan Tue Sep 26 03:44:02 2006 UTC
Modified files:
/smarty/docs/en/designers/language-variables
language-assigned-variables.xml
language-config-variables.xml
language-variables-smarty.xml
Log:
Tidy up formatting on variables
pete_morgan-20060926034402.txt
(text/plain, 16.9 KB)
http://cvs.php.net/viewvc.cgi/smarty/docs/en/designers/language-variables/language-assigned-variables.xml?r1=1.7&r2=1.8&diff_format=u
Index: smarty/docs/en/designers/language-variables/language-assigned-variables.xml
diff -u smarty/docs/en/designers/language-variables/language-assigned-variables.xml:1.7 smarty/docs/en/designers/language-variables/language-assigned-variables.xml:1.8
--- smarty/docs/en/designers/language-variables/language-assigned-variables.xml:1.7 Fri Dec 9 19:47:34 2005
+++ smarty/docs/en/designers/language-variables/language-assigned-variables.xml Tue Sep 26 03:44:02 2006
@@ -1,22 +1,24 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.7 $ -->
+<!-- $Revision: 1.8 $ -->
<sect1 id="language.assigned.variables">
<title>Variables assigned from PHP</title>
<para>
Variables that are
- <link linkend="api.assign">assigned</link> from PHP are referenced by preceding them with
- a dollar sign <literal>$</literal>. Variables assigned from within a
- template with the <link linkend="language.function.assign">{assign}</link>
+ <link linkend="api.assign">assigned</link> from PHP are referenced by
+ preceding them with a dollar sign <literal>$</literal> (like php).
+ Variables assigned from within a template with the
+ <link linkend="language.function.assign"><varname>{assign}</varname></link>
function are also displayed this way.
</para>
+
<example>
- <title>assigned variables</title>
+ <title>Assigned variables</title>
<para> php script</para>
<programlisting role="php">
<![CDATA[
<?php
-$smarty = new Smarty;
+$smarty = new Smarty();
$smarty->assign('firstname', 'Doug');
$smarty->assign('lastname', 'Evans');
@@ -28,13 +30,13 @@
]]>
</programlisting>
<para>
- where the content of index.tpl is:
+ where the content of <filename>index.tpl</filename> is:
</para>
<programlisting>
<![CDATA[
Hello {$firstname} {$lastname}, glad to see you can make it.
<br />
-{* this will not work as $vars are case sensitive *}
+{* this will not work as $variables are case sensitive *}
This weeks meeting is in {$meetingplace}.
{* this will work *}
This weeks meeting is in {$meetingPlace}.
@@ -42,7 +44,7 @@
</programlisting>
<para>
- This will output:
+ This above would output:
</para>
<screen>
<![CDATA[
@@ -53,6 +55,8 @@
]]>
</screen>
</example>
+
+
<sect2 id="language.variables.assoc.arrays">
<title>Associative arrays</title>
<para>
@@ -61,7 +65,7 @@
symbol.
</para>
<example>
- <title>accessing associative array variables</title>
+ <title>Accessing associative array variables</title>
<programlisting role="php">
<![CDATA[
<?php
@@ -77,7 +81,7 @@
]]>
</programlisting>
<para>
- where the content of index.tpl is:
+ where the content of <filename>index.tpl</filename> is:
</para>
<programlisting>
<![CDATA[
@@ -101,14 +105,15 @@
</screen>
</example>
</sect2>
+
+
<sect2 id="language.variables.array.indexes">
<title>Array indexes</title>
<para>
- You can reference arrays by their index, much like native PHP
- syntax.
+ You can reference arrays by their index, much like native PHP syntax.
</para>
<example>
- <title>accessing arrays by index</title>
+ <title>Accessing arrays by index</title>
<programlisting role="php">
<![CDATA[
<?php
@@ -123,7 +128,7 @@
]]>
</programlisting>
<para>
- where index.tpl is:
+ where <filename>index.tpl</filename> is:
</para>
<programlisting>
<![CDATA[
@@ -147,18 +152,20 @@
</screen>
</example>
</sect2>
+
+
<sect2 id="language.variables.objects">
<title>Objects</title>
<para>
Properties of <link linkend="advanced.features.objects">objects</link>
assigned from PHP can be referenced by specifying the property
- name after the '->' symbol.
+ name after the <literal>-></literal> symbol.
</para>
<example>
- <title>accessing object properties</title>
+ <title>Accessing object properties</title>
<programlisting>
<![CDATA[
-name: {$person->name}<br />
+name: {$person->name}<br />
email: {$person->email}<br />
]]>
</programlisting>
@@ -167,7 +174,7 @@
</para>
<screen>
<![CDATA[
-name: Zaphod Beeblebrox<br />
+name: Zaphod Beeblebrox<br />
email: [email protected]<br />
]]>
</screen>
http://cvs.php.net/viewvc.cgi/smarty/docs/en/designers/language-variables/language-config-variables.xml?r1=1.4&r2=1.5&diff_format=u
Index: smarty/docs/en/designers/language-variables/language-config-variables.xml
diff -u smarty/docs/en/designers/language-variables/language-config-variables.xml:1.4 smarty/docs/en/designers/language-variables/language-config-variables.xml:1.5
--- smarty/docs/en/designers/language-variables/language-config-variables.xml:1.4 Fri May 27 16:25:01 2005
+++ smarty/docs/en/designers/language-variables/language-config-variables.xml Tue Sep 26 03:44:02 2006
@@ -1,45 +1,44 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.4 $ -->
+<!-- $Revision: 1.5 $ -->
<sect1 id="language.config.variables">
- <title>Variables loaded from config files</title>
- <para>
+ <title>Variables loaded from config files</title>
+ <para>
Variables that are loaded from the
<link linkend="config.files">config files</link>
- are referenced by
- enclosing them within hash marks (#), or with the smarty variable
- <link
- linkend="language.variables.smarty.config">$smarty.config</link>.
- The second syntax is useful for embedding into quoted attribute
- values.
- </para>
+ are referenced by enclosing them within <literal>#hash marks#</literal>,
+ or with the smarty variable
+ <link linkend="language.variables.smarty.config">
+ <parameter>$smarty.config</parameter></link>.
+ The later syntax is useful for embedding into quoted attribute values.
+ </para>
<example>
<title>config variables</title>
<para>
- foo.conf:
+ Example config file - <filename>foo.conf</filename>:
</para>
<programlisting>
<![CDATA[
pageTitle = "This is mine"
-bodyBgColor = "#eeeeee"
-tableBorderSize = "3"
+bodyBgColor = '#eeeeee'
+tableBorderSize = 3
tableBgColor = "#bbbbbb"
rowBgColor = "#cccccc"
]]>
</programlisting>
<para>
- index.tpl:
+ A template demonstrating the <parameter>#hash#</parameter> method:
</para>
<programlisting>
<![CDATA[
-{config_load file="foo.conf"}
+{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>
+ <td>First</td>
+ <td>Last</td>
+ <td>Address</td>
</tr>
</table>
</body>
@@ -47,19 +46,21 @@
]]>
</programlisting>
<para>
- index.tpl: (alternate syntax)
+ A template demonstrating the
+ <link linkend="language.variables.smarty.config">
+ <parameter>$smarty.config</parameter></link> method:
</para>
<programlisting>
<![CDATA[
-{config_load file="foo.conf"}
+{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>
+ <td>First</td>
+ <td>Last</td>
+ <td>Address</td>
</tr>
</table>
</body>
@@ -67,7 +68,7 @@
]]>
</programlisting>
<para>
- this will output for both examples:
+ Both examples would output:
</para>
<screen>
<![CDATA[
@@ -90,7 +91,8 @@
Config file variables cannot be used until
after they are loaded in from a config file. This procedure is
explained later in this document under
- <link linkend="language.function.config.load"><command>{config_load}</command></link>.
+ <link linkend="language.function.config.load">
+ <varname>{config_load}</varname></link>.
</para>
<para>
See also <link linkend="language.syntax.variables">Variables</link> and
http://cvs.php.net/viewvc.cgi/smarty/docs/en/designers/language-variables/language-variables-smarty.xml?r1=1.15&r2=1.16&diff_format=u
Index: smarty/docs/en/designers/language-variables/language-variables-smarty.xml
diff -u smarty/docs/en/designers/language-variables/language-variables-smarty.xml:1.15 smarty/docs/en/designers/language-variables/language-variables-smarty.xml:1.16
--- smarty/docs/en/designers/language-variables/language-variables-smarty.xml:1.15 Mon Apr 10 20:18:14 2006
+++ smarty/docs/en/designers/language-variables/language-variables-smarty.xml Tue Sep 26 03:44:02 2006
@@ -1,23 +1,28 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.15 $ -->
+<!-- $Revision: 1.16 $ -->
<sect1 id="language.variables.smarty">
<title>{$smarty} reserved variable</title>
<para>
- The PHP reserved {$smarty} variable can be used to access several
- enviroment and request variables. The full list of them follows.
+ The PHP reserved <parameter>{$smarty}</parameter> variable can be used to
+ access several enviroment and request variables.
+ The full list of them follows.
</para>
+
<sect2 id="language.variables.smarty.request">
<title>Request variables</title>
<para>
The <ulink url="&url.php-manual;reserved.variables">request variables
- </ulink> such as $_GET, $_POST, $_COOKIE, $_SERVER, $_ENV and $_SESSION
- (see <link linkend="variable.request.vars.order">$request_vars_order</link>
- and <link
- linkend="variable.request.use.auto.globals">$request_use_auto_globals</link>
- ) can be accessed as demonstrated in the examples below:
+ </ulink> such as <literal>$_GET</literal>, <literal>$_POST</literal>,
+ <literal>$_COOKIE</literal>, <literal>$_SERVER</literal>,
+ <literal>$_ENV</literal> and <literal>$_SESSION</literal>
+ (see <link linkend="variable.request.vars.order">
+ <varname>$request_vars_order</varname></link>
+ and <link linkend="variable.request.use.auto.globals">
+ <varname>$request_use_auto_globals</varname></link>)
+ can be accessed as demonstrated in the examples below:
</para>
<example>
- <title>displaying request variables</title>
+ <title>Displaying request variables</title>
<programlisting>
<![CDATA[
{* display value of page from URL ($_GET) http://www.example.com/index.php?page=foo *}
@@ -45,8 +50,8 @@
</example>
<note>
<para>
- For historical reasons {$SCRIPT_NAME} can be accessed
- directly, although {$smarty.server.SCRIPT_NAME} is the
+ For historical reasons <parameter>{$SCRIPT_NAME}</parameter> can be accessed
+ directly, although <parameter>{$smarty.server.SCRIPT_NAME}</parameter> is the
proposed way to access this value.
</para>
<programlisting>
@@ -57,45 +62,53 @@
</programlisting>
</note>
</sect2>
+
<sect2 id="language.variables.smarty.now">
<title>{$smarty.now}</title>
<para>
The current <ulink url="&url.php-manual;function.time">timestamp</ulink>
- can be accessed with {$smarty.now}. The value reflects the number of
- seconds passed since the so-called Epoch (January 1, 1970)
+ can be accessed with <parameter>{$smarty.now}</parameter>.
+ The value reflects the number of
+ seconds passed since the so-called Epoch on January 1, 1970,
and can be passed directly to the
- <link linkend="language.modifier.date.format">date_format</link>
- modifier for display purposes. Note that time() is called each invocation.
- ie a script that takes 3 seconds to execute with $smarty.now at start and end will show the 3 seconds difference.
+ <link linkend="language.modifier.date.format"><varname>date_format</varname>
+ </link> modifier for display. Note that
+ <ulink url="&url.php-manual;function.time"><varname>time()</varname></ulink>
+ is called each invocation; eg a script that takes three seconds to execute
+ with a call to <parameter>$smarty.now</parameter> at start and end
+ will show the three second difference.
</para>
<example>
- <title>using {$smarty.now}</title>
+ <title>Using {$smarty.now}</title>
<programlisting>
<![CDATA[
{* use the date_format modifier to show current date and time *}
-{$smarty.now|date_format:"%Y-%m-%d %H:%M:%S"}
+{$smarty.now|date_format:'%Y-%m-%d %H:%M:%S'}
]]>
</programlisting>
</example>
</sect2>
+
<sect2 id="language.variables.smarty.const">
<title>{$smarty.const}</title>
<para>
You can access PHP constant values directly. See also <link
- linkend="smarty.constants">smarty constants</link>
+ linkend="smarty.constants">smarty constants</link>.
</para>
<example>
- <title>using {$smarty.const} to access constants</title>
+ <title>Using {$smarty.const} to access a constant</title>
<programlisting role="php">
<![CDATA[
+<?php
// the constant defined in php
-define('_MY_CONST_VAL','CHERRIES');
+define('MY_CONST_VAL','CHERRIES');
+?>
]]>
</programlisting>
+<para>Output the constant in a template with</para>
<programlisting>
<![CDATA[
-{* the output of php constant in the template *}
-{$smarty.const._MY_CONST_VAL}
+{$smarty.const.MY_CONST_VAL}
]]>
</programlisting>
</example>
@@ -104,41 +117,47 @@
<sect2 id="language.variables.smarty.capture">
<title>{$smarty.capture}</title>
<para>
- Template output captured via the <link
- linkend="language.function.capture">{capture}..{/capture}</link>
- construct can be accessed using the {$smarty.capture} variable. See the section on
- <link linkend="language.function.capture">{capture}</link> for an
- example.
+ Template output captured via the built-in
+ <link linkend="language.function.capture">
+ <varname>{capture}..{/capture}</varname></link> function can be accessed
+ using the <parameter>{$smarty.capture}</parameter> variable.
+ See the <link linkend="language.function.capture">
+ <varname>{capture}</varname></link> page for more information.
</para>
</sect2>
<sect2 id="language.variables.smarty.config">
<title>{$smarty.config}</title>
<para>
- {$smarty} variable can be used to refer to loaded <link
- linkend="language.config.variables">config variables</link>.
- {$smarty.config.foo} is a synonym for {#foo#}. See the section on
- <link linkend="language.function.config.load">{config_load}</link>
- for an example.
+ <parameter>{$smarty.config}</parameter> variable can be used to refer
+ to loaded <link linkend="language.config.variables">config variables</link>.
+ <parameter>{$smarty.config.foo}</parameter> is a synonym for
+ <parameter>{#foo#}</parameter>. See the
+ <link linkend="language.function.config.load">{config_load}</link> page
+ for more info.
</para>
</sect2>
<sect2 id="language.variables.smarty.loops">
<title>{$smarty.section}, {$smarty.foreach}</title>
<para>
- {$smarty} variable can be used to refer to
- <link linkend="language.function.section">{section}</link> and
- <link linkend="language.function.foreach">{foreach}</link>
- loop properties. These has very useful values such as .first .index etc
+ The <parameter>{$smarty.section}</parameter> and
+ <parameter>{$smarty.foreach}</parameter> variables can be used to refer to
+ <link linkend="language.function.section"><varname>{section}</varname></link>
+ and
+ <link linkend="language.function.foreach"><varname>{foreach}</varname></link>
+ loop properties respectfully. These have some very useful values such as
+ <varname>.first</varname>, <varname>.index</varname>, etc.
</para>
</sect2>
<sect2 id="language.variables.smarty.template">
<title>{$smarty.template}</title>
<para>
- Returns the name of the current template being
- processed. This example shows the container.tpl and the included banner.tpl
- with {$smarty.template} within both
+ Returns the name of the current template being processed.
+ The following example shows the <filename>container.tpl</filename> and the
+ <filename>included banner.tpl</filename> with
+ <parameter>{$smarty.template}</parameter> within both.
</para>
<programlisting>
<![CDATA[
@@ -156,8 +175,7 @@
]]>
</programlisting>
</sect2>
-
-
+
<sect2 id="language.variables.smarty.version">
<title>{$smarty.version}</title>
<para>
@@ -168,19 +186,19 @@
<div id="footer">Powered by Smarty {$smarty.version}</div>
]]>
</programlisting>
-
-
</sect2>
+
<sect2 id="language.variables.smarty.ldelim">
<title>{$smarty.ldelim}, {$smarty.rdelim}</title>
<para>
- These variables are used for printing the left-delimiter and right-delimiter value literally,
- the same as <link linkend="language.function.ldelim">{ldelim},{rdelim}</link>.
+ These variables are used for printing the left-delimiter and right-delimiter
+ value literally, the same as <link linkend="language.function.ldelim">
+ <varname>{ldelim},{rdelim}</varname></link>.
</para>
<para>
See also
- <link linkend="language.syntax.variables">Variables</link> and
- <link linkend="language.config.variables">Config Variables</link>
+ <link linkend="language.assigned.variables">assigned variables</link> and
+ <link linkend="language.config.variables">config variables</link>
</para>
</sect2>
</sect1>