mirror of
				https://github.com/smarty-php/smarty.git
				synced 2025-10-31 04:11:37 +01:00 
			
		
		
		
	- updates for new build system - added missing files - corrections from users - revcheck comments for all files - big up to didou and nuno, brilliant work - make test: ok - make: ok
		
			
				
	
	
		
			94 lines
		
	
	
		
			2.9 KiB
		
	
	
	
		
			XML
		
	
	
	
	
	
			
		
		
	
	
			94 lines
		
	
	
		
			2.9 KiB
		
	
	
	
		
			XML
		
	
	
	
	
	
| <?xml version="1.0" encoding="iso-8859-1"?>
 | |
| <!-- $Revision$ -->
 | |
| <!-- EN-Revision: 1.2 Maintainer: andreas Status: ready -->
 | |
|   <sect1 id="plugins.compiler.functions"><title>Compiler-Funktionen</title>
 | |
|    <para>
 | |
|     Compiler-Funktionen werden während der Kompilierung des Template
 | |
|     aufgerufen. Das ist nützlich, um PHP-Code oder zeitkritische statische
 | |
|     Inhalte in ein Template einzufügen. Sind eine Compiler-Funktion und
 | |
|     eine eigene Funktion unter dem selben Namen registriert, wird die
 | |
|     Compiler-Funktion ausgeführt.
 | |
|    </para>
 | |
|    <funcsynopsis>
 | |
|     <funcprototype>
 | |
|      <funcdef>mixed <function>smarty_compiler_<replaceable>name</replaceable></function></funcdef>
 | |
|      <paramdef>string <parameter>$tag_arg</parameter></paramdef>
 | |
|      <paramdef>object <parameter>&$smarty</parameter></paramdef>
 | |
|     </funcprototype>
 | |
|    </funcsynopsis>
 | |
|    <para>
 | |
|     Die Compiler-Funktion erhält zwei Parameter: die Tag-Argument Zeichenkette
 | |
|     - also alles ab dem Funktionsnamen bis zum schliessenden Trennzeichen - und
 | |
|     das Smarty Objekt. Gibt den PHP-Code zurück, der in das Template eingefügt werden
 | |
|     soll.
 | |
|    </para>
 | |
|    <para>
 | |
|     
 | |
|     Sehen Sie dazu:
 | |
|     <link linkend="api.register.compiler.function">register_compiler_function()</link>,
 | |
|      <link linkend="api.unregister.compiler.function">unregister_compiler_function()</link>.
 | |
|    </para>
 | |
|    <example>
 | |
|     <title>Einfache Compiler-Funktionen</title>
 | |
|     <programlisting>
 | |
| <![CDATA[
 | |
| <?php
 | |
| /*
 | |
|  * Smarty plugin
 | |
|  * -------------------------------------------------------------
 | |
|  * File:     compiler.tplheader.php
 | |
|  * Type:     compiler
 | |
|  * Name:     tplheader
 | |
|  * Purpose:  Output header containing the source file name and
 | |
|  *           the time it was compiled.
 | |
|  * -------------------------------------------------------------
 | |
|  */
 | |
| function smarty_compiler_tplheader($tag_arg, &$smarty)
 | |
| {
 | |
|     return "\necho '" . $smarty->_current_file . " compiled at " . date('Y-m-d H:M'). "';";
 | |
| }
 | |
| ?>
 | |
| ]]>
 | |
|      </programlisting>
 | |
|      <para>
 | |
|       
 | |
|       Diese Funktion kann aus dem Template wie folgt aufgerufen werden:
 | |
|      </para>
 | |
|      <programlisting>
 | |
|       
 | |
|       {* diese Funktion wird nur zum Kompilier-Zeitpunkt ausgeführt *}
 | |
|       {tplheader}</programlisting>
 | |
|       <para>
 | |
|        
 | |
|        Der resultierende PHP-Code würde ungefähr so aussehen:
 | |
|       </para>
 | |
|       <programlisting>
 | |
| <![CDATA[
 | |
| <?php
 | |
| echo 'index.tpl compiled at 2002-02-20 20:02';
 | |
| ?>
 | |
| ]]>
 | |
|        </programlisting>
 | |
|    </example>
 | |
| </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
 | |
| -->
 |