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