mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-07 03:44:26 +02:00
tweeks
This commit is contained in:
@@ -5,18 +5,21 @@
|
|||||||
<para>
|
<para>
|
||||||
Template comments are surrounded by asterisks, and that is surrounded
|
Template comments are surrounded by asterisks, and that is surrounded
|
||||||
by the
|
by the
|
||||||
<link linkend="variable.left.delimiter"> delimiter</link>
|
<link linkend="variable.left.delimiter">delimiter</link>
|
||||||
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 -->
|
||||||
and are useful for making internal notes in the templates.
|
these are useful for making internal notes in the templates which no one will see;-).
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>Comments</title>
|
<title>Comments within a template</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
<body>
|
|
||||||
{* I am a Smarty comment, I don't exist in the compiled output *}
|
{* I am a Smarty comment, I don't exist in the compiled output *}
|
||||||
|
<html>
|
||||||
|
<title>{$title}</title>
|
||||||
|
</html>
|
||||||
|
<body>
|
||||||
|
|
||||||
{* another single line smarty comment *}
|
{* another single line smarty comment *}
|
||||||
<!-- HTML comment that is sent to the browser -->
|
<!-- HTML comment that is sent to the browser -->
|
||||||
@@ -34,11 +37,11 @@ Multi line comment block with credits block
|
|||||||
@ css: the style output
|
@ css: the style output
|
||||||
**********************************************************}
|
**********************************************************}
|
||||||
|
|
||||||
{* include the header file *}
|
{* The header file with the main logo and stuff *}
|
||||||
{include file='header.tpl'}
|
{include file='header.tpl'}
|
||||||
|
|
||||||
|
|
||||||
{* Dev note: the $includeFile is assigned in foo.php script *}
|
{* Dev note: the $includeFile var is assigned in foo.php script *}
|
||||||
<!-- Displays main content block -->
|
<!-- Displays main content block -->
|
||||||
{include file=$includeFile}
|
{include file=$includeFile}
|
||||||
|
|
||||||
@@ -49,9 +52,10 @@ Multi line comment block with credits block
|
|||||||
</select>
|
</select>
|
||||||
*}
|
*}
|
||||||
|
|
||||||
{* cvs tag for a template *}
|
{* cvs tag for a template, below the 36 SHOULD be an american currency
|
||||||
|
. however its converted in cvs.. *}
|
||||||
{* $Id: Exp $ *}
|
{* $Id: Exp $ *}
|
||||||
|
{* $Id: *}
|
||||||
</body>
|
</body>
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
|
@@ -3,13 +3,13 @@
|
|||||||
<sect1 id="language.syntax.functions">
|
<sect1 id="language.syntax.functions">
|
||||||
<title>Functions</title>
|
<title>Functions</title>
|
||||||
<para>
|
<para>
|
||||||
Each Smarty tag either prints a
|
Every Smarty tag either prints a
|
||||||
<link linkend="language.variables">variable</link> or invokes some sort
|
<link linkend="language.variables">variable</link> or invokes some sort
|
||||||
of function. Functions 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>
|
||||||
into delimiters like so: {funcname
|
within delimiters like so: {funcname
|
||||||
attr1='val1' attr2='val2'}.
|
attr1='val1' attrto='val2'}.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>function syntax</title>
|
<title>function syntax</title>
|
||||||
@@ -20,10 +20,10 @@
|
|||||||
{include file='header.tpl'}
|
{include file='header.tpl'}
|
||||||
{insert file='banner_ads.tpl'}
|
{insert file='banner_ads.tpl'}
|
||||||
|
|
||||||
{if $highlight_name}
|
{if $logged_in}
|
||||||
Welcome, <font color="{#fontColor#}">{$name}!</font>
|
Welcome, <font color="{#fontColor#}">{$name}!</font>
|
||||||
{else}
|
{else}
|
||||||
Welcome, {$name}!
|
hi, {$name}
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{include file='footer.tpl'}
|
{include file='footer.tpl'}
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
<link linkend="language.function.if">{if}</link>,
|
<link linkend="language.function.if">{if}</link>,
|
||||||
<link linkend="language.function.section">{section}</link> and
|
<link linkend="language.function.section">{section}</link> and
|
||||||
<link linkend="language.function.strip">{strip}</link>.
|
<link linkend="language.function.strip">{strip}</link>.
|
||||||
They should not be modified.
|
There should be no need to change or modify them.
|
||||||
</para>
|
</para>
|
||||||
<para>Custom functions are <emphasis role="bold">additional</emphasis>
|
<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>.
|
||||||
@@ -49,6 +49,10 @@
|
|||||||
<link linkend="language.function.popup">{popup}</link>
|
<link linkend="language.function.popup">{popup}</link>
|
||||||
are examples of custom functions.
|
are examples of custom functions.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
See also <link linkend="api.register.function">register_function()</link>
|
||||||
|
</para>
|
||||||
</sect1>
|
</sect1>
|
||||||
|
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
|
@@ -3,16 +3,17 @@
|
|||||||
<sect1 id="language.syntax.variables">
|
<sect1 id="language.syntax.variables">
|
||||||
<title>Variables</title>
|
<title>Variables</title>
|
||||||
<para>
|
<para>
|
||||||
Template variables start with a $dollar sign. They can contain numbers,
|
Template variables start with the $dollar sign. They can contain numbers,
|
||||||
letters and underscores, much like a
|
letters and underscores, much like a
|
||||||
<ulink url="&url.php-manual;language.variables">PHP variable</ulink>.
|
<ulink url="&url.php-manual;language.variables">PHP variable</ulink>.
|
||||||
You can reference arrays
|
You can reference arrays
|
||||||
that are indexed numerically or non-numerically. You can also reference
|
by index numerically or non-numerically. Also reference
|
||||||
object properties and methods.
|
object properties and methods.</para>
|
||||||
|
<para>
|
||||||
<link linkend="language.config.variables">Config file variables</link>
|
<link linkend="language.config.variables">Config file variables</link>
|
||||||
are an exception to the dollar sign syntax.
|
are an exception to the $dollar syntax.
|
||||||
They can be referenced with surrounding #hashmarks#, or
|
and are instead referenced with surrounding #hashmarks#, or
|
||||||
with the special
|
via the
|
||||||
<link linkend="language.variables.smarty.config">$smarty.config</link> variable.
|
<link linkend="language.variables.smarty.config">$smarty.config</link> variable.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
@@ -28,7 +29,7 @@
|
|||||||
{#foo#} <-- display the config file variable "foo"
|
{#foo#} <-- display the config file variable "foo"
|
||||||
{$smarty.config.foo} <-- synonym for {#foo#}
|
{$smarty.config.foo} <-- synonym for {#foo#}
|
||||||
{$foo[bar]} <-- syntax only valid in a section loop, see {section}
|
{$foo[bar]} <-- syntax only valid in a section loop, see {section}
|
||||||
{assign var=foo value="baa"}{$foo} <-- displays "baa", see {assign}
|
{assign var=foo value='baa'}{$foo} <-- displays "baa", see {assign}
|
||||||
|
|
||||||
Many other combinations are allowed
|
Many other combinations are allowed
|
||||||
|
|
||||||
@@ -46,8 +47,8 @@ Many other combinations are allowed
|
|||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
|
|
||||||
<para>Request variables such as get, post, session etc are also available, see the
|
<para>Request variables such as $_GET, $_SESSION etc are available with the <emphasis role="bold">
|
||||||
<link linkend="language.variables.smarty">$smarty</link> reserved variable for more details.
|
<link linkend="language.variables.smarty">$smarty</link></emphasis> reserved variable.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
|
Reference in New Issue
Block a user