Files
smarty/docs/en/designers/language-basic-syntax/language-syntax-functions.xml

85 lines
2.5 KiB
XML
Raw Normal View History

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>
2006-03-27 23:57:45 +00:00
Every Smarty tag either prints a
2004-04-18 17:34:12 +00:00
<link linkend="language.variables">variable</link> or invokes some sort
2006-03-27 23:57:45 +00:00
of function. These are processed and displayed by enclosing the
2005-05-27 16:25:02 +00:00
function and its
<link linkend="language.syntax.attributes">attributes</link>
2006-09-26 02:42:08 +00:00
within delimiters like so:
<literal>{funcname attr1='val1' attr2='val2'}</literal>.
2004-04-18 17:34:12 +00:00
</para>
<example>
2006-09-26 02:42:08 +00:00
<title>function syntax </title>
2004-04-18 17:34:12 +00:00
<programlisting>
2004-04-13 08:46:28 +00:00
<![CDATA[
2006-03-13 21:56:39 +00:00
{config_load file='colors.conf'}
2004-04-13 08:46:28 +00:00
2006-03-13 21:56:39 +00:00
{include file='header.tpl'}
2006-03-28 00:16:33 +00:00
{insert file='banner_ads.tpl' title='Smarty is cool'}
2004-04-13 08:46:28 +00:00
2006-03-27 23:57:45 +00:00
{if $logged_in}
2004-04-13 08:46:28 +00:00
Welcome, <font color="{#fontColor#}">{$name}!</font>
{else}
2006-03-27 23:57:45 +00:00
hi, {$name}
2004-04-13 08:46:28 +00:00
{/if}
2006-03-28 00:16:33 +00:00
{include file='footer.tpl' ad=$random_id}
2004-04-13 08:46:28 +00:00
]]>
2004-04-18 17:34:12 +00:00
</programlisting>
</example>
2006-09-26 02:42:08 +00:00
<itemizedlist>
<listitem><para>
2005-05-21 12:41:15 +00:00
Both <link linkend="language.builtin.functions">built-in functions</link>
and <link linkend="language.custom.functions">custom functions</link>
2005-05-27 16:25:02 +00:00
have the same syntax within templates.
2006-09-26 02:42:08 +00:00
</para></listitem>
<listitem><para>Built-in functions are the
2005-05-27 16:25:02 +00:00
<emphasis role="bold">inner</emphasis> workings of Smarty, such as
2006-09-26 02:42:08 +00:00
<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>.
2006-03-27 23:57:45 +00:00
There should be no need to change or modify them.
2006-09-26 02:42:08 +00:00
</para></listitem>
<listitem><para>Custom functions are
<emphasis role="bold">additional</emphasis>
2005-05-27 16:25:02 +00:00
functions implemented via <link linkend="plugins">plugins</link>.
2006-03-13 21:56:39 +00:00
They can be modified to your liking, or you can create new ones.
2006-09-26 02:42:08 +00:00
<link linkend="language.function.html.options">
<varname>{html_options}</varname></link> and
<link linkend="language.function.popup"><varname>{popup}</varname></link>
2005-05-21 12:41:15 +00:00
are examples of custom functions.
2006-09-26 02:42:08 +00:00
</para></listitem>
</itemizedlist>
2006-03-27 23:57:45 +00:00
<para>
2006-09-26 02:42:08 +00:00
See also <link linkend="api.register.function"><varname>register_function()</varname></link>
2006-03-27 23:57:45 +00:00
</para>
2004-04-13 08:46:28 +00:00
</sect1>
2005-05-21 12:41:15 +00:00
2004-04-13 08:46:28 +00:00
<!-- 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
-->