Files
smarty/docs/en/designers/language-basic-syntax/language-syntax-functions.xml
2006-09-26 02:42:08 +00:00

85 lines
2.5 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ -->
<sect1 id="language.syntax.functions">
<title>Functions</title>
<para>
Every Smarty tag either prints a
<link linkend="language.variables">variable</link> or invokes some sort
of function. These are processed and displayed by enclosing the
function and its
<link linkend="language.syntax.attributes">attributes</link>
within delimiters like so:
<literal>{funcname attr1='val1' attr2='val2'}</literal>.
</para>
<example>
<title>function syntax </title>
<programlisting>
<![CDATA[
{config_load file='colors.conf'}
{include file='header.tpl'}
{insert file='banner_ads.tpl' title='Smarty is cool'}
{if $logged_in}
Welcome, <font color="{#fontColor#}">{$name}!</font>
{else}
hi, {$name}
{/if}
{include file='footer.tpl' ad=$random_id}
]]>
</programlisting>
</example>
<itemizedlist>
<listitem><para>
Both <link linkend="language.builtin.functions">built-in functions</link>
and <link linkend="language.custom.functions">custom functions</link>
have the same syntax within templates.
</para></listitem>
<listitem><para>Built-in functions are the
<emphasis role="bold">inner</emphasis> workings of Smarty, such as
<link linkend="language.function.if"><varname>{if}</varname></link>,
<link linkend="language.function.section"><varname>{section}</varname></link> and
<link linkend="language.function.strip"><varname>{strip}</varname></link>.
There should be no need to change or modify them.
</para></listitem>
<listitem><para>Custom functions are
<emphasis role="bold">additional</emphasis>
functions implemented via <link linkend="plugins">plugins</link>.
They can be modified to your liking, or you can create new ones.
<link linkend="language.function.html.options">
<varname>{html_options}</varname></link> and
<link linkend="language.function.popup"><varname>{popup}</varname></link>
are examples of custom functions.
</para></listitem>
</itemizedlist>
<para>
See also <link linkend="api.register.function"><varname>register_function()</varname></link>
</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
-->