mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-07 11:54:26 +02:00
Formatting of the basic-syntax dir
This commit is contained in:
@@ -17,18 +17,21 @@
|
|||||||
|
|
||||||
<para>
|
<para>
|
||||||
Including literal content is possible using <link
|
Including literal content is possible using <link
|
||||||
linkend="language.function.literal">{literal} .. {/literal}</link> blocks.
|
linkend="language.function.literal">
|
||||||
|
<varname>{literal}..{/literal}</varname></link> blocks.
|
||||||
Similar to HTML entity usage, you can use <link
|
Similar to HTML entity usage, you can use <link
|
||||||
linkend="language.function.ldelim">{ldelim}</link>,<link
|
linkend="language.function.ldelim"><varname>{ldelim}</varname></link>,<link
|
||||||
linkend="language.function.ldelim">{rdelim}</link> or <link
|
linkend="language.function.ldelim"><varname>{rdelim}</varname></link> or <link
|
||||||
linkend="language.variables.smarty.ldelim">{$smarty.ldelim}</link>
|
linkend="language.variables.smarty.ldelim">
|
||||||
to display the current delimiters.
|
<varname>{$smarty.ldelim}</varname></link> to display the current delimiters.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
It is often convenient to simply change Smarty's <link
|
It is often convenient to simply change Smarty's <link
|
||||||
linkend="variable.left.delimiter">$left_delimiter</link> and
|
linkend="variable.left.delimiter">
|
||||||
<link linkend="variable.right.delimiter">$right_delimiter</link>.
|
<parameter>$left_delimiter</parameter></link> and
|
||||||
|
<link linkend="variable.right.delimiter">
|
||||||
|
<parameter>$right_delimiter</parameter></link>.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>changing delimiters example</title>
|
<title>changing delimiters example</title>
|
||||||
@@ -36,9 +39,9 @@
|
|||||||
<![CDATA[
|
<![CDATA[
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$smarty = new Smarty;
|
|
||||||
$smarty->left_delimiter = '<!--{';
|
$smarty->left_delimiter = '<!--{';
|
||||||
$smarty->right_delimiter = '}-->';
|
$smarty->right_delimiter = '}-->';
|
||||||
|
|
||||||
$smarty->assign('foo', 'bar');
|
$smarty->assign('foo', 'bar');
|
||||||
$smarty->assign('name', 'Albert');
|
$smarty->assign('name', 'Albert');
|
||||||
$smarty->display('example.tpl');
|
$smarty->display('example.tpl');
|
||||||
@@ -47,7 +50,7 @@ $smarty->display('example.tpl');
|
|||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
<para>
|
<para>
|
||||||
Where example.tpl is:
|
Where the template is:
|
||||||
</para>
|
</para>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
@@ -62,9 +65,6 @@ Welcome <!--{$name}--> to Smarty
|
|||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
<para>
|
|
||||||
See also <link linkend="language.modifier.escape">escape modifier</link>
|
|
||||||
</para>
|
|
||||||
</sect1>
|
</sect1>
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
Local variables:
|
Local variables:
|
||||||
|
@@ -27,7 +27,9 @@
|
|||||||
</example>
|
</example>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
See also the <link linkend="language.function.math">{math}</link> function for complex equations.
|
See also the <link linkend="language.function.math">
|
||||||
|
<varname>{math}</varname></link> function for complex equations
|
||||||
|
and <link linkend="language.function.eval"><varname>{eval}</varname></link>.
|
||||||
</para>
|
</para>
|
||||||
</sect1>
|
</sect1>
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
tags like so: <emphasis>{* this is a comment *}</emphasis>
|
tags like so: <emphasis>{* this is a comment *}</emphasis>
|
||||||
Smarty comments are NOT displayed in the final output of the template,
|
Smarty comments are NOT displayed in the final output of the template,
|
||||||
unlike <!-- HTML comments -->
|
unlike <!-- HTML comments -->
|
||||||
these are useful for making internal notes in the templates which no one will see;-).
|
these are useful for making internal notes in the templates which no one will see ;-)
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>Comments within a template</title>
|
<title>Comments within a template</title>
|
||||||
|
@@ -8,11 +8,11 @@
|
|||||||
of function. These are processed and displayed by enclosing the
|
of function. These are processed and displayed by enclosing the
|
||||||
function and its
|
function and its
|
||||||
<link linkend="language.syntax.attributes">attributes</link>
|
<link linkend="language.syntax.attributes">attributes</link>
|
||||||
within delimiters like so: {funcname
|
within delimiters like so:
|
||||||
attr1='val1' attr2='val2'}.
|
<literal>{funcname attr1='val1' attr2='val2'}</literal>.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>function syntax</title>
|
<title>function syntax </title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
{config_load file='colors.conf'}
|
{config_load file='colors.conf'}
|
||||||
@@ -30,28 +30,35 @@
|
|||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
<para>
|
|
||||||
|
<itemizedlist>
|
||||||
|
<listitem><para>
|
||||||
Both <link linkend="language.builtin.functions">built-in functions</link>
|
Both <link linkend="language.builtin.functions">built-in functions</link>
|
||||||
and <link linkend="language.custom.functions">custom functions</link>
|
and <link linkend="language.custom.functions">custom functions</link>
|
||||||
have the same syntax within templates.
|
have the same syntax within templates.
|
||||||
</para>
|
</para></listitem>
|
||||||
<para>Built-in functions are the
|
|
||||||
|
<listitem><para>Built-in functions are the
|
||||||
<emphasis role="bold">inner</emphasis> workings of Smarty, such as
|
<emphasis role="bold">inner</emphasis> workings of Smarty, such as
|
||||||
<link linkend="language.function.if">{if}</link>,
|
<link linkend="language.function.if"><varname>{if}</varname></link>,
|
||||||
<link linkend="language.function.section">{section}</link> and
|
<link linkend="language.function.section"><varname>{section}</varname></link> and
|
||||||
<link linkend="language.function.strip">{strip}</link>.
|
<link linkend="language.function.strip"><varname>{strip}</varname></link>.
|
||||||
There should be no need to change or modify them.
|
There should be no need to change or modify them.
|
||||||
</para>
|
</para></listitem>
|
||||||
<para>Custom functions are <emphasis role="bold">additional</emphasis>
|
|
||||||
|
<listitem><para>Custom functions are
|
||||||
|
<emphasis role="bold">additional</emphasis>
|
||||||
functions implemented via <link linkend="plugins">plugins</link>.
|
functions implemented via <link linkend="plugins">plugins</link>.
|
||||||
They can be modified to your liking, or you can create new ones.
|
They can be modified to your liking, or you can create new ones.
|
||||||
<link linkend="language.function.html.options">{html_options}</link> and
|
<link linkend="language.function.html.options">
|
||||||
<link linkend="language.function.popup">{popup}</link>
|
<varname>{html_options}</varname></link> and
|
||||||
|
<link linkend="language.function.popup"><varname>{popup}</varname></link>
|
||||||
are examples of custom functions.
|
are examples of custom functions.
|
||||||
</para>
|
</para></listitem>
|
||||||
|
</itemizedlist>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
See also <link linkend="api.register.function">register_function()</link>
|
See also <link linkend="api.register.function"><varname>register_function()</varname></link>
|
||||||
</para>
|
</para>
|
||||||
</sect1>
|
</sect1>
|
||||||
|
|
||||||
|
@@ -7,12 +7,13 @@
|
|||||||
linkend="api.assign">assigned</link>
|
linkend="api.assign">assigned</link>
|
||||||
<link linkend="language.syntax.variables">variables</link>
|
<link linkend="language.syntax.variables">variables</link>
|
||||||
embedded in double quotes so long as the variable name contains only numbers,
|
embedded in double quotes so long as the variable name contains only numbers,
|
||||||
letters, underscores and brackets []. With any other characters (period,
|
letters, underscores and brackets[]
|
||||||
|
(see <ulink url="&url.php-manual;language.variables">naming</ulink>).
|
||||||
|
With any other characters (period,
|
||||||
object reference, etc.) the variable must be surrounded by
|
object reference, etc.) the variable must be surrounded by
|
||||||
<link linkend="language.syntax.quotes">backticks</link>. You
|
`backticks`. You cannot embed
|
||||||
cannot embed
|
<link linkend="language.modifiers">modifiers</link>, they must always
|
||||||
<link linkend="language.modifiers">modifiers</link>,
|
be applied outside of quotes.
|
||||||
they must always be applied outside of quotes.
|
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>embedded quotes syntax</title>
|
<title>embedded quotes syntax</title>
|
||||||
@@ -34,7 +35,7 @@ PRACTICAL EXAMPLES:
|
|||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
<para>
|
<para>
|
||||||
See also <link linkend="language.modifier.escape">escape</link>.
|
See also <link linkend="language.modifier.escape"><varname>escape</varname></link>.
|
||||||
</para>
|
</para>
|
||||||
</sect1>
|
</sect1>
|
||||||
|
|
||||||
|
@@ -14,7 +14,8 @@
|
|||||||
are an exception to the $dollar syntax
|
are an exception to the $dollar syntax
|
||||||
and are instead referenced with surrounding #hashmarks#, or
|
and are instead referenced with surrounding #hashmarks#, or
|
||||||
via the
|
via the
|
||||||
<link linkend="language.variables.smarty.config">$smarty.config</link> variable.
|
<link linkend="language.variables.smarty.config">
|
||||||
|
<parameter>$smarty.config</parameter></link> variable.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>Variables</title>
|
<title>Variables</title>
|
||||||
@@ -47,16 +48,19 @@ Many other combinations are allowed
|
|||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
|
|
||||||
<para>Request variables such as $_GET, $_SESSION etc are available via the <emphasis role="bold">
|
<para>Request variables such as <literal>$_GET</literal>,
|
||||||
<link linkend="language.variables.smarty">$smarty</link></emphasis> reserved variable.
|
<literal>$_SESSION</literal>, etc are available via the
|
||||||
|
reserved <link linkend="language.variables.smarty">
|
||||||
|
<parameter>$smarty</parameter></link> variable.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
See also <link linkend="language.variables.smarty">$smarty reserved variables</link>,
|
See also <link linkend="language.variables.smarty">
|
||||||
<link linkend="language.config.variables">Config Variables</link>
|
<parameter>$smarty</parameter></link>,
|
||||||
<link linkend="language.function.assign">{assign}</link>
|
<link linkend="language.config.variables">config variables</link>
|
||||||
|
<link linkend="language.function.assign"><varname>{assign}</varname></link>
|
||||||
and
|
and
|
||||||
<link linkend="api.assign">assign()</link>.
|
<link linkend="api.assign"><varname>assign()</varname></link>.
|
||||||
</para>
|
</para>
|
||||||
</sect1>
|
</sect1>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user