2004-04-13 08:46:28 +00:00
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ -->
2004-04-18 17:34:12 +00:00
<sect1 id= "language.syntax.functions" >
<title > Functions</title>
<para >
Each 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
function and its attributes into delimiters like so: {funcname
attr1="val" attr2="val"}.
</para>
<example >
<title > function syntax</title>
<programlisting >
2004-04-13 08:46:28 +00:00
< ![CDATA[
{config_load file="colors.conf"}
{include file="header.tpl"}
{if $highlight_name}
Welcome, <font color= "{#fontColor#}" > {$name}!</font>
{else}
Welcome, {$name}!
{/if}
{include file="footer.tpl"}
]]>
2004-04-18 17:34:12 +00:00
</programlisting>
</example>
<para >
Both built-in functions and custom functions have the same syntax in
the templates. Built-in functions are the inner workings of Smarty,
2005-05-08 19:47:01 +00:00
such as <link linkend= "language.function.if" > <command > if</command> </link> , <link linkend= "language.function.section" > <command > section</command> </link> and
<link linkend= "language.function.strip" > <command > strip</command> </link> . They cannot be modified. Custom functions are
2004-04-18 17:34:12 +00:00
additional functions implemented via plugins. They can be modified to
2005-05-08 19:47:01 +00:00
your liking, or you can add new ones. <link linkend= "language.function.html.options" > <command > html_options</command> </link> and
<link linkend= "language.function.html.select.date" > <command > html_select_date</command> </link> are examples of custom functions.
2004-04-18 17:34:12 +00:00
</para>
2004-04-13 08:46:28 +00:00
</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
2004-04-18 17:34:12 +00:00
-->