mirror of
				https://github.com/smarty-php/smarty.git
				synced 2025-11-03 22:01:36 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			73 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			XML
		
	
	
	
	
	
			
		
		
	
	
			73 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			XML
		
	
	
	
	
	
<?xml version="1.0" encoding="iso-8859-1"?>
 | 
						|
<!-- $Revision$ -->
 | 
						|
<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
 | 
						|
  <link linkend="language.syntax.attributes">attributes</link>
 | 
						|
  into delimiters like so: {funcname
 | 
						|
  attr1="val" attr2="val"}.
 | 
						|
 </para>
 | 
						|
 <example>
 | 
						|
  <title>function syntax</title>
 | 
						|
  <programlisting>
 | 
						|
<![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"}
 | 
						|
]]>
 | 
						|
  </programlisting>
 | 
						|
 </example>
 | 
						|
 <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>
 | 
						|
  <para>Built-in functions are the
 | 
						|
  <emphasis role="bold">inner</emphasis> workings of Smarty, such as
 | 
						|
  <link linkend="language.function.if">{if}</link>,
 | 
						|
  <link linkend="language.function.section">{section}</link> and
 | 
						|
  <link linkend="language.function.strip">{strip}</link>.
 | 
						|
  They cannot be modified.
 | 
						|
  </para>
 | 
						|
  <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 add new ones.
 | 
						|
  <link linkend="language.function.html.options">{html_options}</link> and
 | 
						|
  <link linkend="language.function.popup">{popup}</link>
 | 
						|
  are examples of custom functions.
 | 
						|
 </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
 | 
						|
-->
 |