| 
									
										
										
										
											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-03-27 23:57:45 +00:00
										 |  |  |   within delimiters like so: {funcname | 
					
						
							| 
									
										
										
										
											2006-03-28 00:16:33 +00:00
										 |  |  |   attr1='val1' attr2='val2'}. | 
					
						
							| 
									
										
										
										
											2004-04-18 17:34:12 +00:00
										 |  |  |  </para> | 
					
						
							|  |  |  |  <example> | 
					
						
							|  |  |  |   <title>function syntax</title> | 
					
						
							|  |  |  |   <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> | 
					
						
							|  |  |  |  <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. | 
					
						
							|  |  |  |   </para> | 
					
						
							|  |  |  |   <para>Built-in functions are the | 
					
						
							|  |  |  |   <emphasis role="bold">inner</emphasis> workings of Smarty, such as | 
					
						
							| 
									
										
										
										
											2005-05-23 15:43:01 +00:00
										 |  |  |   <link linkend="language.function.if">{if}</link>, | 
					
						
							|  |  |  |   <link linkend="language.function.section">{section}</link> and | 
					
						
							|  |  |  |   <link linkend="language.function.strip">{strip}</link>. | 
					
						
							| 
									
										
										
										
											2006-03-27 23:57:45 +00:00
										 |  |  |   There should be no need to change or modify them. | 
					
						
							| 
									
										
										
										
											2005-05-27 16:25:02 +00:00
										 |  |  |   </para> | 
					
						
							|  |  |  |   <para>Custom functions are <emphasis role="bold">additional</emphasis> | 
					
						
							|  |  |  |   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. | 
					
						
							| 
									
										
										
										
											2005-05-23 15:43:01 +00:00
										 |  |  |   <link linkend="language.function.html.options">{html_options}</link> and | 
					
						
							| 
									
										
										
										
											2005-05-27 16:25:02 +00:00
										 |  |  |   <link linkend="language.function.popup">{popup}</link> | 
					
						
							| 
									
										
										
										
											2005-05-21 12:41:15 +00:00
										 |  |  |   are examples of custom functions. | 
					
						
							| 
									
										
										
										
											2004-04-18 17:34:12 +00:00
										 |  |  |  </para> | 
					
						
							| 
									
										
										
										
											2006-03-27 23:57:45 +00:00
										 |  |  |   | 
					
						
							|  |  |  |  <para> | 
					
						
							|  |  |  |  See also <link linkend="api.register.function">register_function()</link> | 
					
						
							|  |  |  |  </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
										 |  |  | --> |