diff --git a/docs/de/programmers/advanced-features.xml b/docs/de/programmers/advanced-features.xml
index c073273f..33f7dd76 100644
--- a/docs/de/programmers/advanced-features.xml
+++ b/docs/de/programmers/advanced-features.xml
@@ -2,538 +2,14 @@
Advanced Features
-
- Objekte
-
- Smarty erlaubt es, auf PHP Objekt durch das Template zuzugreifen. Dafür gibt es
- zwei Wege. Der erste ist, Objekte zu registrieren und wie auf eine eigene Funktion zuzugreifen.
- Der andere Weg ist, das Objekt dem Template zuzuweisen und darauf wie auf andere Variablen
- zuzugreifen. Die erste Methode hat eine nettere Template Syntax und ist sicherer da der Zugriff
- auf ein registriertes Objekt mit Sicherheitseinstellungen kontrolliert werden kann. Der Nachteil
- ist, dass registrierte Objekte nicht in Loops verwendet werden können. Welchen Weg Sie einschlagen
- wird von Ihren Bedürfnissen definiert, die erste Methode ist jedoch zu bevorzugen.
-
-
- Wenn die Sicherheitsfunktionen eingeschaltet sind, können keine private Methoden (solche die einen '_'-Prefix tragen)
- aufgerufen werden. Wenn eine Methode und eine Eigeschaft mit dem gleichen Namen existieren wird die Methode
- verwendet.
-
-
- Sie können den Zugriff auf Methoden und Eigenschaften einschränken
- indem Sie sie als Array als dritten Registrationsparameter übergeben.
-
-
- Normalerweise werden Parameter welche einem Objekt via Template übergeben
- werden genau so übergeben wie dies bei normalen eigenen Funktionen der Fall ist.
- Das erste Objekt ist ein assoziatives Array und das zweite das Smarty Objekt selbst.
- Wenn Sie die Parameter einzeln erhalten möchten können Sie den vierten
- Parameter auf FALSE setzen.
-
-
- Der optionale fünfte Parameter hat nur einen Effekt wenn
- format = true ist und eine Liste von
- Methoden enthält die als Block verarbeitet werden sollen.
- Das bedeutet, dass solche Methoden ein schliessendes Tag im Template
- enthalten müssen ({foobar->meth2}...{/foobar->meth2})
- und die Parameter zu den Funktionen die selbe Syntax haben wie block-function-plugins:
- sie erhalten also die 4 Parameter
- $params,
- $content,
- &$smarty und
- &$repeat,
- und verhalten sich auch sonst wie block-function-plugins.
-
-
- registierte oder zugewiesene Objekte verwenden
-
-<?php
-// das objekt
-
-class My_Object {
- function meth1($params, &$smarty_obj) {
- return "meine meth1";
- }
-}
-
-$myobj = new My_Object;
-// objekt registrieren (referenz)
-$smarty->register_object("foobar",$myobj);
-// zugriff auf methoden und eigeschaften einschränken
-$smarty->register_object("foobar",$myobj,array('meth1','meth2','prop1'));
-// wenn wir das traditionelle parameter format verwenden wollen, übergeben wir false für den parameter format
-$smarty->register_object("foobar",$myobj,null,false);
-
-// objekte zuweisen (auch via referenz möglich)
-$smarty->assign_by_ref("myobj", $myobj);
-
-$smarty->display("index.tpl");
-?>
-
-TEMPLATE:
-
-{* zugriff auf ein registriertes objekt *}
-{foobar->meth1 p1="foo" p2=$bar}
-
-{* ausgabe zuweisen *}
-{foobar->meth1 p1="foo" p2=$bar assign="output"}
-ausgabe war: {$output}
-
-{* auf unser zugewiesenes objekt zugreiffen *}
-{$myobj->meth1("foo",$bar)}
-
-
-
- 'pre'-Filter
-
- Template 'pre'-Filter sind Filter, welche auf das Template vor dessen Kompilierung
- angewendet werden. Dies ist nützlich, um zum Beispiel Kommentare zu entfernen
- oder um den Inhalt des Templates zu analysieren. 'pre'-Filter können auf verschiedene
- Arten geladen werden. Man kann sie registrieren,
- aus dem Plugin-Verzeichnis mit load_filter() laden
- oder $autoload_filters verwenden.
- Smarty übergibt der Funktion als ersten Parameter den Template-Quellcode und erwartet
- als Rückgabewert den bearbeiteten Quellcode.
-
-
- Template 'pre'-Filter verwenden
-
- <?php
-
- // fügen Sie folgende Zeilen in Ihre Applikation ein
- function remove_dw_comments($tpl_source, &$smarty)
- {
- return preg_replace("/<!--#.*-->/U","",$tpl_source);
- }
-
-
- // registrieren Sie den 'pre'-Filter
- $smarty->register_prefilter("remove_dw_comments");
- $smarty->display("index.tpl");
- ?>
-
- {* Smarty Template 'index.tpl' *}
-
- <!--# diese Zeile wird vom 'pre'-Filter entfernt-->
-
-
+&programmers.advanced-features.advanced-features-objects;
+&programmers.advanced-features.advanced-features-prefilters;
-
- 'post'-Filter
-
- Template 'post'-Filter sind Filter, welche auf das Template nach dessen Kompilierung
- angewendet werden. 'post'-Filter können auf verschiedene Arten
- geladen werden. Man kann sie registrieren,
- aus dem Plugin-Verzeichnis mit load_filter() laden
- oder $autoload_filters verwenden.
- Smarty übergibt der Funktion als ersten Parameter den Template-Quellcode und erwartet
- als Rückgabewert den bearbeiteten Quellcode.
-
-
- Template 'post'-Filter verwenden
-
- <?php
-
- // fügen Sie folgende Zeilen in Ihre Applikation ein
- function add_header_comment($tpl_source, &$smarty)
- {
- return "<?php echo \"<!-- Created by Smarty! -->\n\" ?>\n".$tpl_source;
- }
-
-
- // registrieren Sie den 'post'-Filter
- $smarty->register_postfilter("add_header_comment");
- $smarty->display("index.tpl");
- ?>
-
- {* kompiliertes Smarty Template 'index.tpl' *}
- <!-- Created by Smarty! -->
- {* Rest des Template Inhalts... *}
-
-
+&programmers.advanced-features.advanced-features-postfilters;
-
- Ausgabefilter
-
- Wenn ein Template mit 'display()' oder 'fetch()' benutzt wird, kann die
- Ausgabe durch verschieden Ausgabefilter geschleust werden. Der Unterschied zu
- 'post'-Filtern ist, dass Ausgabefilter auf die durch 'fetch()' oder
- 'display()' erzeugte Ausgabe angewendet werden, 'post'-Filter aber auf das Kompilat vor
- seiner Speicherung im Dateisystem.
-
-
-
- Ausgabefilter können auf verschiede Arten
- geladen werden. Man kann sie registrieren,
- aus dem Plugin-Verzeichnis mit load_filter() laden
- oder $autoload_filters verwenden.
- Smarty übergibt der Funktion als ersten Parameter die Template-Ausgabe und erwartet
- als Rückgabewert die bearbeitete Ausgabe.
-
-
- Ausgabefilter verwenden
-
- <?php
-
- // fügen Sie folgende Zeilen in Ihre Applikation ein
- function protect_email($tpl_output, &$smarty)
- {
- $tpl_output =
- preg_replace('!(\S+)@([a-zA-Z0-9\.\-]+\.([a-zA-Z]{2,3}|[0-9]{1,3}))!',
- '$1%40$2', $tpl_output);
- return $tpl_output;
- }
-
-
- // Ausgabefilter registrieren
- $smarty->register_outputfilter("protect_email");
- $smarty->display("index.tpl");
-
- // von nun an erhalten alle ausgegebenen e-mail Adressen einen
- // einfach Schutz vor Spambots.
- ?>
-
-
-
- Cache Handler Funktion
-
- Als Alternative zum normalen dateibasierten Caching-Mechanismus können Sie
- eine eigene Cache-Handler Funktion zum lesen, schreiben und löschen von
- Cache-Dateien definieren.
-
-
- Schreiben Sie eine Funktion in Ihrer Applikation, die Smarty als
- Cache-Handler verwenden soll und weisen Sie deren Name der Variable
- $cache_handler_func zu.
- Smarty wird von da an Ihre Funktion zur Bearbeitung des Caches verwenden.
- Als erster Parameter wird die 'action' mit einem der folgendende Werte
- übergeben: 'read', 'write' und 'clear'. Als zweiter Parameter
- wird das Smarty-Objekt übergeben, als dritter der gecachte Inhalt. Bei einem
- 'write' übergibt Smarty den gecachten Inhalt, bei 'read' übergibt Smarty die
- Variable als Referenz und erwartet, dass Ihre Funktion die Inhalte zuweist.
- Bei 'clear' können Sie eine dummy-Variable übergeben. Als vierter Parameter
- wird der Template-Name übergeben (verwendet bei 'write'/'read'), als fünfter
- Parameter die 'cache_id' (optional) und als sechster die 'compile_id' (auch optional).
-
-
- Beispiel mit einer MySQL Datenbank als Datenquelle
-
- <?php
- /*
-
- Beispiel Anwendung:
-
- include('Smarty.class.php');
- include('mysql_cache_handler.php');
-
- $smarty = new Smarty;
- $smarty->cache_handler_func = 'mysql_cache_handler';
-
- $smarty->display('index.tpl');
-
-
-
- die Datenbank hat folgendes Format:
-
- create database SMARTY_CACHE;
-
- create table CACHE_PAGES(
- CacheID char(32) PRIMARY KEY,
- CacheContents MEDIUMTEXT NOT NULL
- );
-
- */
-
- function mysql_cache_handler($action, &$smarty_obj, &$cache_content, $tpl_file=null, $cache_id=null, $compile_id=null)
- {
-
- // Datenbank Host, Benutzer und Passwort festlegen
- $db_host = 'localhost';
- $db_user = 'myuser';
- $db_pass = 'mypass';
- $db_name = 'SMARTY_CACHE';
- $use_gzip = false;
-
-
- // enmalige 'cache_id' erzeugen
- $CacheID = md5($tpl_file.$cache_id.$compile_id);
-
- if(! $link = mysql_pconnect($db_host, $db_user, $db_pass)) {
- $smarty_obj->_trigger_error_msg("cache_handler: could not connect to database");
- return false;
- }
- mysql_select_db($db_name);
-
- switch ($action) {
- case 'read':
-
- // Cache aus der Datenbank lesen
- $results = mysql_query("select CacheContents from CACHE_PAGES where CacheID='$CacheID'");
- if(!$results) {
- $smarty_obj->_trigger_error_msg("cache_handler: query failed.");
- }
- $row = mysql_fetch_array($results,MYSQL_ASSOC);
-
- if($use_gzip && function_exists("gzuncompress")) {
- $cache_contents = gzuncompress($row["CacheContents"]);
- } else {
- $cache_contents = $row["CacheContents"];
- }
- $return = $results;
- break;
- case 'write':
-
- // Cache in Datenbank speichern
- if($use_gzip && function_exists("gzcompress")) {
- // compress the contents for storage efficiency
- $contents = gzcompress($cache_content);
- } else {
- $contents = $cache_content;
- }
- $results = mysql_query("replace into CACHE_PAGES values(
- '$CacheID',
- '".addslashes($contents)."')
- ");
- if(!$results) {
- $smarty_obj->_trigger_error_msg("cache_handler: query failed.");
- }
- $return = $results;
- break;
- case 'clear':
-
- // Cache Informationen löschen
- if(empty($cache_id) && empty($compile_id) && empty($tpl_file)) {
-
- // alle löschen
- $results = mysql_query("delete from CACHE_PAGES");
- } else {
- $results = mysql_query("delete from CACHE_PAGES where CacheID='$CacheID'");
- }
- if(!$results) {
- $smarty_obj->_trigger_error_msg("cache_handler: query failed.");
- }
- $return = $results;
- break;
- default:
-
- // Fehler, unbekannte 'action'
- $smarty_obj->_trigger_error_msg("cache_handler: unknown action \"$action\"");
- $return = false;
- break;
- }
- mysql_close($link);
- return $return;
-
- }
-
- ?>
-
-
-
- Ressourcen
-
- Ein Template kann aus verschiedenen Quellen bezogen werden. Wenn Sie
- ein Template mit 'display()' ausgeben, die Ausgabe mit 'fetch()'
- in einer Variablen speichern oder innnerhalb eines Template ein
- weiteres Template einbinden, müssen Sie den Ressourcen-Typ,
- gefolgt von Pfad und Template-Namen angeben. Wenn kein Resourcetyp angegeben
- wird, wird $default_resource_type
- verwendet.
-
-
- Templates aus dem '$template_dir'
-
- Templates aus dem '$template_dir' benötigen normalerweise keinen Ressourcen-Typ,
- es wird jedoch empfohlen 'file:' zu verwenden. Übergeben Sie einfach den Pfad,
- in dem sich das Template relativ zu '$template_dir' befindet.
-
-
- Templates aus '$template_dir' verwenden
-
-
- // im PHP-Skript
- $smarty->display("index.tpl");
- $smarty->display("admin/menu.tpl");
- $smarty->display("file:admin/menu.tpl"); // entspricht der vorigen Zeile
-
-
- {* im Smarty Template *}
- {include file="index.tpl"}
- {include file="file:index.tpl"} {* entspricht der vorigen Zeile *}
-
-
-
- Templates aus beliebigen Verzeichnissen
-
- Templates ausserhalb von '$template_dir' benötigen den 'file:' Ressourcen-Typ,
- gefolgt von absolutem Pfadnamen und Templatenamen.
-
-
- Templates aus beliebigen Verzeichnissen benutzen
-
-
- // im PHP-Skript
- $smarty->display("file:/export/templates/index.tpl");
- $smarty->display("file:/path/to/my/templates/menu.tpl");
-
-
- {* im Smarty Template *}
- {include file="file:/usr/local/share/templates/navigation.tpl"}
-
-
-
- Windows Dateipfade
-
- Wenn Sie auf einer Windows-Maschine arbeiten, enthalten absoluten Dateipfade
- normalerweise den Laufwerksbuchstaben (C:). Stellen Sie sicher,
- dass alle Pfade den Ressourcen-Typ 'file:' haben, um Namespace-Konflikten
- vorzubeugen.
-
-
- Templates aus Windows Dateipfaden verwenden
-
-
- // im PHP-Skript
- $smarty->display("file:C:/export/templates/index.tpl");
- $smarty->display("file:F:/path/to/my/templates/menu.tpl");
-
-
- {* im Smarty Template *}
- {include file="file:D:/usr/local/share/templates/navigation.tpl"}
-
-
-
-
-
- Templates aus anderen Quellen
-
- Sie können Templates aus jeder für PHP verfügbaren Datenquelle beziehen:
- Datenbanken, Sockets, LDAP, usw. Dazu müssen sie nur ein
- Ressource-Plugin schreiben und registrieren.
-
-
-
- Konsultieren Sie den Abschnitt über Ressource-Plugins
- für mehr Informationen über die Funktionalitäten, die ein derartiges Plugin bereitstellen muss.
-
-
-
-
- Achtung: Sie können die interne file Ressource nicht
- überschreiben. Es steht Ihnen jedoch frei, ein Plugin zu schreiben,
- das die gewünschte Funktionalität implementiert und es als alternativen
- Ressource-Typ zu registrieren.
-
-
-
- Eigene Quellen verwenden
-
-
- // im PHP-Skript
-
-
- // definieren Sie folgende Funktion in Ihrer Applikation
- function db_get_template ($tpl_name, &tpl_source, &$smarty_obj)
- {
- // Datenbankabfrage um unser Template zu laden,
- // und '$tpl_source' zuzuweisen
- $sql = new SQL;
- $sql->query("select tpl_source
- from my_table
- where tpl_name='$tpl_name'");
- if ($sql->num_rows) {
- $tpl_source = $sql->record['tpl_source'];
- return true;
- } else {
- return false;
- }
- }
-
- function db_get_timestamp($tpl_name, &$tpl_timestamp, &$smarty_obj)
- {
-
- // Datenbankabfrage um '$tpl_timestamp' zuzuweisen
- $sql = new SQL;
- $sql->query("select tpl_timestamp
- from my_table
- where tpl_name='$tpl_name'");
- if ($sql->num_rows) {
- $tpl_timestamp = $sql->record['tpl_timestamp'];
- return true;
- } else {
- return false;
- }
- }
-
- function db_get_secure($tpl_name, &$smarty_obj)
- {
-
- // angenommen alle Templates sind sicher
- return true;
- }
-
- function db_get_trusted($tpl_name, &$smarty_obj)
- {
-
- // wird für Templates nicht verwendet
- }
-
-
- // Ressourcen-Typ 'db:' registrieren
- $smarty->register_resource("db", array("db_get_template",
- "db_get_timestamp",
- "db_get_secure",
- "db_get_trusted"));
-
-
- // Ressource im PHP-Skript verwenden
- $smarty->display("db:index.tpl");
-
-
- {* Ressource in einem Smarty Template verwenden *}
- {include file="db:/extras/navigation.tpl"}
-
-
-
-
- Standard Template-Handler
-
- Sie können eine Funktion definieren, die aufgerufen wird,
- wenn ein Template nicht aus der angegeben Ressource geladen werden konnte.
- Dies ist z. B. nützlich, wenn Sie fehlende Templates on-the-fly
- generieren wollen.
-
-
- Standard Template-Handler verwenden
-
- <?php
-
- // fügen Sie folgende Zeilen in Ihre Applikation ein
-
- function make_template ($resource_type, $resource_name, &$template_source, &$template_timestamp, &$smarty_obj)
- {
- if( $resource_type == 'file' ) {
- if ( ! is_readable ( $resource_name )) {
-
- // erzeuge Template-Datei, gib Inhalte zurück
- $template_source = "This is a new template.";
- $template_timestamp = time();
- $smarty_obj->_write_file($resource_name, $template_source);
- return true;
- }
- } else {
-
- // keine Datei
- return false;
- }
- }
-
-
- // Standard Handler definieren
- $smarty->default_template_handler_func = 'make_template';
- ?>
-
-
-
+&programmers.advanced-features.advanced-features-outputfilters;
+&programmers.advanced-features.section-template-cache-handler-func;
+&programmers.advanced-features.template-resources;
+
+ Objekte
+
+ Smarty erlaubt es, auf PHP Objekt durch das Template zuzugreifen. Dafür gibt es
+ zwei Wege. Der erste ist, Objekte zu registrieren und wie auf eine eigene Funktion zuzugreifen.
+ Der andere Weg ist, das Objekt dem Template zuzuweisen und darauf wie auf andere Variablen
+ zuzugreifen. Die erste Methode hat eine nettere Template Syntax und ist sicherer da der Zugriff
+ auf ein registriertes Objekt mit Sicherheitseinstellungen kontrolliert werden kann. Der Nachteil
+ ist, dass registrierte Objekte nicht in Loops verwendet werden können. Welchen Weg Sie einschlagen
+ wird von Ihren Bedürfnissen definiert, die erste Methode ist jedoch zu bevorzugen.
+
+
+ Wenn die Sicherheitsfunktionen eingeschaltet sind, können keine private Methoden (solche die einen '_'-Prefix tragen)
+ aufgerufen werden. Wenn eine Methode und eine Eigeschaft mit dem gleichen Namen existieren wird die Methode
+ verwendet.
+
+
+ Sie können den Zugriff auf Methoden und Eigenschaften einschränken
+ indem Sie sie als Array als dritten Registrationsparameter übergeben.
+
+
+ Normalerweise werden Parameter welche einem Objekt via Template übergeben
+ werden genau so übergeben wie dies bei normalen eigenen Funktionen der Fall ist.
+ Das erste Objekt ist ein assoziatives Array und das zweite das Smarty Objekt selbst.
+ Wenn Sie die Parameter einzeln erhalten möchten können Sie den vierten
+ Parameter auf FALSE setzen.
+
+
+ Der optionale fünfte Parameter hat nur einen Effekt wenn
+ format = true ist und eine Liste von
+ Methoden enthält die als Block verarbeitet werden sollen.
+ Das bedeutet, dass solche Methoden ein schliessendes Tag im Template
+ enthalten müssen ({foobar->meth2}...{/foobar->meth2})
+ und die Parameter zu den Funktionen die selbe Syntax haben wie block-function-plugins:
+ sie erhalten also die 4 Parameter
+ $params,
+ $content,
+ &$smarty und
+ &$repeat,
+ und verhalten sich auch sonst wie block-function-plugins.
+
+
+ registierte oder zugewiesene Objekte verwenden
+
+<?php
+// das objekt
+
+class My_Object {
+ function meth1($params, &$smarty_obj) {
+ return "meine meth1";
+ }
+}
+
+$myobj = new My_Object;
+// objekt registrieren (referenz)
+$smarty->register_object("foobar",$myobj);
+// zugriff auf methoden und eigeschaften einschränken
+$smarty->register_object("foobar",$myobj,array('meth1','meth2','prop1'));
+// wenn wir das traditionelle parameter format verwenden wollen, übergeben wir false für den parameter format
+$smarty->register_object("foobar",$myobj,null,false);
+
+// objekte zuweisen (auch via referenz möglich)
+$smarty->assign_by_ref("myobj", $myobj);
+
+$smarty->display("index.tpl");
+?>
+
+TEMPLATE:
+
+{* zugriff auf ein registriertes objekt *}
+{foobar->meth1 p1="foo" p2=$bar}
+
+{* ausgabe zuweisen *}
+{foobar->meth1 p1="foo" p2=$bar assign="output"}
+ausgabe war: {$output}
+
+{* auf unser zugewiesenes objekt zugreiffen *}
+{$myobj->meth1("foo",$bar)}
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/advanced-features/advanced-features-outputfilters.xml b/docs/de/programmers/advanced-features/advanced-features-outputfilters.xml
new file mode 100644
index 00000000..49f55de9
--- /dev/null
+++ b/docs/de/programmers/advanced-features/advanced-features-outputfilters.xml
@@ -0,0 +1,64 @@
+
+
+
+ Ausgabefilter
+
+ Wenn ein Template mit 'display()' oder 'fetch()' benutzt wird, kann die
+ Ausgabe durch verschieden Ausgabefilter geschleust werden. Der Unterschied zu
+ 'post'-Filtern ist, dass Ausgabefilter auf die durch 'fetch()' oder
+ 'display()' erzeugte Ausgabe angewendet werden, 'post'-Filter aber auf das Kompilat vor
+ seiner Speicherung im Dateisystem.
+
+
+
+ Ausgabefilter können auf verschiede Arten
+ geladen werden. Man kann sie registrieren,
+ aus dem Plugin-Verzeichnis mit load_filter() laden
+ oder $autoload_filters verwenden.
+ Smarty übergibt der Funktion als ersten Parameter die Template-Ausgabe und erwartet
+ als Rückgabewert die bearbeitete Ausgabe.
+
+
+ Ausgabefilter verwenden
+
+ <?php
+
+ // fügen Sie folgende Zeilen in Ihre Applikation ein
+ function protect_email($tpl_output, &$smarty)
+ {
+ $tpl_output =
+ preg_replace('!(\S+)@([a-zA-Z0-9\.\-]+\.([a-zA-Z]{2,3}|[0-9]{1,3}))!',
+ '$1%40$2', $tpl_output);
+ return $tpl_output;
+ }
+
+
+ // Ausgabefilter registrieren
+ $smarty->register_outputfilter("protect_email");
+ $smarty->display("index.tpl");
+
+ // von nun an erhalten alle ausgegebenen e-mail Adressen einen
+ // einfach Schutz vor Spambots.
+ ?>
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/advanced-features/advanced-features-postfilters.xml b/docs/de/programmers/advanced-features/advanced-features-postfilters.xml
new file mode 100644
index 00000000..559b2e3e
--- /dev/null
+++ b/docs/de/programmers/advanced-features/advanced-features-postfilters.xml
@@ -0,0 +1,55 @@
+
+
+
+ 'post'-Filter
+
+ Template 'post'-Filter sind Filter, welche auf das Template nach dessen Kompilierung
+ angewendet werden. 'post'-Filter können auf verschiedene Arten
+ geladen werden. Man kann sie registrieren,
+ aus dem Plugin-Verzeichnis mit load_filter() laden
+ oder $autoload_filters verwenden.
+ Smarty übergibt der Funktion als ersten Parameter den Template-Quellcode und erwartet
+ als Rückgabewert den bearbeiteten Quellcode.
+
+
+ Template 'post'-Filter verwenden
+
+ <?php
+
+ // fügen Sie folgende Zeilen in Ihre Applikation ein
+ function add_header_comment($tpl_source, &$smarty)
+ {
+ return "<?php echo \"<!-- Created by Smarty! -->\n\" ?>\n".$tpl_source;
+ }
+
+
+ // registrieren Sie den 'post'-Filter
+ $smarty->register_postfilter("add_header_comment");
+ $smarty->display("index.tpl");
+ ?>
+
+ {* kompiliertes Smarty Template 'index.tpl' *}
+ <!-- Created by Smarty! -->
+ {* Rest des Template Inhalts... *}
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/advanced-features/advanced-features-prefilters.xml b/docs/de/programmers/advanced-features/advanced-features-prefilters.xml
new file mode 100644
index 00000000..12fdc129
--- /dev/null
+++ b/docs/de/programmers/advanced-features/advanced-features-prefilters.xml
@@ -0,0 +1,56 @@
+
+
+
+ 'pre'-Filter
+
+ Template 'pre'-Filter sind Filter, welche auf das Template vor dessen Kompilierung
+ angewendet werden. Dies ist nützlich, um zum Beispiel Kommentare zu entfernen
+ oder um den Inhalt des Templates zu analysieren. 'pre'-Filter können auf verschiedene
+ Arten geladen werden. Man kann sie registrieren,
+ aus dem Plugin-Verzeichnis mit load_filter() laden
+ oder $autoload_filters verwenden.
+ Smarty übergibt der Funktion als ersten Parameter den Template-Quellcode und erwartet
+ als Rückgabewert den bearbeiteten Quellcode.
+
+
+ Template 'pre'-Filter verwenden
+
+ <?php
+
+ // fügen Sie folgende Zeilen in Ihre Applikation ein
+ function remove_dw_comments($tpl_source, &$smarty)
+ {
+ return preg_replace("/<!--#.*-->/U","",$tpl_source);
+ }
+
+
+ // registrieren Sie den 'pre'-Filter
+ $smarty->register_prefilter("remove_dw_comments");
+ $smarty->display("index.tpl");
+ ?>
+
+ {* Smarty Template 'index.tpl' *}
+
+ <!--# diese Zeile wird vom 'pre'-Filter entfernt-->
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/advanced-features/section-template-cache-handler-func.xml b/docs/de/programmers/advanced-features/section-template-cache-handler-func.xml
new file mode 100644
index 00000000..1d815e44
--- /dev/null
+++ b/docs/de/programmers/advanced-features/section-template-cache-handler-func.xml
@@ -0,0 +1,157 @@
+
+
+
+ Cache Handler Funktion
+
+ Als Alternative zum normalen dateibasierten Caching-Mechanismus können Sie
+ eine eigene Cache-Handler Funktion zum lesen, schreiben und löschen von
+ Cache-Dateien definieren.
+
+
+ Schreiben Sie eine Funktion in Ihrer Applikation, die Smarty als
+ Cache-Handler verwenden soll und weisen Sie deren Name der Variable
+ $cache_handler_func zu.
+ Smarty wird von da an Ihre Funktion zur Bearbeitung des Caches verwenden.
+ Als erster Parameter wird die 'action' mit einem der folgendende Werte
+ übergeben: 'read', 'write' und 'clear'. Als zweiter Parameter
+ wird das Smarty-Objekt übergeben, als dritter der gecachte Inhalt. Bei einem
+ 'write' übergibt Smarty den gecachten Inhalt, bei 'read' übergibt Smarty die
+ Variable als Referenz und erwartet, dass Ihre Funktion die Inhalte zuweist.
+ Bei 'clear' können Sie eine dummy-Variable übergeben. Als vierter Parameter
+ wird der Template-Name übergeben (verwendet bei 'write'/'read'), als fünfter
+ Parameter die 'cache_id' (optional) und als sechster die 'compile_id' (auch optional).
+
+
+ Beispiel mit einer MySQL Datenbank als Datenquelle
+
+ <?php
+ /*
+
+ Beispiel Anwendung:
+
+ include('Smarty.class.php');
+ include('mysql_cache_handler.php');
+
+ $smarty = new Smarty;
+ $smarty->cache_handler_func = 'mysql_cache_handler';
+
+ $smarty->display('index.tpl');
+
+
+
+ die Datenbank hat folgendes Format:
+
+ create database SMARTY_CACHE;
+
+ create table CACHE_PAGES(
+ CacheID char(32) PRIMARY KEY,
+ CacheContents MEDIUMTEXT NOT NULL
+ );
+
+ */
+
+ function mysql_cache_handler($action, &$smarty_obj, &$cache_content, $tpl_file=null, $cache_id=null, $compile_id=null)
+ {
+
+ // Datenbank Host, Benutzer und Passwort festlegen
+ $db_host = 'localhost';
+ $db_user = 'myuser';
+ $db_pass = 'mypass';
+ $db_name = 'SMARTY_CACHE';
+ $use_gzip = false;
+
+
+ // enmalige 'cache_id' erzeugen
+ $CacheID = md5($tpl_file.$cache_id.$compile_id);
+
+ if(! $link = mysql_pconnect($db_host, $db_user, $db_pass)) {
+ $smarty_obj->_trigger_error_msg("cache_handler: could not connect to database");
+ return false;
+ }
+ mysql_select_db($db_name);
+
+ switch ($action) {
+ case 'read':
+
+ // Cache aus der Datenbank lesen
+ $results = mysql_query("select CacheContents from CACHE_PAGES where CacheID='$CacheID'");
+ if(!$results) {
+ $smarty_obj->_trigger_error_msg("cache_handler: query failed.");
+ }
+ $row = mysql_fetch_array($results,MYSQL_ASSOC);
+
+ if($use_gzip && function_exists("gzuncompress")) {
+ $cache_contents = gzuncompress($row["CacheContents"]);
+ } else {
+ $cache_contents = $row["CacheContents"];
+ }
+ $return = $results;
+ break;
+ case 'write':
+
+ // Cache in Datenbank speichern
+ if($use_gzip && function_exists("gzcompress")) {
+ // compress the contents for storage efficiency
+ $contents = gzcompress($cache_content);
+ } else {
+ $contents = $cache_content;
+ }
+ $results = mysql_query("replace into CACHE_PAGES values(
+ '$CacheID',
+ '".addslashes($contents)."')
+ ");
+ if(!$results) {
+ $smarty_obj->_trigger_error_msg("cache_handler: query failed.");
+ }
+ $return = $results;
+ break;
+ case 'clear':
+
+ // Cache Informationen löschen
+ if(empty($cache_id) && empty($compile_id) && empty($tpl_file)) {
+
+ // alle löschen
+ $results = mysql_query("delete from CACHE_PAGES");
+ } else {
+ $results = mysql_query("delete from CACHE_PAGES where CacheID='$CacheID'");
+ }
+ if(!$results) {
+ $smarty_obj->_trigger_error_msg("cache_handler: query failed.");
+ }
+ $return = $results;
+ break;
+ default:
+
+ // Fehler, unbekannte 'action'
+ $smarty_obj->_trigger_error_msg("cache_handler: unknown action \"$action\"");
+ $return = false;
+ break;
+ }
+ mysql_close($link);
+ return $return;
+
+ }
+
+ ?>
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/advanced-features/template-resources.xml b/docs/de/programmers/advanced-features/template-resources.xml
new file mode 100644
index 00000000..09acea21
--- /dev/null
+++ b/docs/de/programmers/advanced-features/template-resources.xml
@@ -0,0 +1,228 @@
+
+
+
+ Ressourcen
+
+ Ein Template kann aus verschiedenen Quellen bezogen werden. Wenn Sie
+ ein Template mit 'display()' ausgeben, die Ausgabe mit 'fetch()'
+ in einer Variablen speichern oder innnerhalb eines Template ein
+ weiteres Template einbinden, müssen Sie den Ressourcen-Typ,
+ gefolgt von Pfad und Template-Namen angeben. Wenn kein Resourcetyp angegeben
+ wird, wird $default_resource_type
+ verwendet.
+
+
+ Templates aus dem '$template_dir'
+
+ Templates aus dem '$template_dir' benötigen normalerweise keinen Ressourcen-Typ,
+ es wird jedoch empfohlen 'file:' zu verwenden. Übergeben Sie einfach den Pfad,
+ in dem sich das Template relativ zu '$template_dir' befindet.
+
+
+ Templates aus '$template_dir' verwenden
+
+
+ // im PHP-Skript
+ $smarty->display("index.tpl");
+ $smarty->display("admin/menu.tpl");
+ $smarty->display("file:admin/menu.tpl"); // entspricht der vorigen Zeile
+
+
+ {* im Smarty Template *}
+ {include file="index.tpl"}
+ {include file="file:index.tpl"} {* entspricht der vorigen Zeile *}
+
+
+
+ Templates aus beliebigen Verzeichnissen
+
+ Templates ausserhalb von '$template_dir' benötigen den 'file:' Ressourcen-Typ,
+ gefolgt von absolutem Pfadnamen und Templatenamen.
+
+
+ Templates aus beliebigen Verzeichnissen benutzen
+
+
+ // im PHP-Skript
+ $smarty->display("file:/export/templates/index.tpl");
+ $smarty->display("file:/path/to/my/templates/menu.tpl");
+
+
+ {* im Smarty Template *}
+ {include file="file:/usr/local/share/templates/navigation.tpl"}
+
+
+
+ Windows Dateipfade
+
+ Wenn Sie auf einer Windows-Maschine arbeiten, enthalten absoluten Dateipfade
+ normalerweise den Laufwerksbuchstaben (C:). Stellen Sie sicher,
+ dass alle Pfade den Ressourcen-Typ 'file:' haben, um Namespace-Konflikten
+ vorzubeugen.
+
+
+ Templates aus Windows Dateipfaden verwenden
+
+
+ // im PHP-Skript
+ $smarty->display("file:C:/export/templates/index.tpl");
+ $smarty->display("file:F:/path/to/my/templates/menu.tpl");
+
+
+ {* im Smarty Template *}
+ {include file="file:D:/usr/local/share/templates/navigation.tpl"}
+
+
+
+
+
+ Templates aus anderen Quellen
+
+ Sie können Templates aus jeder für PHP verfügbaren Datenquelle beziehen:
+ Datenbanken, Sockets, LDAP, usw. Dazu müssen sie nur ein
+ Ressource-Plugin schreiben und registrieren.
+
+
+
+ Konsultieren Sie den Abschnitt über Ressource-Plugins
+ für mehr Informationen über die Funktionalitäten, die ein derartiges Plugin bereitstellen muss.
+
+
+
+
+ Achtung: Sie können die interne file Ressource nicht
+ überschreiben. Es steht Ihnen jedoch frei, ein Plugin zu schreiben,
+ das die gewünschte Funktionalität implementiert und es als alternativen
+ Ressource-Typ zu registrieren.
+
+
+
+ Eigene Quellen verwenden
+
+
+ // im PHP-Skript
+
+
+ // definieren Sie folgende Funktion in Ihrer Applikation
+ function db_get_template ($tpl_name, &tpl_source, &$smarty_obj)
+ {
+ // Datenbankabfrage um unser Template zu laden,
+ // und '$tpl_source' zuzuweisen
+ $sql = new SQL;
+ $sql->query("select tpl_source
+ from my_table
+ where tpl_name='$tpl_name'");
+ if ($sql->num_rows) {
+ $tpl_source = $sql->record['tpl_source'];
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ function db_get_timestamp($tpl_name, &$tpl_timestamp, &$smarty_obj)
+ {
+
+ // Datenbankabfrage um '$tpl_timestamp' zuzuweisen
+ $sql = new SQL;
+ $sql->query("select tpl_timestamp
+ from my_table
+ where tpl_name='$tpl_name'");
+ if ($sql->num_rows) {
+ $tpl_timestamp = $sql->record['tpl_timestamp'];
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ function db_get_secure($tpl_name, &$smarty_obj)
+ {
+
+ // angenommen alle Templates sind sicher
+ return true;
+ }
+
+ function db_get_trusted($tpl_name, &$smarty_obj)
+ {
+
+ // wird für Templates nicht verwendet
+ }
+
+
+ // Ressourcen-Typ 'db:' registrieren
+ $smarty->register_resource("db", array("db_get_template",
+ "db_get_timestamp",
+ "db_get_secure",
+ "db_get_trusted"));
+
+
+ // Ressource im PHP-Skript verwenden
+ $smarty->display("db:index.tpl");
+
+
+ {* Ressource in einem Smarty Template verwenden *}
+ {include file="db:/extras/navigation.tpl"}
+
+
+
+
+ Standard Template-Handler
+
+ Sie können eine Funktion definieren, die aufgerufen wird,
+ wenn ein Template nicht aus der angegeben Ressource geladen werden konnte.
+ Dies ist z. B. nützlich, wenn Sie fehlende Templates on-the-fly
+ generieren wollen.
+
+
+ Standard Template-Handler verwenden
+
+ <?php
+
+ // fügen Sie folgende Zeilen in Ihre Applikation ein
+
+ function make_template ($resource_type, $resource_name, &$template_source, &$template_timestamp, &$smarty_obj)
+ {
+ if( $resource_type == 'file' ) {
+ if ( ! is_readable ( $resource_name )) {
+
+ // erzeuge Template-Datei, gib Inhalte zurück
+ $template_source = "This is a new template.";
+ $template_timestamp = time();
+ $smarty_obj->_write_file($resource_name, $template_source);
+ return true;
+ }
+ } else {
+
+ // keine Datei
+ return false;
+ }
+ }
+
+
+ // Standard Handler definieren
+ $smarty->default_template_handler_func = 'make_template';
+ ?>
+
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-functions.xml b/docs/de/programmers/api-functions.xml
index 9d5fc50a..4db9abee 100644
--- a/docs/de/programmers/api-functions.xml
+++ b/docs/de/programmers/api-functions.xml
@@ -2,901 +2,40 @@
Methoden
-
- append (anhängen)
-
-
- void append
- mixed var
-
-
- void append
- string varname
- mixed var
-
-
-
- Wird verwendet, um an Template-Variablen weitere Daten anzuhängen. Sie
- können entweder ein Namen/Wert-Paar oder assoziative Arrays,
- die mehrere Namen/Wert-Paare enthalten, übergeben.
-
-
- append (anhängen)
-
-
- // Namen/Wert-Paare übergeben
- $smarty->append("Name","Fred");
- $smarty->append("Address",$address);
-
- // assoziatives Array übergeben
- $smarty->append(array("city" => "Lincoln","state" => "Nebraska"));
-
-
-
- append_by_ref (via Referenz anhängen)
-
-
- void append_by_ref
- string varname
- mixed var
-
-
-
- Wird verwendet, um an Template-Variablen Werte via Referenz (pass by reference) anstatt via Kopie
- anzuhängen. Konsultieren Sie das PHP-Manual zum Thema 'variable referencing'
- für weitere Erklärungen.
-
-
- Technische Bemerkung
-
- 'append_by_ref()' ist effizienter als 'append()', da keine Kopie der Variable
- erzeugt, sondern auf die Variable im Speicher referenziert wird. Beachten Sie
- dabei, dass eine nachträgliche änderung Original-Variable auch die zugewiesene Variable
- ändert. PHP5 wird die Referenzierung automatisch übernehmen, diese
- Funktion dient als Workaround.
-
-
-
- append_by_ref (via Referenz anhängen)
-
-
- // Namen/Wert-Paare übergeben
- $smarty->append_by_ref("Name",$myname);
- $smarty->append_by_ref("Address",$address);
-
-
-
- assign (zuweisen)
-
-
- void assign
- mixed var
-
-
- void assign
- string varname
- mixed var
-
-
-
- Wird verwendet, um einem Template Werte zuzuweisen. Sie können
- entweder Namen/Wert-Paare oder ein assoziatives Array
- mit Namen/Wert-Paaren übergeben.
-
-
- assign
-
-
- // Namen/Wert-Paare übergeben
- $smarty->assign("Name","Fred");
- $smarty->assign("Address",$address);
-
-
- // assoziatives Array mit Namen/Wert-Paaren übergeben
- $smarty->assign(array("city" => "Lincoln","state" => "Nebraska"));
-
-
-
- assign_by_ref (via Referenz zuweisen)
-
-
- void assign_by_ref
- string varname
- mixed var
-
-
-
- Weist einen Wert via Referenz zu, anstatt eine Kopie zu machen.
- Konsultieren Sie das PHP-Manual zum Thema 'variable referencing' für weitere Erklärungen.
-
-
- Technical Note
-
- 'assign_by_ref()' ist effizienter als 'assign()', da keine Kopie der Variable
- erzeugt wird, sondern auf die Variable im Speicher referenziert wird. Beachten Sie
- dabei, dass eine nachträgliche änderung Original-Variable auch die zugewiesene Variable
- ändert. PHP5 wird die Referenzierung automatisch übernehmen, diese
- Funktion dient als Workaround.
-
-
-
- assign_by_ref (via Referenz zuweisen)
-
-
- // Namen/Wert-Paare übergeben
- $smarty->assign_by_ref("Name",$myname);
- $smarty->assign_by_ref("Address",$address);
-
-
-
- clear_all_assign (alle Zuweisungen löschen)
-
-
- void clear_all_assign
-
-
-
-
- Löscht die Werte aller zugewiesenen Variablen.
-
-
- clear_all_assign (alle Zuweisungen löschen)
-
-
- // lösche alle zugewiesenen Variablen
- $smarty->clear_all_assign();
-
-
-
- clear_all_cache (Cache vollständig leeren)
-
-
- void clear_all_cache
- int expire time
-
-
-
- Leert den gesamten Template-Cache. Als optionaler Parameter kann ein
- Mindestalter in Sekunden angegeben werden, das die einzelne Datei haben
- muss, bevor sie gelöscht wird.
-
-
- clear_all_cache (Cache vollständig leeren)
-
-
- // leere den gesamten cache
- $smarty->clear_all_cache();
-
-
-
- clear_assign (lösche Zuweisung)
-
-
- void clear_assign
- string var
-
-
-
- Löscht den Wert einer oder mehrerer (übergabe als Array) zugewiesener Variablen.
-
-
- clear_assign (lösche Zuweisung)
-
-
- // lösche eine einzelne Variable
- $smarty->clear_assign("Name");
-
-
- // lösche mehrere Variablen
- $smarty->clear_assign(array("Name","Address","Zip"));
-
-
-
- clear_cache (leere Cache)
-
- voidclear_cache
- stringtemplate
- stringcache id
- stringcompile id
- intexpire time
-
-
- Löscht den Cache eines bestimmten Templates. Falls Sie mehrere
- Caches für ein Template verwenden, können Sie als zweiten Parameter
- die 'cache_id' des zu leerenden Caches übergeben. Als dritten Parameter
- können sie die 'compile_id' angeben. Sie können Templates auch
- gruppieren und dann als Gruppe aus dem Cache löschen. Sehen sie dazu den Abschnitt über
- caching. Als vierten Parameter können Sie
- ein Mindestalter in Sekunden angeben, das ein Cache aufweisen muss,
- bevor er gelöscht wird.
-
-
- clear_cache (Cache leeren)
-
-
- // Cache eines Templates leeren
- $smarty->clear_cache("index.tpl");
-
-
- // leere den Cache einer bestimmten 'cache-id' eines mehrfach-gecachten Templates
- $smarty->clear_cache("index.tpl","CACHEID");
-
-
-
- clear_compiled_tpl (kompiliertes Template löschen)
-
-
- void clear_compiled_tpl
- string tpl_file
-
-
-
- Löscht die kompilierte Version des angegebenen Templates. Falls
- kein Template-Name übergeben wird, werden alle kompilierten
- Templates gelöscht. Diese Funktion ist für fortgeschrittene Benutzer.
-
-
- clear_compiled_tpl (kompiliertes Template löschen)
-
-
- // ein bestimmtes kompiliertes Template löschen
- $smarty->clear_compiled_tpl("index.tpl");
-
-
- // das gesamte Kompilier-Verzeichnis löschen
- $smarty->clear_compiled_tpl();
-
-
-
- display (ausgeben)
-
- voiddisplay
- stringtemplate
- stringcache_id
- stringcompile_id
-
-
- Gibt ein Template aus. Sie müssen einen gültigen
- Template Ressourcen-Typ
- inklusive Pfad angeben. Als optionalen zweiten Parameter können
- Sie eine 'cache_id' übergeben. Konsultieren
- Sie den Abschnitt über caching für weitere Informationen.
-
-
- Als optionalen dritten Parameter können Sie eine 'compile_id' übergeben.
- Dies ist wertvoll, falls Sie verschiedene Versionen eines Templates
- kompilieren wollen - zum Beispiel in verschiedenen Sprachen. 'compile_id'
- wird auch verwendet, wenn Sie mehr als ein '$template_dir' aber nur ein
- '$compile_dir' haben. Setzen Sie dazu für jedes Verzeichnis eine
- eigene 'compile_id', andernfalls werden Templates mit dem gleichen Namen
- überschrieben. Sie können die Variable $compile_id
- auch einmalig setzen, anstatt sie bei jedem Aufruf von 'display()' zu übergeben.
-
-
- display (ausgeben)
-
- include("Smarty.class.php");
- $smarty = new Smarty;
- $smarty->caching = true;
-
-
- // Datenbank-Aufrufe nur durchführen, wenn kein Cache existiert
- if(!$smarty->is_cached("index.tpl"))
- {
-
-
- // Beispieldaten
- $address = "245 N 50th";
- $db_data = array(
- "City" => "Lincoln",
- "State" => "Nebraska",
- "Zip" = > "68502"
- );
-
- $smarty->assign("Name","Fred");
- $smarty->assign("Address",$address);
- $smarty->assign($db_data);
-
- }
-
-
- // Ausgabe
- $smarty->display("index.tpl");
-
-
- Verwenden Sie die Syntax von template resources
- um Dateien ausserhalb von '$template_dir' zu verwenden.
-
-
- Beispiele von Template-Ressourcen für 'display()'
-
-
- // absoluter Dateipfad
- $smarty->display("/usr/local/include/templates/header.tpl");
-
-
- // absoluter Dateipfad (alternativ)
- $smarty->display("file:/usr/local/include/templates/header.tpl");
-
-
- // absoluter Dateipfad unter Windows (MUSS mit 'file:'-Prefix versehen werden)
- $smarty->display("file:C:/www/pub/templates/header.tpl");
-
-
- // aus der Template-Ressource 'db' einbinden
- $smarty->display("db:header.tpl");
-
-
-
-
- fetch
-
- stringfetch
- stringtemplate
- stringcache_id
- stringcompile_id
-
-
- Gibt die Ausgabe des Template zurück, anstatt es direkt anzuzeigen. Übergeben Sie
- einen gültigen Template Ressource-Typ
- und -Pfad. Als optionaler zweiter Parameter kann eine 'cache_id' übergeben werden.
- Bitte konsultieren Sie den Abschnitt über caching
- für weitere Informationen.
-
-
-
- Als optionalen dritten Parameter können Sie eine 'compile_id' übergeben.
- Dies ist wertvoll, falls Sie verschiedene Versionen eines Templates
- kompilieren wollen - zum Beispiel in verschiedenen Sprachen. 'compile_id'
- wird auch verwendet, wenn Sie mehr als ein '$template_dir' aber nur ein
- '$compile_dir' haben. Setzen Sie dann für jedes Verzeichnis eine
- eigene 'compile_id', andernfalls werden Templates mit dem gleichen Namen
- überschrieben. Sie können die Variable $compile_id
- auch einmalig setzen, anstatt sie bei jedem Aufruf von 'fetch()' zu übergeben.
-
-
- fetch
-
- include("Smarty.class.php");
- $smarty = new Smarty;
-
- $smarty->caching = true;
-
-
- // Datenbank-Aufrufe nur durchführen, wenn kein Cache existiert
- if(!$smarty->is_cached("index.tpl"))
- {
-
-
- // Beispieldaten
- $address = "245 N 50th";
- $db_data = array(
- "City" => "Lincoln",
- "State" => "Nebraska",
- "Zip" = > "68502"
- );
-
- $smarty->assign("Name","Fred");
- $smarty->assign("Address",$address);
- $smarty->assign($db_data);
-
- }
-
-
- // Ausgabe abfangen
- $output = $smarty->fetch("index.tpl");
-
-
- // Etwas mit $output anstellen
-
- echo $output;
-
-
-
- get_template_vars (Template-Variablen extrahieren)
-
-
- array get_template_vars
-
-
-
-
- Gibt ein Array der zugewiesenen Template-Variablen zurück.
-
-
- get_template_vars (Template-Variablen extrahieren)
-
-
- // alle zugewiesenen Template-Variablen extrahieren
- $tpl_vars = $smarty->get_template_vars();
-
-
- // Anschauen
- var_dump($tpl_vars);
-
-
-
- is_cached (gecachte Version existiert)
-
-
- void is_cached
- string template
- [string cache_id]
-
-
-
- Gibt 'true' zurück, wenn ein gültiger Cache für das angegebene Template existiert.
- Dies funktioniert nur, wenn caching eingeschaltet ist.
-
-
- is_cached
-
- $smarty->caching = true;
-
- if(!$smarty->is_cached("index.tpl")) {
-
- // Datenbank-Abfragen, Variablen zuweisen...
- }
-
- $smarty->display("index.tpl");
-
-
- Als optionalen zweiten Parameter können Sie die 'cache_id' übergeben,
- falls Sie mehrere Caches für ein Template verwenden.
-
-
- 'is_cached' bei mehreren Template-Caches
-
- $smarty->caching = true;
-
- if(!$smarty->is_cached("index.tpl", "FrontPage")) {
-
- // Datenbank Abfragen, Variablen zuweisen...
- }
-
- $smarty->display("index.tpl","FrontPage");
-
-
-
- load_filter (Filter laden)
-
-
- void load_filter
- string type
- string name
-
-
-
- Mit dieser Funktion können Filter-Plugins geladen werden.
- Der erste Parameter definiert den Filter-Typ und kann einen der
- folgenden Werte haben: 'pre', 'post', oder 'output'. Als zweiter
- Parameter wird der Name des Filter-Plugins angegeben, zum Beispiel 'trim'.
-
-
- Filter-Plugins laden
-
- $smarty->load_filter('pre', 'trim'); // lade den 'pre'-Filter (Vor-Filter) namens 'trim'
- $smarty->load_filter('pre', 'datefooter'); // lade einen zweiten Vor-Filter namens 'datefooter'
- $smarty->load_filter('output', 'compress'); // lade den 'output'-Filter (Ausgabe-Filter) namens 'compress'
-
-
-
- register_block (Block-Funktion registrieren)
-
-
- void register_block
- string name
- mixed impl
- bool cacheable
- array or null cache_attrs
-
-
-
- Wird verwendet, um Block-Funktion-Plugins dynamisch zu registrieren.
- Übergeben Sie dazu den Namen der Block-Funktion und den Namen der
- PHP-Callback-Funktion, die die entsprechende Funktionalität bereitstellt.
-
-
- Der Parameter impl kann als (a) einen Funktionnamen oder (b) einem Array der Form array(&$object, $method),
- wobei &$object eine Referenz zu einem Objekt und $method der Name der Methode die aufgerufen werden soll ist,
- oder als Array der Form array(&$class, $method), wobei $class der Name der Klasse und $method
- der Name der Methode ist die aufgerufen werden soll, übergeben werden.
-
-
- $cacheable und $cache_attrs können in den meisten Fällen weggelassen werden. Konsultieren Sie Die Ausgabe von cachebaren Plugins Kontrollieren für weitere Informationen.
-
-
- register_block (Block-Funktion registrieren)
-
- /* PHP */
- $smarty->register_block("translate", "do_translation");
-
- function do_translation ($params, $content, &$smarty, &$repeat) {
- if (isset($content)) {
- $lang = $params['lang'];
-
- // übersetze den Inhalt von '$content'
- return $translation;
- }
- }
-
- {* template *}
- {translate lang="br"}
- Hello, world!
- {/translate}
-
-
-
- register_compiler_function (Compiler-Funktion registrieren)
-
-
- void register_compiler_function
- string name
- mixed impl
- bool cacheable
-
-
-
- Wird verwendet, um Compiler-Funktion-Plugins dynamisch zu
- registrieren. Übergeben Sie dazu den Namen der Compiler-Funktion und den Namen der
- PHP-Funktion, die die entsprechende Funktionalität bereitstellt.
-
-
- Der Parameter impl kann als (a) einen Funktionnamen oder (b) einem Array der Form array(&$object, $method),
- wobei &$object eine Referenz zu einem Objekt und $method der Name der Methode die aufgerufen werden soll ist,
- oder als Array der Form array(&$class, $method), wobei $class der Name der Klasse und $method
- der Name der Methode ist die aufgerufen werden soll, übergeben werden.
-
-
- $cacheable und $cache_attrs können in den meisten Fällen weggelassen werden. Konsultieren Sie Die Ausgabe von cachebaren Plugins Kontrollieren für weitere Informationen.
-
-
-
- register_function (Funktion registrieren)
-
-
- void register_function
- string name
- mixed impl
- bool cacheable
- array or null cache_attrs
-
-
-
- Wird verwendet, um Template-Funktion-Plugins dynamisch zu
- registrieren. Übergeben Sie dazu den Namen der Template-Funktion
- und den Namen der PHP-Funktion, die die entsprechende Funktionalität bereitstellt.
-
-
- Der Parameter impl kann als (a) einen Funktionnamen oder (b) einem Array der Form array(&$object, $method),
- wobei &$object eine Referenz zu einem Objekt und $method der Name der Methode die aufgerufen werden soll ist,
- oder als Array der Form array(&$class, $method), wobei $class der Name der Klasse und $method
- der Name der Methode ist die aufgerufen werden soll, übergeben werden.
-
-
- $cacheable und $cache_attrs können in den meisten Fällen weggelassen werden. Konsultieren Sie Die Ausgabe von cachebaren Plugins Kontrollieren für weitere Informationen.
-
-
- register_function (Funktion registrieren)
-
- $smarty->register_function("date_now", "print_current_date");
-
- function print_current_date ($params) {
- extract($params);
- if(empty($format))
- $format="%b %e, %Y";
- return strftime($format,time());
- }
-
- // Von nun an können Sie {date_now} verwenden, um das aktuelle Datum auszugeben.
- // Oder {date_now format="%Y/%m/%d"}, wenn Sie es formatieren wollen.
-
-
-
- register_modifier (Modifikator-Plugin registrieren)
-
-
- void register_modifier
- string name
- mixed impl
-
-
-
- Wird verwendet, um Modifikator-Plugins dynamisch zu
- registrieren. Übergeben Sie dazu den Namen der Modifikator-Funktion
- und den Namen der PHP-Funktion, die die entsprechende Funktionalität
- bereitstellt.
-
-
- Der Parameter impl kann als (a) einen Funktionnamen oder (b) einem Array der Form array(&$object, $method),
- wobei &$object eine Referenz zu einem Objekt und $method der Name der Methode die aufgerufen werden soll ist,
- oder als Array der Form array(&$class, $method), wobei $class der Name der Klasse und $method
- der Name der Methode ist die aufgerufen werden soll, übergeben werden.
-
-
- register_modifier (Modifikator-Plugin registrieren)
-
-
- // PHP's 'stripslashes()'-Funktion als Smarty Modifikator registrieren
-
- $smarty->register_modifier("sslash", "stripslashes");
-
-
- // Von nun an können Sie {$var|sslash} verwenden,
- // um "\"-Zeichen (Backslash) aus Zeichenketten zu entfernen. ('\\' wird zu '\',...)
-
-
-
- register_object
-
-
- void register_object
- string object_name
- object $object
- array allowed methods/properties
- boolean format
- array block methods
-
-
-
- Wird verwendet um ein Objekt zu registrieren. Konsultieren Sie den Abschnitt Objekte
- für weitere Informationen und Beispiele.
-
-
-
- register_outputfilter (Ausgabefilter registrieren)
-
-
- void register_outputfilter
- mixed function
-
-
-
- Verwenden Sie diese Funktion um dynamisch Ausgabefilter zu registrieren, welche
- die Template Ausgabe verarbeiten bevor sie angezeigt wird. Konsultieren Sie
- den Abschnitt über Ausgabefilter
- für mehr Informationen.
-
-
- Der Parameter function kann als (a) einen Funktionnamen oder (b) einem Array der Form array(&$object, $method),
- wobei &$object eine Referenz zu einem Objekt und $method der Name der Methode die aufgerufen werden soll ist,
- oder als Array der Form array(&$class, $method), wobei $class der Name der Klasse und $method
- der Name der Methode ist die aufgerufen werden soll, übergeben werden.
-
-
-
- register_postfilter ('post'-Filter registrieren)
-
-
- void register_postfilter
- mixed function
-
-
-
- Wird verwendet, um 'post'-Filter dynamisch zu registrieren. 'post'-Filter werden
- auf das kompilierte Template angewendet. Konsultieren Sie dazu den
- Abschnitt template postfilters.
-
-
- Der Parameter function kann als (a) einen Funktionnamen oder (b) einem Array der Form array(&$object, $method),
- wobei &$object eine Referenz zu einem Objekt und $method der Name der Methode die aufgerufen werden soll ist,
- oder als Array der Form array(&$class, $method), wobei $class der Name der Klasse und $method
- der Name der Methode ist die aufgerufen werden soll, übergeben werden.
-
-
-
- register_prefilter ('pre'-Filter registrieren)
-
-
- void register_prefilter
- mixed function
-
-
-
- Wird verwendet, um 'pre'-Filter dynamisch zu registrieren. 'pre'-Filter werden
- vor der Kompilierung auf das Template angewendet. Konsultieren Sie dazu den
- Abschnitt 'pre'-Filter.
-
-
- Der Parameter function kann als (a) einen Funktionnamen oder (b) einem Array der Form array(&$object, $method),
- wobei &$object eine Referenz zu einem Objekt und $method der Name der Methode die aufgerufen werden soll ist,
- oder als Array der Form array(&$class, $method), wobei $class der Name der Klasse und $method
- der Name der Methode ist die aufgerufen werden soll, übergeben werden.
-
-
-
- register_resource (Ressource registrieren)
-
-
- void register_resource
- string name
- array resource_funcs
-
-
-
- Wird verwendet, um ein Ressource-Plugin dynamisch zu
- registrieren. Übergeben Sie dazu den Ressourcen-Namen und
- das Array mit den Namen der PHP-Funktionen, die die Funktionalität implementieren.
- Konsultieren Sie den Abschnitt template resources
- für weitere Informationen zum Thema.
-
-
- Technische Bemerkung
-
- Ein Ressourcename muss mindestens 2 Zeichen lang sein. Namen mit einem (1) Zeichen
- werden ignoriert und als Teil des Pfades verwenden, wie in $smarty->display('c:/path/to/index.tpl');.
-
-
-
- Der Parameter resource_funcs muss aus 4 oder 5 Elementen bestehen. Wenn 4 Elemente übergeben werden,
- werden diese als Ersatz Callback-Funktionen fü "source", "timestamp", "secure" und "trusted" verwendet. Mit 5 Elementen
- muss der erste Parameter eine Referenz auf das Objekt oder die Klasse sein, welche die benötigten Methoden bereitstellt.
-
-
- register_resource (Ressource registrieren)
-
- $smarty->register_resource("db", array("db_get_template",
- "db_get_timestamp",
- "db_get_secure",
- "db_get_trusted"));
-
-
-
- trigger_error (Fehler auslösen)
-
-
- void trigger_error
- string error_msg
- [int level]
-
-
-
- Wird verwendet, um eine Fehlermeldung via Smarty auszugeben.
- Der level-Parameter kann alle
- Werte der 'trigger_error()'-PHP-Funktion haben,
- zum Beispiel E_USER_NOTICE, E_USER_WARNING, usw.
- Voreingestellt ist E_USER_WARNING.
-
-
+&programmers.api-functions.api-append;
+&programmers.api-functions.api-append-by-ref;
+&programmers.api-functions.api-assign;
+&programmers.api-functions.api-assign-by-ref;
+&programmers.api-functions.api-clear-all-assign;
+&programmers.api-functions.api-clear-all-cache;
+&programmers.api-functions.api-clear-assign;
+&programmers.api-functions.api-clear-cache;
+&programmers.api-functions.api-clear-compiled-tpl;
+&programmers.api-functions.api-display;
+&programmers.api-functions.api-fetch;
+&programmers.api-functions.api-get-template-vars;
+&programmers.api-functions.api-is-cached;
+&programmers.api-functions.api-load-filter;
+&programmers.api-functions.api-register-block;
+&programmers.api-functions.api-register-compiler-function;
+&programmers.api-functions.api-register-function;
+&programmers.api-functions.api-register-modifier;
+&programmers.api-functions.api-register-object;
+&programmers.api-functions.api-register-outputfilter;
+&programmers.api-functions.api-register-postfilter;
+&programmers.api-functions.api-register-prefilter;
+&programmers.api-functions.api-register-resource;
+&programmers.api-functions.api-trigger-error;
-
- template_exists (Template existiert)
-
-
- bool template_exists
- string template
-
-
-
- Diese Funktion prüft, ob das angegebene Template existiert. Als Parameter
- können entweder ein Pfad im Dateisystem oder eine Ressource übergeben werden.
-
-
-
- unregister_block (Block-Funktion deaktivieren)
-
-
- void unregister_block
- string name
-
-
-
- Wird verwendet, um registrierte Block-Funktionen auszuschalten.
- Übergeben Sie dazu den Namen der Block-Funktion.
-
-
-
- unregister_compiler_function (Compiler-Funktion deaktivieren)
-
-
- void unregister_compiler_function
- string name
-
-
-
- Wird verwendet, um registrierte Compiler-Funktionen auszuschalten.
- Übergeben Sie dazu den Funktionsnamen der Compiler-Funktion.
-
-
-
- unregister_function (Template-Funktion deaktivieren)
-
-
- void unregister_function
- string name
-
-
-
- Wird verwendet, um registrierte Template-Funktionen auszuschalten.
- Übergeben Sie dazu den Namen der Template-Funktion.
-
-
- unregister_function
-
-
- // Template-Designer sollen keinen Zugriff auf das Dateisystem haben
-
- $smarty->unregister_function("fetch");
-
-
-
- unregister_modifier (Modifikator deaktivieren)
-
-
- void unregister_modifier
- string name
-
-
-
- Wird verwendet, um registrierte Variablen-Modifikatoren auszuschalten.
- Übergeben Sie dazu den Modifikator-Namen.
-
-
- unregister_modifier
-
-
- // Verhindern, dass Template-Designer 'strip_tags' anwenden
-
- $smarty->unregister_modifier("strip_tags");
-
-
-
- unregister_outputfilter (Ausgabefilter deaktivieren)
-
-
- void unregister_outputfilter
- string function_name
-
-
-
-
- Wird verwendet, um registrierte Ausgabefilter auszuschalten.
-
-
-
- unregister_postfilter ('post'-Filter deaktivieren)
-
-
- void unregister_postfilter
- string function_name
-
-
-
-
- Wird verwendet, um registrierte 'post'-Filter auszuschalten.
-
-
-
- unregister_prefilter ('pre'-Filter deaktiviern)
-
-
- void unregister_prefilter
- string function_name
-
-
-
-
- Wird verwendet, um registrierte 'pre'-Filter auszuschalten.
-
-
-
- unregister_resource (Ressource deaktivieren)
-
-
- void unregister_resource
- string name
-
-
-
- Wird verwendet, um registrierte Ressourcen auszuschalten.
- Übergeben Sie dazu den Namen der Ressource.
-
-
- unregister_resource (Ressource deaktivieren)
-
- $smarty->unregister_resource("db");
-
-
+&programmers.api-functions.api-template-exists;
+&programmers.api-functions.api-unregister-block;
+&programmers.api-functions.api-unregister-compiler-function;
+&programmers.api-functions.api-unregister-function;
+&programmers.api-functions.api-unregister-modifier;
+&programmers.api-functions.api-unregister-outputfilter;
+&programmers.api-functions.api-unregister-postfilter;
+&programmers.api-functions.api-unregister-prefilter;
+&programmers.api-functions.api-unregister-resource;
+
+ append_by_ref (via Referenz anhängen)
+
+
+ void append_by_ref
+ string varname
+ mixed var
+
+
+
+ Wird verwendet, um an Template-Variablen Werte via Referenz (pass by reference) anstatt via Kopie
+ anzuhängen. Konsultieren Sie das PHP-Manual zum Thema 'variable referencing'
+ für weitere Erklärungen.
+
+
+ Technische Bemerkung
+
+ 'append_by_ref()' ist effizienter als 'append()', da keine Kopie der Variable
+ erzeugt, sondern auf die Variable im Speicher referenziert wird. Beachten Sie
+ dabei, dass eine nachträgliche änderung Original-Variable auch die zugewiesene Variable
+ ändert. PHP5 wird die Referenzierung automatisch übernehmen, diese
+ Funktion dient als Workaround.
+
+
+
+ append_by_ref (via Referenz anhängen)
+
+
+ // Namen/Wert-Paare übergeben
+ $smarty->append_by_ref("Name",$myname);
+ $smarty->append_by_ref("Address",$address);
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-functions/api-append.xml b/docs/de/programmers/api-functions/api-append.xml
new file mode 100644
index 00000000..56d7589f
--- /dev/null
+++ b/docs/de/programmers/api-functions/api-append.xml
@@ -0,0 +1,52 @@
+
+
+
+ append (anhängen)
+
+
+ void append
+ mixed var
+
+
+ void append
+ string varname
+ mixed var
+
+
+
+ Wird verwendet, um an Template-Variablen weitere Daten anzuhängen. Sie
+ können entweder ein Namen/Wert-Paar oder assoziative Arrays,
+ die mehrere Namen/Wert-Paare enthalten, übergeben.
+
+
+ append (anhängen)
+
+
+ // Namen/Wert-Paare übergeben
+ $smarty->append("Name","Fred");
+ $smarty->append("Address",$address);
+
+ // assoziatives Array übergeben
+ $smarty->append(array("city" => "Lincoln","state" => "Nebraska"));
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-functions/api-assign-by-ref.xml b/docs/de/programmers/api-functions/api-assign-by-ref.xml
new file mode 100644
index 00000000..5886348b
--- /dev/null
+++ b/docs/de/programmers/api-functions/api-assign-by-ref.xml
@@ -0,0 +1,54 @@
+
+
+
+ assign_by_ref (via Referenz zuweisen)
+
+
+ void assign_by_ref
+ string varname
+ mixed var
+
+
+
+ Weist einen Wert via Referenz zu, anstatt eine Kopie zu machen.
+ Konsultieren Sie das PHP-Manual zum Thema 'variable referencing' für weitere Erklärungen.
+
+
+ Technical Note
+
+ 'assign_by_ref()' ist effizienter als 'assign()', da keine Kopie der Variable
+ erzeugt wird, sondern auf die Variable im Speicher referenziert wird. Beachten Sie
+ dabei, dass eine nachträgliche änderung Original-Variable auch die zugewiesene Variable
+ ändert. PHP5 wird die Referenzierung automatisch übernehmen, diese
+ Funktion dient als Workaround.
+
+
+
+ assign_by_ref (via Referenz zuweisen)
+
+
+ // Namen/Wert-Paare übergeben
+ $smarty->assign_by_ref("Name",$myname);
+ $smarty->assign_by_ref("Address",$address);
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-functions/api-assign.xml b/docs/de/programmers/api-functions/api-assign.xml
new file mode 100644
index 00000000..7d712ff4
--- /dev/null
+++ b/docs/de/programmers/api-functions/api-assign.xml
@@ -0,0 +1,53 @@
+
+
+
+ assign (zuweisen)
+
+
+ void assign
+ mixed var
+
+
+ void assign
+ string varname
+ mixed var
+
+
+
+ Wird verwendet, um einem Template Werte zuzuweisen. Sie können
+ entweder Namen/Wert-Paare oder ein assoziatives Array
+ mit Namen/Wert-Paaren übergeben.
+
+
+ assign
+
+
+ // Namen/Wert-Paare übergeben
+ $smarty->assign("Name","Fred");
+ $smarty->assign("Address",$address);
+
+
+ // assoziatives Array mit Namen/Wert-Paaren übergeben
+ $smarty->assign(array("city" => "Lincoln","state" => "Nebraska"));
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-functions/api-clear-all-assign.xml b/docs/de/programmers/api-functions/api-clear-all-assign.xml
new file mode 100644
index 00000000..4c4c874c
--- /dev/null
+++ b/docs/de/programmers/api-functions/api-clear-all-assign.xml
@@ -0,0 +1,41 @@
+
+
+
+ clear_all_assign (alle Zuweisungen löschen)
+
+
+ void clear_all_assign
+
+
+
+
+ Löscht die Werte aller zugewiesenen Variablen.
+
+
+ clear_all_assign (alle Zuweisungen löschen)
+
+
+ // lösche alle zugewiesenen Variablen
+ $smarty->clear_all_assign();
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-functions/api-clear-all-cache.xml b/docs/de/programmers/api-functions/api-clear-all-cache.xml
new file mode 100644
index 00000000..880d178a
--- /dev/null
+++ b/docs/de/programmers/api-functions/api-clear-all-cache.xml
@@ -0,0 +1,43 @@
+
+
+
+ clear_all_cache (Cache vollständig leeren)
+
+
+ void clear_all_cache
+ int expire time
+
+
+
+ Leert den gesamten Template-Cache. Als optionaler Parameter kann ein
+ Mindestalter in Sekunden angegeben werden, das die einzelne Datei haben
+ muss, bevor sie gelöscht wird.
+
+
+ clear_all_cache (Cache vollständig leeren)
+
+
+ // leere den gesamten cache
+ $smarty->clear_all_cache();
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-functions/api-clear-assign.xml b/docs/de/programmers/api-functions/api-clear-assign.xml
new file mode 100644
index 00000000..dd05ff13
--- /dev/null
+++ b/docs/de/programmers/api-functions/api-clear-assign.xml
@@ -0,0 +1,45 @@
+
+
+
+ clear_assign (lösche Zuweisung)
+
+
+ void clear_assign
+ string var
+
+
+
+ Löscht den Wert einer oder mehrerer (übergabe als Array) zugewiesener Variablen.
+
+
+ clear_assign (lösche Zuweisung)
+
+
+ // lösche eine einzelne Variable
+ $smarty->clear_assign("Name");
+
+
+ // lösche mehrere Variablen
+ $smarty->clear_assign(array("Name","Address","Zip"));
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-functions/api-clear-cache.xml b/docs/de/programmers/api-functions/api-clear-cache.xml
new file mode 100644
index 00000000..8fed4697
--- /dev/null
+++ b/docs/de/programmers/api-functions/api-clear-cache.xml
@@ -0,0 +1,53 @@
+
+
+
+ clear_cache (leere Cache)
+
+ voidclear_cache
+ stringtemplate
+ stringcache id
+ stringcompile id
+ intexpire time
+
+
+ Löscht den Cache eines bestimmten Templates. Falls Sie mehrere
+ Caches für ein Template verwenden, können Sie als zweiten Parameter
+ die 'cache_id' des zu leerenden Caches übergeben. Als dritten Parameter
+ können sie die 'compile_id' angeben. Sie können Templates auch
+ gruppieren und dann als Gruppe aus dem Cache löschen. Sehen sie dazu den Abschnitt über
+ caching. Als vierten Parameter können Sie
+ ein Mindestalter in Sekunden angeben, das ein Cache aufweisen muss,
+ bevor er gelöscht wird.
+
+
+ clear_cache (Cache leeren)
+
+
+ // Cache eines Templates leeren
+ $smarty->clear_cache("index.tpl");
+
+
+ // leere den Cache einer bestimmten 'cache-id' eines mehrfach-gecachten Templates
+ $smarty->clear_cache("index.tpl","CACHEID");
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-functions/api-clear-compiled-tpl.xml b/docs/de/programmers/api-functions/api-clear-compiled-tpl.xml
new file mode 100644
index 00000000..4f5484a9
--- /dev/null
+++ b/docs/de/programmers/api-functions/api-clear-compiled-tpl.xml
@@ -0,0 +1,47 @@
+
+
+
+ clear_compiled_tpl (kompiliertes Template löschen)
+
+
+ void clear_compiled_tpl
+ string tpl_file
+
+
+
+ Löscht die kompilierte Version des angegebenen Templates. Falls
+ kein Template-Name übergeben wird, werden alle kompilierten
+ Templates gelöscht. Diese Funktion ist für fortgeschrittene Benutzer.
+
+
+ clear_compiled_tpl (kompiliertes Template löschen)
+
+
+ // ein bestimmtes kompiliertes Template löschen
+ $smarty->clear_compiled_tpl("index.tpl");
+
+
+ // das gesamte Kompilier-Verzeichnis löschen
+ $smarty->clear_compiled_tpl();
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-functions/api-display.xml b/docs/de/programmers/api-functions/api-display.xml
new file mode 100644
index 00000000..d3cb0c56
--- /dev/null
+++ b/docs/de/programmers/api-functions/api-display.xml
@@ -0,0 +1,103 @@
+
+
+
+ display (ausgeben)
+
+ voiddisplay
+ stringtemplate
+ stringcache_id
+ stringcompile_id
+
+
+ Gibt ein Template aus. Sie müssen einen gültigen
+ Template Ressourcen-Typ
+ inklusive Pfad angeben. Als optionalen zweiten Parameter können
+ Sie eine 'cache_id' übergeben. Konsultieren
+ Sie den Abschnitt über caching für weitere Informationen.
+
+
+ Als optionalen dritten Parameter können Sie eine 'compile_id' übergeben.
+ Dies ist wertvoll, falls Sie verschiedene Versionen eines Templates
+ kompilieren wollen - zum Beispiel in verschiedenen Sprachen. 'compile_id'
+ wird auch verwendet, wenn Sie mehr als ein '$template_dir' aber nur ein
+ '$compile_dir' haben. Setzen Sie dazu für jedes Verzeichnis eine
+ eigene 'compile_id', andernfalls werden Templates mit dem gleichen Namen
+ überschrieben. Sie können die Variable $compile_id
+ auch einmalig setzen, anstatt sie bei jedem Aufruf von 'display()' zu übergeben.
+
+
+ display (ausgeben)
+
+ include("Smarty.class.php");
+ $smarty = new Smarty;
+ $smarty->caching = true;
+
+
+ // Datenbank-Aufrufe nur durchführen, wenn kein Cache existiert
+ if(!$smarty->is_cached("index.tpl"))
+ {
+
+
+ // Beispieldaten
+ $address = "245 N 50th";
+ $db_data = array(
+ "City" => "Lincoln",
+ "State" => "Nebraska",
+ "Zip" = > "68502"
+ );
+
+ $smarty->assign("Name","Fred");
+ $smarty->assign("Address",$address);
+ $smarty->assign($db_data);
+
+ }
+
+
+ // Ausgabe
+ $smarty->display("index.tpl");
+
+
+ Verwenden Sie die Syntax von template resources
+ um Dateien ausserhalb von '$template_dir' zu verwenden.
+
+
+ Beispiele von Template-Ressourcen für 'display()'
+
+
+ // absoluter Dateipfad
+ $smarty->display("/usr/local/include/templates/header.tpl");
+
+
+ // absoluter Dateipfad (alternativ)
+ $smarty->display("file:/usr/local/include/templates/header.tpl");
+
+
+ // absoluter Dateipfad unter Windows (MUSS mit 'file:'-Prefix versehen werden)
+ $smarty->display("file:C:/www/pub/templates/header.tpl");
+
+
+ // aus der Template-Ressource 'db' einbinden
+ $smarty->display("db:header.tpl");
+
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-functions/api-fetch.xml b/docs/de/programmers/api-functions/api-fetch.xml
new file mode 100644
index 00000000..84b77fb3
--- /dev/null
+++ b/docs/de/programmers/api-functions/api-fetch.xml
@@ -0,0 +1,86 @@
+
+
+
+ fetch
+
+ stringfetch
+ stringtemplate
+ stringcache_id
+ stringcompile_id
+
+
+ Gibt die Ausgabe des Template zurück, anstatt es direkt anzuzeigen. Übergeben Sie
+ einen gültigen Template Ressource-Typ
+ und -Pfad. Als optionaler zweiter Parameter kann eine 'cache_id' übergeben werden.
+ Bitte konsultieren Sie den Abschnitt über caching
+ für weitere Informationen.
+
+
+
+ Als optionalen dritten Parameter können Sie eine 'compile_id' übergeben.
+ Dies ist wertvoll, falls Sie verschiedene Versionen eines Templates
+ kompilieren wollen - zum Beispiel in verschiedenen Sprachen. 'compile_id'
+ wird auch verwendet, wenn Sie mehr als ein '$template_dir' aber nur ein
+ '$compile_dir' haben. Setzen Sie dann für jedes Verzeichnis eine
+ eigene 'compile_id', andernfalls werden Templates mit dem gleichen Namen
+ überschrieben. Sie können die Variable $compile_id
+ auch einmalig setzen, anstatt sie bei jedem Aufruf von 'fetch()' zu übergeben.
+
+
+ fetch
+
+ include("Smarty.class.php");
+ $smarty = new Smarty;
+
+ $smarty->caching = true;
+
+
+ // Datenbank-Aufrufe nur durchführen, wenn kein Cache existiert
+ if(!$smarty->is_cached("index.tpl"))
+ {
+
+
+ // Beispieldaten
+ $address = "245 N 50th";
+ $db_data = array(
+ "City" => "Lincoln",
+ "State" => "Nebraska",
+ "Zip" = > "68502"
+ );
+
+ $smarty->assign("Name","Fred");
+ $smarty->assign("Address",$address);
+ $smarty->assign($db_data);
+
+ }
+
+
+ // Ausgabe abfangen
+ $output = $smarty->fetch("index.tpl");
+
+
+ // Etwas mit $output anstellen
+
+ echo $output;
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-functions/api-get-template-vars.xml b/docs/de/programmers/api-functions/api-get-template-vars.xml
new file mode 100644
index 00000000..84aaba11
--- /dev/null
+++ b/docs/de/programmers/api-functions/api-get-template-vars.xml
@@ -0,0 +1,45 @@
+
+
+
+ get_template_vars (Template-Variablen extrahieren)
+
+
+ array get_template_vars
+
+
+
+
+ Gibt ein Array der zugewiesenen Template-Variablen zurück.
+
+
+ get_template_vars (Template-Variablen extrahieren)
+
+
+ // alle zugewiesenen Template-Variablen extrahieren
+ $tpl_vars = $smarty->get_template_vars();
+
+
+ // Anschauen
+ var_dump($tpl_vars);
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-functions/api-is-cached.xml b/docs/de/programmers/api-functions/api-is-cached.xml
new file mode 100644
index 00000000..bde4afbf
--- /dev/null
+++ b/docs/de/programmers/api-functions/api-is-cached.xml
@@ -0,0 +1,64 @@
+
+
+
+ is_cached (gecachte Version existiert)
+
+
+ void is_cached
+ string template
+ [string cache_id]
+
+
+
+ Gibt 'true' zurück, wenn ein gültiger Cache für das angegebene Template existiert.
+ Dies funktioniert nur, wenn caching eingeschaltet ist.
+
+
+ is_cached
+
+ $smarty->caching = true;
+
+ if(!$smarty->is_cached("index.tpl")) {
+
+ // Datenbank-Abfragen, Variablen zuweisen...
+ }
+
+ $smarty->display("index.tpl");
+
+
+ Als optionalen zweiten Parameter können Sie die 'cache_id' übergeben,
+ falls Sie mehrere Caches für ein Template verwenden.
+
+
+ 'is_cached' bei mehreren Template-Caches
+
+ $smarty->caching = true;
+
+ if(!$smarty->is_cached("index.tpl", "FrontPage")) {
+
+ // Datenbank Abfragen, Variablen zuweisen...
+ }
+
+ $smarty->display("index.tpl","FrontPage");
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-functions/api-load-filter.xml b/docs/de/programmers/api-functions/api-load-filter.xml
new file mode 100644
index 00000000..da919dc3
--- /dev/null
+++ b/docs/de/programmers/api-functions/api-load-filter.xml
@@ -0,0 +1,45 @@
+
+
+
+ load_filter (Filter laden)
+
+
+ void load_filter
+ string type
+ string name
+
+
+
+ Mit dieser Funktion können Filter-Plugins geladen werden.
+ Der erste Parameter definiert den Filter-Typ und kann einen der
+ folgenden Werte haben: 'pre', 'post', oder 'output'. Als zweiter
+ Parameter wird der Name des Filter-Plugins angegeben, zum Beispiel 'trim'.
+
+
+ Filter-Plugins laden
+
+ $smarty->load_filter('pre', 'trim'); // lade den 'pre'-Filter (Vor-Filter) namens 'trim'
+ $smarty->load_filter('pre', 'datefooter'); // lade einen zweiten Vor-Filter namens 'datefooter'
+ $smarty->load_filter('output', 'compress'); // lade den 'output'-Filter (Ausgabe-Filter) namens 'compress'
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-functions/api-register-block.xml b/docs/de/programmers/api-functions/api-register-block.xml
new file mode 100644
index 00000000..6b176e17
--- /dev/null
+++ b/docs/de/programmers/api-functions/api-register-block.xml
@@ -0,0 +1,68 @@
+
+
+
+ register_block (Block-Funktion registrieren)
+
+
+ void register_block
+ string name
+ mixed impl
+ bool cacheable
+ array or null cache_attrs
+
+
+
+ Wird verwendet, um Block-Funktion-Plugins dynamisch zu registrieren.
+ Übergeben Sie dazu den Namen der Block-Funktion und den Namen der
+ PHP-Callback-Funktion, die die entsprechende Funktionalität bereitstellt.
+
+
+ Der Parameter impl kann als (a) einen Funktionnamen oder (b) einem Array der Form array(&$object, $method),
+ wobei &$object eine Referenz zu einem Objekt und $method der Name der Methode die aufgerufen werden soll ist,
+ oder als Array der Form array(&$class, $method), wobei $class der Name der Klasse und $method
+ der Name der Methode ist die aufgerufen werden soll, übergeben werden.
+
+
+ $cacheable und $cache_attrs können in den meisten Fällen weggelassen werden. Konsultieren Sie Die Ausgabe von cachebaren Plugins Kontrollieren für weitere Informationen.
+
+
+ register_block (Block-Funktion registrieren)
+
+ /* PHP */
+ $smarty->register_block("translate", "do_translation");
+
+ function do_translation ($params, $content, &$smarty, &$repeat) {
+ if (isset($content)) {
+ $lang = $params['lang'];
+
+ // übersetze den Inhalt von '$content'
+ return $translation;
+ }
+ }
+
+ {* template *}
+ {translate lang="br"}
+ Hello, world!
+ {/translate}
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-functions/api-register-compiler-function.xml b/docs/de/programmers/api-functions/api-register-compiler-function.xml
new file mode 100644
index 00000000..30875011
--- /dev/null
+++ b/docs/de/programmers/api-functions/api-register-compiler-function.xml
@@ -0,0 +1,47 @@
+
+
+
+ register_compiler_function (Compiler-Funktion registrieren)
+
+
+ void register_compiler_function
+ string name
+ mixed impl
+ bool cacheable
+
+
+
+ Wird verwendet, um Compiler-Funktion-Plugins dynamisch zu
+ registrieren. Übergeben Sie dazu den Namen der Compiler-Funktion und den Namen der
+ PHP-Funktion, die die entsprechende Funktionalität bereitstellt.
+
+
+ Der Parameter impl kann als (a) einen Funktionnamen oder (b) einem Array der Form array(&$object, $method),
+ wobei &$object eine Referenz zu einem Objekt und $method der Name der Methode die aufgerufen werden soll ist,
+ oder als Array der Form array(&$class, $method), wobei $class der Name der Klasse und $method
+ der Name der Methode ist die aufgerufen werden soll, übergeben werden.
+
+
+ $cacheable und $cache_attrs können in den meisten Fällen weggelassen werden. Konsultieren Sie Die Ausgabe von cachebaren Plugins Kontrollieren für weitere Informationen.
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-functions/api-register-function.xml b/docs/de/programmers/api-functions/api-register-function.xml
new file mode 100644
index 00000000..c3eee9c2
--- /dev/null
+++ b/docs/de/programmers/api-functions/api-register-function.xml
@@ -0,0 +1,63 @@
+
+
+
+ register_function (Funktion registrieren)
+
+
+ void register_function
+ string name
+ mixed impl
+ bool cacheable
+ array or null cache_attrs
+
+
+
+ Wird verwendet, um Template-Funktion-Plugins dynamisch zu
+ registrieren. Übergeben Sie dazu den Namen der Template-Funktion
+ und den Namen der PHP-Funktion, die die entsprechende Funktionalität bereitstellt.
+
+
+ Der Parameter impl kann als (a) einen Funktionnamen oder (b) einem Array der Form array(&$object, $method),
+ wobei &$object eine Referenz zu einem Objekt und $method der Name der Methode die aufgerufen werden soll ist,
+ oder als Array der Form array(&$class, $method), wobei $class der Name der Klasse und $method
+ der Name der Methode ist die aufgerufen werden soll, übergeben werden.
+
+
+ $cacheable und $cache_attrs können in den meisten Fällen weggelassen werden. Konsultieren Sie Die Ausgabe von cachebaren Plugins Kontrollieren für weitere Informationen.
+
+
+ register_function (Funktion registrieren)
+
+ $smarty->register_function("date_now", "print_current_date");
+
+ function print_current_date ($params) {
+ extract($params);
+ if(empty($format))
+ $format="%b %e, %Y";
+ return strftime($format,time());
+ }
+
+ // Von nun an können Sie {date_now} verwenden, um das aktuelle Datum auszugeben.
+ // Oder {date_now format="%Y/%m/%d"}, wenn Sie es formatieren wollen.
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-functions/api-register-modifier.xml b/docs/de/programmers/api-functions/api-register-modifier.xml
new file mode 100644
index 00000000..30fec531
--- /dev/null
+++ b/docs/de/programmers/api-functions/api-register-modifier.xml
@@ -0,0 +1,56 @@
+
+
+
+ register_modifier (Modifikator-Plugin registrieren)
+
+
+ void register_modifier
+ string name
+ mixed impl
+
+
+
+ Wird verwendet, um Modifikator-Plugins dynamisch zu
+ registrieren. Übergeben Sie dazu den Namen der Modifikator-Funktion
+ und den Namen der PHP-Funktion, die die entsprechende Funktionalität
+ bereitstellt.
+
+
+ Der Parameter impl kann als (a) einen Funktionnamen oder (b) einem Array der Form array(&$object, $method),
+ wobei &$object eine Referenz zu einem Objekt und $method der Name der Methode die aufgerufen werden soll ist,
+ oder als Array der Form array(&$class, $method), wobei $class der Name der Klasse und $method
+ der Name der Methode ist die aufgerufen werden soll, übergeben werden.
+
+
+ register_modifier (Modifikator-Plugin registrieren)
+
+
+ // PHP's 'stripslashes()'-Funktion als Smarty Modifikator registrieren
+
+ $smarty->register_modifier("sslash", "stripslashes");
+
+
+ // Von nun an können Sie {$var|sslash} verwenden,
+ // um "\"-Zeichen (Backslash) aus Zeichenketten zu entfernen. ('\\' wird zu '\',...)
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-functions/api-register-object.xml b/docs/de/programmers/api-functions/api-register-object.xml
new file mode 100644
index 00000000..f67716bb
--- /dev/null
+++ b/docs/de/programmers/api-functions/api-register-object.xml
@@ -0,0 +1,39 @@
+
+
+
+ register_object
+
+
+ void register_object
+ string object_name
+ object $object
+ array allowed methods/properties
+ boolean format
+ array block methods
+
+
+
+ Wird verwendet um ein Objekt zu registrieren. Konsultieren Sie den Abschnitt Objekte
+ für weitere Informationen und Beispiele.
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-functions/api-register-outputfilter.xml b/docs/de/programmers/api-functions/api-register-outputfilter.xml
new file mode 100644
index 00000000..357a67a2
--- /dev/null
+++ b/docs/de/programmers/api-functions/api-register-outputfilter.xml
@@ -0,0 +1,43 @@
+
+
+
+ register_outputfilter (Ausgabefilter registrieren)
+
+
+ void register_outputfilter
+ mixed function
+
+
+
+ Verwenden Sie diese Funktion um dynamisch Ausgabefilter zu registrieren, welche
+ die Template Ausgabe verarbeiten bevor sie angezeigt wird. Konsultieren Sie
+ den Abschnitt über Ausgabefilter
+ für mehr Informationen.
+
+
+ Der Parameter function kann als (a) einen Funktionnamen oder (b) einem Array der Form array(&$object, $method),
+ wobei &$object eine Referenz zu einem Objekt und $method der Name der Methode die aufgerufen werden soll ist,
+ oder als Array der Form array(&$class, $method), wobei $class der Name der Klasse und $method
+ der Name der Methode ist die aufgerufen werden soll, übergeben werden.
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-functions/api-register-postfilter.xml b/docs/de/programmers/api-functions/api-register-postfilter.xml
new file mode 100644
index 00000000..49249a84
--- /dev/null
+++ b/docs/de/programmers/api-functions/api-register-postfilter.xml
@@ -0,0 +1,42 @@
+
+
+
+ register_postfilter ('post'-Filter registrieren)
+
+
+ void register_postfilter
+ mixed function
+
+
+
+ Wird verwendet, um 'post'-Filter dynamisch zu registrieren. 'post'-Filter werden
+ auf das kompilierte Template angewendet. Konsultieren Sie dazu den
+ Abschnitt template postfilters.
+
+
+ Der Parameter function kann als (a) einen Funktionnamen oder (b) einem Array der Form array(&$object, $method),
+ wobei &$object eine Referenz zu einem Objekt und $method der Name der Methode die aufgerufen werden soll ist,
+ oder als Array der Form array(&$class, $method), wobei $class der Name der Klasse und $method
+ der Name der Methode ist die aufgerufen werden soll, übergeben werden.
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-functions/api-register-prefilter.xml b/docs/de/programmers/api-functions/api-register-prefilter.xml
new file mode 100644
index 00000000..77392903
--- /dev/null
+++ b/docs/de/programmers/api-functions/api-register-prefilter.xml
@@ -0,0 +1,42 @@
+
+
+
+ register_prefilter ('pre'-Filter registrieren)
+
+
+ void register_prefilter
+ mixed function
+
+
+
+ Wird verwendet, um 'pre'-Filter dynamisch zu registrieren. 'pre'-Filter werden
+ vor der Kompilierung auf das Template angewendet. Konsultieren Sie dazu den
+ Abschnitt 'pre'-Filter.
+
+
+ Der Parameter function kann als (a) einen Funktionnamen oder (b) einem Array der Form array(&$object, $method),
+ wobei &$object eine Referenz zu einem Objekt und $method der Name der Methode die aufgerufen werden soll ist,
+ oder als Array der Form array(&$class, $method), wobei $class der Name der Klasse und $method
+ der Name der Methode ist die aufgerufen werden soll, übergeben werden.
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-functions/api-register-resource.xml b/docs/de/programmers/api-functions/api-register-resource.xml
new file mode 100644
index 00000000..8820f773
--- /dev/null
+++ b/docs/de/programmers/api-functions/api-register-resource.xml
@@ -0,0 +1,59 @@
+
+
+
+ register_resource (Ressource registrieren)
+
+
+ void register_resource
+ string name
+ array resource_funcs
+
+
+
+ Wird verwendet, um ein Ressource-Plugin dynamisch zu
+ registrieren. Übergeben Sie dazu den Ressourcen-Namen und
+ das Array mit den Namen der PHP-Funktionen, die die Funktionalität implementieren.
+ Konsultieren Sie den Abschnitt template resources
+ für weitere Informationen zum Thema.
+
+
+ Technische Bemerkung
+
+ Ein Ressourcename muss mindestens 2 Zeichen lang sein. Namen mit einem (1) Zeichen
+ werden ignoriert und als Teil des Pfades verwenden, wie in $smarty->display('c:/path/to/index.tpl');.
+
+
+
+ Der Parameter resource_funcs muss aus 4 oder 5 Elementen bestehen. Wenn 4 Elemente übergeben werden,
+ werden diese als Ersatz Callback-Funktionen fü "source", "timestamp", "secure" und "trusted" verwendet. Mit 5 Elementen
+ muss der erste Parameter eine Referenz auf das Objekt oder die Klasse sein, welche die benötigten Methoden bereitstellt.
+
+
+ register_resource (Ressource registrieren)
+
+ $smarty->register_resource("db", array("db_get_template",
+ "db_get_timestamp",
+ "db_get_secure",
+ "db_get_trusted"));
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-functions/api-template-exists.xml b/docs/de/programmers/api-functions/api-template-exists.xml
new file mode 100644
index 00000000..134ba62e
--- /dev/null
+++ b/docs/de/programmers/api-functions/api-template-exists.xml
@@ -0,0 +1,35 @@
+
+
+
+ template_exists (Template existiert)
+
+
+ bool template_exists
+ string template
+
+
+
+ Diese Funktion prüft, ob das angegebene Template existiert. Als Parameter
+ können entweder ein Pfad im Dateisystem oder eine Ressource übergeben werden.
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-functions/api-trigger-error.xml b/docs/de/programmers/api-functions/api-trigger-error.xml
new file mode 100644
index 00000000..68daf0dc
--- /dev/null
+++ b/docs/de/programmers/api-functions/api-trigger-error.xml
@@ -0,0 +1,39 @@
+
+
+
+ trigger_error (Fehler auslösen)
+
+
+ void trigger_error
+ string error_msg
+ [int level]
+
+
+
+ Wird verwendet, um eine Fehlermeldung via Smarty auszugeben.
+ Der level-Parameter kann alle
+ Werte der 'trigger_error()'-PHP-Funktion haben,
+ zum Beispiel E_USER_NOTICE, E_USER_WARNING, usw.
+ Voreingestellt ist E_USER_WARNING.
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-functions/api-unregister-block.xml b/docs/de/programmers/api-functions/api-unregister-block.xml
new file mode 100644
index 00000000..e5a2c7d1
--- /dev/null
+++ b/docs/de/programmers/api-functions/api-unregister-block.xml
@@ -0,0 +1,35 @@
+
+
+
+ unregister_block (Block-Funktion deaktivieren)
+
+
+ void unregister_block
+ string name
+
+
+
+ Wird verwendet, um registrierte Block-Funktionen auszuschalten.
+ Übergeben Sie dazu den Namen der Block-Funktion.
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-functions/api-unregister-compiler-function.xml b/docs/de/programmers/api-functions/api-unregister-compiler-function.xml
new file mode 100644
index 00000000..24674fef
--- /dev/null
+++ b/docs/de/programmers/api-functions/api-unregister-compiler-function.xml
@@ -0,0 +1,35 @@
+
+
+
+ unregister_compiler_function (Compiler-Funktion deaktivieren)
+
+
+ void unregister_compiler_function
+ string name
+
+
+
+ Wird verwendet, um registrierte Compiler-Funktionen auszuschalten.
+ Übergeben Sie dazu den Funktionsnamen der Compiler-Funktion.
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-functions/api-unregister-function.xml b/docs/de/programmers/api-functions/api-unregister-function.xml
new file mode 100644
index 00000000..5bf6d2ae
--- /dev/null
+++ b/docs/de/programmers/api-functions/api-unregister-function.xml
@@ -0,0 +1,43 @@
+
+
+
+ unregister_function (Template-Funktion deaktivieren)
+
+
+ void unregister_function
+ string name
+
+
+
+ Wird verwendet, um registrierte Template-Funktionen auszuschalten.
+ Übergeben Sie dazu den Namen der Template-Funktion.
+
+
+ unregister_function
+
+
+ // Template-Designer sollen keinen Zugriff auf das Dateisystem haben
+
+ $smarty->unregister_function("fetch");
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-functions/api-unregister-modifier.xml b/docs/de/programmers/api-functions/api-unregister-modifier.xml
new file mode 100644
index 00000000..e65452e4
--- /dev/null
+++ b/docs/de/programmers/api-functions/api-unregister-modifier.xml
@@ -0,0 +1,43 @@
+
+
+
+ unregister_modifier (Modifikator deaktivieren)
+
+
+ void unregister_modifier
+ string name
+
+
+
+ Wird verwendet, um registrierte Variablen-Modifikatoren auszuschalten.
+ Übergeben Sie dazu den Modifikator-Namen.
+
+
+ unregister_modifier
+
+
+ // Verhindern, dass Template-Designer 'strip_tags' anwenden
+
+ $smarty->unregister_modifier("strip_tags");
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-functions/api-unregister-outputfilter.xml b/docs/de/programmers/api-functions/api-unregister-outputfilter.xml
new file mode 100644
index 00000000..9178faf8
--- /dev/null
+++ b/docs/de/programmers/api-functions/api-unregister-outputfilter.xml
@@ -0,0 +1,35 @@
+
+
+
+ unregister_outputfilter (Ausgabefilter deaktivieren)
+
+
+ void unregister_outputfilter
+ string function_name
+
+
+
+
+ Wird verwendet, um registrierte Ausgabefilter auszuschalten.
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-functions/api-unregister-postfilter.xml b/docs/de/programmers/api-functions/api-unregister-postfilter.xml
new file mode 100644
index 00000000..3a75d07a
--- /dev/null
+++ b/docs/de/programmers/api-functions/api-unregister-postfilter.xml
@@ -0,0 +1,35 @@
+
+
+
+ unregister_postfilter ('post'-Filter deaktivieren)
+
+
+ void unregister_postfilter
+ string function_name
+
+
+
+
+ Wird verwendet, um registrierte 'post'-Filter auszuschalten.
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-functions/api-unregister-prefilter.xml b/docs/de/programmers/api-functions/api-unregister-prefilter.xml
new file mode 100644
index 00000000..d5808e3c
--- /dev/null
+++ b/docs/de/programmers/api-functions/api-unregister-prefilter.xml
@@ -0,0 +1,35 @@
+
+
+
+ unregister_prefilter ('pre'-Filter deaktiviern)
+
+
+ void unregister_prefilter
+ string function_name
+
+
+
+
+ Wird verwendet, um registrierte 'pre'-Filter auszuschalten.
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-functions/api-unregister-resource.xml b/docs/de/programmers/api-functions/api-unregister-resource.xml
new file mode 100644
index 00000000..60413a2d
--- /dev/null
+++ b/docs/de/programmers/api-functions/api-unregister-resource.xml
@@ -0,0 +1,40 @@
+
+
+
+ unregister_resource (Ressource deaktivieren)
+
+
+ void unregister_resource
+ string name
+
+
+
+ Wird verwendet, um registrierte Ressourcen auszuschalten.
+ Übergeben Sie dazu den Namen der Ressource.
+
+
+ unregister_resource (Ressource deaktivieren)
+
+ $smarty->unregister_resource("db");
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-variables.xml b/docs/de/programmers/api-variables.xml
index 719b4229..98427fe5 100644
--- a/docs/de/programmers/api-variables.xml
+++ b/docs/de/programmers/api-variables.xml
@@ -3,441 +3,40 @@
Variablen
-
- $template_dir
-
- Definiert das Standard-Template Verzeichnis. Wenn
- sie beim Einbinden von Templates keinen Ressourcen-Typ übergeben,
- werden sie in diesem Pfad gesucht. Normalerweise lautet er './templates'.
- Das heisst, Smarty erwartet das Template-Verzeichnis im selben Verzeichnis
- wie das ausgeführte PHP-Skript.
-
-
- Technische Bemerkung
-
- Dieses Verzeichnis sollte ausserhalb der DocumentRoot
- des Webservers liegen.
-
-
-
-
- $compile_dir
-
- Definiert das Verzeichnis, in das die kompilierten Templates geschrieben
- werden. Normalerweise lautet es './templates_c'.
- Das heisst, Smarty erwartet das Kompilier-Verzeichnis im selben Verzeichnis
- wie das ausgeführte PHP-Skript.
-
-
- Technische Bemerkung
-
- Diese Einstellung kann als relativer oder als absoluter Pfad
- angegeben werden. 'include_path' wird nicht verwendet.
-
-
-
- Technische Bemerkung
-
- Dieses Verzeichnis sollte ausserhalb der DocumentRoot
- des Webservers liegen.
-
-
-
-
- $config_dir
-
- Dieses Verzeichnis definiert den Ort, an dem die von den
- Templates verwendeten Konfigurationsdateien abgelegt sind. Normalerweise
- ist dies './configs'. Das bedeutet, Smarty erwartet das
- Konfigurations-Verzeichnis im selben Verzeichnis wie das ausgeführte
- PHP-Skript.
-
-
- Technische Bemerkung
-
- Dieses Verzeichnis sollte ausserhalb der DocumentRoot
- des Webservers liegen.
-
-
-
-
- $plugins_dir
-
- Definiert das Verzeichnis in welchem Smarty die zu ladenden Plugins sucht.
- Normalerweise ist dies 'plugins' im SMARTY_DIR Pfad. Wenn Sie einen relativen
- Pfad angeben, wird Smarty zuerst versuchen das Plugin von SMARTY_DIR aus zu erreichen,
- danach relativ zum aktuellen Verzeichnis (mit 'cwd' - current working directory)
- und zum Schluss in jedem Eintrag des PHP-'include_path'.
-
-
- Technische Bemerkung
-
- Für optimale Performance ist es sinnvoll, 'plugins_dir'
- absolut oder relativ zu SMARTY_DIR bzw. dem aktuellen Verzeichnis zu definieren.
- Von der Definition des Verzeichnisses im PHP-'include_path' wird abgeraten.
-
-
-
-
- $debugging
-
- Aktiviert die Debugging Konsole.
- Die Konsole besteht aus einem Javascript-Fenster, welches Informationen zum
- momentan geladenen Template und den zugewiesenen Variablen enthält.
-
-
-
- $debug_tpl
-
- Definiert den Namen des für die Debugging Konsole verwendeten Template. Normalerweise
- lautet er 'debug.tpl' und befindet sich im SMARTY_DIR Verzeichnis.
-
-
-
- $debugging_ctrl
-
- Definiert Alternativen zur Aktivierung der Debugging Konsole.
- NONE verbietet alternative Methoden. URL aktiviert ds Debugging,
- wenn das Schlüsselwort 'SMARTY_DEBUG' im QUERY_STRING gefunden wird.
- Wenn '$debugging' auf 'true' gesetzt ist, wird dieser Wert ignoriert.
-
-
-
- $global_assign
-
- Definiert eine Liste von Variablen die jedem Template automatisch
- zugewiesen werden. Dies ist nützlich falls man globale beziehungsweise Server-Variablen,
- zuweisen will, ohne dies von Hand zu tun. Jedes Element in '$global_assign' sollte
- entweder den Namen der zuzuweisenden Variablen enthalten, oder Schlüssel/Wert-Paare,
- bei welchen der Schlüssel den Namen des globalen Arrays definiert und der
- Wert den Array mit den zuzuweisenden Werten. '$SCRIPT_NAME' wird immer zugewiesen und
- aus '$HTTP_SERVER_VARS' bezogen.
-
-
- Technische Bemerkung
-
- Server-Variablen können über die '$smarty'-Variable
- erreicht werden, zum Beispiel: {$smarty.server.SCRIPT_NAME}.
- Konsultieren sie den Abschnitt zu $smarty
- für weiterführende Informationen.
-
-
-
-
- $undefined
-
- Definiert den Wert von '$undefined' für Smarty. Normalerweise ist
- dieser Wert 'null'. Momentan wird er nur verwendet, um nicht definierten
- Elementen aus '$global_assign' einen Standardwert zuzuweisen.
-
-
-
- $autoload_filters
-
- Filter die Sie zu jedem Template laden möchten, können Sie mit Hilfe
- dieser Variable festlegen. Smarty wird sie danach automatisch laden. Die Variable
- enthält ein assoziatives Array, in dem der Schlüssel den Filter-Typ
- und der Wert den Filter-Namen definiert. Zum Beispiel:
-
-
- $smarty->autoload_filters = array('pre' => array('trim', 'stamp'),
- 'output' => array('convert'));
-
-
-
-
-
- $compile_check
-
- Bei jedem Aufruf der PHP-Applikation überprüft Smarty,
- ob sich das zugrundeliegende Template seit dem letzten Aufruf
- geändert hat. Falls es eine Änderung feststellt,
- wird das Template neu kompiliert. Seit Smarty 1.4.0 wird
- das Template - falls es nicht existiert - kompiliert, unabhängig
- davon welcher Wert '$compile_check' hat. Normalerweise ist der
- Wert dieser Variable 'true'. Wenn eine Applikation produktiv
- eingesetzt wird (die Templates ändern sich nicht mehr), kann
- der 'compile_check'-Schritt entfallen. Setzen Sie dann
- '$compile_check' auf 'false', um die Performance zu steigern.
- Achtung: Wenn Sie '$compile_check' auf 'false' setzen und anschliessend
- ein Template ändern, wird diese Änderung *nicht* angezeigt.
- Wenn caching und 'compile_check' eingeschaltet sind, werden die
- gecachten Skripts neu kompiliert, sobald eine Änderung an
- einem der eingebundenen Templates festgestellt wird.
- Siehe auch $force_compile
- und clear_compiled_tpl.
-
-
-
- $force_compile
-
- Veranlasst Smarty dazu die Templates bei jedem Aufruf neu
- zu kompilieren. Diese Einstellung überschreibt '$compile_check'.
- Normalerweise ist dies ausgeschaltet, kann jedoch für die Fehlersuche
- nützlich sein. In einem Produktiven-Umfeld sollte auf
- die Verwendung verzichtet werden. Wenn caching eingeschaltet ist,
- werden die gecachten Dateien bei jedem Aufruf neu kompiliert.
-
-
-
- $caching
-
- Definiert ob Smarty die Template-Ausgabe cachen soll. Normalerweise ist dies
- ausgeschaltet (disabled, Wert: 0). Falls Ihre Templates redundante Inhalte erzeugen,
- ist es empfehlenswert caching einzuschalten. Die Performance wird signifikant verbessert.
- Sie können auch mehrere Caches für ein Template haben. Die Werte 1 und 2 aktivieren
- caching. Bei 1 verwendet Smarty die Variable '$cache_lifetime', um zu berechnen
- ob ein Template neu kompiliert werden soll. Der Wert 2 weist Smarty an, den Wert von
- 'cache_lifetime' zur Zeit der Erzeugung des Cache zu verwenden. Damit können Sie 'cache_lifetime'
- setzen, bevor Sie das Template einbinden und haben so eine feine Kontrolle darüber,
- wann ein bestimmter Cache abläuft. Konsultieren Sie dazu auch: is_cached.
-
-
- Wenn '$compile_check' aktiviert ist, wird der Cache regeneriert sobald ein Template
- oder eine Konfigurations-Variable geändert wurde. Wenn '$force_compile' aktiviert ist,
- werden die gecachten Inhalte bei jedem Aufruf neu generiert.
-
-
-
- $cache_dir
-
- Definiert den Namen des Verzeichnisses in dem die Template-Caches
- angelegt werden. Normalerweise ist dies './cache', was Smarty veranlasst
- das Cache-Verzeichnis im aktuellen Verzeichnis zu suchen. Sie können
- auch einen eigenen Cache-Handler zur Kontrolle der Cache-Dateien
- definieren, der diese Einstellung ignoriert.
-
-
- Technische Bemerkung
-
- Die Angabe muss entweder relativ oder absolut angegeben werden. 'include_path'
- wird nicht verwendet.
-
-
-
- Technische Bemerkung
-
- Es wird empfohlen ein Verzeichnis ausserhalb der DocumentRoot zu verwenden.
-
-
-
-
- $cache_lifetime
-
- Definiert die Zeitspanne (in Sekunden) die ein Cache gültig
- bleibt. Ist die Zeit abgelaufen, wird der Cache neu generiert. '$caching'
- muss eingeschaltet (true) sein, damit '$cache_lifetime' Sinn macht. Der
- Wert -1 bewirkt, dass der Cache nie abläuft. Der Wert 0 bewirkt, dass
- der Inhalt immer neu generiert wird (nur sinnvoll für Tests, eine
- effizientere Methode wäre $caching
- auf 'false' zu setzen).
-
-
- Wenn $force_compile
- gesetzt ist, wird der Cache immer neu generiert (was einem Ausschalten
- von caching gleichkommt). Mit der clear_all_cache()
- Funktion können Sie alle Cache-Dateien auf einmal entfernen. Mit der
- clear_cache() Funktion können Sie
- einzelne Cache-Dateien (oder Gruppen) entfernen.
-
-
- Technische Bemerkung
-
- Falls Sie bestimmten Templates eine eigene Cache-Lifetime geben wollen,
- können Sie dies tun indem Sie $caching
- auf 2 stellen und '$cache_lifetime' einen einmaligen Wert zuweisen, bevor Sie
- 'display()' oder 'fetch()' aufrufen.
-
-
-
-
- $cache_handler_func
-
- Sie können auch eine eigene Cache-Handler Funktion definieren.
- Siehe Abschnitt zur custom cache handler Funktion.
-
-
-
- $cache_modified_check
-
- Wenn auf 1 gesetzt, verwendet Smarty den If-Modified-Since
- Header des Clients. Falls sich der Timestamp der Cache-Datei
- seit dem letzten Besuch nicht geändert hat, wird der
- Header '304 Not Modified' anstatt des Inhalts ausgegeben. Dies
- funktioniert nur mit gecachten Inhalten die keine insert
- Tags enthalten.
-
-
-
- $default_template_handler_func
-
- Diese Funktion wird aufgerufen, wenn ein Template nicht aus der
- vorgegebenen Quelle geladen werden kann.
-
-
-
- $php_handling
-
- Definiert wie Smarty mit PHP-Code innerhalb von Templates umgehen soll.
- Es gibt 4 verschiedene Einstellungen. Normalerweise wird
- SMARTY_PHP_PASSTHRU verwendet. Achtung: '$php_handling' wirkt sich NICHT
- auf PHP-Code aus, der zwischen {php}{/php}
- Tags steht.
-
-
- SMARTY_PHP_PASSTHRU - Smarty gibt die Tags aus.
- SMARTY_PHP_QUOTE - Smarty maskiert die Tags als HTML-Entities.
- SMARTY_PHP_REMOVE - Smarty entfernt die Tags.
- SMARTY_PHP_ALLOW - Smarty führt den Code als PHP-Code aus.
-
-
- ACHTUNG: Es wird davon abgeraten, PHP-Code in Templates einzubetten.
- Bitte verwenden Sie stattdessen custom functions
- oder Variablen-Modifikatoren.
-
-
-
- $security
-
- '$security' ein-/ausschalten. Normalerweise 'false' (ausgeschaltet).
- Die Sicherheitseinstellung ist wertvoll, wenn nicht vertrauenswürdigen
- Parteien Zugriff auf die Templates gegeben wird (zum Beispiel via FTP).
- Mit aktivierter '$security' kann verhindert werden, dass diese das System
- via Template-Engine kompromittieren. Die '$security' einzuschalten halt folgende
- Auswirkungen auf die Template-Language (ausser sie werden mit '$security_settings'
- überschrieben):
-
-
- Wenn '$php_handling' auf SMARTY_PHP_ALLOW geschaltet ist, wird der Wert auf SMARTY_PHP_PASSTHRU geändert.
- Ausser den in '$security_settings' definierten, sind keine Funktionen in IF-Statements aufrufbar.
- Templates können nur aus den im '$secure_dir'-Array definierten Verzeichnissen geladen werden.
- 'fetch()' kann nur verwendet werden um Dateien aus '$secure_dir' zu laden.
- {php}{/php}-Tags sind nicht erlaubt.
- Ausser den in '$security_settings' definierten, sind keine PHP-Funktionen direkt als Variablen-Modifikatoren aufrufbar.
-
-
-
- $secure_dir
-
- Definiert die als 'sicher' geltenden Verzeichnisse als Array.
- {include} und {fetch} verwenden diese Verzeichnisse, wenn '$security'
- eingeschaltet ist.
-
-
-
- $security_settings
-
- Wird verwendet um spezifische Sicherheits-Einstellungen zu
- ändern, wenn '$security' eingeschaltet ist.
-
-
- PHP_HANDLING - true/false. Wenn auf 'true' gesetzt wird '$php_handling' ignoriert.
- IF_FUNCS - Ist ein Array aller erlaubter Funktionen in IF-Statements.
- INCLUDE_ANY - true/false. Wenn 'true', kann jedes Template geladen werden, auch ausserhalb der '$secure_dir'-Liste.
- PHP_TAGS - true/false. Wenn 'true', sind keine {php}{/php}-Tags erlaubt.
- MODIFIER_FUNCS - Ist ein Array aller Funktionen die als Variablen-Modifikatoren verwendet werden dürfen.
-
-
-
- $trusted_dir
-
- '$trusted_dir' wird nur verwendet wenn die Sicherheit eingeschaltet ist. Der Wert
- ist ein Array aller Verzeichnisse, die als vertrauenswürdig gelten.
- In diesen Verzeichnissen können PHP-Skripte, die man direkt aus einem Template
- mit {include_php} aufruft,
- abgelegt werden.
-
-
-
- $left_delimiter
-
- Das zu verwendende linke Trennzeichen der Template-Sprache.
- Normalerweise '{'.
-
-
-
- $right_delimiter
-
- Das zu verwendende rechte Trennzeichen der Template-Sprache.
- Normalerweise '}'.
-
-
-
- $show_info_header
-
- Gibt am Anfang der HTML-Seite die Smarty Version und das Kompilier-Datum des Templates
- als Kommentar aus. Normalerweise 'false'.
-
-
-
- $show_info_include
-
- Gibt am Anfang und am Ende jedes eingebundenen Templates einen HTML-Kommentar aus.
- Normalerweise 'false'.
-
-
-
- $compiler_class
-
- Definiert den Namen der Compiler-Klasse, die Smarty zum kompilieren
- der Templates verwenden soll. Normalerweise 'Smarty_Compiler'. Nur
- für fortgeschrittene Anwender.
-
-
-
- $request_vars_order
-
- Die Reihenfolge in welcher die Request-Variblen zugewiesen werden.
- Verhält sich wie 'variables_order' in der php.ini.
-
-
-
- $request_use_auto_globals
-
- Definiert ob Smarty php's $HTTP_*_VARS[] ($request_use_auto_globals=false welches
- der Standardwert ist) oder $_*[] ($request_use_auto_globals=true) verwenden soll.
- Dies betrifft Templates die {$smarty.request.*}, {$smarty.get.*}, etc... verwenden.
- Achtung: wenn $request_use_auto_globals auf TRUE gesetzt ist, hat variable.request.vars.order
- keine Auswirkungen, da php's Konfigurationswert gpc_order verwendet wird.
-
-
-
- $compile_id
-
- Persistenter 'compile-identifier'. Anstatt jedem Funktionsaufruf die selbe 'compile_id'
- zu übergeben, kann eine individuelle 'compile_id' gesetzt werden. Das ist z. B.
- sinnvoll, um in Kombination mit einem 'prefilter' verschiedene Sprach-Versionen eines Template
- kompilieren.
-
-
-
- $use_sub_dirs
-
- Wenn Sie Smarty in einer Umgebung einsetzen, die das Erstellen von Unterverzeichnissen
- nicht erlaubt, können Sie diesen Wert auf 'false' setzen. Unterverzeichnisse
- sind jedoch effizienter und sollten deshalb möglichst verwendet werden.
-
-
-
- $default_modifiers
-
- Definiert ein Array von Variablen-Modifikatoren, die auf jeder Variable anzuwenden sind.
- Wenn Sie zum Beispiel alle Variablen standardmässig HTML-Maskieren wollen,
- können Sie array('escape:"htmlall"'); verwenden. Um eine Variable von dieser
- Behandlung auszuschliessen, können Sie ihr den Parameter 'smarty' mit dem Modifikator 'nodefaults'
- übergeben. Als Beispiel: {$var|smarty:nodefaults}.
- Zum Beispiel: {$var|nodefaults}.
-
-
-
- $default_resource_type
-
- Definiert den Ressourcentyp der von Smarty implizitverwendet werden soll. Standartwert
- ist 'file', was dazu führt dass $smarty->display('index.tpl'); und
- $smarty->display('file:index.tpl'); identisch sind. Konsultieren Sie das
- Resource Kapitel für weitere Informationen.
-
-
+&programmers.api-variables.variable-template-dir;
+&programmers.api-variables.variable-compile-dir;
+&programmers.api-variables.variable-config-dir;
+&programmers.api-variables.variable-plugins-dir;
+&programmers.api-variables.variable-debugging;
+&programmers.api-variables.variable-debug-tpl;
+&programmers.api-variables.variable-debugging-ctrl;
+&programmers.api-variables.variable-global-assign;
+&programmers.api-variables.variable-undefined;
+&programmers.api-variables.variable-autoload-filters;
+&programmers.api-variables.variable-compile-check;
+&programmers.api-variables.variable-force-compile;
+&programmers.api-variables.variable-caching;
+&programmers.api-variables.variable-cache-dir;
+&programmers.api-variables.variable-cache-lifetime;
+&programmers.api-variables.variable-cache-handler-func;
+&programmers.api-variables.variable-cache-modified-check;
+&programmers.api-variables.variable-default-template-handler-func;
+&programmers.api-variables.variable-php-handling;
+&programmers.api-variables.variable-security;
+&programmers.api-variables.variable-secure-dir;
+&programmers.api-variables.variable-security-settings;
+&programmers.api-variables.variable-trusted-dir;
+&programmers.api-variables.variable-left-delimiter;
+&programmers.api-variables.variable-right-delimiter;
+&programmers.api-variables.variable-show-info-header;
+&programmers.api-variables.variable-show-info-include;
+&programmers.api-variables.variable-compiler-class;
+&programmers.api-variables.variable-request-vars-order;
+&programmers.api-variables.variable-request-use-auto-globals;
+&programmers.api-variables.variable-compile-id;
+&programmers.api-variables.variable-use-sub-dirs;
+&programmers.api-variables.variable-default-modifiers;
+&programmers.api-variables.variable-default-resource-type;
+
+ $autoload_filters
+
+ Filter die Sie zu jedem Template laden möchten, können Sie mit Hilfe
+ dieser Variable festlegen. Smarty wird sie danach automatisch laden. Die Variable
+ enthält ein assoziatives Array, in dem der Schlüssel den Filter-Typ
+ und der Wert den Filter-Namen definiert. Zum Beispiel:
+
+
+ $smarty->autoload_filters = array('pre' => array('trim', 'stamp'),
+ 'output' => array('convert'));
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-variables/variable-cache-dir.xml b/docs/de/programmers/api-variables/variable-cache-dir.xml
new file mode 100644
index 00000000..4c3ca903
--- /dev/null
+++ b/docs/de/programmers/api-variables/variable-cache-dir.xml
@@ -0,0 +1,45 @@
+
+
+
+ $cache_dir
+
+ Definiert den Namen des Verzeichnisses in dem die Template-Caches
+ angelegt werden. Normalerweise ist dies './cache', was Smarty veranlasst
+ das Cache-Verzeichnis im aktuellen Verzeichnis zu suchen. Sie können
+ auch einen eigenen Cache-Handler zur Kontrolle der Cache-Dateien
+ definieren, der diese Einstellung ignoriert.
+
+
+ Technische Bemerkung
+
+ Die Angabe muss entweder relativ oder absolut angegeben werden. 'include_path'
+ wird nicht verwendet.
+
+
+
+ Technische Bemerkung
+
+ Es wird empfohlen ein Verzeichnis ausserhalb der DocumentRoot zu verwenden.
+
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-variables/variable-cache-handler-func.xml b/docs/de/programmers/api-variables/variable-cache-handler-func.xml
new file mode 100644
index 00000000..73830d06
--- /dev/null
+++ b/docs/de/programmers/api-variables/variable-cache-handler-func.xml
@@ -0,0 +1,29 @@
+
+
+
+ $cache_handler_func
+
+ Sie können auch eine eigene Cache-Handler Funktion definieren.
+ Siehe Abschnitt zur custom cache handler Funktion.
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-variables/variable-cache-lifetime.xml b/docs/de/programmers/api-variables/variable-cache-lifetime.xml
new file mode 100644
index 00000000..cee3334c
--- /dev/null
+++ b/docs/de/programmers/api-variables/variable-cache-lifetime.xml
@@ -0,0 +1,51 @@
+
+
+
+ $cache_lifetime
+
+ Definiert die Zeitspanne (in Sekunden) die ein Cache gültig
+ bleibt. Ist die Zeit abgelaufen, wird der Cache neu generiert. '$caching'
+ muss eingeschaltet (true) sein, damit '$cache_lifetime' Sinn macht. Der
+ Wert -1 bewirkt, dass der Cache nie abläuft. Der Wert 0 bewirkt, dass
+ der Inhalt immer neu generiert wird (nur sinnvoll für Tests, eine
+ effizientere Methode wäre $caching
+ auf 'false' zu setzen).
+
+
+ Wenn $force_compile
+ gesetzt ist, wird der Cache immer neu generiert (was einem Ausschalten
+ von caching gleichkommt). Mit der clear_all_cache()
+ Funktion können Sie alle Cache-Dateien auf einmal entfernen. Mit der
+ clear_cache() Funktion können Sie
+ einzelne Cache-Dateien (oder Gruppen) entfernen.
+
+
+ Technische Bemerkung
+
+ Falls Sie bestimmten Templates eine eigene Cache-Lifetime geben wollen,
+ können Sie dies tun indem Sie $caching
+ auf 2 stellen und '$cache_lifetime' einen einmaligen Wert zuweisen, bevor Sie
+ 'display()' oder 'fetch()' aufrufen.
+
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-variables/variable-cache-modified-check.xml b/docs/de/programmers/api-variables/variable-cache-modified-check.xml
new file mode 100644
index 00000000..de4bec5e
--- /dev/null
+++ b/docs/de/programmers/api-variables/variable-cache-modified-check.xml
@@ -0,0 +1,33 @@
+
+
+
+ $cache_modified_check
+
+ Wenn auf 1 gesetzt, verwendet Smarty den If-Modified-Since
+ Header des Clients. Falls sich der Timestamp der Cache-Datei
+ seit dem letzten Besuch nicht geändert hat, wird der
+ Header '304 Not Modified' anstatt des Inhalts ausgegeben. Dies
+ funktioniert nur mit gecachten Inhalten die keine insert
+ Tags enthalten.
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-variables/variable-caching.xml b/docs/de/programmers/api-variables/variable-caching.xml
new file mode 100644
index 00000000..d86d861f
--- /dev/null
+++ b/docs/de/programmers/api-variables/variable-caching.xml
@@ -0,0 +1,41 @@
+
+
+
+ $caching
+
+ Definiert ob Smarty die Template-Ausgabe cachen soll. Normalerweise ist dies
+ ausgeschaltet (disabled, Wert: 0). Falls Ihre Templates redundante Inhalte erzeugen,
+ ist es empfehlenswert caching einzuschalten. Die Performance wird signifikant verbessert.
+ Sie können auch mehrere Caches für ein Template haben. Die Werte 1 und 2 aktivieren
+ caching. Bei 1 verwendet Smarty die Variable '$cache_lifetime', um zu berechnen
+ ob ein Template neu kompiliert werden soll. Der Wert 2 weist Smarty an, den Wert von
+ 'cache_lifetime' zur Zeit der Erzeugung des Cache zu verwenden. Damit können Sie 'cache_lifetime'
+ setzen, bevor Sie das Template einbinden und haben so eine feine Kontrolle darüber,
+ wann ein bestimmter Cache abläuft. Konsultieren Sie dazu auch: is_cached.
+
+
+ Wenn '$compile_check' aktiviert ist, wird der Cache regeneriert sobald ein Template
+ oder eine Konfigurations-Variable geändert wurde. Wenn '$force_compile' aktiviert ist,
+ werden die gecachten Inhalte bei jedem Aufruf neu generiert.
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-variables/variable-compile-check.xml b/docs/de/programmers/api-variables/variable-compile-check.xml
new file mode 100644
index 00000000..bbf8eb45
--- /dev/null
+++ b/docs/de/programmers/api-variables/variable-compile-check.xml
@@ -0,0 +1,44 @@
+
+
+
+ $compile_check
+
+ Bei jedem Aufruf der PHP-Applikation überprüft Smarty,
+ ob sich das zugrundeliegende Template seit dem letzten Aufruf
+ geändert hat. Falls es eine Änderung feststellt,
+ wird das Template neu kompiliert. Seit Smarty 1.4.0 wird
+ das Template - falls es nicht existiert - kompiliert, unabhängig
+ davon welcher Wert '$compile_check' hat. Normalerweise ist der
+ Wert dieser Variable 'true'. Wenn eine Applikation produktiv
+ eingesetzt wird (die Templates ändern sich nicht mehr), kann
+ der 'compile_check'-Schritt entfallen. Setzen Sie dann
+ '$compile_check' auf 'false', um die Performance zu steigern.
+ Achtung: Wenn Sie '$compile_check' auf 'false' setzen und anschliessend
+ ein Template ändern, wird diese Änderung *nicht* angezeigt.
+ Wenn caching und 'compile_check' eingeschaltet sind, werden die
+ gecachten Skripts neu kompiliert, sobald eine Änderung an
+ einem der eingebundenen Templates festgestellt wird.
+ Siehe auch $force_compile
+ und clear_compiled_tpl.
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-variables/variable-compile-dir.xml b/docs/de/programmers/api-variables/variable-compile-dir.xml
new file mode 100644
index 00000000..5f2e90f4
--- /dev/null
+++ b/docs/de/programmers/api-variables/variable-compile-dir.xml
@@ -0,0 +1,45 @@
+
+
+
+ $compile_dir
+
+ Definiert das Verzeichnis, in das die kompilierten Templates geschrieben
+ werden. Normalerweise lautet es './templates_c'.
+ Das heisst, Smarty erwartet das Kompilier-Verzeichnis im selben Verzeichnis
+ wie das ausgeführte PHP-Skript.
+
+
+ Technische Bemerkung
+
+ Diese Einstellung kann als relativer oder als absoluter Pfad
+ angegeben werden. 'include_path' wird nicht verwendet.
+
+
+
+ Technische Bemerkung
+
+ Dieses Verzeichnis sollte ausserhalb der DocumentRoot
+ des Webservers liegen.
+
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-variables/variable-compile-id.xml b/docs/de/programmers/api-variables/variable-compile-id.xml
new file mode 100644
index 00000000..2f40ceb9
--- /dev/null
+++ b/docs/de/programmers/api-variables/variable-compile-id.xml
@@ -0,0 +1,31 @@
+
+
+
+ $compile_id
+
+ Persistenter 'compile-identifier'. Anstatt jedem Funktionsaufruf die selbe 'compile_id'
+ zu übergeben, kann eine individuelle 'compile_id' gesetzt werden. Das ist z. B.
+ sinnvoll, um in Kombination mit einem 'prefilter' verschiedene Sprach-Versionen eines Template
+ kompilieren.
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-variables/variable-compiler-class.xml b/docs/de/programmers/api-variables/variable-compiler-class.xml
new file mode 100644
index 00000000..4c6d0521
--- /dev/null
+++ b/docs/de/programmers/api-variables/variable-compiler-class.xml
@@ -0,0 +1,30 @@
+
+
+
+ $compiler_class
+
+ Definiert den Namen der Compiler-Klasse, die Smarty zum kompilieren
+ der Templates verwenden soll. Normalerweise 'Smarty_Compiler'. Nur
+ für fortgeschrittene Anwender.
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-variables/variable-config-dir.xml b/docs/de/programmers/api-variables/variable-config-dir.xml
new file mode 100644
index 00000000..d3e70d29
--- /dev/null
+++ b/docs/de/programmers/api-variables/variable-config-dir.xml
@@ -0,0 +1,39 @@
+
+
+
+ $config_dir
+
+ Dieses Verzeichnis definiert den Ort, an dem die von den
+ Templates verwendeten Konfigurationsdateien abgelegt sind. Normalerweise
+ ist dies './configs'. Das bedeutet, Smarty erwartet das
+ Konfigurations-Verzeichnis im selben Verzeichnis wie das ausgeführte
+ PHP-Skript.
+
+
+ Technische Bemerkung
+
+ Dieses Verzeichnis sollte ausserhalb der DocumentRoot
+ des Webservers liegen.
+
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-variables/variable-debug-tpl.xml b/docs/de/programmers/api-variables/variable-debug-tpl.xml
new file mode 100644
index 00000000..30f5c73a
--- /dev/null
+++ b/docs/de/programmers/api-variables/variable-debug-tpl.xml
@@ -0,0 +1,29 @@
+
+
+
+ $debug_tpl
+
+ Definiert den Namen des für die Debugging Konsole verwendeten Template. Normalerweise
+ lautet er 'debug.tpl' und befindet sich im SMARTY_DIR Verzeichnis.
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-variables/variable-debugging-ctrl.xml b/docs/de/programmers/api-variables/variable-debugging-ctrl.xml
new file mode 100644
index 00000000..619650d3
--- /dev/null
+++ b/docs/de/programmers/api-variables/variable-debugging-ctrl.xml
@@ -0,0 +1,31 @@
+
+
+
+ $debugging_ctrl
+
+ Definiert Alternativen zur Aktivierung der Debugging Konsole.
+ NONE verbietet alternative Methoden. URL aktiviert ds Debugging,
+ wenn das Schlüsselwort 'SMARTY_DEBUG' im QUERY_STRING gefunden wird.
+ Wenn '$debugging' auf 'true' gesetzt ist, wird dieser Wert ignoriert.
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-variables/variable-debugging.xml b/docs/de/programmers/api-variables/variable-debugging.xml
new file mode 100644
index 00000000..85e563ce
--- /dev/null
+++ b/docs/de/programmers/api-variables/variable-debugging.xml
@@ -0,0 +1,30 @@
+
+
+
+ $debugging
+
+ Aktiviert die Debugging Konsole.
+ Die Konsole besteht aus einem Javascript-Fenster, welches Informationen zum
+ momentan geladenen Template und den zugewiesenen Variablen enthält.
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-variables/variable-default-modifiers.xml b/docs/de/programmers/api-variables/variable-default-modifiers.xml
new file mode 100644
index 00000000..da84f498
--- /dev/null
+++ b/docs/de/programmers/api-variables/variable-default-modifiers.xml
@@ -0,0 +1,33 @@
+
+
+
+ $default_modifiers
+
+ Definiert ein Array von Variablen-Modifikatoren, die auf jeder Variable anzuwenden sind.
+ Wenn Sie zum Beispiel alle Variablen standardmässig HTML-Maskieren wollen,
+ können Sie array('escape:"htmlall"'); verwenden. Um eine Variable von dieser
+ Behandlung auszuschliessen, können Sie ihr den Parameter 'smarty' mit dem Modifikator 'nodefaults'
+ übergeben. Als Beispiel: {$var|smarty:nodefaults}.
+ Zum Beispiel: {$var|nodefaults}.
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-variables/variable-default-resource-type.xml b/docs/de/programmers/api-variables/variable-default-resource-type.xml
new file mode 100644
index 00000000..d51378dd
--- /dev/null
+++ b/docs/de/programmers/api-variables/variable-default-resource-type.xml
@@ -0,0 +1,31 @@
+
+
+
+ $default_resource_type
+
+ Definiert den Ressourcentyp der von Smarty implizitverwendet werden soll. Standartwert
+ ist 'file', was dazu führt dass $smarty->display('index.tpl'); und
+ $smarty->display('file:index.tpl'); identisch sind. Konsultieren Sie das
+ Resource Kapitel für weitere Informationen.
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-variables/variable-default-template-handler-func.xml b/docs/de/programmers/api-variables/variable-default-template-handler-func.xml
new file mode 100644
index 00000000..0eabc3e4
--- /dev/null
+++ b/docs/de/programmers/api-variables/variable-default-template-handler-func.xml
@@ -0,0 +1,29 @@
+
+
+
+ $default_template_handler_func
+
+ Diese Funktion wird aufgerufen, wenn ein Template nicht aus der
+ vorgegebenen Quelle geladen werden kann.
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-variables/variable-force-compile.xml b/docs/de/programmers/api-variables/variable-force-compile.xml
new file mode 100644
index 00000000..bb29dce1
--- /dev/null
+++ b/docs/de/programmers/api-variables/variable-force-compile.xml
@@ -0,0 +1,33 @@
+
+
+
+ $force_compile
+
+ Veranlasst Smarty dazu die Templates bei jedem Aufruf neu
+ zu kompilieren. Diese Einstellung überschreibt '$compile_check'.
+ Normalerweise ist dies ausgeschaltet, kann jedoch für die Fehlersuche
+ nützlich sein. In einem Produktiven-Umfeld sollte auf
+ die Verwendung verzichtet werden. Wenn caching eingeschaltet ist,
+ werden die gecachten Dateien bei jedem Aufruf neu kompiliert.
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-variables/variable-global-assign.xml b/docs/de/programmers/api-variables/variable-global-assign.xml
new file mode 100644
index 00000000..44d5ddb5
--- /dev/null
+++ b/docs/de/programmers/api-variables/variable-global-assign.xml
@@ -0,0 +1,43 @@
+
+
+
+ $global_assign
+
+ Definiert eine Liste von Variablen die jedem Template automatisch
+ zugewiesen werden. Dies ist nützlich falls man globale beziehungsweise Server-Variablen,
+ zuweisen will, ohne dies von Hand zu tun. Jedes Element in '$global_assign' sollte
+ entweder den Namen der zuzuweisenden Variablen enthalten, oder Schlüssel/Wert-Paare,
+ bei welchen der Schlüssel den Namen des globalen Arrays definiert und der
+ Wert den Array mit den zuzuweisenden Werten. '$SCRIPT_NAME' wird immer zugewiesen und
+ aus '$HTTP_SERVER_VARS' bezogen.
+
+
+ Technische Bemerkung
+
+ Server-Variablen können über die '$smarty'-Variable
+ erreicht werden, zum Beispiel: {$smarty.server.SCRIPT_NAME}.
+ Konsultieren sie den Abschnitt zu $smarty
+ für weiterführende Informationen.
+
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-variables/variable-left-delimiter.xml b/docs/de/programmers/api-variables/variable-left-delimiter.xml
new file mode 100644
index 00000000..10550527
--- /dev/null
+++ b/docs/de/programmers/api-variables/variable-left-delimiter.xml
@@ -0,0 +1,29 @@
+
+
+
+ $left_delimiter
+
+ Das zu verwendende linke Trennzeichen der Template-Sprache.
+ Normalerweise '{'.
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-variables/variable-php-handling.xml b/docs/de/programmers/api-variables/variable-php-handling.xml
new file mode 100644
index 00000000..ab9ff430
--- /dev/null
+++ b/docs/de/programmers/api-variables/variable-php-handling.xml
@@ -0,0 +1,43 @@
+
+
+
+ $php_handling
+
+ Definiert wie Smarty mit PHP-Code innerhalb von Templates umgehen soll.
+ Es gibt 4 verschiedene Einstellungen. Normalerweise wird
+ SMARTY_PHP_PASSTHRU verwendet. Achtung: '$php_handling' wirkt sich NICHT
+ auf PHP-Code aus, der zwischen {php}{/php}
+ Tags steht.
+
+
+ SMARTY_PHP_PASSTHRU - Smarty gibt die Tags aus.
+ SMARTY_PHP_QUOTE - Smarty maskiert die Tags als HTML-Entities.
+ SMARTY_PHP_REMOVE - Smarty entfernt die Tags.
+ SMARTY_PHP_ALLOW - Smarty führt den Code als PHP-Code aus.
+
+
+ ACHTUNG: Es wird davon abgeraten, PHP-Code in Templates einzubetten.
+ Bitte verwenden Sie stattdessen custom functions
+ oder Variablen-Modifikatoren.
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-variables/variable-plugins-dir.xml b/docs/de/programmers/api-variables/variable-plugins-dir.xml
new file mode 100644
index 00000000..fb8cf9e0
--- /dev/null
+++ b/docs/de/programmers/api-variables/variable-plugins-dir.xml
@@ -0,0 +1,40 @@
+
+
+
+ $plugins_dir
+
+ Definiert das Verzeichnis in welchem Smarty die zu ladenden Plugins sucht.
+ Normalerweise ist dies 'plugins' im SMARTY_DIR Pfad. Wenn Sie einen relativen
+ Pfad angeben, wird Smarty zuerst versuchen das Plugin von SMARTY_DIR aus zu erreichen,
+ danach relativ zum aktuellen Verzeichnis (mit 'cwd' - current working directory)
+ und zum Schluss in jedem Eintrag des PHP-'include_path'.
+
+
+ Technische Bemerkung
+
+ Für optimale Performance ist es sinnvoll, 'plugins_dir'
+ absolut oder relativ zu SMARTY_DIR bzw. dem aktuellen Verzeichnis zu definieren.
+ Von der Definition des Verzeichnisses im PHP-'include_path' wird abgeraten.
+
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-variables/variable-request-use-auto-globals.xml b/docs/de/programmers/api-variables/variable-request-use-auto-globals.xml
new file mode 100644
index 00000000..9e5b9714
--- /dev/null
+++ b/docs/de/programmers/api-variables/variable-request-use-auto-globals.xml
@@ -0,0 +1,32 @@
+
+
+
+ $request_use_auto_globals
+
+ Definiert ob Smarty php's $HTTP_*_VARS[] ($request_use_auto_globals=false welches
+ der Standardwert ist) oder $_*[] ($request_use_auto_globals=true) verwenden soll.
+ Dies betrifft Templates die {$smarty.request.*}, {$smarty.get.*}, etc... verwenden.
+ Achtung: wenn $request_use_auto_globals auf TRUE gesetzt ist, hat variable.request.vars.order
+ keine Auswirkungen, da php's Konfigurationswert gpc_order verwendet wird.
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-variables/variable-request-vars-order.xml b/docs/de/programmers/api-variables/variable-request-vars-order.xml
new file mode 100644
index 00000000..273c5703
--- /dev/null
+++ b/docs/de/programmers/api-variables/variable-request-vars-order.xml
@@ -0,0 +1,29 @@
+
+
+
+ $request_vars_order
+
+ Die Reihenfolge in welcher die Request-Variblen zugewiesen werden.
+ Verhält sich wie 'variables_order' in der php.ini.
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-variables/variable-right-delimiter.xml b/docs/de/programmers/api-variables/variable-right-delimiter.xml
new file mode 100644
index 00000000..9189cb89
--- /dev/null
+++ b/docs/de/programmers/api-variables/variable-right-delimiter.xml
@@ -0,0 +1,29 @@
+
+
+
+ $right_delimiter
+
+ Das zu verwendende rechte Trennzeichen der Template-Sprache.
+ Normalerweise '}'.
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-variables/variable-secure-dir.xml b/docs/de/programmers/api-variables/variable-secure-dir.xml
new file mode 100644
index 00000000..d82a9b39
--- /dev/null
+++ b/docs/de/programmers/api-variables/variable-secure-dir.xml
@@ -0,0 +1,30 @@
+
+
+
+ $secure_dir
+
+ Definiert die als 'sicher' geltenden Verzeichnisse als Array.
+ {include} und {fetch} verwenden diese Verzeichnisse, wenn '$security'
+ eingeschaltet ist.
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-variables/variable-security-settings.xml b/docs/de/programmers/api-variables/variable-security-settings.xml
new file mode 100644
index 00000000..5babf259
--- /dev/null
+++ b/docs/de/programmers/api-variables/variable-security-settings.xml
@@ -0,0 +1,36 @@
+
+
+
+ $security_settings
+
+ Wird verwendet um spezifische Sicherheits-Einstellungen zu
+ ändern, wenn '$security' eingeschaltet ist.
+
+
+ PHP_HANDLING - true/false. Wenn auf 'true' gesetzt wird '$php_handling' ignoriert.
+ IF_FUNCS - Ist ein Array aller erlaubter Funktionen in IF-Statements.
+ INCLUDE_ANY - true/false. Wenn 'true', kann jedes Template geladen werden, auch ausserhalb der '$secure_dir'-Liste.
+ PHP_TAGS - true/false. Wenn 'true', sind keine {php}{/php}-Tags erlaubt.
+ MODIFIER_FUNCS - Ist ein Array aller Funktionen die als Variablen-Modifikatoren verwendet werden dürfen.
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-variables/variable-security.xml b/docs/de/programmers/api-variables/variable-security.xml
new file mode 100644
index 00000000..49f9d8a9
--- /dev/null
+++ b/docs/de/programmers/api-variables/variable-security.xml
@@ -0,0 +1,42 @@
+
+
+
+ $security
+
+ '$security' ein-/ausschalten. Normalerweise 'false' (ausgeschaltet).
+ Die Sicherheitseinstellung ist wertvoll, wenn nicht vertrauenswürdigen
+ Parteien Zugriff auf die Templates gegeben wird (zum Beispiel via FTP).
+ Mit aktivierter '$security' kann verhindert werden, dass diese das System
+ via Template-Engine kompromittieren. Die '$security' einzuschalten halt folgende
+ Auswirkungen auf die Template-Language (ausser sie werden mit '$security_settings'
+ überschrieben):
+
+
+ Wenn '$php_handling' auf SMARTY_PHP_ALLOW geschaltet ist, wird der Wert auf SMARTY_PHP_PASSTHRU geändert.
+ Ausser den in '$security_settings' definierten, sind keine Funktionen in IF-Statements aufrufbar.
+ Templates können nur aus den im '$secure_dir'-Array definierten Verzeichnissen geladen werden.
+ 'fetch()' kann nur verwendet werden um Dateien aus '$secure_dir' zu laden.
+ {php}{/php}-Tags sind nicht erlaubt.
+ Ausser den in '$security_settings' definierten, sind keine PHP-Funktionen direkt als Variablen-Modifikatoren aufrufbar.
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-variables/variable-show-info-header.xml b/docs/de/programmers/api-variables/variable-show-info-header.xml
new file mode 100644
index 00000000..adf4a9fb
--- /dev/null
+++ b/docs/de/programmers/api-variables/variable-show-info-header.xml
@@ -0,0 +1,29 @@
+
+
+
+ $show_info_header
+
+ Gibt am Anfang der HTML-Seite die Smarty Version und das Kompilier-Datum des Templates
+ als Kommentar aus. Normalerweise 'false'.
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-variables/variable-show-info-include.xml b/docs/de/programmers/api-variables/variable-show-info-include.xml
new file mode 100644
index 00000000..715300b1
--- /dev/null
+++ b/docs/de/programmers/api-variables/variable-show-info-include.xml
@@ -0,0 +1,29 @@
+
+
+
+ $show_info_include
+
+ Gibt am Anfang und am Ende jedes eingebundenen Templates einen HTML-Kommentar aus.
+ Normalerweise 'false'.
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-variables/variable-template-dir.xml b/docs/de/programmers/api-variables/variable-template-dir.xml
new file mode 100644
index 00000000..cdbf5e6e
--- /dev/null
+++ b/docs/de/programmers/api-variables/variable-template-dir.xml
@@ -0,0 +1,39 @@
+
+
+
+ $template_dir
+
+ Definiert das Standard-Template Verzeichnis. Wenn
+ sie beim Einbinden von Templates keinen Ressourcen-Typ übergeben,
+ werden sie in diesem Pfad gesucht. Normalerweise lautet er './templates'.
+ Das heisst, Smarty erwartet das Template-Verzeichnis im selben Verzeichnis
+ wie das ausgeführte PHP-Skript.
+
+
+ Technische Bemerkung
+
+ Dieses Verzeichnis sollte ausserhalb der DocumentRoot
+ des Webservers liegen.
+
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-variables/variable-trusted-dir.xml b/docs/de/programmers/api-variables/variable-trusted-dir.xml
new file mode 100644
index 00000000..f6da5738
--- /dev/null
+++ b/docs/de/programmers/api-variables/variable-trusted-dir.xml
@@ -0,0 +1,32 @@
+
+
+
+ $trusted_dir
+
+ '$trusted_dir' wird nur verwendet wenn die Sicherheit eingeschaltet ist. Der Wert
+ ist ein Array aller Verzeichnisse, die als vertrauenswürdig gelten.
+ In diesen Verzeichnissen können PHP-Skripte, die man direkt aus einem Template
+ mit {include_php} aufruft,
+ abgelegt werden.
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-variables/variable-undefined.xml b/docs/de/programmers/api-variables/variable-undefined.xml
new file mode 100644
index 00000000..9f2bfcef
--- /dev/null
+++ b/docs/de/programmers/api-variables/variable-undefined.xml
@@ -0,0 +1,30 @@
+
+
+
+ $undefined
+
+ Definiert den Wert von '$undefined' für Smarty. Normalerweise ist
+ dieser Wert 'null'. Momentan wird er nur verwendet, um nicht definierten
+ Elementen aus '$global_assign' einen Standardwert zuzuweisen.
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/api-variables/variable-use-sub-dirs.xml b/docs/de/programmers/api-variables/variable-use-sub-dirs.xml
new file mode 100644
index 00000000..21d64201
--- /dev/null
+++ b/docs/de/programmers/api-variables/variable-use-sub-dirs.xml
@@ -0,0 +1,30 @@
+
+
+
+ $use_sub_dirs
+
+ Wenn Sie Smarty in einer Umgebung einsetzen, die das Erstellen von Unterverzeichnissen
+ nicht erlaubt, können Sie diesen Wert auf 'false' setzen. Unterverzeichnisse
+ sind jedoch effizienter und sollten deshalb möglichst verwendet werden.
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/caching.xml b/docs/de/programmers/caching.xml
index f69bd592..11372fb8 100644
--- a/docs/de/programmers/caching.xml
+++ b/docs/de/programmers/caching.xml
@@ -19,360 +19,10 @@
erneuernden Wetterinformationen haben, macht es möglicherweise keinen Sinn,
die Seite überhaupt zu cachen.
-
- Caching einrichten
-
- Als erstes muss das Caching eingeschaltet werden. Dies erreicht man, indem
- $caching auf 'true' (oder 1) gesetzt wird.
-
-
- Caching einschalten
-
- require('Smarty.class.php');
- $smarty = new Smarty;
-
- $smarty->caching = true;
-
- $smarty->display('index.tpl');
-
-
- Wenn Caching eingeschaltet ist, wird der Funktionsaufruf display('index.tpl')
- das Template normal rendern, zur selben Zeit jedoch auch eine Datei mit
- dem Inhalt in das $cache_dir schreiben
- (als gecachte Kopie). Beim nächsten Aufruf von display('index.tpl') wird die
- gecachte Kopie verwendet.
-
-
- Technische Bemerkung
-
- Die im '$cache_dir' abgelegen Dateien haben einen ähnlichen Namen
- wie das Template, mit dem sie erzeugt wurden. Obwohl sie eine '.php'-Endung
- aufweisen, sind sie keine ausführbaren PHP-Skripte.
- Editieren Sie diese Dateien NICHT!
-
-
-
- Jede gecachte Seite hat eine Lebensdauer, die von $cache_lifetime
- bestimmt wird. Normalerweise beträgt der Wert 3600 Sekunden (= 1 Stunde). Nach Ablauf dieser Lebensdauer
- wird der Cache neu generiert. Sie können die Lebensdauer pro Cache bestimmen indem Sie '$caching'
- auf 2 setzen. Konsultieren Sie den Abschnitt über $cache_lifetime
- für weitere Informationen.
-
-
- '$cache_lifetime' pro Cache einstellen
-
- require('Smarty.class.php');
- $smarty = new Smarty;
-
- $smarty->caching = 2; // Lebensdauer ist pro Cache
-
-
- // Standardwert für '$cache_lifetime' auf 5 Minuten setzen
- $smarty->cache_lifetime = 300;
- $smarty->display('index.tpl');
-
-
- // '$cache_lifetime' für 'home.tpl' auf 1 Stunde setzen
- $smarty->cache_lifetime = 3600;
- $smarty->display('home.tpl');
-
- // ACHTUNG: die folgende Zuweisung an '$cache_lifetime' wird nicht funktionieren,
- // wenn '$caching' auf 2 gestellt ist. Wenn die '$cache_lifetime' für 'home.tpl' bereits
- // auf 1 Stunde gesetzt wurde, werden neue Werte ignoriert.
- // 'home.tpl' wird nach dieser Zuweisung immer noch eine '$cache_lifetime' von 1 Stunde haben.
- $smarty->cache_lifetime = 30; // 30 Sekunden
- $smarty->display('home.tpl');
-
-
- Wenn $compile_check eingeschaltet ist,
- werden alle in den Cache eingeflossenen Templates und Konfigurationsdateien
- hinsichtlich ihrer letzten änderung überprüft.
- Falls eine der Dateien seit der Erzeugung des Cache geändert wurde,
- wird der Cache unverzüglich neu generiert. Dadurch ergibt sich ein
- geringer Mehraufwand. Für optimale Performace sollte '$compile_check'
- deshalb auf 'false' gesetzt werden.
-
-
- '$compile_check' einschalten
-
- require('Smarty.class.php');
- $smarty = new Smarty;
-
- $smarty->caching = true;
- $smarty->compile_check = true;
-
- $smarty->display('index.tpl');
-
-
- Wenn $force_compile eingeschaltet ist,
- werden die Cache-Dateien immer neu generiert und das Caching damit wirkungslos gemacht.
- '$force_compile' wird normalerweise nur für die Fehlersuche verwendet.
- Ein effizienterer Weg das Caching auszuschalten wäre,
- $caching auf 'false' (oder 0) zu setzen.
-
-
- Mit der Funktion is_cached() kann überprüft
- werden, ob von einem Template eine gecachte Version vorliegt.
- In einem Template, das zum Beispiel Daten aus einer Datenbank bezieht,
- können Sie diese Funktion verwenden, um den Prozess zu überspringen.
-
-
- is_cached() verwenden
-
- require('Smarty.class.php');
- $smarty = new Smarty;
-
- $smarty->caching = true;
-
- if(!$smarty->is_cached('index.tpl')) {
-
- // kein Cache gefunden, also Variablen zuweisen
- $contents = get_database_contents();
- $smarty->assign($contents);
- }
-
- $smarty->display('index.tpl');
-
-
- Mit der insert Funktion können Sie
- Teile einer Seite dynamisch halten. Wenn zum Beispiel ein Banner in einer gecachten Seite
- nicht gecached werden soll, kann dessen Aufruf mit 'insert' dynamisch gehalten werden.
- Konsultieren Sie den Abschnitt über insert
- für weitere Informationen und Beispiele.
-
-
- Mit der Funktion clear_all_cache() können
- Sie den gesamten Template-Cache löschen. Mit clear_cache()
- einzelne Templates oder Template-Gruppen.
-
-
- Cache leeren
-
- require('Smarty.class.php');
- $smarty = new Smarty;
-
- $smarty->caching = true;
-
-
- // alle Cache-Dateien löschen
- $smarty->clear_all_cache();
-
-
- // nur Cache von 'index.tpl' löschen
- $smarty->clear_cache('index.tpl');
-
- $smarty->display('index.tpl');
-
-
-
- Multiple Caches für eine Seite
-
- Sie können für Aufrufe von 'display()' oder 'fetch()' auch mehrere Caches erzeugen.
- Nehmen wir zum Beispiel an, der Aufruf von display('index.tpl') erzeuge für
- verschieden Fälle unterschiedliche Inhalte und Sie wollen jeden dieser Inhalte
- separat cachen. Um dies zu erreichen, können Sie eine 'cache_id' beim Funktionsaufruf
- übergeben.
-
-
- 'display()' eine 'cache_id' übergeben
-
- require('Smarty.class.php');
- $smarty = new Smarty;
-
- $smarty->caching = true;
-
- $my_cache_id = $_GET['article_id'];
-
- $smarty->display('index.tpl', $my_cache_id);
-
-
- Im oberen Beispiel übergeben wir die Variable '$my_cache_id'
- als 'cache_id' an 'display()'. Für jede einmalige 'cache_id'
- wird ein eigener Cache von 'index.tpl' erzeugt. In diesem
- Beispiel wurde 'article_id' per URL übergeben und als 'cache_id' verwendet.
-
-
- Technische Bemerkung
-
- Seien Sie vorsichtig, wenn Sie Smarty (oder jeder anderen PHP-Applikation)
- Werte direkt vom Client (Webbrowser) übergeben. Obwohl das Beispiel oben
- praktisch aussehen mag, kann es schwerwiegende Konsequenzen haben. Die 'cache_id'
- wird verwendet, um im Dateisystem ein Verzeichnis zu erstellen. Wenn ein Benutzer
- also überlange Werte übergibt oder ein Skript benutzt, das in hohem
- Tempo neue 'article_ids' übermittelt, kann dies auf dem Server zu Problemen
- führen. Stellen Sie daher sicher, dass Sie alle empfangenen Werte auf
- ihre Gültigkeit überprüfen und unerlaubte Sequenzen entfernen.
- Sie wissen möglicherweise, dass ihre 'article_id' nur 10 Zeichen lang sein kann, nur
- aus alphanumerischen Zeichen bestehen darf und in der Datenbank eingetragen
- sein muss. überpüfen sie das!
-
-
-
- Denken Sie daran, Aufrufen von is_cached()
- und clear_cache() als zweiten Parameter
- die 'cache_id' zu übergeben.
-
-
- 'is_cached()' mit 'cache_id' aufrufen
-
- require('Smarty.class.php');
- $smarty = new Smarty;
-
- $smarty->caching = true;
-
- $my_cache_id = $_GET['article_id'];
-
- if(!$smarty->is_cached('index.tpl', $my_cache_id)) {
-
- // kein Cache gefunden, also Variablen zuweisen
- $contents = get_database_contents();
- $smarty->assign($contents);
- }
-
- $smarty->display('index.tpl', $my_cache_id);
-
-
- Sie können mit 'clear_cache()' den gesamten Cache einer bestimmten 'cache_id'
- auf einmal löschen, wenn Sie als Parameter die 'cache_id' übergeben.
-
-
- Cache einer bestimmten 'cache_id' leeren
-
- require('Smarty.class.php');
- $smarty = new Smarty;
-
- $smarty->caching = true;
-
-
- // Cache mit 'sports' als 'cache_id' löschen
- $smarty->clear_cache(null, "sports");
-
- $smarty->display('index.tpl', "sports");
-
-
- Indem Sie allen dieselbe 'cache_id' übergeben, lassen sich Caches gruppieren.
-
-
-
- Cache-Gruppen
-
- Sie können auch eine feinere Gruppierung vornehmen, indem Sie
- 'cache_id'-Gruppen erzeugen. Dies erreichen Sie, indem Sie jede Cache-Untergruppe
- durch ein '|'-Zeichen (pipe) in der 'cache_id' abtrennen. Sie können so viele
- Untergruppen erstellen, wie Sie möchten.
-
-
- 'cache_id'-Gruppen
-
- require('Smarty.class.php');
- $smarty = new Smarty;
-
- $smarty->caching = true;
-
-
- // leere alle Caches welche 'sports|basketball' als erste zwei 'cache_id'-Gruppen enthalten
- $smarty->clear_cache(null, "sports|basketball");
-
- // leere alle Caches welche 'sports' als erste 'cache_id'-Gruppe haben. Dies schliesst
- // 'sports|basketball', oder 'sports|(anything)|(anything)|(anything)|...' ein
- $smarty->clear_cache(null, "sports");
-
- $smarty->display('index.tpl',"sports|basketball");
-
-
- Technische Bemerkung
-
- Cache-Gruppierung benutzt nicht den Pfad zum Template für die 'cache_id'. Wenn Sie
- zum Beispiel display('themes/blue/index.tpl') aufrufen, können Sie NICHT
- den ganzen Cache unter 'themes/blue' leeren. Wenn Sie dies tun möchten,
- müssen Sie die Caches anhand der 'cache_id' gruppieren - zum Beispiel
- display('themes/blue/index.tpl','themes|blue');
- Danach können Sie alle Caches des 'blue-theme' mit clear_cache(null, 'themes|blue');
- leeren.
-
-
-
-
- Die Ausgabe von cachebaren Plugins Kontrollieren
-
- Seit Smarty-2.6.0 kann bei der Registrierung angegeben werden ob ein Plugin
- cached werden soll. Der dritte Parameter für register_block, register_compiler_function
- und register_function heisst $cacheable, der Standardwert ist TRUE, was in Smarty vor
- Version 2.6.0 üblich war.
-
-
- Wenn ein Plugin mit $cacheable=false registriert wird, wird er bei jedem Besuch der Seite aufgerufen, selbst wenn die Site aus dem Cache stammt. Die Pluginfunktion verhält sich ein wenig wie insert.
-
-
- Im Gegensatz zu {insert} werden die Attribute standartmässig nicht gecached. Sie können das caching jedoch mit dem vierten Parameter $cache_attrs kontrollieren. $cache_attrs ist ein Array aller Attributnamen die gecached wertden sollen.
-
-
- Preventing a plugin's output from being cached
-
-index.php:
-
-require('Smarty.class.php');
-$smarty = new Smarty;
-$smarty->caching = true;
-
-function remaining_seconds($params, &$smarty) {
- $remain = $params['endtime'] - time();
- if ($remain >=0)
- return $remain . " second(s)";
- else
- return "done";
-}
-
-$smarty->register_function('remaining', 'remaining_seconds', false, array('endtime'));
-
-if (!$smarty->is_cached('index.tpl')) {
- // objekt $obj aus datenbank dem template zuweisen
- $smarty->assign_by_ref('obj', $obj);
-}
-
-$smarty->display('index.tpl');
-
-
-index.tpl:
-
-Time Remaining: {remain endtime=$obj->endtime}
-
- Der Wert von $obj->endtime ändert bei jeder Anzeige der Seite, selbst wenn die Seite gecached wurde. Das Objekt $obj wird nur geladen wenn die Seite nicht gecached wurde.
-
-
-
- Verhindern dass Template Blöcke gecached werden
-
-index.php:
-
-require('Smarty.class.php');
-$smarty = new Smarty;
-$smarty->caching = true;
-
-function smarty_block_dynamic($param, $content, &$smarty) {
- return $content;
-}
-$smarty->register_block('dynamic', 'smarty_block_dynamic', false);
-
-$smarty->display('index.tpl');
-
-
-index.tpl:
-
-Page created: {"0"|date_format:"%D %H:%M:%S"}
-
-{dynamic}
-
-Now is: {"0"|date_format:"%D %H:%M:%S"}
-
-... do other stuff ...
-
-{/dynamic}
-
-
-Um sicherzustellen dass ein Teil eines Templates nicht gecached werden soll, kann dieser Abschnitt in einen {dynamic}...{/dynamic} Block verpackt werden.
-
-
+&programmers.caching.caching-setting-up;
+&programmers.caching.caching-multiple-caches;
+&programmers.caching.caching-groups;
+&programmers.caching.caching-cacheable;
+
+ Die Ausgabe von cachebaren Plugins Kontrollieren
+
+ Seit Smarty-2.6.0 kann bei der Registrierung angegeben werden ob ein Plugin
+ cached werden soll. Der dritte Parameter für register_block, register_compiler_function
+ und register_function heisst $cacheable, der Standardwert ist TRUE, was in Smarty vor
+ Version 2.6.0 üblich war.
+
+
+ Wenn ein Plugin mit $cacheable=false registriert wird, wird er bei jedem Besuch der Seite aufgerufen, selbst wenn die Site aus dem Cache stammt. Die Pluginfunktion verhält sich ein wenig wie insert.
+
+
+ Im Gegensatz zu {insert} werden die Attribute standartmässig nicht gecached. Sie können das caching jedoch mit dem vierten Parameter $cache_attrs kontrollieren. $cache_attrs ist ein Array aller Attributnamen die gecached wertden sollen.
+
+
+ Preventing a plugin's output from being cached
+
+index.php:
+
+require('Smarty.class.php');
+$smarty = new Smarty;
+$smarty->caching = true;
+
+function remaining_seconds($params, &$smarty) {
+ $remain = $params['endtime'] - time();
+ if ($remain >=0)
+ return $remain . " second(s)";
+ else
+ return "done";
+}
+
+$smarty->register_function('remaining', 'remaining_seconds', false, array('endtime'));
+
+if (!$smarty->is_cached('index.tpl')) {
+ // objekt $obj aus datenbank dem template zuweisen
+ $smarty->assign_by_ref('obj', $obj);
+}
+
+$smarty->display('index.tpl');
+
+
+index.tpl:
+
+Time Remaining: {remain endtime=$obj->endtime}
+
+ Der Wert von $obj->endtime ändert bei jeder Anzeige der Seite, selbst wenn die Seite gecached wurde. Das Objekt $obj wird nur geladen wenn die Seite nicht gecached wurde.
+
+
+
+ Verhindern dass Template Blöcke gecached werden
+
+index.php:
+
+require('Smarty.class.php');
+$smarty = new Smarty;
+$smarty->caching = true;
+
+function smarty_block_dynamic($param, $content, &$smarty) {
+ return $content;
+}
+$smarty->register_block('dynamic', 'smarty_block_dynamic', false);
+
+$smarty->display('index.tpl');
+
+
+index.tpl:
+
+Page created: {"0"|date_format:"%D %H:%M:%S"}
+
+{dynamic}
+
+Now is: {"0"|date_format:"%D %H:%M:%S"}
+
+... do other stuff ...
+
+{/dynamic}
+
+
+Um sicherzustellen dass ein Teil eines Templates nicht gecached werden soll, kann dieser Abschnitt in einen {dynamic}...{/dynamic} Block verpackt werden.
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/caching/caching-groups.xml b/docs/de/programmers/caching/caching-groups.xml
new file mode 100644
index 00000000..29a5b003
--- /dev/null
+++ b/docs/de/programmers/caching/caching-groups.xml
@@ -0,0 +1,61 @@
+
+
+
+ Cache-Gruppen
+
+ Sie können auch eine feinere Gruppierung vornehmen, indem Sie
+ 'cache_id'-Gruppen erzeugen. Dies erreichen Sie, indem Sie jede Cache-Untergruppe
+ durch ein '|'-Zeichen (pipe) in der 'cache_id' abtrennen. Sie können so viele
+ Untergruppen erstellen, wie Sie möchten.
+
+
+ 'cache_id'-Gruppen
+
+ require('Smarty.class.php');
+ $smarty = new Smarty;
+
+ $smarty->caching = true;
+
+
+ // leere alle Caches welche 'sports|basketball' als erste zwei 'cache_id'-Gruppen enthalten
+ $smarty->clear_cache(null, "sports|basketball");
+
+ // leere alle Caches welche 'sports' als erste 'cache_id'-Gruppe haben. Dies schliesst
+ // 'sports|basketball', oder 'sports|(anything)|(anything)|(anything)|...' ein
+ $smarty->clear_cache(null, "sports");
+
+ $smarty->display('index.tpl',"sports|basketball");
+
+
+ Technische Bemerkung
+
+ Cache-Gruppierung benutzt nicht den Pfad zum Template für die 'cache_id'. Wenn Sie
+ zum Beispiel display('themes/blue/index.tpl') aufrufen, können Sie NICHT
+ den ganzen Cache unter 'themes/blue' leeren. Wenn Sie dies tun möchten,
+ müssen Sie die Caches anhand der 'cache_id' gruppieren - zum Beispiel
+ display('themes/blue/index.tpl','themes|blue');
+ Danach können Sie alle Caches des 'blue-theme' mit clear_cache(null, 'themes|blue');
+ leeren.
+
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/caching/caching-multiple-caches.xml b/docs/de/programmers/caching/caching-multiple-caches.xml
new file mode 100644
index 00000000..d12f3aca
--- /dev/null
+++ b/docs/de/programmers/caching/caching-multiple-caches.xml
@@ -0,0 +1,111 @@
+
+
+
+ Multiple Caches für eine Seite
+
+ Sie können für Aufrufe von 'display()' oder 'fetch()' auch mehrere Caches erzeugen.
+ Nehmen wir zum Beispiel an, der Aufruf von display('index.tpl') erzeuge für
+ verschieden Fälle unterschiedliche Inhalte und Sie wollen jeden dieser Inhalte
+ separat cachen. Um dies zu erreichen, können Sie eine 'cache_id' beim Funktionsaufruf
+ übergeben.
+
+
+ 'display()' eine 'cache_id' übergeben
+
+ require('Smarty.class.php');
+ $smarty = new Smarty;
+
+ $smarty->caching = true;
+
+ $my_cache_id = $_GET['article_id'];
+
+ $smarty->display('index.tpl', $my_cache_id);
+
+
+ Im oberen Beispiel übergeben wir die Variable '$my_cache_id'
+ als 'cache_id' an 'display()'. Für jede einmalige 'cache_id'
+ wird ein eigener Cache von 'index.tpl' erzeugt. In diesem
+ Beispiel wurde 'article_id' per URL übergeben und als 'cache_id' verwendet.
+
+
+ Technische Bemerkung
+
+ Seien Sie vorsichtig, wenn Sie Smarty (oder jeder anderen PHP-Applikation)
+ Werte direkt vom Client (Webbrowser) übergeben. Obwohl das Beispiel oben
+ praktisch aussehen mag, kann es schwerwiegende Konsequenzen haben. Die 'cache_id'
+ wird verwendet, um im Dateisystem ein Verzeichnis zu erstellen. Wenn ein Benutzer
+ also überlange Werte übergibt oder ein Skript benutzt, das in hohem
+ Tempo neue 'article_ids' übermittelt, kann dies auf dem Server zu Problemen
+ führen. Stellen Sie daher sicher, dass Sie alle empfangenen Werte auf
+ ihre Gültigkeit überprüfen und unerlaubte Sequenzen entfernen.
+ Sie wissen möglicherweise, dass ihre 'article_id' nur 10 Zeichen lang sein kann, nur
+ aus alphanumerischen Zeichen bestehen darf und in der Datenbank eingetragen
+ sein muss. überpüfen sie das!
+
+
+
+ Denken Sie daran, Aufrufen von is_cached()
+ und clear_cache() als zweiten Parameter
+ die 'cache_id' zu übergeben.
+
+
+ 'is_cached()' mit 'cache_id' aufrufen
+
+ require('Smarty.class.php');
+ $smarty = new Smarty;
+
+ $smarty->caching = true;
+
+ $my_cache_id = $_GET['article_id'];
+
+ if(!$smarty->is_cached('index.tpl', $my_cache_id)) {
+
+ // kein Cache gefunden, also Variablen zuweisen
+ $contents = get_database_contents();
+ $smarty->assign($contents);
+ }
+
+ $smarty->display('index.tpl', $my_cache_id);
+
+
+ Sie können mit 'clear_cache()' den gesamten Cache einer bestimmten 'cache_id'
+ auf einmal löschen, wenn Sie als Parameter die 'cache_id' übergeben.
+
+
+ Cache einer bestimmten 'cache_id' leeren
+
+ require('Smarty.class.php');
+ $smarty = new Smarty;
+
+ $smarty->caching = true;
+
+
+ // Cache mit 'sports' als 'cache_id' löschen
+ $smarty->clear_cache(null, "sports");
+
+ $smarty->display('index.tpl', "sports");
+
+
+ Indem Sie allen dieselbe 'cache_id' übergeben, lassen sich Caches gruppieren.
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/caching/caching-setting-up.xml b/docs/de/programmers/caching/caching-setting-up.xml
new file mode 100644
index 00000000..102f9763
--- /dev/null
+++ b/docs/de/programmers/caching/caching-setting-up.xml
@@ -0,0 +1,167 @@
+
+
+
+ Caching einrichten
+
+ Als erstes muss das Caching eingeschaltet werden. Dies erreicht man, indem
+ $caching auf 'true' (oder 1) gesetzt wird.
+
+
+ Caching einschalten
+
+ require('Smarty.class.php');
+ $smarty = new Smarty;
+
+ $smarty->caching = true;
+
+ $smarty->display('index.tpl');
+
+
+ Wenn Caching eingeschaltet ist, wird der Funktionsaufruf display('index.tpl')
+ das Template normal rendern, zur selben Zeit jedoch auch eine Datei mit
+ dem Inhalt in das $cache_dir schreiben
+ (als gecachte Kopie). Beim nächsten Aufruf von display('index.tpl') wird die
+ gecachte Kopie verwendet.
+
+
+ Technische Bemerkung
+
+ Die im '$cache_dir' abgelegen Dateien haben einen ähnlichen Namen
+ wie das Template, mit dem sie erzeugt wurden. Obwohl sie eine '.php'-Endung
+ aufweisen, sind sie keine ausführbaren PHP-Skripte.
+ Editieren Sie diese Dateien NICHT!
+
+
+
+ Jede gecachte Seite hat eine Lebensdauer, die von $cache_lifetime
+ bestimmt wird. Normalerweise beträgt der Wert 3600 Sekunden (= 1 Stunde). Nach Ablauf dieser Lebensdauer
+ wird der Cache neu generiert. Sie können die Lebensdauer pro Cache bestimmen indem Sie '$caching'
+ auf 2 setzen. Konsultieren Sie den Abschnitt über $cache_lifetime
+ für weitere Informationen.
+
+
+ '$cache_lifetime' pro Cache einstellen
+
+ require('Smarty.class.php');
+ $smarty = new Smarty;
+
+ $smarty->caching = 2; // Lebensdauer ist pro Cache
+
+
+ // Standardwert für '$cache_lifetime' auf 5 Minuten setzen
+ $smarty->cache_lifetime = 300;
+ $smarty->display('index.tpl');
+
+
+ // '$cache_lifetime' für 'home.tpl' auf 1 Stunde setzen
+ $smarty->cache_lifetime = 3600;
+ $smarty->display('home.tpl');
+
+ // ACHTUNG: die folgende Zuweisung an '$cache_lifetime' wird nicht funktionieren,
+ // wenn '$caching' auf 2 gestellt ist. Wenn die '$cache_lifetime' für 'home.tpl' bereits
+ // auf 1 Stunde gesetzt wurde, werden neue Werte ignoriert.
+ // 'home.tpl' wird nach dieser Zuweisung immer noch eine '$cache_lifetime' von 1 Stunde haben.
+ $smarty->cache_lifetime = 30; // 30 Sekunden
+ $smarty->display('home.tpl');
+
+
+ Wenn $compile_check eingeschaltet ist,
+ werden alle in den Cache eingeflossenen Templates und Konfigurationsdateien
+ hinsichtlich ihrer letzten änderung überprüft.
+ Falls eine der Dateien seit der Erzeugung des Cache geändert wurde,
+ wird der Cache unverzüglich neu generiert. Dadurch ergibt sich ein
+ geringer Mehraufwand. Für optimale Performace sollte '$compile_check'
+ deshalb auf 'false' gesetzt werden.
+
+
+ '$compile_check' einschalten
+
+ require('Smarty.class.php');
+ $smarty = new Smarty;
+
+ $smarty->caching = true;
+ $smarty->compile_check = true;
+
+ $smarty->display('index.tpl');
+
+
+ Wenn $force_compile eingeschaltet ist,
+ werden die Cache-Dateien immer neu generiert und das Caching damit wirkungslos gemacht.
+ '$force_compile' wird normalerweise nur für die Fehlersuche verwendet.
+ Ein effizienterer Weg das Caching auszuschalten wäre,
+ $caching auf 'false' (oder 0) zu setzen.
+
+
+ Mit der Funktion is_cached() kann überprüft
+ werden, ob von einem Template eine gecachte Version vorliegt.
+ In einem Template, das zum Beispiel Daten aus einer Datenbank bezieht,
+ können Sie diese Funktion verwenden, um den Prozess zu überspringen.
+
+
+ is_cached() verwenden
+
+ require('Smarty.class.php');
+ $smarty = new Smarty;
+
+ $smarty->caching = true;
+
+ if(!$smarty->is_cached('index.tpl')) {
+
+ // kein Cache gefunden, also Variablen zuweisen
+ $contents = get_database_contents();
+ $smarty->assign($contents);
+ }
+
+ $smarty->display('index.tpl');
+
+
+ Mit der insert Funktion können Sie
+ Teile einer Seite dynamisch halten. Wenn zum Beispiel ein Banner in einer gecachten Seite
+ nicht gecached werden soll, kann dessen Aufruf mit 'insert' dynamisch gehalten werden.
+ Konsultieren Sie den Abschnitt über insert
+ für weitere Informationen und Beispiele.
+
+
+ Mit der Funktion clear_all_cache() können
+ Sie den gesamten Template-Cache löschen. Mit clear_cache()
+ einzelne Templates oder Template-Gruppen.
+
+
+ Cache leeren
+
+ require('Smarty.class.php');
+ $smarty = new Smarty;
+
+ $smarty->caching = true;
+
+
+ // alle Cache-Dateien löschen
+ $smarty->clear_all_cache();
+
+
+ // nur Cache von 'index.tpl' löschen
+ $smarty->clear_cache('index.tpl');
+
+ $smarty->display('index.tpl');
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/plugins.xml b/docs/de/programmers/plugins.xml
index aadb50f8..fb9a9aa9 100644
--- a/docs/de/programmers/plugins.xml
+++ b/docs/de/programmers/plugins.xml
@@ -24,745 +24,26 @@
-
- Wie Plugins funktionieren
-
- Plugins werden immer erst bei Bedarf geladen. Nur die im Template
- verwendeten Funktionen, Ressourcen, Variablen-Modifikatoren, etc. werden geladen.
- Des weiteren wird jedes Plugin nur einmal geladen, selbst wenn mehrere Smarty-Instanzen
- im selben Request erzeugt werden.
-
-
- 'pre'/'post'-Filter machen die Ausnahme. Da sie in den Templates nicht direkt
- erwähnt werden, müssen sie zu Beginn der Ausführung explizit via API geladen oder
- registriert werden. Die Reihenfolge der Anwendung mehrerer Filter desselben Typs
- entspricht der Reihenfolge in der sie geladen/registriert wurden.
-
-
- Die plugins directory Variable kann eine Zeichenkette,
- oder ein Array mit Verzeichnisnamen sein. Um einen Plugin zu installieren können Sie ihn einfach
- in einem der Verzeichnisse ablegen.
-
-
+&programmers.plugins.plugins-howto;
-
- Namenskonvention
-
- Plugin-Dateien müssen einer klaren Namenskonvention gehorchen,
- um von Smarty erkannt zu werden.
-
-
-
- Die Plugin-Dateien müssen wie folgt benannt werden:
-
-
-
- type.name.php
-
-
-
-
-
-
- Wobei Typ einen der folgenden Werte haben kann:
-
- function
- modifier
- block
- compiler
- prefilter
- postfilter
- outputfilter
- resource
- insert
-
-
-
- und Name ein erlaubter Identifikator (bestehend
- aus Buchstaben, Zahlen und Unterstrichen) ist.
-
-
- Ein paar Beispiele: function.html_select_date.php,
- resource.db.php,
- modifier.spacify.php.
-
-
-
- Die Plugin-Funktion innerhalb das Plugin-Datei muss wie folgt benannt werden:
-
-
- smarty_type_name
-
-
-
-
- type und name haben die selbe Bedeutung wie bei den Plugin-Dateien.
-
-
- Smarty gibt Fehlermeldungen aus, falls ein aufgerufenes Plugin nicht existiert,
- oder eine Datei mit falscher Namensgebung im Verzeichnis gefunden wurde.
-
-
-
- Plugins schreiben
-
- Plugins können von Smarty automatisch geladen oder
- zur Laufzeit dynamisch mit den register_* API-Funktionen
- registriert werden. Um registrierte Plugins wieder zu entfernen,
- können die unregister_* API-Funktionen verwendet werden.
-
-
- Bei Plugins, die zur Laufzeit geladen werden, müssen keine Namenskonventionen
- beachtet werden.
-
-
- Wenn ein Plugin auf die Funktionalität eines anderen Plugins angewiesen
- ist (wie dies bei manchen Smarty Standard-Plugins der Fall ist), sollte
- folgender Weg gewählt werden, um das benötigte Plugin zu laden:
-
-
- require_once $smarty->_get_plugin_filepath('function', 'html_options');
-
- Das Smarty Objekt wird jedem Plugin immer als letzter Parameter
- übergeben (ausser bei Variablen-Modifikatoren und bei Blücken wird
- &$repeat nach dem Smarty Objekt übergeben um Rückwärtskompatibel zu bleiben).
-
-
+&programmers.plugins.plugins-naming-conventions;
+&programmers.plugins.plugins-writing;
- Template-Funktionen
-
-
- void smarty_function_name
- array $params
- object &$smarty
-
-
-
- Alle einer Funktion übergebenen Parameter werden in der Variable
- $params als assoziatives Array abgelegt. Sie können
- auf diese Werte entweder direkt mit $params['start'] zugreifen
- oder sie mit extract($params) in die Symbol-Tabelle importieren.
-
-
- Die Ausgabe der Funktion wird verwendet, um das Funktions-Tag im Template
- (fetch Funktion, zum Beispiel) zu ersetzen.
- Alternativ kann sie auch etwas tun, ohne eine Ausgabe zurückzuliefern
- (assign Funktion, zum Beispiel).
-
-
- Falls die Funktion dem Template Variablen zuweisen oder
- auf eine andere Smarty-Funktionalität zugreifen möchte, kann dazu das
- übergebene $smarty Objekt verwendet werden.
-
-
-
- Sehen Sie dazu:
- register_function(),
- unregister_function().
-
-
-
- Funktionsplugin mit Ausgabe
-
- <?php
- /*
- * Smarty plugin
- * -------------------------------------------------------------
- * File: function.eightball.php
- * Type: function
- * Name: eightball
- * Purpose: outputs a random magic answer
- * -------------------------------------------------------------
- */
- function smarty_function_eightball($params, &$smarty)
- {
- $answers = array('Yes',
- 'No',
- 'No way',
- 'Outlook not so good',
- 'Ask again soon',
- 'Maybe in your reality');
-
- $result = array_rand($answers);
- echo $answers[$result];
- }
- ?>
-
-
-
-
- Es kann im Template wie folgt angewendet werden:
-
-
- Question: Will we ever have time travel?
- Answer: {eightball}.
-
-
- Funktionsplugin ohne Ausgabe
-
- <?php
- /*
- * Smarty plugin
- * -------------------------------------------------------------
- * File: function.assign.php
- * Type: function
- * Name: assign
- * Purpose: assign a value to a template variable
- * -------------------------------------------------------------
- */
- function smarty_function_assign($params, &$smarty)
- {
- extract($params);
-
- if (empty($var)) {
- $smarty->trigger_error("assign: missing 'var' parameter");
- return;
- }
-
- if (!in_array('value', array_keys($params))) {
- $smarty->trigger_error("assign: missing 'value' parameter");
- return;
- }
-
- $smarty->assign($var, $value);
- }
- ?>
-
-
-
+&programmers.plugins.plugins-functions;
- Variablen-Modifikatoren
-
- Variablen-Modifikatoren sind kleine Funktionen, die auf eine Variable angewendet
- werden, bevor sie ausgegeben oder weiterverwendet wird. Variablen-Modifikatoren können
- aneinadergereiht werden.
-
-
-
- mixed smarty_modifier_name
- mixed $value
- [mixed $param1, ...]
-
-
-
- Der erste an das Modifikator-Plugin übergebene Parameter ist der
- Wert mit welchem er arbeiten soll. Die restlichen Parameter sind optional
- und hängen von den durchzuführenden Operationen ab.
-
-
-
- Der Modifikator muss das Resultat seiner Verarbeitung zurückgeben.
-
-
- Sehen Sie dazu:
- register_modifier(),
- unregister_modifier().
-
-
- Einfaches Modifikator-Plugin
-
- Dieses Plugin dient als Alias einer PHP-Funktion und erwartet keine
- zusätzlichen Parameter.
-
-
- <?php
- /*
- * Smarty plugin
- * -------------------------------------------------------------
- * File: modifier.capitalize.php
- * Type: modifier
- * Name: capitalize
- * Purpose: capitalize words in the string
- * -------------------------------------------------------------
- */
- function smarty_modifier_capitalize($string)
- {
- return ucwords($string);
- }
- ?>
-
-
-
- Komplexes Modifikator-Plugin
-
- <?php
- /*
- * Smarty plugin
- * -------------------------------------------------------------
- * File: modifier.truncate.php
- * Type: modifier
- * Name: truncate
- * Purpose: Truncate a string to a certain length if necessary,
- * optionally splitting in the middle of a word, and
- * appending the $etc string.
- * -------------------------------------------------------------
- */
- function smarty_modifier_truncate($string, $length = 80, $etc = '...',
- $break_words = false)
- {
- if ($length == 0)
- return '';
-
- if (strlen($string) > $length) {
- $length -= strlen($etc);
- $fragment = substr($string, 0, $length+1);
- if ($break_words)
- $fragment = substr($fragment, 0, -1);
- else
- $fragment = preg_replace('/\s+(\S+)?$/', '', $fragment);
- return $fragment.$etc;
- } else
- return $string;
- }
- ?>
-
-
+&programmers.plugins.plugins-modifiers;
- Block-Funktionen
-
-
- void smarty_function_name
- array $params
- mixed $content
- object &$smarty
-
-
-
- Block-Funktionen sind Funktionen, die in der Form {func} .. {/func} notiert
- werden. Mit anderen Worten umschliessen sie einen Template-Abschnitt und
- arbeiten danach auf dessen Inhalt. Eine Block-Funktion {func} .. {/func}
- kann nicht mir einer gleichnamigen Template-Funktion {func}
- überschrieben werden.
-
-
- Ihre Funktions-Implementation wird von Smarty zweimal
- aufgerufen: einmal für das öffnende und einmal
- für das schliessende Tag. (konsultieren Sie den Abschnitt zu &$repeat
- um zu erfahren wie Sie dies ändern können.)
-
-
- Nur das Öffnungs-Tag kann Attribute enthalten. Alle so übergebenen Attribute
- werden als assoziatives Array $params der Template-Funktion
- übergeben. Sie können auf die Werte entweder direkt mit $params['start']
- zugreifen oder sie mit extract($params) in die Symbol-Tabelle
- importieren. Die Attribute aus dem Öffnungs-Tag stehen auch beim Aufruf für das
- schliessende Tag zur Verfügung.
-
-
- Der Inhalt der $content Variable hängt davon
- ab, ob die Funktion für das öffnende Tag oder für das schliessende
- Tag aufgerufen wird. Für das öffnende Tag ist der Wert null,
- für das schliessende Tag ist es der Inhalt des Template-Abschnitts.
- Achtung: Der Template-Abschnitt den Sie erhalten, wurde bereits von
- Smarty bearbeitet. Sie erhalten also die Template-Ausgabe, nicht den Template-Quelltext.
-
-
- Der Parameter &$repeat wird als Referenz übergeben und
- kontrolliert wie oft ein Block dargestellt werden soll. Standardwert von $repeat
- ist beim ersten Aufruf (für das öffnende Tag) true, danach immer
- false.
- Jedes Mal wenn eine Funktion für &$repeat TRUE zurück gibt,
- wird der Inhalt zwischen {func} .. {/func} erneut mit dem veränderten
- Inhalt als $content Parameter aufgerufen.
-
-
- Wenn Sie verschachtelte Block-Funktionen haben, können Sie
- die Eltern-Block-Funktion mit der $smarty->_tag_stack Variable
- herausfinden. Lassen Sie sich ihren Inhalt mit 'var_dump()' ausgeben.
- Die Struktur sollte selbsterklärend sein.
-
-
-
- Sehen Sie dazu:
- register_block(),
- unregister_block().
-
-
- Block-Funktionen
-
- <?php
- /*
- * Smarty plugin
- * -------------------------------------------------------------
- * File: block.translate.php
- * Type: block
- * Name: translate
- * Purpose: translate a block of text
- * -------------------------------------------------------------
- */
- function smarty_block_translate($params, $content, &$smarty)
- {
- if (isset($content)) {
- $lang = $params['lang'];
-
- // den $content irgendwie intelligent übersetzuen
- return $translation;
- }
- }
-
-
+&programmers.plugins.plugins-block-functions;
- Compiler-Funktionen
-
- 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.
-
-
-
- mixed smarty_compiler_name
- string $tag_arg
- object &$smarty
-
-
-
- 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.
-
-
-
- Sehen Sie dazu:
- register_compiler_function(),
- unregister_compiler_function().
-
-
- Einfache Compiler-Funktionen
-
- <?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'). "';";
- }
- ?>
-
-
- Diese Funktion kann aus dem Template wie folgt aufgerufen werden:
-
-
-
- {* diese Funktion wird nur zum Kompilier-Zeitpunkt ausgeführt *}
- {tplheader}
-
-
- Der resultierende PHP-Code würde ungefähr so aussehen:
-
-
- <php
- echo 'index.tpl compiled at 2002-02-20 20:02';
- ?>
-
-
+&programmers.plugins.plugins-compiler-functions;
-
- 'pre'/'post'-Filter
-
- 'pre'-Filter und 'post'-Filter folgen demselben Konzept. Der
- einzige Unterschied ist der Zeitpunkt der Ausführung.
-
-
-
- string smarty_prefilter_name
- string $source
- object &$smarty
-
-
-
- 'pre'-Filter werden verwendet, um die Quellen eines Templates direkt
- vor der Kompilierung zu verarbeiten. Als erster Parameter wird die
- Template-Quelle, die möglicherweise bereits durch eine weiteren 'pre'-Filter
- bearbeitet wurden, übergeben. Das Plugin muss den resultierenden Wert
- zurückgeben. Achtung: Diese Werte werden nicht gespeichert und nur
- zum Kompilier-Zeitpunkt verwendet.
-
-
-
- string smarty_postfilter_name
- string $compiled
- object &$smarty
-
-
-
- 'post'-Filter werden auf die kompilierte Ausgabe direkt vor dem Speichern
- angewendet. Als erster Parameter wird der kompilierte Template-Code
- übergeben, der möglicherweise zuvor von anderen 'post'-Filtern
- bearbeitet wurde. Das Plugin muss den veränderten Template-Code zurückgeben.
-
-
- 'pre'-Filter Plugin
-
- <?php
- /*
- * Smarty plugin
- * -------------------------------------------------------------
- * File: prefilter.pre01.php
- * Type: prefilter
- * Name: pre01
- * Purpose: Convert html tags to be lowercase.
- * -------------------------------------------------------------
- */
- function smarty_prefilter_pre01($source, &$smarty)
- {
- return preg_replace('!<(\w+)[^>]+>!e', 'strtolower("$1")', $source);
- }
- ?>
-
-
-
- 'post'-Filter Plugin
-
- <?php
- /*
- * Smarty plugin
- * -------------------------------------------------------------
- * File: postfilter.post01.php
- * Type: postfilter
- * Name: post01
- * Purpose: Output code that lists all current template vars.
- * -------------------------------------------------------------
- */
- function smarty_postfilter_post01($compiled, &$smarty)
- {
- $compiled = "<pre>\n<?php print_r(\$this->get_template_vars()); ?>\n</pre>" . $compiled;
- return $compiled;
- }
- ?>
-
-
+&programmers.plugins.plugins-prefilters-postfilters;
- Ausgabefilter
-
- Ausgabefilter werden auf das Template direkt vor der Ausgabe angewendet,
- nachdem es geladen und ausgeführt wurde.
-
-
-
- string smarty_outputfilter_name
- string $template_output
- object &$smarty
-
-
-
- Als erster Parameter wird die Template-Ausgabe übergeben, welche
- verarbeitet werden soll und als zweiter Parameter das Smarty-Objekt.
- Das Plugin muss danach die verarbeitete Template-Ausgabe zurückgeben.
-
-
- Ausgabefilter Plugin
-
- /*
- * Smarty plugin
- * -------------------------------------------------------------
- * File: outputfilter.protect_email.php
- * Type: outputfilter
- * Name: protect_email
- * Purpose: Converts @ sign in email addresses to %40 as
- * a simple protection against spambots
- * -------------------------------------------------------------
- */
- function smarty_outputfilter_protect_email($output, &$smarty)
- {
- return preg_replace('!(\S+)@([a-zA-Z0-9\.\-]+\.([a-zA-Z]{2,3}|[0-9]{1,3}))!',
- '$1%40$2', $output);
- }
-
-
-
+&programmers.plugins.plugins-outputfilters;
- Ressourcen
-
- Ressourcen-Plugins stellen einen generischen Weg dar, um Smarty mit
- Template-Quellen oder PHP-Skripten zu versorgen. Einige Beispiele von Ressourcen:
- Datenbanken, LDAP, shared Memory, Sockets, usw.
-
-
-
- Für jeden Ressource-Typ müssen 4 Funktionen registriert werden. Jede dieser
- Funktionen erhält die verlangte Ressource als ersten Parameter und das Smarty Objekt
- als letzten. Die restlichen Parameter hängen von der Funktion ab.
-
-
-
-
- bool smarty_resource_name_source
- string $rsrc_name
- string &$source
- object &$smarty
-
-
- bool smarty_resource_name_timestamp
- string $rsrc_name
- int &$timestamp
- object &$smarty
-
-
- bool smarty_resource_name_secure
- string $rsrc_name
- object &$smarty
-
-
- bool smarty_resource_name_trusted
- string $rsrc_name
- object &$smarty
-
-
-
-
- Die erste Funktion wird verwendet, um die Ressource zu laden. Der
- zweite Parameter ist eine Variable, die via Referenz übergeben
- wird und in der das Resultat gespeichert werden soll. Die Funktion
- gibt true zurück, wenn der Ladevorgang erfolgreich war -
- andernfalls false.
-
-
-
- Die zweite Funktion fragt das letzte Änderungsdatum der angeforderten
- Ressource (als Unix-Timestamp) ab. Der zweite Parameter ist die Variable,
- welche via Referenz übergeben wird und in der das Resultat gespeichert werden soll.
- Gibt true zurück, wenn das Änderungsdatum ermittelt
- werden konnte und false wenn nicht.
-
-
-
- Die dritte Funktion gibt true oder false
- zurück, je nachdem ob die angeforderte Ressource als sicher bezeichnet wird
- oder nicht. Diese Funktion wird nur für Template-Ressourcen verwendet,
- sollte aber in jedem Fall definiert werden.
-
-
-
- Die vierte Funktion gibt true oder false
- zurück, je nachdem ob die angeforderte Ressource als vertrauenswürdig angesehen wird
- oder nicht. Diese Funktion wird nur verwendet, wenn PHP-Skripte via include_php
- oder insert eingebunden werden sollen und ein 'src' Attribut übergeben wurde.
- Die Funktion sollte aber in jedem Fall definiert werden.
-
-
- Sehen Sie dazu:
- register_resource(),
- unregister_resource().
-
-
- Ressourcen Plugin
-
- <?php
- /*
- * Smarty plugin
- * -------------------------------------------------------------
- * File: resource.db.php
- * Type: resource
- * Name: db
- * Purpose: Fetches templates from a database
- * -------------------------------------------------------------
- */
- function smarty_resource_db_source($tpl_name, &$tpl_source, &$smarty)
- {
- // Datenbankabfragen machen, um '$tpl_source' das template zuzuweisen
- $sql = new SQL;
- $sql->query("select tpl_source
- from my_table
- where tpl_name='$tpl_name'");
- if ($sql->num_rows) {
- $tpl_source = $sql->record['tpl_source'];
- return true;
- } else {
- return false;
- }
- }
-
- function smarty_resource_db_timestamp($tpl_name, &$tpl_timestamp, &$smarty)
- {
-
- // Datenbankabfragen durchführen um '$tpl_timestamp' zuzuweisen
- $sql = new SQL;
- $sql->query("select tpl_timestamp
- from my_table
- where tpl_name='$tpl_name'");
- if ($sql->num_rows) {
- $tpl_timestamp = $sql->record['tpl_timestamp'];
- return true;
- } else {
- return false;
- }
- }
-
- function smarty_resource_db_secure($tpl_name, &$smarty)
- {
-
- // angenommen alle Templates seien sicher...
- return true;
- }
-
- function smarty_resource_db_trusted($tpl_name, &$smarty)
- {
-
- // wird für Templates nicht verwendet
- }
- ?>
-
-
+&programmers.plugins.plugins-resources;
- Inserts
-
- Insert-Plugins werden verwendet, um Funktionen zu implementieren, die
- via insert aufgerufen werden.
-
-
-
- string smarty_insert_name
- array $params
- object &$smarty
-
-
-
- Als erster Parameter wird der Funktion ein assoziatives Array aller Attribute
- übergeben, die im Insert-Tag notiert wurden. Sie können
- auf diese Werte entweder direkt mit $params['start'] zugreifen
- oder sie mit extract($params) importieren.
-
-
- Als Rückgabewert muss das Resultat der Ausführung geliefert werden,
- das danach den Platz des insert-Tags im Template einnimmt.
-
-
- Insert-Plugin
-
- <?php
- /*
- * Smarty plugin
- * -------------------------------------------------------------
- * File: insert.time.php
- * Type: time
- * Name: time
- * Purpose: Inserts current date/time according to format
- * -------------------------------------------------------------
- */
- function smarty_insert_time($params, &$smarty)
- {
- if (empty($params['format'])) {
- $smarty->trigger_error("insert time: missing 'format' parameter");
- return;
- }
-
- $datetime = strftime($params['format']);
- return $datetime;
- }
- ?>
-
-
+&programmers.plugins.plugins-inserts;
+ Block-Funktionen
+
+
+ void smarty_function_name
+ array $params
+ mixed $content
+ object &$smarty
+
+
+
+ Block-Funktionen sind Funktionen, die in der Form {func} .. {/func} notiert
+ werden. Mit anderen Worten umschliessen sie einen Template-Abschnitt und
+ arbeiten danach auf dessen Inhalt. Eine Block-Funktion {func} .. {/func}
+ kann nicht mir einer gleichnamigen Template-Funktion {func}
+ überschrieben werden.
+
+
+ Ihre Funktions-Implementation wird von Smarty zweimal
+ aufgerufen: einmal für das öffnende und einmal
+ für das schliessende Tag. (konsultieren Sie den Abschnitt zu &$repeat
+ um zu erfahren wie Sie dies ändern können.)
+
+
+ Nur das Öffnungs-Tag kann Attribute enthalten. Alle so übergebenen Attribute
+ werden als assoziatives Array $params der Template-Funktion
+ übergeben. Sie können auf die Werte entweder direkt mit $params['start']
+ zugreifen oder sie mit extract($params) in die Symbol-Tabelle
+ importieren. Die Attribute aus dem Öffnungs-Tag stehen auch beim Aufruf für das
+ schliessende Tag zur Verfügung.
+
+
+ Der Inhalt der $content Variable hängt davon
+ ab, ob die Funktion für das öffnende Tag oder für das schliessende
+ Tag aufgerufen wird. Für das öffnende Tag ist der Wert null,
+ für das schliessende Tag ist es der Inhalt des Template-Abschnitts.
+ Achtung: Der Template-Abschnitt den Sie erhalten, wurde bereits von
+ Smarty bearbeitet. Sie erhalten also die Template-Ausgabe, nicht den Template-Quelltext.
+
+
+ Der Parameter &$repeat wird als Referenz übergeben und
+ kontrolliert wie oft ein Block dargestellt werden soll. Standardwert von $repeat
+ ist beim ersten Aufruf (für das öffnende Tag) true, danach immer
+ false.
+ Jedes Mal wenn eine Funktion für &$repeat TRUE zurück gibt,
+ wird der Inhalt zwischen {func} .. {/func} erneut mit dem veränderten
+ Inhalt als $content Parameter aufgerufen.
+
+
+ Wenn Sie verschachtelte Block-Funktionen haben, können Sie
+ die Eltern-Block-Funktion mit der $smarty->_tag_stack Variable
+ herausfinden. Lassen Sie sich ihren Inhalt mit 'var_dump()' ausgeben.
+ Die Struktur sollte selbsterklärend sein.
+
+
+
+ Sehen Sie dazu:
+ register_block(),
+ unregister_block().
+
+
+ Block-Funktionen
+
+ <?php
+ /*
+ * Smarty plugin
+ * -------------------------------------------------------------
+ * File: block.translate.php
+ * Type: block
+ * Name: translate
+ * Purpose: translate a block of text
+ * -------------------------------------------------------------
+ */
+ function smarty_block_translate($params, $content, &$smarty)
+ {
+ if (isset($content)) {
+ $lang = $params['lang'];
+
+ // den $content irgendwie intelligent übersetzuen
+ return $translation;
+ }
+ }
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/plugins/plugins-compiler-functions.xml b/docs/de/programmers/plugins/plugins-compiler-functions.xml
new file mode 100644
index 00000000..c58f5655
--- /dev/null
+++ b/docs/de/programmers/plugins/plugins-compiler-functions.xml
@@ -0,0 +1,86 @@
+
+
+ Compiler-Funktionen
+
+ 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.
+
+
+
+ mixed smarty_compiler_name
+ string $tag_arg
+ object &$smarty
+
+
+
+ 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.
+
+
+
+ Sehen Sie dazu:
+ register_compiler_function(),
+ unregister_compiler_function().
+
+
+ Einfache Compiler-Funktionen
+
+ <?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'). "';";
+ }
+ ?>
+
+
+ Diese Funktion kann aus dem Template wie folgt aufgerufen werden:
+
+
+
+ {* diese Funktion wird nur zum Kompilier-Zeitpunkt ausgeführt *}
+ {tplheader}
+
+
+ Der resultierende PHP-Code würde ungefähr so aussehen:
+
+
+ <php
+ echo 'index.tpl compiled at 2002-02-20 20:02';
+ ?>
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/plugins/plugins-functions.xml b/docs/de/programmers/plugins/plugins-functions.xml
new file mode 100644
index 00000000..1ec81417
--- /dev/null
+++ b/docs/de/programmers/plugins/plugins-functions.xml
@@ -0,0 +1,123 @@
+
+
+ Template-Funktionen
+
+
+ void smarty_function_name
+ array $params
+ object &$smarty
+
+
+
+ Alle einer Funktion übergebenen Parameter werden in der Variable
+ $params als assoziatives Array abgelegt. Sie können
+ auf diese Werte entweder direkt mit $params['start'] zugreifen
+ oder sie mit extract($params) in die Symbol-Tabelle importieren.
+
+
+ Die Ausgabe der Funktion wird verwendet, um das Funktions-Tag im Template
+ (fetch Funktion, zum Beispiel) zu ersetzen.
+ Alternativ kann sie auch etwas tun, ohne eine Ausgabe zurückzuliefern
+ (assign Funktion, zum Beispiel).
+
+
+ Falls die Funktion dem Template Variablen zuweisen oder
+ auf eine andere Smarty-Funktionalität zugreifen möchte, kann dazu das
+ übergebene $smarty Objekt verwendet werden.
+
+
+
+ Sehen Sie dazu:
+ register_function(),
+ unregister_function().
+
+
+
+ Funktionsplugin mit Ausgabe
+
+ <?php
+ /*
+ * Smarty plugin
+ * -------------------------------------------------------------
+ * File: function.eightball.php
+ * Type: function
+ * Name: eightball
+ * Purpose: outputs a random magic answer
+ * -------------------------------------------------------------
+ */
+ function smarty_function_eightball($params, &$smarty)
+ {
+ $answers = array('Yes',
+ 'No',
+ 'No way',
+ 'Outlook not so good',
+ 'Ask again soon',
+ 'Maybe in your reality');
+
+ $result = array_rand($answers);
+ echo $answers[$result];
+ }
+ ?>
+
+
+
+
+ Es kann im Template wie folgt angewendet werden:
+
+
+ Question: Will we ever have time travel?
+ Answer: {eightball}.
+
+
+ Funktionsplugin ohne Ausgabe
+
+ <?php
+ /*
+ * Smarty plugin
+ * -------------------------------------------------------------
+ * File: function.assign.php
+ * Type: function
+ * Name: assign
+ * Purpose: assign a value to a template variable
+ * -------------------------------------------------------------
+ */
+ function smarty_function_assign($params, &$smarty)
+ {
+ extract($params);
+
+ if (empty($var)) {
+ $smarty->trigger_error("assign: missing 'var' parameter");
+ return;
+ }
+
+ if (!in_array('value', array_keys($params))) {
+ $smarty->trigger_error("assign: missing 'value' parameter");
+ return;
+ }
+
+ $smarty->assign($var, $value);
+ }
+ ?>
+
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/plugins/plugins-howto.xml b/docs/de/programmers/plugins/plugins-howto.xml
new file mode 100644
index 00000000..2a367bfb
--- /dev/null
+++ b/docs/de/programmers/plugins/plugins-howto.xml
@@ -0,0 +1,42 @@
+
+
+
+ Wie Plugins funktionieren
+
+ Plugins werden immer erst bei Bedarf geladen. Nur die im Template
+ verwendeten Funktionen, Ressourcen, Variablen-Modifikatoren, etc. werden geladen.
+ Des weiteren wird jedes Plugin nur einmal geladen, selbst wenn mehrere Smarty-Instanzen
+ im selben Request erzeugt werden.
+
+
+ 'pre'/'post'-Filter machen die Ausnahme. Da sie in den Templates nicht direkt
+ erwähnt werden, müssen sie zu Beginn der Ausführung explizit via API geladen oder
+ registriert werden. Die Reihenfolge der Anwendung mehrerer Filter desselben Typs
+ entspricht der Reihenfolge in der sie geladen/registriert wurden.
+
+
+ Die plugins directory Variable kann eine Zeichenkette,
+ oder ein Array mit Verzeichnisnamen sein. Um einen Plugin zu installieren können Sie ihn einfach
+ in einem der Verzeichnisse ablegen.
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/plugins/plugins-inserts.xml b/docs/de/programmers/plugins/plugins-inserts.xml
new file mode 100644
index 00000000..83336d50
--- /dev/null
+++ b/docs/de/programmers/plugins/plugins-inserts.xml
@@ -0,0 +1,70 @@
+
+
+ Inserts
+
+ Insert-Plugins werden verwendet, um Funktionen zu implementieren, die
+ via insert aufgerufen werden.
+
+
+
+ string smarty_insert_name
+ array $params
+ object &$smarty
+
+
+
+ Als erster Parameter wird der Funktion ein assoziatives Array aller Attribute
+ übergeben, die im Insert-Tag notiert wurden. Sie können
+ auf diese Werte entweder direkt mit $params['start'] zugreifen
+ oder sie mit extract($params) importieren.
+
+
+ Als Rückgabewert muss das Resultat der Ausführung geliefert werden,
+ das danach den Platz des insert-Tags im Template einnimmt.
+
+
+ Insert-Plugin
+
+ <?php
+ /*
+ * Smarty plugin
+ * -------------------------------------------------------------
+ * File: insert.time.php
+ * Type: time
+ * Name: time
+ * Purpose: Inserts current date/time according to format
+ * -------------------------------------------------------------
+ */
+ function smarty_insert_time($params, &$smarty)
+ {
+ if (empty($params['format'])) {
+ $smarty->trigger_error("insert time: missing 'format' parameter");
+ return;
+ }
+
+ $datetime = strftime($params['format']);
+ return $datetime;
+ }
+ ?>
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/plugins/plugins-modifiers.xml b/docs/de/programmers/plugins/plugins-modifiers.xml
new file mode 100644
index 00000000..0c74b992
--- /dev/null
+++ b/docs/de/programmers/plugins/plugins-modifiers.xml
@@ -0,0 +1,108 @@
+
+
+ Variablen-Modifikatoren
+
+ Variablen-Modifikatoren sind kleine Funktionen, die auf eine Variable angewendet
+ werden, bevor sie ausgegeben oder weiterverwendet wird. Variablen-Modifikatoren können
+ aneinadergereiht werden.
+
+
+
+ mixed smarty_modifier_name
+ mixed $value
+ [mixed $param1, ...]
+
+
+
+ Der erste an das Modifikator-Plugin übergebene Parameter ist der
+ Wert mit welchem er arbeiten soll. Die restlichen Parameter sind optional
+ und hängen von den durchzuführenden Operationen ab.
+
+
+
+ Der Modifikator muss das Resultat seiner Verarbeitung zurückgeben.
+
+
+ Sehen Sie dazu:
+ register_modifier(),
+ unregister_modifier().
+
+
+ Einfaches Modifikator-Plugin
+
+ Dieses Plugin dient als Alias einer PHP-Funktion und erwartet keine
+ zusätzlichen Parameter.
+
+
+ <?php
+ /*
+ * Smarty plugin
+ * -------------------------------------------------------------
+ * File: modifier.capitalize.php
+ * Type: modifier
+ * Name: capitalize
+ * Purpose: capitalize words in the string
+ * -------------------------------------------------------------
+ */
+ function smarty_modifier_capitalize($string)
+ {
+ return ucwords($string);
+ }
+ ?>
+
+
+
+ Komplexes Modifikator-Plugin
+
+ <?php
+ /*
+ * Smarty plugin
+ * -------------------------------------------------------------
+ * File: modifier.truncate.php
+ * Type: modifier
+ * Name: truncate
+ * Purpose: Truncate a string to a certain length if necessary,
+ * optionally splitting in the middle of a word, and
+ * appending the $etc string.
+ * -------------------------------------------------------------
+ */
+ function smarty_modifier_truncate($string, $length = 80, $etc = '...',
+ $break_words = false)
+ {
+ if ($length == 0)
+ return '';
+
+ if (strlen($string) > $length) {
+ $length -= strlen($etc);
+ $fragment = substr($string, 0, $length+1);
+ if ($break_words)
+ $fragment = substr($fragment, 0, -1);
+ else
+ $fragment = preg_replace('/\s+(\S+)?$/', '', $fragment);
+ return $fragment.$etc;
+ } else
+ return $string;
+ }
+ ?>
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/plugins/plugins-naming-conventions.xml b/docs/de/programmers/plugins/plugins-naming-conventions.xml
new file mode 100644
index 00000000..bd712c11
--- /dev/null
+++ b/docs/de/programmers/plugins/plugins-naming-conventions.xml
@@ -0,0 +1,80 @@
+
+
+
+ Namenskonvention
+
+ Plugin-Dateien müssen einer klaren Namenskonvention gehorchen,
+ um von Smarty erkannt zu werden.
+
+
+
+ Die Plugin-Dateien müssen wie folgt benannt werden:
+
+
+
+ type.name.php
+
+
+
+
+
+
+ Wobei Typ einen der folgenden Werte haben kann:
+
+ function
+ modifier
+ block
+ compiler
+ prefilter
+ postfilter
+ outputfilter
+ resource
+ insert
+
+
+
+ und Name ein erlaubter Identifikator (bestehend
+ aus Buchstaben, Zahlen und Unterstrichen) ist.
+
+
+ Ein paar Beispiele: function.html_select_date.php,
+ resource.db.php,
+ modifier.spacify.php.
+
+
+
+ Die Plugin-Funktion innerhalb das Plugin-Datei muss wie folgt benannt werden:
+
+
+ smarty_type_name
+
+
+
+
+ type und name haben die selbe Bedeutung wie bei den Plugin-Dateien.
+
+
+ Smarty gibt Fehlermeldungen aus, falls ein aufgerufenes Plugin nicht existiert,
+ oder eine Datei mit falscher Namensgebung im Verzeichnis gefunden wurde.
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/plugins/plugins-outputfilters.xml b/docs/de/programmers/plugins/plugins-outputfilters.xml
new file mode 100644
index 00000000..d39cf491
--- /dev/null
+++ b/docs/de/programmers/plugins/plugins-outputfilters.xml
@@ -0,0 +1,60 @@
+
+
+ Ausgabefilter
+
+ Ausgabefilter werden auf das Template direkt vor der Ausgabe angewendet,
+ nachdem es geladen und ausgeführt wurde.
+
+
+
+ string smarty_outputfilter_name
+ string $template_output
+ object &$smarty
+
+
+
+ Als erster Parameter wird die Template-Ausgabe übergeben, welche
+ verarbeitet werden soll und als zweiter Parameter das Smarty-Objekt.
+ Das Plugin muss danach die verarbeitete Template-Ausgabe zurückgeben.
+
+
+ Ausgabefilter Plugin
+
+ /*
+ * Smarty plugin
+ * -------------------------------------------------------------
+ * File: outputfilter.protect_email.php
+ * Type: outputfilter
+ * Name: protect_email
+ * Purpose: Converts @ sign in email addresses to %40 as
+ * a simple protection against spambots
+ * -------------------------------------------------------------
+ */
+ function smarty_outputfilter_protect_email($output, &$smarty)
+ {
+ return preg_replace('!(\S+)@([a-zA-Z0-9\.\-]+\.([a-zA-Z]{2,3}|[0-9]{1,3}))!',
+ '$1%40$2', $output);
+ }
+
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/plugins/plugins-prefilters-postfilters.xml b/docs/de/programmers/plugins/plugins-prefilters-postfilters.xml
new file mode 100644
index 00000000..9be4ff2a
--- /dev/null
+++ b/docs/de/programmers/plugins/plugins-prefilters-postfilters.xml
@@ -0,0 +1,97 @@
+
+
+
+ 'pre'/'post'-Filter
+
+ 'pre'-Filter und 'post'-Filter folgen demselben Konzept. Der
+ einzige Unterschied ist der Zeitpunkt der Ausführung.
+
+
+
+ string smarty_prefilter_name
+ string $source
+ object &$smarty
+
+
+
+ 'pre'-Filter werden verwendet, um die Quellen eines Templates direkt
+ vor der Kompilierung zu verarbeiten. Als erster Parameter wird die
+ Template-Quelle, die möglicherweise bereits durch eine weiteren 'pre'-Filter
+ bearbeitet wurden, übergeben. Das Plugin muss den resultierenden Wert
+ zurückgeben. Achtung: Diese Werte werden nicht gespeichert und nur
+ zum Kompilier-Zeitpunkt verwendet.
+
+
+
+ string smarty_postfilter_name
+ string $compiled
+ object &$smarty
+
+
+
+ 'post'-Filter werden auf die kompilierte Ausgabe direkt vor dem Speichern
+ angewendet. Als erster Parameter wird der kompilierte Template-Code
+ übergeben, der möglicherweise zuvor von anderen 'post'-Filtern
+ bearbeitet wurde. Das Plugin muss den veränderten Template-Code zurückgeben.
+
+
+ 'pre'-Filter Plugin
+
+ <?php
+ /*
+ * Smarty plugin
+ * -------------------------------------------------------------
+ * File: prefilter.pre01.php
+ * Type: prefilter
+ * Name: pre01
+ * Purpose: Convert html tags to be lowercase.
+ * -------------------------------------------------------------
+ */
+ function smarty_prefilter_pre01($source, &$smarty)
+ {
+ return preg_replace('!<(\w+)[^>]+>!e', 'strtolower("$1")', $source);
+ }
+ ?>
+
+
+
+ 'post'-Filter Plugin
+
+ <?php
+ /*
+ * Smarty plugin
+ * -------------------------------------------------------------
+ * File: postfilter.post01.php
+ * Type: postfilter
+ * Name: post01
+ * Purpose: Output code that lists all current template vars.
+ * -------------------------------------------------------------
+ */
+ function smarty_postfilter_post01($compiled, &$smarty)
+ {
+ $compiled = "<pre>\n<?php print_r(\$this->get_template_vars()); ?>\n</pre>" . $compiled;
+ return $compiled;
+ }
+ ?>
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/plugins/plugins-resources.xml b/docs/de/programmers/plugins/plugins-resources.xml
new file mode 100644
index 00000000..1a33c870
--- /dev/null
+++ b/docs/de/programmers/plugins/plugins-resources.xml
@@ -0,0 +1,154 @@
+
+
+ Ressourcen
+
+ Ressourcen-Plugins stellen einen generischen Weg dar, um Smarty mit
+ Template-Quellen oder PHP-Skripten zu versorgen. Einige Beispiele von Ressourcen:
+ Datenbanken, LDAP, shared Memory, Sockets, usw.
+
+
+
+ Für jeden Ressource-Typ müssen 4 Funktionen registriert werden. Jede dieser
+ Funktionen erhält die verlangte Ressource als ersten Parameter und das Smarty Objekt
+ als letzten. Die restlichen Parameter hängen von der Funktion ab.
+
+
+
+
+ bool smarty_resource_name_source
+ string $rsrc_name
+ string &$source
+ object &$smarty
+
+
+ bool smarty_resource_name_timestamp
+ string $rsrc_name
+ int &$timestamp
+ object &$smarty
+
+
+ bool smarty_resource_name_secure
+ string $rsrc_name
+ object &$smarty
+
+
+ bool smarty_resource_name_trusted
+ string $rsrc_name
+ object &$smarty
+
+
+
+
+ Die erste Funktion wird verwendet, um die Ressource zu laden. Der
+ zweite Parameter ist eine Variable, die via Referenz übergeben
+ wird und in der das Resultat gespeichert werden soll. Die Funktion
+ gibt true zurück, wenn der Ladevorgang erfolgreich war -
+ andernfalls false.
+
+
+
+ Die zweite Funktion fragt das letzte Änderungsdatum der angeforderten
+ Ressource (als Unix-Timestamp) ab. Der zweite Parameter ist die Variable,
+ welche via Referenz übergeben wird und in der das Resultat gespeichert werden soll.
+ Gibt true zurück, wenn das Änderungsdatum ermittelt
+ werden konnte und false wenn nicht.
+
+
+
+ Die dritte Funktion gibt true oder false
+ zurück, je nachdem ob die angeforderte Ressource als sicher bezeichnet wird
+ oder nicht. Diese Funktion wird nur für Template-Ressourcen verwendet,
+ sollte aber in jedem Fall definiert werden.
+
+
+
+ Die vierte Funktion gibt true oder false
+ zurück, je nachdem ob die angeforderte Ressource als vertrauenswürdig angesehen wird
+ oder nicht. Diese Funktion wird nur verwendet, wenn PHP-Skripte via include_php
+ oder insert eingebunden werden sollen und ein 'src' Attribut übergeben wurde.
+ Die Funktion sollte aber in jedem Fall definiert werden.
+
+
+ Sehen Sie dazu:
+ register_resource(),
+ unregister_resource().
+
+
+ Ressourcen Plugin
+
+ <?php
+ /*
+ * Smarty plugin
+ * -------------------------------------------------------------
+ * File: resource.db.php
+ * Type: resource
+ * Name: db
+ * Purpose: Fetches templates from a database
+ * -------------------------------------------------------------
+ */
+ function smarty_resource_db_source($tpl_name, &$tpl_source, &$smarty)
+ {
+ // Datenbankabfragen machen, um '$tpl_source' das template zuzuweisen
+ $sql = new SQL;
+ $sql->query("select tpl_source
+ from my_table
+ where tpl_name='$tpl_name'");
+ if ($sql->num_rows) {
+ $tpl_source = $sql->record['tpl_source'];
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ function smarty_resource_db_timestamp($tpl_name, &$tpl_timestamp, &$smarty)
+ {
+
+ // Datenbankabfragen durchführen um '$tpl_timestamp' zuzuweisen
+ $sql = new SQL;
+ $sql->query("select tpl_timestamp
+ from my_table
+ where tpl_name='$tpl_name'");
+ if ($sql->num_rows) {
+ $tpl_timestamp = $sql->record['tpl_timestamp'];
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ function smarty_resource_db_secure($tpl_name, &$smarty)
+ {
+
+ // angenommen alle Templates seien sicher...
+ return true;
+ }
+
+ function smarty_resource_db_trusted($tpl_name, &$smarty)
+ {
+
+ // wird für Templates nicht verwendet
+ }
+ ?>
+
+
+
\ No newline at end of file
diff --git a/docs/de/programmers/plugins/plugins-writing.xml b/docs/de/programmers/plugins/plugins-writing.xml
new file mode 100644
index 00000000..46ba88db
--- /dev/null
+++ b/docs/de/programmers/plugins/plugins-writing.xml
@@ -0,0 +1,47 @@
+
+
+
+ Plugins schreiben
+
+ Plugins können von Smarty automatisch geladen oder
+ zur Laufzeit dynamisch mit den register_* API-Funktionen
+ registriert werden. Um registrierte Plugins wieder zu entfernen,
+ können die unregister_* API-Funktionen verwendet werden.
+
+
+ Bei Plugins, die zur Laufzeit geladen werden, müssen keine Namenskonventionen
+ beachtet werden.
+
+
+ Wenn ein Plugin auf die Funktionalität eines anderen Plugins angewiesen
+ ist (wie dies bei manchen Smarty Standard-Plugins der Fall ist), sollte
+ folgender Weg gewählt werden, um das benötigte Plugin zu laden:
+
+
+ require_once $smarty->_get_plugin_filepath('function', 'html_options');
+
+ Das Smarty Objekt wird jedem Plugin immer als letzter Parameter
+ übergeben (ausser bei Variablen-Modifikatoren und bei Blücken wird
+ &$repeat nach dem Smarty Objekt übergeben um Rückwärtskompatibel zu bleiben).
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/advanced-features.xml b/docs/en/programmers/advanced-features.xml
index 541dcd5e..28cec01a 100644
--- a/docs/en/programmers/advanced-features.xml
+++ b/docs/en/programmers/advanced-features.xml
@@ -2,560 +2,16 @@
Advanced Features
-
- Objects
-
- Smarty allows access to PHP objects through the templates. There are
- two ways to access them. One way is to register objects to the template,
- then use access them via syntax similar to custom functions. The other way
- is to assign objects to the templates and access them much like any other
- assigned variable. The first method has a much nicer template syntax. It
- is also more secure, as a registered object can be restricted to certain
- methods or properties. However, a registered object cannot be looped over
- or assigned in arrays of objects, etc. The method you choose will be
- determined by your needs, but use the first method whenever possible to
- keep template syntax to a minimum.
-
-
- If security is enabled, no private methods or functions can be accessed
- (begininning with "_"). If a method and property of the same name exist,
- the method will be used.
-
-
- You can restrict the methods and properties that can be accessed by
- listing them in an array as the third registration parameter.
-
-
- By default, parameters passed to objects through the templates are passed
- the same way custom functions get them. An associative array is passed
- as the first parameter, and the smarty object as the second. If you want
- the parameters passed one at a time for each argument like traditional
- object parameter passing, set the fourth registration parameter to false.
-
-
- The optional fifth parameter has only effect with
- format being true
- and contains a list ob methods that should be treated as
- blocks. That means these methods have a closing tag in the
- template
- ({foobar->meth2}...{/foobar->meth2}) and
- the parameters to the methods have the same synopsis as the
- parameters for block-function-plugins: They get 4 parameters
- $params,
- $content,
- &$smarty and
- &$repeat and they also behave like
- block-function-plugins.
-
-
- using a registered or assigned object
-
-register_object("foobar",$myobj);
-// if we want to restrict access to certain methods or properties, list them
-$smarty->register_object("foobar",$myobj,array('meth1','meth2','prop1'));
-// if you want to use the traditional object parameter format, pass a boolean of false
-$smarty->register_object("foobar",$myobj,null,false);
+&programmers.advanced-features.advanced-features-outputfilters;
-// We can also assign objects. Assign by ref when possible.
-$smarty->assign_by_ref("myobj", $myobj);
+&programmers.advanced-features.section-template-cache-handler-func;
-$smarty->display("index.tpl");
-?>
-
-TEMPLATE:
-
-{* access our registered object *}
-{foobar->meth1 p1="foo" p2=$bar}
-
-{* you can also assign the output *}
-{foobar->meth1 p1="foo" p2=$bar assign="output"}
-the output was {$output}
-
-{* access our assigned object *}
-{$myobj->meth1("foo",$bar)}
-]]>
-
-
-
-
- Prefilters
-
- Template prefilters are PHP functions that your templates are ran through
- before they are compiled. This is good for preprocessing your templates
- to remove unwanted comments, keeping an eye on what people are putting
- in their templates, etc. Prefilters can be either
- registered or loaded from
- the plugins directory by using
- load_filter() function or by
- setting
- $autoload_filters variable.
- Smarty will pass the template source code as the first argument, and
- expect the function to return the resulting template source code.
-
-
- using a template prefilter
-
-/U","",$tpl_source);
-}
-
-// register the prefilter
-$smarty->register_prefilter("remove_dw_comments");
-$smarty->display("index.tpl");
-?>
-
-{* Smarty template index.tpl *}
-
-]]>
-
-
-
-
-
- Postfilters
-
- Template postfilters are PHP functions that your templates are ran through
- after they are compiled. Postfilters can be either
- registered or loaded
- from the plugins directory by using
- load_filter() function or by
- setting
- $autoload_filters
- variable. Smarty will pass the compiled template code as the first
- argument, and expect the function to return the result of the
- processing.
-
-
- using a template postfilter
-
-;\n\" ?>;\n".$tpl_source;
-}
-
-// register the postfilter
-$smarty->register_postfilter("add_header_comment");
-$smarty->display("index.tpl");
-?>
-
-{* compiled Smarty template index.tpl *}
-
-{* rest of template content... *}
-]]>
-
-
-
-
-
- Output Filters
-
- When the template is invoked via display() or fetch(), its output can be
- sent through one or more output filters. This differs from postfilters
- because postfilters operate on compiled templates before they are saved to
- the disk, and output filters operate on the template output when it is
- executed.
-
-
-
- Output filters can be either
- registered or loaded
- from the plugins directory by using
- load_filter() function or by
- setting
- $autoload_filters
- variable. Smarty will pass the template output as the first argument,
- and expect the function to return the result of the processing.
-
-
- using a template outputfilter
-
-register_outputfilter("protect_email");
-$smarty->display("index.tpl");
-
-// now any occurrence of an email address in the template output will have
-// a simple protection against spambots
-?>
-]]>
-
-
-
-
-
- Cache Handler Function
-
- As an alternative to using the default file-based caching mechanism, you
- can specify a custom cache handling function that will be used to read,
- write and clear cached files.
-
-
- Create a function in your application that Smarty will use as a
- cache handler. Set the name of it in the
- $cache_handler_func
- class variable. Smarty will now use this to handle cached data. The
- first argument is the action, which will be one of 'read', 'write' and
- 'clear'. The second parameter is the Smarty object. The third parameter
- is the cached content. Upon a write, Smarty passes the cached content
- in these parameters. Upon a 'read', Smarty expects your function to
- accept this parameter by reference and populate it with the cached
- data. Upon a 'clear', pass a dummy variable here since it is not used.
- The fourth parameter is the name of the template file (needed for
- read/write), the fifth parameter is the cache_id (optional), and the
- sixth is the compile_id (optional).
-
-
- Note: The last parameter ($exp_time) was added in Smarty-2.6.0.
-
-
- example using MySQL as a cache source
-
-cache_handler_func = 'mysql_cache_handler';
-
-$smarty->display('index.tpl');
-
-
-mysql database is expected in this format:
-
-create database SMARTY_CACHE;
-
-create table CACHE_PAGES(
-CacheID char(32) PRIMARY KEY,
-CacheContents MEDIUMTEXT NOT NULL
-);
-
-*/
-
-function mysql_cache_handler($action, &$smarty_obj, &$cache_content, $tpl_file=null, $cache_id=null, $compile_id=null, $exp_time=null)
-{
- // set db host, user and pass here
- $db_host = 'localhost';
- $db_user = 'myuser';
- $db_pass = 'mypass';
- $db_name = 'SMARTY_CACHE';
- $use_gzip = false;
-
- // create unique cache id
- $CacheID = md5($tpl_file.$cache_id.$compile_id);
-
- if(! $link = mysql_pconnect($db_host, $db_user, $db_pass)) {
- $smarty_obj->_trigger_error_msg("cache_handler: could not connect to database");
- return false;
- }
- mysql_select_db($db_name);
-
- switch ($action) {
- case 'read':
- // save cache to database
- $results = mysql_query("select CacheContents from CACHE_PAGES where CacheID='$CacheID'");
- if(!$results) {
- $smarty_obj->_trigger_error_msg("cache_handler: query failed.");
- }
- $row = mysql_fetch_array($results,MYSQL_ASSOC);
-
- if($use_gzip && function_exists("gzuncompress")) {
- $cache_contents = gzuncompress($row["CacheContents"]);
- } else {
- $cache_contents = $row["CacheContents"];
- }
- $return = $results;
- break;
- case 'write':
- // save cache to database
-
- if($use_gzip && function_exists("gzcompress")) {
- // compress the contents for storage efficiency
- $contents = gzcompress($cache_content);
- } else {
- $contents = $cache_content;
- }
- $results = mysql_query("replace into CACHE_PAGES values(
- '$CacheID',
- '".addslashes($contents)."')
- ");
- if(!$results) {
- $smarty_obj->_trigger_error_msg("cache_handler: query failed.");
- }
- $return = $results;
- break;
- case 'clear':
- // clear cache info
- if(empty($cache_id) && empty($compile_id) && empty($tpl_file)) {
- // clear them all
- $results = mysql_query("delete from CACHE_PAGES");
- } else {
- $results = mysql_query("delete from CACHE_PAGES where CacheID='$CacheID'");
- }
- if(!$results) {
- $smarty_obj->_trigger_error_msg("cache_handler: query failed.");
- }
- $return = $results;
- break;
- default:
- // error, unknown action
- $smarty_obj->_trigger_error_msg("cache_handler: unknown action \"$action\"");
- $return = false;
- break;
- }
- mysql_close($link);
- return $return;
-
-}
-
-?>
-]]>
-
-
-
-
-
- Resources
-
- The templates may come from a variety of sources. When you display or fetch
- a template, or when you include a template from within another template,
- you supply a resource type, followed by the appropriate path and template
- name. If a resource is not explicitly given the value of $default_resource_type is
- assumed.
-
-
- Templates from $template_dir
-
- Templates from the $template_dir do not require a template
- resource, although you can use the file: resource for consistancy.
- Just supply the path to the template you want to use relative to
- the $template_dir root directory.
-
-
- using templates from $template_dir
-
-display("index.tpl");
-$smarty->display("admin/menu.tpl");
-$smarty->display("file:admin/menu.tpl"); // same as one above
-?>
-
-{* from within Smarty template *}
-{include file="index.tpl"}
-{include file="file:index.tpl"} {* same as one above *}
-]]>
-
-
-
-
- Templates from any directory
-
- Templates outside of the $template_dir require the file: template
- resource type, followed by the absolute path and name of the
- template.
-
-
- using templates from any directory
-
-display("file:/export/templates/index.tpl");
-$smarty->display("file:/path/to/my/templates/menu.tpl");
-?>
-
-{* from within Smarty template *}
-{include file="file:/usr/local/share/templates/navigation.tpl"}
-]]>
-
-
-
-
- Windows Filepaths
-
- If you are using a Windows machine, filepaths usually include a
- drive letter (C:) at the beginning of the pathname. Be sure to use
- "file:" in the path to avoid namespace conflicts and get the
- desired results.
-
-
- using templates from windows file paths
-
-display("file:C:/export/templates/index.tpl");
-$smarty->display("file:F:/path/to/my/templates/menu.tpl");
-?>
-
-{* from within Smarty template *}
-{include file="file:D:/usr/local/share/templates/navigation.tpl"}
-]]>
-
-
-
-
-
-
- Templates from other sources
-
- You can retrieve templates using whatever possible source you can
- access with PHP: databases, sockets, LDAP, and so on. You do this
- by writing resource plugin functions and registering them with
- Smarty.
-
-
-
- See resource plugins
- section for more information on the functions you are supposed
- to provide.
-
-
-
-
- Note that you cannot override the built-in
- file resource, but you can provide a resource
- that fetches templates from the file system in some other way by
- registering under another resource name.
-
-
-
- using custom resources
-
-query("select tpl_source
- from my_table
- where tpl_name='$tpl_name'");
- if ($sql->num_rows) {
- $tpl_source = $sql->record['tpl_source'];
- return true;
- } else {
- return false;
- }
-}
-
-function db_get_timestamp($tpl_name, &$tpl_timestamp, &$smarty_obj)
-{
- // do database call here to populate $tpl_timestamp.
- $sql = new SQL;
- $sql->query("select tpl_timestamp
- from my_table
- where tpl_name='$tpl_name'");
- if ($sql->num_rows) {
- $tpl_timestamp = $sql->record['tpl_timestamp'];
- return true;
- } else {
- return false;
- }
-}
-
-function db_get_secure($tpl_name, &$smarty_obj)
-{
- // assume all templates are secure
- return true;
-}
-
-function db_get_trusted($tpl_name, &$smarty_obj)
-{
- // not used for templates
-}
-
-// register the resource name "db"
-$smarty->register_resource("db", array("db_get_template",
- "db_get_timestamp",
- "db_get_secure",
- "db_get_trusted"));
-
-// using resource from php script
-$smarty->display("db:index.tpl");
-?>
-
-{* using resource from within Smarty template *}
-{include file="db:/extras/navigation.tpl"}
-]]>
-
-
-
-
-
- Default template handler function
-
- You can specify a function that is used to retrieve template
- contents in the event the template cannot be retrieved from its
- resource. One use of this is to create templates that do not exist
- on-the-fly.
-
-
- using the default template handler function
-
-_write_file($resource_name,$template_source);
- return true;
- }
- } else {
- // not a file
- return false;
- }
-}
-
-// set the default handler
-$smarty->default_template_handler_func = 'make_template';
-?>
-]]>
-
-
-
-
+&programmers.advanced-features.template-resources;
+
+ Objects
+
+ Smarty allows access to PHP objects through the templates. There are
+ two ways to access them. One way is to register objects to the template,
+ then use access them via syntax similar to custom functions. The other way
+ is to assign objects to the templates and access them much like any other
+ assigned variable. The first method has a much nicer template syntax. It
+ is also more secure, as a registered object can be restricted to certain
+ methods or properties. However, a registered object cannot be looped over
+ or assigned in arrays of objects, etc. The method you choose will be
+ determined by your needs, but use the first method whenever possible to
+ keep template syntax to a minimum.
+
+
+ If security is enabled, no private methods or functions can be accessed
+ (begininning with "_"). If a method and property of the same name exist,
+ the method will be used.
+
+
+ You can restrict the methods and properties that can be accessed by
+ listing them in an array as the third registration parameter.
+
+
+ By default, parameters passed to objects through the templates are passed
+ the same way custom functions get them. An associative array is passed
+ as the first parameter, and the smarty object as the second. If you want
+ the parameters passed one at a time for each argument like traditional
+ object parameter passing, set the fourth registration parameter to false.
+
+
+ The optional fifth parameter has only effect with
+ format being true
+ and contains a list ob methods that should be treated as
+ blocks. That means these methods have a closing tag in the
+ template
+ ({foobar->meth2}...{/foobar->meth2}) and
+ the parameters to the methods have the same synopsis as the
+ parameters for block-function-plugins: They get 4 parameters
+ $params,
+ $content,
+ &$smarty and
+ &$repeat and they also behave like
+ block-function-plugins.
+
+
+ using a registered or assigned object
+
+register_object("foobar",$myobj);
+// if we want to restrict access to certain methods or properties, list them
+$smarty->register_object("foobar",$myobj,array('meth1','meth2','prop1'));
+// if you want to use the traditional object parameter format, pass a boolean of false
+$smarty->register_object("foobar",$myobj,null,false);
+
+// We can also assign objects. Assign by ref when possible.
+$smarty->assign_by_ref("myobj", $myobj);
+
+$smarty->display("index.tpl");
+?>
+
+TEMPLATE:
+
+{* access our registered object *}
+{foobar->meth1 p1="foo" p2=$bar}
+
+{* you can also assign the output *}
+{foobar->meth1 p1="foo" p2=$bar assign="output"}
+the output was {$output}
+
+{* access our assigned object *}
+{$myobj->meth1("foo",$bar)}
+]]>
+
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/advanced-features/advanced-features-outputfilters.xml b/docs/en/programmers/advanced-features/advanced-features-outputfilters.xml
new file mode 100644
index 00000000..6f77c7e9
--- /dev/null
+++ b/docs/en/programmers/advanced-features/advanced-features-outputfilters.xml
@@ -0,0 +1,67 @@
+
+
+
+ Output Filters
+
+ When the template is invoked via display() or fetch(), its output can be
+ sent through one or more output filters. This differs from postfilters
+ because postfilters operate on compiled templates before they are saved to
+ the disk, and output filters operate on the template output when it is
+ executed.
+
+
+
+ Output filters can be either
+ registered or loaded
+ from the plugins directory by using
+ load_filter() function or by
+ setting
+ $autoload_filters
+ variable. Smarty will pass the template output as the first argument,
+ and expect the function to return the result of the processing.
+
+
+ using a template outputfilter
+
+register_outputfilter("protect_email");
+$smarty->display("index.tpl");
+
+// now any occurrence of an email address in the template output will have
+// a simple protection against spambots
+?>
+]]>
+
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/advanced-features/advanced-features-postfilters.xml b/docs/en/programmers/advanced-features/advanced-features-postfilters.xml
new file mode 100644
index 00000000..606b0656
--- /dev/null
+++ b/docs/en/programmers/advanced-features/advanced-features-postfilters.xml
@@ -0,0 +1,59 @@
+
+
+
+ Postfilters
+
+ Template postfilters are PHP functions that your templates are ran through
+ after they are compiled. Postfilters can be either
+ registered or loaded
+ from the plugins directory by using
+ load_filter() function or by
+ setting
+ $autoload_filters
+ variable. Smarty will pass the compiled template code as the first
+ argument, and expect the function to return the result of the
+ processing.
+
+
+ using a template postfilter
+
+;\n\" ?>;\n".$tpl_source;
+}
+
+// register the postfilter
+$smarty->register_postfilter("add_header_comment");
+$smarty->display("index.tpl");
+?>
+
+{* compiled Smarty template index.tpl *}
+
+{* rest of template content... *}
+]]>
+
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/advanced-features/advanced-features-prefilters.xml b/docs/en/programmers/advanced-features/advanced-features-prefilters.xml
new file mode 100644
index 00000000..c006ef2b
--- /dev/null
+++ b/docs/en/programmers/advanced-features/advanced-features-prefilters.xml
@@ -0,0 +1,59 @@
+
+
+
+ Prefilters
+
+ Template prefilters are PHP functions that your templates are ran through
+ before they are compiled. This is good for preprocessing your templates
+ to remove unwanted comments, keeping an eye on what people are putting
+ in their templates, etc. Prefilters can be either
+ registered or loaded from
+ the plugins directory by using
+ load_filter() function or by
+ setting
+ $autoload_filters variable.
+ Smarty will pass the template source code as the first argument, and
+ expect the function to return the resulting template source code.
+
+
+ using a template prefilter
+
+/U","",$tpl_source);
+}
+
+// register the prefilter
+$smarty->register_prefilter("remove_dw_comments");
+$smarty->display("index.tpl");
+?>
+
+{* Smarty template index.tpl *}
+
+]]>
+
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/advanced-features/section-template-cache-handler-func.xml b/docs/en/programmers/advanced-features/section-template-cache-handler-func.xml
new file mode 100644
index 00000000..a664da3e
--- /dev/null
+++ b/docs/en/programmers/advanced-features/section-template-cache-handler-func.xml
@@ -0,0 +1,157 @@
+
+
+
+ Cache Handler Function
+
+ As an alternative to using the default file-based caching mechanism, you
+ can specify a custom cache handling function that will be used to read,
+ write and clear cached files.
+
+
+ Create a function in your application that Smarty will use as a
+ cache handler. Set the name of it in the
+ $cache_handler_func
+ class variable. Smarty will now use this to handle cached data. The
+ first argument is the action, which will be one of 'read', 'write' and
+ 'clear'. The second parameter is the Smarty object. The third parameter
+ is the cached content. Upon a write, Smarty passes the cached content
+ in these parameters. Upon a 'read', Smarty expects your function to
+ accept this parameter by reference and populate it with the cached
+ data. Upon a 'clear', pass a dummy variable here since it is not used.
+ The fourth parameter is the name of the template file (needed for
+ read/write), the fifth parameter is the cache_id (optional), and the
+ sixth is the compile_id (optional).
+
+
+ Note: The last parameter ($exp_time) was added in Smarty-2.6.0.
+
+
+ example using MySQL as a cache source
+
+cache_handler_func = 'mysql_cache_handler';
+
+$smarty->display('index.tpl');
+
+
+mysql database is expected in this format:
+
+create database SMARTY_CACHE;
+
+create table CACHE_PAGES(
+CacheID char(32) PRIMARY KEY,
+CacheContents MEDIUMTEXT NOT NULL
+);
+
+*/
+
+function mysql_cache_handler($action, &$smarty_obj, &$cache_content, $tpl_file=null, $cache_id=null, $compile_id=null, $exp_time=null)
+{
+ // set db host, user and pass here
+ $db_host = 'localhost';
+ $db_user = 'myuser';
+ $db_pass = 'mypass';
+ $db_name = 'SMARTY_CACHE';
+ $use_gzip = false;
+
+ // create unique cache id
+ $CacheID = md5($tpl_file.$cache_id.$compile_id);
+
+ if(! $link = mysql_pconnect($db_host, $db_user, $db_pass)) {
+ $smarty_obj->_trigger_error_msg("cache_handler: could not connect to database");
+ return false;
+ }
+ mysql_select_db($db_name);
+
+ switch ($action) {
+ case 'read':
+ // save cache to database
+ $results = mysql_query("select CacheContents from CACHE_PAGES where CacheID='$CacheID'");
+ if(!$results) {
+ $smarty_obj->_trigger_error_msg("cache_handler: query failed.");
+ }
+ $row = mysql_fetch_array($results,MYSQL_ASSOC);
+
+ if($use_gzip && function_exists("gzuncompress")) {
+ $cache_contents = gzuncompress($row["CacheContents"]);
+ } else {
+ $cache_contents = $row["CacheContents"];
+ }
+ $return = $results;
+ break;
+ case 'write':
+ // save cache to database
+
+ if($use_gzip && function_exists("gzcompress")) {
+ // compress the contents for storage efficiency
+ $contents = gzcompress($cache_content);
+ } else {
+ $contents = $cache_content;
+ }
+ $results = mysql_query("replace into CACHE_PAGES values(
+ '$CacheID',
+ '".addslashes($contents)."')
+ ");
+ if(!$results) {
+ $smarty_obj->_trigger_error_msg("cache_handler: query failed.");
+ }
+ $return = $results;
+ break;
+ case 'clear':
+ // clear cache info
+ if(empty($cache_id) && empty($compile_id) && empty($tpl_file)) {
+ // clear them all
+ $results = mysql_query("delete from CACHE_PAGES");
+ } else {
+ $results = mysql_query("delete from CACHE_PAGES where CacheID='$CacheID'");
+ }
+ if(!$results) {
+ $smarty_obj->_trigger_error_msg("cache_handler: query failed.");
+ }
+ $return = $results;
+ break;
+ default:
+ // error, unknown action
+ $smarty_obj->_trigger_error_msg("cache_handler: unknown action \"$action\"");
+ $return = false;
+ break;
+ }
+ mysql_close($link);
+ return $return;
+
+}
+
+?>
+]]>
+
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/advanced-features/template-resources.xml b/docs/en/programmers/advanced-features/template-resources.xml
new file mode 100644
index 00000000..2d9bee6c
--- /dev/null
+++ b/docs/en/programmers/advanced-features/template-resources.xml
@@ -0,0 +1,231 @@
+
+
+
+ Resources
+
+ The templates may come from a variety of sources. When you display or fetch
+ a template, or when you include a template from within another template,
+ you supply a resource type, followed by the appropriate path and template
+ name. If a resource is not explicitly given the value of $default_resource_type is
+ assumed.
+
+
+ Templates from $template_dir
+
+ Templates from the $template_dir do not require a template
+ resource, although you can use the file: resource for consistancy.
+ Just supply the path to the template you want to use relative to
+ the $template_dir root directory.
+
+
+ using templates from $template_dir
+
+display("index.tpl");
+$smarty->display("admin/menu.tpl");
+$smarty->display("file:admin/menu.tpl"); // same as one above
+?>
+
+{* from within Smarty template *}
+{include file="index.tpl"}
+{include file="file:index.tpl"} {* same as one above *}
+]]>
+
+
+
+
+ Templates from any directory
+
+ Templates outside of the $template_dir require the file: template
+ resource type, followed by the absolute path and name of the
+ template.
+
+
+ using templates from any directory
+
+display("file:/export/templates/index.tpl");
+$smarty->display("file:/path/to/my/templates/menu.tpl");
+?>
+
+{* from within Smarty template *}
+{include file="file:/usr/local/share/templates/navigation.tpl"}
+]]>
+
+
+
+
+ Windows Filepaths
+
+ If you are using a Windows machine, filepaths usually include a
+ drive letter (C:) at the beginning of the pathname. Be sure to use
+ "file:" in the path to avoid namespace conflicts and get the
+ desired results.
+
+
+ using templates from windows file paths
+
+display("file:C:/export/templates/index.tpl");
+$smarty->display("file:F:/path/to/my/templates/menu.tpl");
+?>
+
+{* from within Smarty template *}
+{include file="file:D:/usr/local/share/templates/navigation.tpl"}
+]]>
+
+
+
+
+
+
+ Templates from other sources
+
+ You can retrieve templates using whatever possible source you can
+ access with PHP: databases, sockets, LDAP, and so on. You do this
+ by writing resource plugin functions and registering them with
+ Smarty.
+
+
+
+ See resource plugins
+ section for more information on the functions you are supposed
+ to provide.
+
+
+
+
+ Note that you cannot override the built-in
+ file resource, but you can provide a resource
+ that fetches templates from the file system in some other way by
+ registering under another resource name.
+
+
+
+ using custom resources
+
+query("select tpl_source
+ from my_table
+ where tpl_name='$tpl_name'");
+ if ($sql->num_rows) {
+ $tpl_source = $sql->record['tpl_source'];
+ return true;
+ } else {
+ return false;
+ }
+}
+
+function db_get_timestamp($tpl_name, &$tpl_timestamp, &$smarty_obj)
+{
+ // do database call here to populate $tpl_timestamp.
+ $sql = new SQL;
+ $sql->query("select tpl_timestamp
+ from my_table
+ where tpl_name='$tpl_name'");
+ if ($sql->num_rows) {
+ $tpl_timestamp = $sql->record['tpl_timestamp'];
+ return true;
+ } else {
+ return false;
+ }
+}
+
+function db_get_secure($tpl_name, &$smarty_obj)
+{
+ // assume all templates are secure
+ return true;
+}
+
+function db_get_trusted($tpl_name, &$smarty_obj)
+{
+ // not used for templates
+}
+
+// register the resource name "db"
+$smarty->register_resource("db", array("db_get_template",
+ "db_get_timestamp",
+ "db_get_secure",
+ "db_get_trusted"));
+
+// using resource from php script
+$smarty->display("db:index.tpl");
+?>
+
+{* using resource from within Smarty template *}
+{include file="db:/extras/navigation.tpl"}
+]]>
+
+
+
+
+
+ Default template handler function
+
+ You can specify a function that is used to retrieve template
+ contents in the event the template cannot be retrieved from its
+ resource. One use of this is to create templates that do not exist
+ on-the-fly.
+
+
+ using the default template handler function
+
+_write_file($resource_name,$template_source);
+ return true;
+ }
+ } else {
+ // not a file
+ return false;
+ }
+}
+
+// set the default handler
+$smarty->default_template_handler_func = 'make_template';
+?>
+]]>
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-functions.xml b/docs/en/programmers/api-functions.xml
index 1f0fe5f2..6591f430 100644
--- a/docs/en/programmers/api-functions.xml
+++ b/docs/en/programmers/api-functions.xml
@@ -2,1212 +2,45 @@
Methods
-
- append
-
-
- void append
- mixed var
-
-
- void append
- string varname
- mixed var
-
-
- void append
- string varname
- mixed var
- boolean merge
-
-
-
- This is used to append an element to an assigned array. If you append
- to a string value, it is converted to an array value and then
- appended to. You can explicitly pass name/value pairs, or associative
- arrays containing the name/value pairs. If you pass the optional third
- parameter of true, the value will be merged with the current array
- instead of appended.
-
-
- Technical Note
-
- The merge parameter respects array keys, so if you merge two
- numerically indexed arrays, they may overwrite each other or result in
- non-sequential keys. This is unlike the array_merge() function of PHP
- which wipes out numerical keys and renumbers them.
-
-
-
- append
-
-append("Name","Fred");
-$smarty->append("Address",$address);
+&programmers.api-functions.api-append;
+&programmers.api-functions.api-append-by-ref;
+&programmers.api-functions.api-assign;
+&programmers.api-functions.api-assign-by-ref;
+&programmers.api-functions.api-clear-all-assign;
+&programmers.api-functions.api-clear-all-cache;
+&programmers.api-functions.api-clear-assign;
+&programmers.api-functions.api-clear-cache;
+&programmers.api-functions.api-clear-compiled-tpl;
+&programmers.api-functions.api-clear-config;
+&programmers.api-functions.api-config-load;
+&programmers.api-functions.api-display;
+&programmers.api-functions.api-fetch;
+&programmers.api-functions.api-get-config-vars;
+&programmers.api-functions.api-get-registered-object;
+&programmers.api-functions.api-get-template-vars;
+&programmers.api-functions.api-is-cached;
+&programmers.api-functions.api-load-filter;
+&programmers.api-functions.api-register-block;
+&programmers.api-functions.api-register-compiler-function;
+&programmers.api-functions.api-register-function;
+&programmers.api-functions.api-register-modifier;
+&programmers.api-functions.api-register-object;
+&programmers.api-functions.api-register-outputfilter;
+&programmers.api-functions.api-register-postfilter;
+&programmers.api-functions.api-register-prefilter;
+&programmers.api-functions.api-register-resource;
+&programmers.api-functions.api-trigger-error;
-// passing an associative array
-$smarty->append(array("city" => "Lincoln","state" => "Nebraska"));
-?>
-]]>
-
-
-
-
- append_by_ref
-
-
- void append_by_ref
- string varname
- mixed var
-
-
- void append_by_ref
- string varname
- mixed var
- boolean merge
-
-
-
- This is used to append values to the templates by reference.
- If you append a variable by reference then change its
- value, the appended value sees the change as well. For objects,
- append_by_ref() also avoids an in-memory copy of the appended object.
- See the PHP manual on variable referencing for an in-depth
- explanation. If you pass the optional third parameter of true,
- the value will be merged with the current array instead of appended.
-
-
- Technical Note
-
- The merge parameter respects array keys, so if you merge two
- numerically indexed arrays, they may overwrite each other or result in
- non-sequential keys. This is unlike the array_merge() function of PHP
- which wipes out numerical keys and renumbers them.
-
-
-
- append_by_ref
-
-append_by_ref("Name", $myname);
-$smarty->append_by_ref("Address", $address);
-?>
-]]>
-
-
-
-
- assign
-
-
- void assign
- mixed var
-
-
- void assign
- string varname
- mixed var
-
-
-
- This is used to assign values to the templates. You can
- explicitly pass name/value pairs, or associative arrays
- containing the name/value pairs.
-
-
- assign
-
-assign('Name', 'Fred');
-$smarty->assign('Address', $address);
-
-// passing an associative array
-$smarty->assign(array("city" => "Lincoln", "state" => "Nebraska"));
-?>
-]]>
-
-
-
-
- assign_by_ref
-
-
- void assign_by_ref
- string varname
- mixed var
-
-
-
- This is used to assign values to the templates by reference instead of
- making a copy. See the PHP manual on variable referencing for an explanation.
-
-
- Technical Note
-
- This is used to assign values to the templates by reference.
- If you assign a variable by reference then change its
- value, the assigned value sees the change as well. For objects,
- assign_by_ref() also avoids an in-memory copy of the assigned object.
- See the PHP manual on variable referencing for an in-depth
- explanation.
-
-
-
- assign_by_ref
-
-assign_by_ref('Name', $myname);
-$smarty->assign_by_ref('Address', $address);
-?>
-]]>
-
-
-
-
- clear_all_assign
-
-
- void clear_all_assign
-
-
-
-
- This clears the values of all assigned variables.
-
-
-clear_all_assign
-
-clear_all_assign();
-?>
-]]>
-
-
-
-
- clear_all_cache
-
-
- void clear_all_cache
- int expire time
-
-
-
- This clears the entire template cache. As an optional
- parameter, you can supply a minimum age in seconds the cache
- files must be before they will get cleared.
-
-
-clear_all_cache
-
-clear_all_cache();
-?>
-]]>
-
-
-
-
- clear_assign
-
-
- void clear_assign
- string var
-
-
-
- This clears the value of an assigned variable. This
- can be a single value, or an array of values.
-
-
-clear_assign
-
-clear_assign("Name");
-
-// clear multiple variables
-$smarty->clear_assign(array("Name","Address","Zip"));
-?>
-]]>
-
-
-
-
- clear_cache
-
- voidclear_cache
- stringtemplate
- stringcache id
- stringcompile id
- intexpire time
-
-
- This clears the cache for a specific template. If you have
- multiple caches for this template, you can clear a specific
- cache by supplying the cache id as the second parameter. You
- can also pass a compile id as a third parameter. You can "group"
- templates together so they can be removed as a group. See the
- caching section for more
- information. As an optional fourth parameter, you can supply a
- minimum age in seconds the cache file must be before it will
- get cleared.
-
-
-clear_cache
-
-clear_cache("index.tpl");
-
-// clear the cache for a particular cache id in an multiple-cache template
-$smarty->clear_cache("index.tpl","CACHEID");
-?>
-]]>
-
-
-
-
- clear_compiled_tpl
-
- voidclear_compiled_tpl
- stringtpl_file
- stringcompile_id
- intexp_time
-
-
- This clears the compiled version of the specified template
- resource, or all compiled template files if one is not specified.
- if you pass a compile_id only the compiled template for this
- specific compile_id is cleared. if you pass an exp_time, then only
- compiled templates older than exp_time seconds are cleared, by
- default all compiled templates are cleared regardless of their age.
- This function is for advanced use only, not normally needed.
-
-
-clear_compiled_tpl
-
-clear_compiled_tpl("index.tpl");
-
-// clear entire compile directory
-$smarty->clear_compiled_tpl();
-?>
-]]>
-
-
-
-
- clear_config
-
- voidclear_config
- stringvar
-
-
- This clears all assigned config variables. If a variable name is
- supplied, only that variable is cleared.
-
-
-clear_config
-
-clear_config();
-
-// clear one variable
-$smarty->clear_config('foobar');
-?>
-]]>
-
-
-
-
- config_load
-
- voidconfig_load
- stringfile
- stringsection
-
-
- This loads config file data and assigns it to the template. This
- works identical to the template config_load
- function.
-
-
- Technical Note
-
- As of Smarty 2.4.0, assigned template variables are kept across
- invocations of fetch() and display(). Config vars loaded from
- config_load() are always global scope. Config files are also
- compiled for faster execution, and respect the force_compile and compile_check settings.
-
-
-
-config_load
-
-config_load('my.conf');
-
-// load a section
-$smarty->config_load('my.conf','foobar');
-?>
-]]>
-
-
-
-
- display
-
- voiddisplay
- stringtemplate
- stringcache_id
- stringcompile_id
-
-
- This displays the template. Supply a valid template resource
- type and path. As an optional second parameter, you can pass a
- cache id. See the caching
- section for more information.
-
-
- As an optional third parameter, you can pass a compile id. This
- is in the event that you want to compile different versions of
- the same template, such as having separate templates compiled
- for different languages. Another use for compile_id is when you
- use more than one $template_dir but only one $compile_dir. Set
- a separate compile_id for each $template_dir, otherwise
- templates of the same name will overwrite each other. You can
- also set the $compile_id variable once
- instead of passing this to each call to display().
-
-
-display
-
-caching = true;
-
-// only do db calls if cache doesn't exist
-if(!$smarty->is_cached("index.tpl"))
-{
-
- // dummy up some data
- $address = "245 N 50th";
- $db_data = array(
- "City" => "Lincoln",
- "State" => "Nebraska",
- "Zip" => "68502"
- );
-
- $smarty->assign("Name","Fred");
- $smarty->assign("Address",$address);
- $smarty->assign($db_data);
-
-}
-
-// display the output
-$smarty->display("index.tpl");
-?>
-]]>
-
-
-
- Use the syntax for template resources to
- display files outside of the $template_dir directory.
-
-
-function display template resource examples
-
-display("/usr/local/include/templates/header.tpl");
-
-// absolute filepath (same thing)
-$smarty->display("file:/usr/local/include/templates/header.tpl");
-
-// windows absolute filepath (MUST use "file:" prefix)
-$smarty->display("file:C:/www/pub/templates/header.tpl");
-
-// include from template resource named "db"
-$smarty->display("db:header.tpl");
-?>
-]]>
-
-
-
-
-
- fetch
-
- stringfetch
- stringtemplate
- stringcache_id
- stringcompile_id
-
-
- This returns the template output instead of displaying it.
- Supply a valid template resource
- type and path. As an optional second parameter, you can pass a
- cache id. See the caching
- section for more information.
-
-
- As an optional third parameter, you can pass a compile id. This
- is in the event that you want to compile different versions of
- the same template, such as having separate templates compiled
- for different languages. Another use for compile_id is when you
- use more than one $template_dir but only one $compile_dir. Set
- a separate compile_id for each $template_dir, otherwise
- templates of the same name will overwrite each other. You can
- also set the $compile_id variable once
- instead of passing this to each call to fetch().
-
-
-fetch
-
-caching = true;
-
-// only do db calls if cache doesn't exist
-if(!$smarty->is_cached("index.tpl"))
-{
-
- // dummy up some data
- $address = "245 N 50th";
- $db_data = array(
- "City" => "Lincoln",
- "State" => "Nebraska",
- "Zip" => "68502"
- );
-
- $smarty->assign("Name","Fred");
- $smarty->assign("Address",$address);
- $smarty->assign($db_data);
-
-}
-
-// capture the output
-$output = $smarty->fetch("index.tpl");
-
-// do something with $output here
-
-echo $output;
-?>
-]]>
-
-
-
-
- get_config_vars
-
- arrayget_config_vars
- stringvarname
-
-
- This returns the given loaded config variable value. If no parameter
- is given, an array of all loaded config variables is returned.
-
-
-get_config_vars
-
-get_config_vars('foo');
-
-// get all loaded config template vars
-$config_vars = $smarty->get_config_vars();
-
-// take a look at them
-print_r($config_vars);
-?>
-]]>
-
-
-
-
- get_registered_object
-
-
- array get_registered_object
- string object_name
-
-
-
- This returns a reference to a registered object. This is useful
- from within a custom function when you need direct access to a
- registered object.
-
-
-get_registered_object
-
-get_registered_object($params['object']);
- // use $obj_ref is now a reference to the object
- }
-}
-?>
-]]>
-
-
-
-
- get_template_vars
-
- arrayget_template_vars
- stringvarname
-
-
- This returns the given assigned variable value. If no parameter
- is given, an array of all assigned variables is returned.
-
-
-get_template_vars
-
-get_template_vars('foo');
-
-// get all assigned template vars
-$tpl_vars = $smarty->get_template_vars();
-
-// take a look at them
-print_r($tpl_vars);
-?>
-]]>
-
-
-
-
- is_cached
-
-
- boolean is_cached
- string template
- [string cache_id]
-
-
-
- This returns true if there is a valid cache for this template.
- This only works if caching is set to true.
-
-
-is_cached
-
-caching = true;
-
-if(!$smarty->is_cached("index.tpl")) {
- // do database calls, assign vars here
-}
-
-$smarty->display("index.tpl");
-?>
-]]>
-
-
-
- You can also pass a cache id as an optional second parameter
- in case you want multiple caches for the given template.
-
-
-is_cached with multiple-cache template
-
-caching = true;
-
-if(!$smarty->is_cached("index.tpl","FrontPage")) {
- // do database calls, assign vars here
-}
-
-$smarty->display("index.tpl","FrontPage");
-?>
-]]>
-
-
-
-
- load_filter
-
-
- void load_filter
- string type
- string name
-
-
-
- This function can be used to load a filter plugin. The first
- argument specifies the type of the filter to load and can be one
- of the following: 'pre', 'post', or 'output'. The second argument
- specifies the name of the filter plugin, for example, 'trim'.
-
-
-loading filter plugins
-
-load_filter('pre', 'trim'); // load prefilter named 'trim'
-$smarty->load_filter('pre', 'datefooter'); // load another prefilter named 'datefooter'
-$smarty->load_filter('output', 'compress'); // load output filter named 'compress'
-?>
-]]>
-
-
-
-
- register_block
-
-
- void register_block
- string name
- mixed impl
- bool cacheable
- array or null cache_attrs
-
-
-
- Use this to dynamically register block functions plugins.
- Pass in the block function name, followed by the PHP
- function callback that implements it.
-
-
-
- The php-function callback impl can be either (a) a string
- containing the function name or (b) an array of the form
- array(&$object, $method) with
- &$object being a reference to an
- object and $method being a string
- containing the mehod-name or (c) an array of the form
- array(&$class, $method) with
- $class being a classname and
- $method being a class method of that
- class.
-
-
-$cacheable and $cache_attrs can be omitted in most cases. See Controlling Cacheability of Plugins' Output on how to use them properly.
-
-
-register_block
-
-register_block("translate", "do_translation");
-
-function do_translation ($params, $content, &$smarty, &$repeat) {
- if (isset($content)) {
- $lang = $params['lang'];
- // do some translation with $content
- return $translation;
- }
-}
-?>
-
-{* template *}
-{translate lang="br"}
- Hello, world!
-{/translate}
-]]>
-
-
-
-
- register_compiler_function
-
-
- void register_compiler_function
- string name
- mixed impl
- bool cacheable
-
-
-
- Use this to dynamically register a compiler function plugin.
- Pass in the compiler function name, followed by the PHP
- function that implements it.
-
-
- The php-function callback impl can be either (a) a string
- containing the function name or (b) an array of the form
- array(&$object, $method) with
- &$object being a reference to an
- object and $method being a string
- containing the mehod-name or (c) an array of the form
- array(&$class, $method) with
- $class being a classname and
- $method being a class method of that
- class.
-
-
- $cacheable can be omitted in
- most cases. See Controlling
- Cacheability of Plugins' Output on how to it properly.
-
-
-
- register_function
-
-
- void register_function
- string name
- mixed impl
- bool cacheable
- array or null cache_attrs
-
-
-
- Use this to dynamically register template function plugins.
- Pass in the template function name, followed by the PHP
- function name that implements it.
-
-
- The php-function callback impl can be either (a) a string
- containing the function name or (b) an array of the form
- array(&$object, $method) with
- &$object being a reference to an
- object and $method being a string
- containing the mehod-name or (c) an array of the form
- array(&$class, $method) with
- $class being a classname and
- $method being a class method of that
- class.
-
-
-$cacheable and $cache_attrs can be omitted in most cases. See Controlling Cacheability of Plugins' Output on how to use them properly.
-
-
-register_function
-
-register_function("date_now", "print_current_date");
-
-function print_current_date ($params) {
- if(empty($params['format']))
- $format = "%b %e, %Y";
- else
- $format = $params['format'];
- return strftime($format,time());
-}
-
-// now you can use this in Smarty to print the current date: {date_now}
-// or, {date_now format="%Y/%m/%d"} to format it.
-?>
-]]>
-
-
-
-
- register_modifier
-
-
- void register_modifier
- string name
- mixed impl
-
-
-
- Use this to dynamically register modifier plugin. Pass in the
- template modifier name, followed by the PHP function that it
- implements it.
-
-
- The php-function callback impl can be either (a) a string
- containing the function name or (b) an array of the form
- array(&$object, $method) with
- &$object being a reference to an
- object and $method being a string
- containing the mehod-name or (c) an array of the form
- array(&$class, $method) with
- $class being a classname and
- $method being a class method of that
- class.
-
-
-
-register_modifier
-
-register_modifier("sslash","stripslashes");
-
-// now you can use {$var|sslash} to strip slashes from variables
-?>
-]]>
-
-
-
-
- register_object
-
-
- void register_object
- string object_name
- object $object
- array allowed methods/properties
- boolean format
- array block methods
-
-
-
- This is to register an object for use in the templates. See the
- object section
- of the manual for examples.
-
-
-
- register_outputfilter
-
-
- void register_outputfilter
- mixed function
-
-
-
- Use this to dynamically register outputfilters to operate on
- a template's output before it is displayed. See
- template output
- filters
- for more information on how to set up an output filter function.
-
-
- The php-function callback function can be either (a) a string
- containing the function name or (b) an array of the form
- array(&$object, $method) with
- &$object being a reference to an
- object and $method being a string
- containing the mehod-name or (c) an array of the form
- array(&$class, $method) with
- $class being a classname and
- $method being a class method of that
- class.
-
-
-
- register_postfilter
-
-
- void register_postfilter
- mixed function
-
-
-
- Use this to dynamically register postfilters to run templates
- through after they are compiled. See template postfilters for
- more information on how to setup a postfiltering function.
-
-
- The php-function callback function can be either (a) a string
- containing the function name or (b) an array of the form
- array(&$object, $method) with
- &$object being a reference to an
- object and $method being a string
- containing the mehod-name or (c) an array of the form
- array(&$class, $method) with
- $class being a classname and
- $method being a class method of that
- class.
-
-
-
- register_prefilter
-
-
- void register_prefilter
- mixed function
-
-
-
- Use this to dynamically register prefilters to run templates
- through before they are compiled. See template prefilters for
- more information on how to setup a prefiltering function.
-
-
- The php-function callback function can be either (a) a string
- containing the function name or (b) an array of the form
- array(&$object, $method) with
- &$object being a reference to an
- object and $method being a string
- containing the mehod-name or (c) an array of the form
- array(&$class, $method) with
- $class being a classname and
- $method being a class method of that
- class.
-
-
-
- register_resource
-
-
- void register_resource
- string name
- array resource_funcs
-
-
-
- Use this to dynamically register a resource plugin with Smarty.
- Pass in the name of the resource and the array of PHP functions
- implementing it. See
- template resources
- for more information on how to setup a function for fetching
- templates.
-
-
- Technical Note
-
- A resource name must be at least two characters in length. One
- character resource names will be ignored and used as part of the file
- path, such as $smarty->display('c:/path/to/index.tpl');
-
-
-
- The php-function-array resource_funcs
- must have 4 or 5 elements. With 4 elements the elements are
- the functions-callbacks for the respective "source",
- "timestamp", "secure" and "trusted" functions of the
- resource. With 5 elements the first element has to be an
- object reference or a class name of the object or class
- implementing the resource and the 4 following elements have
- to be the method names implementing "source", "timestamp",
- "secure" and "trusted".
-
-
-register_resource
-
-register_resource("db", array("db_get_template",
- "db_get_timestamp",
- "db_get_secure",
- "db_get_trusted"));
-?>
-]]>
-
-
-
-
- trigger_error
-
-
- void trigger_error
- string error_msg
- [int level]
-
-
-
- This function can be used to output an error message using Smarty.
- level parameter can be one of the values
- used for trigger_error() PHP function, i.e. E_USER_NOTICE,
- E_USER_WARNING, etc. By default it's E_USER_WARNING.
-
-
-
-
- template_exists
-
-
- bool template_exists
- string template
-
-
-
- This function checks whether the specified template exists. It can
- accept either a path to the template on the filesystem or a
- resource string specifying the template.
-
-
-
- unregister_block
-
-
- void unregister_block
- string name
-
-
-
- Use this to dynamically unregister block function plugin.
- Pass in the block function name.
-
-
-
- unregister_compiler_function
-
-
- void unregister_compiler_function
- string name
-
-
-
- Use this to dynamically unregister a compiler function. Pass in
- the name of the compiler function.
-
-
-
- unregister_function
-
-
- void unregister_function
- string name
-
-
-
- Use this to dynamically unregister template function plugin.
- Pass in the template function name.
-
-
-unregister_function
-
-unregister_function("fetch");
-?>
-]]>
-
-
-
-
- unregister_modifier
-
-
- void unregister_modifier
- string name
-
-
-
- Use this to dynamically unregister modifier plugin. Pass in the
- template modifier name.
-
-
-unregister_modifier
-
-unregister_modifier("strip_tags");
-?>
-]]>
-
-
-
-
- unregister_object
-
-
- void unregister_object
- string object_name
-
-
-
- Use this to unregister an object.
-
-
-
- unregister_outputfilter
-
-
- void unregister_outputfilter
- string function_name
-
-
-
- Use this to dynamically unregister an output filter.
-
-
-
- unregister_postfilter
-
-
- void unregister_postfilter
- string function_name
-
-
-
- Use this to dynamically unregister a postfilter.
-
-
-
- unregister_prefilter
-
-
- void unregister_prefilter
- string function_name
-
-
-
- Use this to dynamically unregister a prefilter.
-
-
-
- unregister_resource
-
-
- void unregister_resource
- string name
-
-
-
- Use this to dynamically unregister a resource plugin. Pass in the
- name of the resource.
-
-
-unregister_resource
-
-unregister_resource("db");
-?>
-]]>
-
-
-
+&programmers.api-functions.api-template-exists;
+&programmers.api-functions.api-unregister-block;
+&programmers.api-functions.api-unregister-compiler-function;
+&programmers.api-functions.api-unregister-function;
+&programmers.api-functions.api-unregister-modifier;
+&programmers.api-functions.api-unregister-object;
+&programmers.api-functions.api-unregister-outputfilter;
+&programmers.api-functions.api-unregister-postfilter;
+&programmers.api-functions.api-unregister-prefilter;
+&programmers.api-functions.api-unregister-resource;
+
+ append_by_ref
+
+
+ void append_by_ref
+ string varname
+ mixed var
+
+
+ void append_by_ref
+ string varname
+ mixed var
+ boolean merge
+
+
+
+ This is used to append values to the templates by reference.
+ If you append a variable by reference then change its
+ value, the appended value sees the change as well. For objects,
+ append_by_ref() also avoids an in-memory copy of the appended object.
+ See the PHP manual on variable referencing for an in-depth
+ explanation. If you pass the optional third parameter of true,
+ the value will be merged with the current array instead of appended.
+
+
+ Technical Note
+
+ The merge parameter respects array keys, so if you merge two
+ numerically indexed arrays, they may overwrite each other or result in
+ non-sequential keys. This is unlike the array_merge() function of PHP
+ which wipes out numerical keys and renumbers them.
+
+
+
+ append_by_ref
+
+append_by_ref("Name", $myname);
+$smarty->append_by_ref("Address", $address);
+?>
+]]>
+
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-functions/api-append.xml b/docs/en/programmers/api-functions/api-append.xml
new file mode 100644
index 00000000..e8ea7665
--- /dev/null
+++ b/docs/en/programmers/api-functions/api-append.xml
@@ -0,0 +1,74 @@
+
+
+
+ append
+
+
+ void append
+ mixed var
+
+
+ void append
+ string varname
+ mixed var
+
+
+ void append
+ string varname
+ mixed var
+ boolean merge
+
+
+
+ This is used to append an element to an assigned array. If you append
+ to a string value, it is converted to an array value and then
+ appended to. You can explicitly pass name/value pairs, or associative
+ arrays containing the name/value pairs. If you pass the optional third
+ parameter of true, the value will be merged with the current array
+ instead of appended.
+
+
+ Technical Note
+
+ The merge parameter respects array keys, so if you merge two
+ numerically indexed arrays, they may overwrite each other or result in
+ non-sequential keys. This is unlike the array_merge() function of PHP
+ which wipes out numerical keys and renumbers them.
+
+
+
+ append
+
+append("Name","Fred");
+$smarty->append("Address",$address);
+
+// passing an associative array
+$smarty->append(array("city" => "Lincoln","state" => "Nebraska"));
+?>
+]]>
+
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-functions/api-assign-by-ref.xml b/docs/en/programmers/api-functions/api-assign-by-ref.xml
new file mode 100644
index 00000000..a86fa750
--- /dev/null
+++ b/docs/en/programmers/api-functions/api-assign-by-ref.xml
@@ -0,0 +1,59 @@
+
+
+
+ assign_by_ref
+
+
+ void assign_by_ref
+ string varname
+ mixed var
+
+
+
+ This is used to assign values to the templates by reference instead of
+ making a copy. See the PHP manual on variable referencing for an explanation.
+
+
+ Technical Note
+
+ This is used to assign values to the templates by reference.
+ If you assign a variable by reference then change its
+ value, the assigned value sees the change as well. For objects,
+ assign_by_ref() also avoids an in-memory copy of the assigned object.
+ See the PHP manual on variable referencing for an in-depth
+ explanation.
+
+
+
+ assign_by_ref
+
+assign_by_ref('Name', $myname);
+$smarty->assign_by_ref('Address', $address);
+?>
+]]>
+
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-functions/api-assign.xml b/docs/en/programmers/api-functions/api-assign.xml
new file mode 100644
index 00000000..45051037
--- /dev/null
+++ b/docs/en/programmers/api-functions/api-assign.xml
@@ -0,0 +1,56 @@
+
+
+
+ assign
+
+
+ void assign
+ mixed var
+
+
+ void assign
+ string varname
+ mixed var
+
+
+
+ This is used to assign values to the templates. You can
+ explicitly pass name/value pairs, or associative arrays
+ containing the name/value pairs.
+
+
+ assign
+
+assign('Name', 'Fred');
+$smarty->assign('Address', $address);
+
+// passing an associative array
+$smarty->assign(array("city" => "Lincoln", "state" => "Nebraska"));
+?>
+]]>
+
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-functions/api-clear-all-assign.xml b/docs/en/programmers/api-functions/api-clear-all-assign.xml
new file mode 100644
index 00000000..6ab39a35
--- /dev/null
+++ b/docs/en/programmers/api-functions/api-clear-all-assign.xml
@@ -0,0 +1,45 @@
+
+
+
+ clear_all_assign
+
+
+ void clear_all_assign
+
+
+
+
+ This clears the values of all assigned variables.
+
+
+clear_all_assign
+
+clear_all_assign();
+?>
+]]>
+
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-functions/api-clear-all-cache.xml b/docs/en/programmers/api-functions/api-clear-all-cache.xml
new file mode 100644
index 00000000..6adcc83a
--- /dev/null
+++ b/docs/en/programmers/api-functions/api-clear-all-cache.xml
@@ -0,0 +1,47 @@
+
+
+
+ clear_all_cache
+
+
+ void clear_all_cache
+ int expire time
+
+
+
+ This clears the entire template cache. As an optional
+ parameter, you can supply a minimum age in seconds the cache
+ files must be before they will get cleared.
+
+
+clear_all_cache
+
+clear_all_cache();
+?>
+]]>
+
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-functions/api-clear-assign.xml b/docs/en/programmers/api-functions/api-clear-assign.xml
new file mode 100644
index 00000000..a7db906e
--- /dev/null
+++ b/docs/en/programmers/api-functions/api-clear-assign.xml
@@ -0,0 +1,49 @@
+
+
+
+ clear_assign
+
+
+ void clear_assign
+ string var
+
+
+
+ This clears the value of an assigned variable. This
+ can be a single value, or an array of values.
+
+
+clear_assign
+
+clear_assign("Name");
+
+// clear multiple variables
+$smarty->clear_assign(array("Name","Address","Zip"));
+?>
+]]>
+
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-functions/api-clear-cache.xml b/docs/en/programmers/api-functions/api-clear-cache.xml
new file mode 100644
index 00000000..c035ed0e
--- /dev/null
+++ b/docs/en/programmers/api-functions/api-clear-cache.xml
@@ -0,0 +1,57 @@
+
+
+
+ clear_cache
+
+ voidclear_cache
+ stringtemplate
+ stringcache id
+ stringcompile id
+ intexpire time
+
+
+ This clears the cache for a specific template. If you have
+ multiple caches for this template, you can clear a specific
+ cache by supplying the cache id as the second parameter. You
+ can also pass a compile id as a third parameter. You can "group"
+ templates together so they can be removed as a group. See the
+ caching section for more
+ information. As an optional fourth parameter, you can supply a
+ minimum age in seconds the cache file must be before it will
+ get cleared.
+
+
+clear_cache
+
+clear_cache("index.tpl");
+
+// clear the cache for a particular cache id in an multiple-cache template
+$smarty->clear_cache("index.tpl","CACHEID");
+?>
+]]>
+
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-functions/api-clear-compiled-tpl.xml b/docs/en/programmers/api-functions/api-clear-compiled-tpl.xml
new file mode 100644
index 00000000..f0fb325e
--- /dev/null
+++ b/docs/en/programmers/api-functions/api-clear-compiled-tpl.xml
@@ -0,0 +1,54 @@
+
+
+
+ clear_compiled_tpl
+
+ voidclear_compiled_tpl
+ stringtpl_file
+ stringcompile_id
+ intexp_time
+
+
+ This clears the compiled version of the specified template
+ resource, or all compiled template files if one is not specified.
+ if you pass a compile_id only the compiled template for this
+ specific compile_id is cleared. if you pass an exp_time, then only
+ compiled templates older than exp_time seconds are cleared, by
+ default all compiled templates are cleared regardless of their age.
+ This function is for advanced use only, not normally needed.
+
+
+clear_compiled_tpl
+
+clear_compiled_tpl("index.tpl");
+
+// clear entire compile directory
+$smarty->clear_compiled_tpl();
+?>
+]]>
+
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-functions/api-clear-config.xml b/docs/en/programmers/api-functions/api-clear-config.xml
new file mode 100644
index 00000000..8492753b
--- /dev/null
+++ b/docs/en/programmers/api-functions/api-clear-config.xml
@@ -0,0 +1,47 @@
+
+
+
+ clear_config
+
+ voidclear_config
+ stringvar
+
+
+ This clears all assigned config variables. If a variable name is
+ supplied, only that variable is cleared.
+
+
+clear_config
+
+clear_config();
+
+// clear one variable
+$smarty->clear_config('foobar');
+?>
+]]>
+
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-functions/api-config-load.xml b/docs/en/programmers/api-functions/api-config-load.xml
new file mode 100644
index 00000000..6f1990ae
--- /dev/null
+++ b/docs/en/programmers/api-functions/api-config-load.xml
@@ -0,0 +1,61 @@
+
+
+
+ config_load
+
+ voidconfig_load
+ stringfile
+ stringsection
+
+
+ This loads config file data and assigns it to the template. This
+ works identical to the template config_load
+ function.
+
+
+ Technical Note
+
+ As of Smarty 2.4.0, assigned template variables are kept across
+ invocations of fetch() and display(). Config vars loaded from
+ config_load() are always global scope. Config files are also
+ compiled for faster execution, and respect the force_compile and compile_check settings.
+
+
+
+config_load
+
+config_load('my.conf');
+
+// load a section
+$smarty->config_load('my.conf','foobar');
+?>
+]]>
+
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-functions/api-display.xml b/docs/en/programmers/api-functions/api-display.xml
new file mode 100644
index 00000000..6e89601d
--- /dev/null
+++ b/docs/en/programmers/api-functions/api-display.xml
@@ -0,0 +1,109 @@
+
+
+
+ display
+
+ voiddisplay
+ stringtemplate
+ stringcache_id
+ stringcompile_id
+
+
+ This displays the template. Supply a valid template resource
+ type and path. As an optional second parameter, you can pass a
+ cache id. See the caching
+ section for more information.
+
+
+ As an optional third parameter, you can pass a compile id. This
+ is in the event that you want to compile different versions of
+ the same template, such as having separate templates compiled
+ for different languages. Another use for compile_id is when you
+ use more than one $template_dir but only one $compile_dir. Set
+ a separate compile_id for each $template_dir, otherwise
+ templates of the same name will overwrite each other. You can
+ also set the $compile_id variable once
+ instead of passing this to each call to display().
+
+
+display
+
+caching = true;
+
+// only do db calls if cache doesn't exist
+if(!$smarty->is_cached("index.tpl"))
+{
+
+ // dummy up some data
+ $address = "245 N 50th";
+ $db_data = array(
+ "City" => "Lincoln",
+ "State" => "Nebraska",
+ "Zip" => "68502"
+ );
+
+ $smarty->assign("Name","Fred");
+ $smarty->assign("Address",$address);
+ $smarty->assign($db_data);
+
+}
+
+// display the output
+$smarty->display("index.tpl");
+?>
+]]>
+
+
+
+ Use the syntax for template resources to
+ display files outside of the $template_dir directory.
+
+
+function display template resource examples
+
+display("/usr/local/include/templates/header.tpl");
+
+// absolute filepath (same thing)
+$smarty->display("file:/usr/local/include/templates/header.tpl");
+
+// windows absolute filepath (MUST use "file:" prefix)
+$smarty->display("file:C:/www/pub/templates/header.tpl");
+
+// include from template resource named "db"
+$smarty->display("db:header.tpl");
+?>
+]]>
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-functions/api-fetch.xml b/docs/en/programmers/api-functions/api-fetch.xml
new file mode 100644
index 00000000..e55b449f
--- /dev/null
+++ b/docs/en/programmers/api-functions/api-fetch.xml
@@ -0,0 +1,89 @@
+
+
+
+ fetch
+
+ stringfetch
+ stringtemplate
+ stringcache_id
+ stringcompile_id
+
+
+ This returns the template output instead of displaying it.
+ Supply a valid template resource
+ type and path. As an optional second parameter, you can pass a
+ cache id. See the caching
+ section for more information.
+
+
+ As an optional third parameter, you can pass a compile id. This
+ is in the event that you want to compile different versions of
+ the same template, such as having separate templates compiled
+ for different languages. Another use for compile_id is when you
+ use more than one $template_dir but only one $compile_dir. Set
+ a separate compile_id for each $template_dir, otherwise
+ templates of the same name will overwrite each other. You can
+ also set the $compile_id variable once
+ instead of passing this to each call to fetch().
+
+
+fetch
+
+caching = true;
+
+// only do db calls if cache doesn't exist
+if(!$smarty->is_cached("index.tpl"))
+{
+
+ // dummy up some data
+ $address = "245 N 50th";
+ $db_data = array(
+ "City" => "Lincoln",
+ "State" => "Nebraska",
+ "Zip" => "68502"
+ );
+
+ $smarty->assign("Name","Fred");
+ $smarty->assign("Address",$address);
+ $smarty->assign($db_data);
+
+}
+
+// capture the output
+$output = $smarty->fetch("index.tpl");
+
+// do something with $output here
+
+echo $output;
+?>
+]]>
+
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-functions/api-get-config-vars.xml b/docs/en/programmers/api-functions/api-get-config-vars.xml
new file mode 100644
index 00000000..8f725352
--- /dev/null
+++ b/docs/en/programmers/api-functions/api-get-config-vars.xml
@@ -0,0 +1,50 @@
+
+
+
+ get_config_vars
+
+ arrayget_config_vars
+ stringvarname
+
+
+ This returns the given loaded config variable value. If no parameter
+ is given, an array of all loaded config variables is returned.
+
+
+get_config_vars
+
+get_config_vars('foo');
+
+// get all loaded config template vars
+$config_vars = $smarty->get_config_vars();
+
+// take a look at them
+print_r($config_vars);
+?>
+]]>
+
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-functions/api-get-registered-object.xml b/docs/en/programmers/api-functions/api-get-registered-object.xml
new file mode 100644
index 00000000..6b96d7dc
--- /dev/null
+++ b/docs/en/programmers/api-functions/api-get-registered-object.xml
@@ -0,0 +1,52 @@
+
+
+
+ get_registered_object
+
+
+ array get_registered_object
+ string object_name
+
+
+
+ This returns a reference to a registered object. This is useful
+ from within a custom function when you need direct access to a
+ registered object.
+
+
+get_registered_object
+
+get_registered_object($params['object']);
+ // use $obj_ref is now a reference to the object
+ }
+}
+?>
+]]>
+
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-functions/api-get-template-vars.xml b/docs/en/programmers/api-functions/api-get-template-vars.xml
new file mode 100644
index 00000000..f2fc2add
--- /dev/null
+++ b/docs/en/programmers/api-functions/api-get-template-vars.xml
@@ -0,0 +1,50 @@
+
+
+
+ get_template_vars
+
+ arrayget_template_vars
+ stringvarname
+
+
+ This returns the given assigned variable value. If no parameter
+ is given, an array of all assigned variables is returned.
+
+
+get_template_vars
+
+get_template_vars('foo');
+
+// get all assigned template vars
+$tpl_vars = $smarty->get_template_vars();
+
+// take a look at them
+print_r($tpl_vars);
+?>
+]]>
+
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-functions/api-is-cached.xml b/docs/en/programmers/api-functions/api-is-cached.xml
new file mode 100644
index 00000000..711316a0
--- /dev/null
+++ b/docs/en/programmers/api-functions/api-is-cached.xml
@@ -0,0 +1,73 @@
+
+
+
+ is_cached
+
+
+ boolean is_cached
+ string template
+ [string cache_id]
+
+
+
+ This returns true if there is a valid cache for this template.
+ This only works if caching is set to true.
+
+
+is_cached
+
+caching = true;
+
+if(!$smarty->is_cached("index.tpl")) {
+ // do database calls, assign vars here
+}
+
+$smarty->display("index.tpl");
+?>
+]]>
+
+
+
+ You can also pass a cache id as an optional second parameter
+ in case you want multiple caches for the given template.
+
+
+is_cached with multiple-cache template
+
+caching = true;
+
+if(!$smarty->is_cached("index.tpl","FrontPage")) {
+ // do database calls, assign vars here
+}
+
+$smarty->display("index.tpl","FrontPage");
+?>
+]]>
+
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-functions/api-load-filter.xml b/docs/en/programmers/api-functions/api-load-filter.xml
new file mode 100644
index 00000000..98ef2a10
--- /dev/null
+++ b/docs/en/programmers/api-functions/api-load-filter.xml
@@ -0,0 +1,50 @@
+
+
+
+ load_filter
+
+
+ void load_filter
+ string type
+ string name
+
+
+
+ This function can be used to load a filter plugin. The first
+ argument specifies the type of the filter to load and can be one
+ of the following: 'pre', 'post', or 'output'. The second argument
+ specifies the name of the filter plugin, for example, 'trim'.
+
+
+loading filter plugins
+
+load_filter('pre', 'trim'); // load prefilter named 'trim'
+$smarty->load_filter('pre', 'datefooter'); // load another prefilter named 'datefooter'
+$smarty->load_filter('output', 'compress'); // load output filter named 'compress'
+?>
+]]>
+
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-functions/api-register-block.xml b/docs/en/programmers/api-functions/api-register-block.xml
new file mode 100644
index 00000000..2557fe37
--- /dev/null
+++ b/docs/en/programmers/api-functions/api-register-block.xml
@@ -0,0 +1,78 @@
+
+
+
+ register_block
+
+
+ void register_block
+ string name
+ mixed impl
+ bool cacheable
+ array or null cache_attrs
+
+
+
+ Use this to dynamically register block functions plugins.
+ Pass in the block function name, followed by the PHP
+ function callback that implements it.
+
+
+
+ The php-function callback impl can be either (a) a string
+ containing the function name or (b) an array of the form
+ array(&$object, $method) with
+ &$object being a reference to an
+ object and $method being a string
+ containing the mehod-name or (c) an array of the form
+ array(&$class, $method) with
+ $class being a classname and
+ $method being a class method of that
+ class.
+
+
+$cacheable and $cache_attrs can be omitted in most cases. See Controlling Cacheability of Plugins' Output on how to use them properly.
+
+
+register_block
+
+register_block("translate", "do_translation");
+
+function do_translation ($params, $content, &$smarty, &$repeat) {
+ if (isset($content)) {
+ $lang = $params['lang'];
+ // do some translation with $content
+ return $translation;
+ }
+}
+?>
+
+{* template *}
+{translate lang="br"}
+ Hello, world!
+{/translate}
+]]>
+
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-functions/api-register-compiler-function.xml b/docs/en/programmers/api-functions/api-register-compiler-function.xml
new file mode 100644
index 00000000..35c0e588
--- /dev/null
+++ b/docs/en/programmers/api-functions/api-register-compiler-function.xml
@@ -0,0 +1,55 @@
+
+
+
+ register_compiler_function
+
+
+ void register_compiler_function
+ string name
+ mixed impl
+ bool cacheable
+
+
+
+ Use this to dynamically register a compiler function plugin.
+ Pass in the compiler function name, followed by the PHP
+ function that implements it.
+
+
+ The php-function callback impl can be either (a) a string
+ containing the function name or (b) an array of the form
+ array(&$object, $method) with
+ &$object being a reference to an
+ object and $method being a string
+ containing the mehod-name or (c) an array of the form
+ array(&$class, $method) with
+ $class being a classname and
+ $method being a class method of that
+ class.
+
+
+ $cacheable can be omitted in
+ most cases. See Controlling
+ Cacheability of Plugins' Output on how to it properly.
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-functions/api-register-function.xml b/docs/en/programmers/api-functions/api-register-function.xml
new file mode 100644
index 00000000..a984b886
--- /dev/null
+++ b/docs/en/programmers/api-functions/api-register-function.xml
@@ -0,0 +1,75 @@
+
+
+
+ register_function
+
+
+ void register_function
+ string name
+ mixed impl
+ bool cacheable
+ array or null cache_attrs
+
+
+
+ Use this to dynamically register template function plugins.
+ Pass in the template function name, followed by the PHP
+ function name that implements it.
+
+
+ The php-function callback impl can be either (a) a string
+ containing the function name or (b) an array of the form
+ array(&$object, $method) with
+ &$object being a reference to an
+ object and $method being a string
+ containing the mehod-name or (c) an array of the form
+ array(&$class, $method) with
+ $class being a classname and
+ $method being a class method of that
+ class.
+
+
+$cacheable and $cache_attrs can be omitted in most cases. See Controlling Cacheability of Plugins' Output on how to use them properly.
+
+
+register_function
+
+register_function("date_now", "print_current_date");
+
+function print_current_date ($params) {
+ if(empty($params['format']))
+ $format = "%b %e, %Y";
+ else
+ $format = $params['format'];
+ return strftime($format,time());
+}
+
+// now you can use this in Smarty to print the current date: {date_now}
+// or, {date_now format="%Y/%m/%d"} to format it.
+?>
+]]>
+
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-functions/api-register-modifier.xml b/docs/en/programmers/api-functions/api-register-modifier.xml
new file mode 100644
index 00000000..ed1fc881
--- /dev/null
+++ b/docs/en/programmers/api-functions/api-register-modifier.xml
@@ -0,0 +1,64 @@
+
+
+
+ register_modifier
+
+
+ void register_modifier
+ string name
+ mixed impl
+
+
+
+ Use this to dynamically register modifier plugin. Pass in the
+ template modifier name, followed by the PHP function that it
+ implements it.
+
+
+ The php-function callback impl can be either (a) a string
+ containing the function name or (b) an array of the form
+ array(&$object, $method) with
+ &$object being a reference to an
+ object and $method being a string
+ containing the mehod-name or (c) an array of the form
+ array(&$class, $method) with
+ $class being a classname and
+ $method being a class method of that
+ class.
+
+
+
+register_modifier
+
+register_modifier("sslash","stripslashes");
+
+// now you can use {$var|sslash} to strip slashes from variables
+?>
+]]>
+
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-functions/api-register-object.xml b/docs/en/programmers/api-functions/api-register-object.xml
new file mode 100644
index 00000000..b0fd6c86
--- /dev/null
+++ b/docs/en/programmers/api-functions/api-register-object.xml
@@ -0,0 +1,40 @@
+
+
+
+ register_object
+
+
+ void register_object
+ string object_name
+ object $object
+ array allowed methods/properties
+ boolean format
+ array block methods
+
+
+
+ This is to register an object for use in the templates. See the
+ object section
+ of the manual for examples.
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-functions/api-register-outputfilter.xml b/docs/en/programmers/api-functions/api-register-outputfilter.xml
new file mode 100644
index 00000000..6d5db988
--- /dev/null
+++ b/docs/en/programmers/api-functions/api-register-outputfilter.xml
@@ -0,0 +1,50 @@
+
+
+
+ register_outputfilter
+
+
+ void register_outputfilter
+ mixed function
+
+
+
+ Use this to dynamically register outputfilters to operate on
+ a template's output before it is displayed. See
+ template output
+ filters
+ for more information on how to set up an output filter function.
+
+
+ The php-function callback function can be either (a) a string
+ containing the function name or (b) an array of the form
+ array(&$object, $method) with
+ &$object being a reference to an
+ object and $method being a string
+ containing the mehod-name or (c) an array of the form
+ array(&$class, $method) with
+ $class being a classname and
+ $method being a class method of that
+ class.
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-functions/api-register-postfilter.xml b/docs/en/programmers/api-functions/api-register-postfilter.xml
new file mode 100644
index 00000000..2639604f
--- /dev/null
+++ b/docs/en/programmers/api-functions/api-register-postfilter.xml
@@ -0,0 +1,49 @@
+
+
+
+ register_postfilter
+
+
+ void register_postfilter
+ mixed function
+
+
+
+ Use this to dynamically register postfilters to run templates
+ through after they are compiled. See template postfilters for
+ more information on how to setup a postfiltering function.
+
+
+ The php-function callback function can be either (a) a string
+ containing the function name or (b) an array of the form
+ array(&$object, $method) with
+ &$object being a reference to an
+ object and $method being a string
+ containing the mehod-name or (c) an array of the form
+ array(&$class, $method) with
+ $class being a classname and
+ $method being a class method of that
+ class.
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-functions/api-register-prefilter.xml b/docs/en/programmers/api-functions/api-register-prefilter.xml
new file mode 100644
index 00000000..bb3c7dfc
--- /dev/null
+++ b/docs/en/programmers/api-functions/api-register-prefilter.xml
@@ -0,0 +1,49 @@
+
+
+
+ register_prefilter
+
+
+ void register_prefilter
+ mixed function
+
+
+
+ Use this to dynamically register prefilters to run templates
+ through before they are compiled. See template prefilters for
+ more information on how to setup a prefiltering function.
+
+
+ The php-function callback function can be either (a) a string
+ containing the function name or (b) an array of the form
+ array(&$object, $method) with
+ &$object being a reference to an
+ object and $method being a string
+ containing the mehod-name or (c) an array of the form
+ array(&$class, $method) with
+ $class being a classname and
+ $method being a class method of that
+ class.
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-functions/api-register-resource.xml b/docs/en/programmers/api-functions/api-register-resource.xml
new file mode 100644
index 00000000..31885209
--- /dev/null
+++ b/docs/en/programmers/api-functions/api-register-resource.xml
@@ -0,0 +1,72 @@
+
+
+
+ register_resource
+
+
+ void register_resource
+ string name
+ array resource_funcs
+
+
+
+ Use this to dynamically register a resource plugin with Smarty.
+ Pass in the name of the resource and the array of PHP functions
+ implementing it. See
+ template resources
+ for more information on how to setup a function for fetching
+ templates.
+
+
+ Technical Note
+
+ A resource name must be at least two characters in length. One
+ character resource names will be ignored and used as part of the file
+ path, such as $smarty->display('c:/path/to/index.tpl');
+
+
+
+ The php-function-array resource_funcs
+ must have 4 or 5 elements. With 4 elements the elements are
+ the functions-callbacks for the respective "source",
+ "timestamp", "secure" and "trusted" functions of the
+ resource. With 5 elements the first element has to be an
+ object reference or a class name of the object or class
+ implementing the resource and the 4 following elements have
+ to be the method names implementing "source", "timestamp",
+ "secure" and "trusted".
+
+
+register_resource
+
+register_resource("db", array("db_get_template",
+ "db_get_timestamp",
+ "db_get_secure",
+ "db_get_trusted"));
+?>
+]]>
+
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-functions/api-template-exists.xml b/docs/en/programmers/api-functions/api-template-exists.xml
new file mode 100644
index 00000000..1e9e32e4
--- /dev/null
+++ b/docs/en/programmers/api-functions/api-template-exists.xml
@@ -0,0 +1,36 @@
+
+
+
+ template_exists
+
+
+ bool template_exists
+ string template
+
+
+
+ This function checks whether the specified template exists. It can
+ accept either a path to the template on the filesystem or a
+ resource string specifying the template.
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-functions/api-trigger-error.xml b/docs/en/programmers/api-functions/api-trigger-error.xml
new file mode 100644
index 00000000..7e779e00
--- /dev/null
+++ b/docs/en/programmers/api-functions/api-trigger-error.xml
@@ -0,0 +1,38 @@
+
+
+
+ trigger_error
+
+
+ void trigger_error
+ string error_msg
+ [int level]
+
+
+
+ This function can be used to output an error message using Smarty.
+ level parameter can be one of the values
+ used for trigger_error() PHP function, i.e. E_USER_NOTICE,
+ E_USER_WARNING, etc. By default it's E_USER_WARNING.
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-functions/api-unregister-block.xml b/docs/en/programmers/api-functions/api-unregister-block.xml
new file mode 100644
index 00000000..ea7be58e
--- /dev/null
+++ b/docs/en/programmers/api-functions/api-unregister-block.xml
@@ -0,0 +1,35 @@
+
+
+
+ unregister_block
+
+
+ void unregister_block
+ string name
+
+
+
+ Use this to dynamically unregister block function plugin.
+ Pass in the block function name.
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-functions/api-unregister-compiler-function.xml b/docs/en/programmers/api-functions/api-unregister-compiler-function.xml
new file mode 100644
index 00000000..1b21c409
--- /dev/null
+++ b/docs/en/programmers/api-functions/api-unregister-compiler-function.xml
@@ -0,0 +1,35 @@
+
+
+
+ unregister_compiler_function
+
+
+ void unregister_compiler_function
+ string name
+
+
+
+ Use this to dynamically unregister a compiler function. Pass in
+ the name of the compiler function.
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-functions/api-unregister-function.xml b/docs/en/programmers/api-functions/api-unregister-function.xml
new file mode 100644
index 00000000..1c5e1546
--- /dev/null
+++ b/docs/en/programmers/api-functions/api-unregister-function.xml
@@ -0,0 +1,47 @@
+
+
+
+ unregister_function
+
+
+ void unregister_function
+ string name
+
+
+
+ Use this to dynamically unregister template function plugin.
+ Pass in the template function name.
+
+
+unregister_function
+
+unregister_function("fetch");
+?>
+]]>
+
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-functions/api-unregister-modifier.xml b/docs/en/programmers/api-functions/api-unregister-modifier.xml
new file mode 100644
index 00000000..a53ed1e7
--- /dev/null
+++ b/docs/en/programmers/api-functions/api-unregister-modifier.xml
@@ -0,0 +1,47 @@
+
+
+
+ unregister_modifier
+
+
+ void unregister_modifier
+ string name
+
+
+
+ Use this to dynamically unregister modifier plugin. Pass in the
+ template modifier name.
+
+
+unregister_modifier
+
+unregister_modifier("strip_tags");
+?>
+]]>
+
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-functions/api-unregister-object.xml b/docs/en/programmers/api-functions/api-unregister-object.xml
new file mode 100644
index 00000000..d9007b0f
--- /dev/null
+++ b/docs/en/programmers/api-functions/api-unregister-object.xml
@@ -0,0 +1,34 @@
+
+
+
+ unregister_object
+
+
+ void unregister_object
+ string object_name
+
+
+
+ Use this to unregister an object.
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-functions/api-unregister-outputfilter.xml b/docs/en/programmers/api-functions/api-unregister-outputfilter.xml
new file mode 100644
index 00000000..c3438f7d
--- /dev/null
+++ b/docs/en/programmers/api-functions/api-unregister-outputfilter.xml
@@ -0,0 +1,34 @@
+
+
+
+ unregister_outputfilter
+
+
+ void unregister_outputfilter
+ string function_name
+
+
+
+ Use this to dynamically unregister an output filter.
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-functions/api-unregister-postfilter.xml b/docs/en/programmers/api-functions/api-unregister-postfilter.xml
new file mode 100644
index 00000000..cca256d1
--- /dev/null
+++ b/docs/en/programmers/api-functions/api-unregister-postfilter.xml
@@ -0,0 +1,34 @@
+
+
+
+ unregister_postfilter
+
+
+ void unregister_postfilter
+ string function_name
+
+
+
+ Use this to dynamically unregister a postfilter.
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-functions/api-unregister-prefilter.xml b/docs/en/programmers/api-functions/api-unregister-prefilter.xml
new file mode 100644
index 00000000..60be265a
--- /dev/null
+++ b/docs/en/programmers/api-functions/api-unregister-prefilter.xml
@@ -0,0 +1,34 @@
+
+
+
+ unregister_prefilter
+
+
+ void unregister_prefilter
+ string function_name
+
+
+
+ Use this to dynamically unregister a prefilter.
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-functions/api-unregister-resource.xml b/docs/en/programmers/api-functions/api-unregister-resource.xml
new file mode 100644
index 00000000..00656004
--- /dev/null
+++ b/docs/en/programmers/api-functions/api-unregister-resource.xml
@@ -0,0 +1,45 @@
+
+
+
+ unregister_resource
+
+
+ void unregister_resource
+ string name
+
+
+
+ Use this to dynamically unregister a resource plugin. Pass in the
+ name of the resource.
+
+
+unregister_resource
+
+unregister_resource("db");
+?>
+]]>
+
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-variables.xml b/docs/en/programmers/api-variables.xml
index fad0dfa1..5aee5930 100644
--- a/docs/en/programmers/api-variables.xml
+++ b/docs/en/programmers/api-variables.xml
@@ -3,479 +3,42 @@
Variables
-
- $template_dir
-
- This is the name of the default template directory. If you do
- not supply a resource type when including files, they will be
- found here. By default this is "./templates", meaning that it
- will look for the templates directory in the same directory as
- the executing php script.
-
-
- Technical Note
-
- It is not recommended to put this directory under
- the web server document root.
-
-
-
-
- $compile_dir
-
- This is the name of the directory where compiled templates are
- located. By default this is "./templates_c", meaning that it
- will look for the compile directory in the same directory as
- the executing php script.
-
-
- Technical Note
-
- This setting must be either a relative or
- absolute path. include_path is not used for writing files.
-
-
-
- Technical Note
-
- It is not recommended to put this directory under
- the web server document root.
-
-
-
-
- $config_dir
-
- This is the directory used to store config files used in the
- templates. Default is "./configs", meaning that it will look
- for the configs directory in the same directory as the
- executing php script.
-
-
- Technical Note
-
- It is not recommended to put this directory under
- the web server document root.
-
-
-
-
- $plugins_dir
-
- This is the directories where Smarty will look for the plugins that it
- needs. Default is "plugins" under the SMARTY_DIR. If you supply a
- relative path, Smarty will first look under the SMARTY_DIR, then
- relative to the cwd (current working directory), then relative to each
- entry in your PHP include path.
-
-
- Technical Note
-
- For best performance, do not setup your plugins_dir to have to use the
- PHP include path. Use an absolute pathname, or a path relative to
- SMARTY_DIR or the cwd.
-
-
-
-
- $debugging
-
- This enables the debugging console.
- The console is a javascript window that informs you of the
- included templates and assigned variables for the current
- template page.
-
-
-
- $debug_tpl
-
- This is the name of the template file used for the debugging console. By
- default, it is named debug.tpl and is located in the SMARTY_DIR.
-
-
-
- $debugging_ctrl
-
- This allows alternate ways to enable debugging. NONE means no
- alternate methods are allowed. URL means when the keyword
- SMARTY_DEBUG is found in the QUERY_STRING, debugging is enabled
- for that invocation of the script. If $debugging is true, this
- value is ignored.
-
-
-
- $undefined
-
- This sets the value of $undefined for Smarty, default is null.
- Currently this is only used to set undefined variables in
- $global_assign to a default value.
-
-
-
- $autoload_filters
-
- If there are some filters that you wish to load on every template
- invocation, you can specify them using this variable and Smarty will
- automatically load them for you. The variable is an associative array
- where keys are filter types and values are arrays of the filter
- names. For example:
-
-
-autoload_filters = array('pre' => array('trim', 'stamp'),
- 'output' => array('convert'));
-?>
-]]>
-
-
-
-
-
- $compile_check
-
- Upon each invocation of the PHP application, Smarty tests to see if the
- current template has changed (different time stamp) since the last time
- it was compiled. If it has changed, it recompiles that template. If the
- template has not been compiled, it will compile regardless of this
- setting. By default this variable is set to true. Once an application is
- put into production (templates won't be changing), the compile_check
- step is no longer needed. Be sure to set $compile_check to "false" for
- maximal performance. Note that if you change this to "false" and a
- template file is changed, you will *not* see the change since the
- template will not get recompiled. If caching is enabled and
- compile_check is enabled, then the cache files will get regenerated if
- an involved template file or config file was updated. See $force_compile or clear_compiled_tpl.
-
-
-
- $force_compile
-
- This forces Smarty to (re)compile templates on every
- invocation. This setting overrides $compile_check. By default
- this is disabled. This is handy for development and debugging.
- It should never be used in a production environment. If caching
- is enabled, the cache file(s) will be regenerated every time.
-
-
-
- $caching
-
- This tells Smarty whether or not to cache the output of the templates.
- By default this is set to 0, or disabled. If your templates generate
- redundant redundant content, it is advisable to turn on caching. This
- will result in significant performance gains. You can also have multiple
- caches for the same template. A value of 1 or 2 enables caching. 1 tells
- Smarty to use the current $cache_lifetime variable to determine if the
- cache has expired. A value of 2 tells Smarty to use the cache_lifetime
- value at the time the cache was generated. This way you can set the
- cache_lifetime just before fetching the template to have granular
- control over when that particular cache expires. See also is_cached.
-
-
- If $compile_check is enabled, the cached content will be regenerated if
- any of the templates or config files that are part of this cache are
- changed. If $force_compile is enabled, the cached content will always be
- regenerated.
-
-
-
- $cache_dir
-
- This is the name of the directory where template caches are
- stored. By default this is "./cache", meaning that it will look
- for the cache directory in the same directory as the executing
- php script. You can also use your own custom cache handler
- function to control cache files, which will ignore this
- setting.
-
-
- Technical Note
-
- This setting must be either a relative or
- absolute path. include_path is not used for writing files.
-
-
-
- Technical Note
-
- It is not recommended to put this directory under
- the web server document root.
-
-
-
-
- $cache_lifetime
-
- This is the length of time in seconds that a template cache is valid.
- Once this time has expired, the cache will be regenerated. $caching must
- be set to "true" for $cache_lifetime to have any purpose. A value of -1
- will force the cache to never expire. A value of 0 will cause the cache
- to always regenerate (good for testing only, to disable caching a more
- efficient method is to set $caching = false.)
-
-
- If $force_compile is
- enabled, the cache files will be regenerated every time, effectively
- disabling caching. You can clear all the cache files with the clear_all_cache() function, or
- individual cache files (or groups) with the clear_cache() function.
-
-
- Technical Note
-
- If you want to give certain templates their own cache lifetime, you could
- do this by setting $caching = 2,
- then set $cache_lifetime to a unique value just before calling display()
- or fetch().
-
-
-
-
- $cache_handler_func
-
- You can supply a custom function to handle cache files instead
- of using the built-in method using the $cache_dir. See the
- custom cache
- handler function section for details.
-
-
-
- $cache_modified_check
-
- If set to true, Smarty will respect the If-Modified-Since
- header sent from the client. If the cached file timestamp has
- not changed since the last visit, then a "304 Not Modified"
- header will be sent instead of the content. This works only on
- cached content without insert tags.
-
-
-
- $config_overwrite
-
- If set to true, variables read in from config files will overwrite each
- other. Otherwise, the variables will be pushed onto an array. This is
- helpful if you want to store arrays of data in config files, just list
- each element multiple times. true by default.
-
-
-
- $config_booleanize
-
- If set to true, config file values of on/true/yes and off/false/no get
- converted to boolean values automatically. This way you can use the
- values in the template like so: {if #foobar#} ... {/if}. If foobar was
- on, true or yes, the {if} statement will execute. true by default.
-
-
-
- $config_read_hidden
-
- If set to true, hidden sections (section names beginning with a period)
- in config files can be read from templates. Typically you would leave
- this false, that way you can store sensitive data in the config files
- such as database parameters and not worry about the template loading
- them. false by default.
-
-
-
- $config_fix_newlines
-
- If set to true, mac and dos newlines (\r and \r\n) in config files are
- converted to \n when they are parsed. true by default.
-
-
-
- $default_template_handler_func
-
- This function is called when a template cannot be obtained from
- its resource.
-
-
-
- $php_handling
-
- This tells Smarty how to handle PHP code embedded in the
- templates. There are four possible settings, default being
- SMARTY_PHP_PASSTHRU. Note that this does NOT affect php code
- within {php}{/php}
- tags in the template.
-
-
- SMARTY_PHP_PASSTHRU - Smarty echos tags as-is.
- SMARTY_PHP_QUOTE - Smarty quotes the tags as
- html entities.
- SMARTY_PHP_REMOVE - Smarty removes the tags from
- the templates.
- SMARTY_PHP_ALLOW - Smarty will execute the tags
- as PHP code.
-
-
- NOTE: Embedding PHP code into templates is highly discouraged.
- Use custom functions or
- modifiers instead.
-
-
-
- $security
-
- $security true/false, default is false. Security is good for
- situations when you have untrusted parties editing the templates
- (via ftp for example) and you want to reduce the risk of system
- security compromises through the template language. Turning on
- security enforces the following rules to the template language,
- unless specifially overridden with $security_settings:
-
-
- If $php_handling is set to SMARTY_PHP_ALLOW, this is
- implicitly changed to SMARTY_PHP_PASSTHRU
- PHP functions are not allowed in IF statements,
- except those specified in the $security_settings
- templates can only be included from directories
- listed in the $secure_dir array
- local files can only be fetched from directories
- listed in the $secure_dir array using {fetch}
- {php}{/php} tags are not allowed
- PHP functions are not allowed as modifiers, except
- those specified in the $security_settings
-
-
-
- $secure_dir
-
- This is an array of all local directories that are considered
- secure. {include} and {fetch} use this when security is enabled.
-
-
-
- $security_settings
-
- These are used to override or specify the security settings when
- security is enabled. These are the possible settings:
-
-
- PHP_HANDLING - true/false. If set to true, the
- $php_handling setting is not checked for security.
- IF_FUNCS - This is an array of the names of permitted
- PHP functions in IF statements.
- INCLUDE_ANY - true/false. If set to true, any
- template can be included from the file system, regardless of the
- $secure_dir list.
- PHP_TAGS - true/false. If set to true, {php}{/php}
- tags are permitted in the templates.
- MODIFIER_FUNCS - This is an array of the names of permitted
- PHP functions used as variable modifiers.
-
-
-
- $trusted_dir
-
- $trusted_dir is only for use when $security is enabled. This is an array
- of all directories that are considered trusted. Trusted directories are
- where you keep php scripts that are executed directly from the templates
- with {include_php}.
-
-
-
- $left_delimiter
-
- This is the left delimiter used by the template language.
- Default is "{".
-
-
-
- $right_delimiter
-
- This is the right delimiter used by the template language.
- Default is "}".
-
-
-
- $compiler_class
-
- Specifies the name of the compiler class that Smarty will use
- to compile the templates. The default is 'Smarty_Compiler'. For
- advanced users only.
-
-
-
- $request_vars_order
-
- The order in which request variables are registered, similar to
- variables_order in php.ini
-
-
-
- $request_use_auto_globals
-
- Specifies if Smarty should use php's $HTTP_*_VARS[]
- ($request_use_auto_globals=false which is the default value) or
- $_*[] ($request_use_auto_globals=true). This affects templates
- that make use of {$smarty.request.*}, {$smarty.get.*} etc. .
- Caution: If you set $request_use_auto_globals to true, variable.request.vars.order
- has no effect but php's configuration value
- gpc_order is used.
-
-
-
- $error_reporting
-
- When this value is set to a non-null-value it's value is
- used as php's error_reporting-level inside of display() and
- fetch(). When debugging is enabled this value is ignored
- and the error-level is left untouched.
-
-
-
- $compile_id
-
- Persistant compile identifier. As an alternative to passing the same
- compile_id to each and every function call, you can set this compile_id
- and it will be used implicitly thereafter.
-
-
-
- $use_sub_dirs
-
- Set this to false if your PHP environment does not allow the creation of
- sub directories by Smarty. Sub directories are more efficient, so use them
- if you can.
-
-
- Technical Note
-
- Since Smarty-2.6.2 use_sub_dirs defaults to false.
-
-
-
-
- $default_modifiers
-
- This is an array of modifiers to implicitly apply to every variable in a
- template. For example, to HTML-escape every variable by default, use
- array('escape:"htmlall"'); To make a variable exempt from default
- modifiers, pass the special "smarty" modifier with a parameter value of
- "nodefaults" modifier to it, such as
- {$var|smarty:nodefaults}.
-
-
-
- $default_resource_type
-
- This tells smarty what resource type to use implicitly. The default value
- is 'file', meaning that $smarty->display('index.tpl'); and
- $smarty->display('file:index.tpl'); are identical in meaning. See the
- resource chapter for details.
-
-
+&programmers.api-variables.variable-template-dir;
+&programmers.api-variables.variable-compile-dir;
+&programmers.api-variables.variable-config-dir;
+&programmers.api-variables.variable-plugins-dir;
+&programmers.api-variables.variable-debugging;
+&programmers.api-variables.variable-debug-tpl;
+&programmers.api-variables.variable-debugging-ctrl;
+&programmers.api-variables.variable-undefined;
+&programmers.api-variables.variable-autoload-filters;
+&programmers.api-variables.variable-compile-check;
+&programmers.api-variables.variable-force-compile;
+&programmers.api-variables.variable-caching;
+&programmers.api-variables.variable-cache-dir;
+&programmers.api-variables.variable-cache-lifetime;
+&programmers.api-variables.variable-cache-handler-func;
+&programmers.api-variables.variable-cache-modified-check;
+&programmers.api-variables.variable-config-overwrite;
+&programmers.api-variables.variable-config-booleanize;
+&programmers.api-variables.variable-config-read-hidden;
+&programmers.api-variables.variable-config-fix-newlines;
+&programmers.api-variables.variable-default-template-handler-func;
+&programmers.api-variables.variable-php-handling;
+&programmers.api-variables.variable-security;
+&programmers.api-variables.variable-secure-dir;
+&programmers.api-variables.variable-security-settings;
+&programmers.api-variables.variable-trusted-dir;
+&programmers.api-variables.variable-left-delimiter;
+&programmers.api-variables.variable-right-delimiter;
+&programmers.api-variables.variable-compiler-class;
+&programmers.api-variables.variable-request-vars-order;
+&programmers.api-variables.variable-request-use-auto-globals;
+&programmers.api-variables.variable-error-reporting;
+&programmers.api-variables.variable-compile-id;
+&programmers.api-variables.variable-use-sub-dirs;
+&programmers.api-variables.variable-default-modifiers;
+&programmers.api-variables.variable-default-resource-type;
+
+ $autoload_filters
+
+ If there are some filters that you wish to load on every template
+ invocation, you can specify them using this variable and Smarty will
+ automatically load them for you. The variable is an associative array
+ where keys are filter types and values are arrays of the filter
+ names. For example:
+
+
+autoload_filters = array('pre' => array('trim', 'stamp'),
+ 'output' => array('convert'));
+?>
+]]>
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-variables/variable-cache-dir.xml b/docs/en/programmers/api-variables/variable-cache-dir.xml
new file mode 100644
index 00000000..8796cf39
--- /dev/null
+++ b/docs/en/programmers/api-variables/variable-cache-dir.xml
@@ -0,0 +1,47 @@
+
+
+
+ $cache_dir
+
+ This is the name of the directory where template caches are
+ stored. By default this is "./cache", meaning that it will look
+ for the cache directory in the same directory as the executing
+ php script. You can also use your own custom cache handler
+ function to control cache files, which will ignore this
+ setting.
+
+
+ Technical Note
+
+ This setting must be either a relative or
+ absolute path. include_path is not used for writing files.
+
+
+
+ Technical Note
+
+ It is not recommended to put this directory under
+ the web server document root.
+
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-variables/variable-cache-handler-func.xml b/docs/en/programmers/api-variables/variable-cache-handler-func.xml
new file mode 100644
index 00000000..193463b3
--- /dev/null
+++ b/docs/en/programmers/api-variables/variable-cache-handler-func.xml
@@ -0,0 +1,31 @@
+
+
+
+ $cache_handler_func
+
+ You can supply a custom function to handle cache files instead
+ of using the built-in method using the $cache_dir. See the
+ custom cache
+ handler function section for details.
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-variables/variable-cache-lifetime.xml b/docs/en/programmers/api-variables/variable-cache-lifetime.xml
new file mode 100644
index 00000000..489921a3
--- /dev/null
+++ b/docs/en/programmers/api-variables/variable-cache-lifetime.xml
@@ -0,0 +1,51 @@
+
+
+
+ $cache_lifetime
+
+ This is the length of time in seconds that a template cache is valid.
+ Once this time has expired, the cache will be regenerated. $caching must
+ be set to "true" for $cache_lifetime to have any purpose. A value of -1
+ will force the cache to never expire. A value of 0 will cause the cache
+ to always regenerate (good for testing only, to disable caching a more
+ efficient method is to set $caching = false.)
+
+
+ If $force_compile is
+ enabled, the cache files will be regenerated every time, effectively
+ disabling caching. You can clear all the cache files with the clear_all_cache() function, or
+ individual cache files (or groups) with the clear_cache() function.
+
+
+ Technical Note
+
+ If you want to give certain templates their own cache lifetime, you could
+ do this by setting $caching = 2,
+ then set $cache_lifetime to a unique value just before calling display()
+ or fetch().
+
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-variables/variable-cache-modified-check.xml b/docs/en/programmers/api-variables/variable-cache-modified-check.xml
new file mode 100644
index 00000000..dd6687f1
--- /dev/null
+++ b/docs/en/programmers/api-variables/variable-cache-modified-check.xml
@@ -0,0 +1,32 @@
+
+
+
+ $cache_modified_check
+
+ If set to true, Smarty will respect the If-Modified-Since
+ header sent from the client. If the cached file timestamp has
+ not changed since the last visit, then a "304 Not Modified"
+ header will be sent instead of the content. This works only on
+ cached content without insert tags.
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-variables/variable-caching.xml b/docs/en/programmers/api-variables/variable-caching.xml
new file mode 100644
index 00000000..0fb75fa2
--- /dev/null
+++ b/docs/en/programmers/api-variables/variable-caching.xml
@@ -0,0 +1,44 @@
+
+
+
+ $caching
+
+ This tells Smarty whether or not to cache the output of the templates.
+ By default this is set to 0, or disabled. If your templates generate
+ redundant redundant content, it is advisable to turn on caching. This
+ will result in significant performance gains. You can also have multiple
+ caches for the same template. A value of 1 or 2 enables caching. 1 tells
+ Smarty to use the current $cache_lifetime variable to determine if the
+ cache has expired. A value of 2 tells Smarty to use the cache_lifetime
+ value at the time the cache was generated. This way you can set the
+ cache_lifetime just before fetching the template to have granular
+ control over when that particular cache expires. See also is_cached.
+
+
+ If $compile_check is enabled, the cached content will be regenerated if
+ any of the templates or config files that are part of this cache are
+ changed. If $force_compile is enabled, the cached content will always be
+ regenerated.
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-variables/variable-compile-check.xml b/docs/en/programmers/api-variables/variable-compile-check.xml
new file mode 100644
index 00000000..23efbe78
--- /dev/null
+++ b/docs/en/programmers/api-variables/variable-compile-check.xml
@@ -0,0 +1,41 @@
+
+
+
+ $compile_check
+
+ Upon each invocation of the PHP application, Smarty tests to see if the
+ current template has changed (different time stamp) since the last time
+ it was compiled. If it has changed, it recompiles that template. If the
+ template has not been compiled, it will compile regardless of this
+ setting. By default this variable is set to true. Once an application is
+ put into production (templates won't be changing), the compile_check
+ step is no longer needed. Be sure to set $compile_check to "false" for
+ maximal performance. Note that if you change this to "false" and a
+ template file is changed, you will *not* see the change since the
+ template will not get recompiled. If caching is enabled and
+ compile_check is enabled, then the cache files will get regenerated if
+ an involved template file or config file was updated. See $force_compile or clear_compiled_tpl.
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-variables/variable-compile-dir.xml b/docs/en/programmers/api-variables/variable-compile-dir.xml
new file mode 100644
index 00000000..f0fc0550
--- /dev/null
+++ b/docs/en/programmers/api-variables/variable-compile-dir.xml
@@ -0,0 +1,45 @@
+
+
+
+ $compile_dir
+
+ This is the name of the directory where compiled templates are
+ located. By default this is "./templates_c", meaning that it
+ will look for the compile directory in the same directory as
+ the executing php script.
+
+
+ Technical Note
+
+ This setting must be either a relative or
+ absolute path. include_path is not used for writing files.
+
+
+
+ Technical Note
+
+ It is not recommended to put this directory under
+ the web server document root.
+
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-variables/variable-compile-id.xml b/docs/en/programmers/api-variables/variable-compile-id.xml
new file mode 100644
index 00000000..3b0b12ae
--- /dev/null
+++ b/docs/en/programmers/api-variables/variable-compile-id.xml
@@ -0,0 +1,30 @@
+
+
+
+ $compile_id
+
+ Persistant compile identifier. As an alternative to passing the same
+ compile_id to each and every function call, you can set this compile_id
+ and it will be used implicitly thereafter.
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-variables/variable-compiler-class.xml b/docs/en/programmers/api-variables/variable-compiler-class.xml
new file mode 100644
index 00000000..076822b4
--- /dev/null
+++ b/docs/en/programmers/api-variables/variable-compiler-class.xml
@@ -0,0 +1,30 @@
+
+
+
+ $compiler_class
+
+ Specifies the name of the compiler class that Smarty will use
+ to compile the templates. The default is 'Smarty_Compiler'. For
+ advanced users only.
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-variables/variable-config-booleanize.xml b/docs/en/programmers/api-variables/variable-config-booleanize.xml
new file mode 100644
index 00000000..966719f4
--- /dev/null
+++ b/docs/en/programmers/api-variables/variable-config-booleanize.xml
@@ -0,0 +1,31 @@
+
+
+
+ $config_booleanize
+
+ If set to true, config file values of on/true/yes and off/false/no get
+ converted to boolean values automatically. This way you can use the
+ values in the template like so: {if #foobar#} ... {/if}. If foobar was
+ on, true or yes, the {if} statement will execute. true by default.
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-variables/variable-config-dir.xml b/docs/en/programmers/api-variables/variable-config-dir.xml
new file mode 100644
index 00000000..1531fe5f
--- /dev/null
+++ b/docs/en/programmers/api-variables/variable-config-dir.xml
@@ -0,0 +1,38 @@
+
+
+
+ $config_dir
+
+ This is the directory used to store config files used in the
+ templates. Default is "./configs", meaning that it will look
+ for the configs directory in the same directory as the
+ executing php script.
+
+
+ Technical Note
+
+ It is not recommended to put this directory under
+ the web server document root.
+
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-variables/variable-config-fix-newlines.xml b/docs/en/programmers/api-variables/variable-config-fix-newlines.xml
new file mode 100644
index 00000000..fd889472
--- /dev/null
+++ b/docs/en/programmers/api-variables/variable-config-fix-newlines.xml
@@ -0,0 +1,29 @@
+
+
+
+ $config_fix_newlines
+
+ If set to true, mac and dos newlines (\r and \r\n) in config files are
+ converted to \n when they are parsed. true by default.
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-variables/variable-config-overwrite.xml b/docs/en/programmers/api-variables/variable-config-overwrite.xml
new file mode 100644
index 00000000..882fcf8d
--- /dev/null
+++ b/docs/en/programmers/api-variables/variable-config-overwrite.xml
@@ -0,0 +1,31 @@
+
+
+
+ $config_overwrite
+
+ If set to true, variables read in from config files will overwrite each
+ other. Otherwise, the variables will be pushed onto an array. This is
+ helpful if you want to store arrays of data in config files, just list
+ each element multiple times. true by default.
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-variables/variable-config-read-hidden.xml b/docs/en/programmers/api-variables/variable-config-read-hidden.xml
new file mode 100644
index 00000000..cb42e91e
--- /dev/null
+++ b/docs/en/programmers/api-variables/variable-config-read-hidden.xml
@@ -0,0 +1,32 @@
+
+
+
+ $config_read_hidden
+
+ If set to true, hidden sections (section names beginning with a period)
+ in config files can be read from templates. Typically you would leave
+ this false, that way you can store sensitive data in the config files
+ such as database parameters and not worry about the template loading
+ them. false by default.
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-variables/variable-debug-tpl.xml b/docs/en/programmers/api-variables/variable-debug-tpl.xml
new file mode 100644
index 00000000..53a67266
--- /dev/null
+++ b/docs/en/programmers/api-variables/variable-debug-tpl.xml
@@ -0,0 +1,30 @@
+
+
+
+ $debug_tpl
+
+ This is the name of the template file used for the debugging console. By
+ default, it is named debug.tpl and is located in the SMARTY_DIR.
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-variables/variable-debugging-ctrl.xml b/docs/en/programmers/api-variables/variable-debugging-ctrl.xml
new file mode 100644
index 00000000..2bb08022
--- /dev/null
+++ b/docs/en/programmers/api-variables/variable-debugging-ctrl.xml
@@ -0,0 +1,32 @@
+
+
+
+ $debugging_ctrl
+
+ This allows alternate ways to enable debugging. NONE means no
+ alternate methods are allowed. URL means when the keyword
+ SMARTY_DEBUG is found in the QUERY_STRING, debugging is enabled
+ for that invocation of the script. If $debugging is true, this
+ value is ignored.
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-variables/variable-debugging.xml b/docs/en/programmers/api-variables/variable-debugging.xml
new file mode 100644
index 00000000..0da2573c
--- /dev/null
+++ b/docs/en/programmers/api-variables/variable-debugging.xml
@@ -0,0 +1,32 @@
+
+
+
+ $debugging
+
+ This enables the debugging console.
+ The console is a javascript window that informs you of the
+ included templates and assigned variables for the current
+ template page.
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-variables/variable-default-modifiers.xml b/docs/en/programmers/api-variables/variable-default-modifiers.xml
new file mode 100644
index 00000000..c068cd02
--- /dev/null
+++ b/docs/en/programmers/api-variables/variable-default-modifiers.xml
@@ -0,0 +1,33 @@
+
+
+
+ $default_modifiers
+
+ This is an array of modifiers to implicitly apply to every variable in a
+ template. For example, to HTML-escape every variable by default, use
+ array('escape:"htmlall"'); To make a variable exempt from default
+ modifiers, pass the special "smarty" modifier with a parameter value of
+ "nodefaults" modifier to it, such as
+ {$var|smarty:nodefaults}.
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-variables/variable-default-resource-type.xml b/docs/en/programmers/api-variables/variable-default-resource-type.xml
new file mode 100644
index 00000000..47e75df1
--- /dev/null
+++ b/docs/en/programmers/api-variables/variable-default-resource-type.xml
@@ -0,0 +1,31 @@
+
+
+
+ $default_resource_type
+
+ This tells smarty what resource type to use implicitly. The default value
+ is 'file', meaning that $smarty->display('index.tpl'); and
+ $smarty->display('file:index.tpl'); are identical in meaning. See the
+ resource chapter for details.
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-variables/variable-default-template-handler-func.xml b/docs/en/programmers/api-variables/variable-default-template-handler-func.xml
new file mode 100644
index 00000000..d508ac6b
--- /dev/null
+++ b/docs/en/programmers/api-variables/variable-default-template-handler-func.xml
@@ -0,0 +1,29 @@
+
+
+
+ $default_template_handler_func
+
+ This function is called when a template cannot be obtained from
+ its resource.
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-variables/variable-error-reporting.xml b/docs/en/programmers/api-variables/variable-error-reporting.xml
new file mode 100644
index 00000000..4d99d854
--- /dev/null
+++ b/docs/en/programmers/api-variables/variable-error-reporting.xml
@@ -0,0 +1,31 @@
+
+
+
+ $error_reporting
+
+ When this value is set to a non-null-value it's value is
+ used as php's error_reporting-level inside of display() and
+ fetch(). When debugging is enabled this value is ignored
+ and the error-level is left untouched.
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-variables/variable-force-compile.xml b/docs/en/programmers/api-variables/variable-force-compile.xml
new file mode 100644
index 00000000..51df1dd9
--- /dev/null
+++ b/docs/en/programmers/api-variables/variable-force-compile.xml
@@ -0,0 +1,32 @@
+
+
+
+ $force_compile
+
+ This forces Smarty to (re)compile templates on every
+ invocation. This setting overrides $compile_check. By default
+ this is disabled. This is handy for development and debugging.
+ It should never be used in a production environment. If caching
+ is enabled, the cache file(s) will be regenerated every time.
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-variables/variable-left-delimiter.xml b/docs/en/programmers/api-variables/variable-left-delimiter.xml
new file mode 100644
index 00000000..3e2399ba
--- /dev/null
+++ b/docs/en/programmers/api-variables/variable-left-delimiter.xml
@@ -0,0 +1,29 @@
+
+
+
+ $left_delimiter
+
+ This is the left delimiter used by the template language.
+ Default is "{".
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-variables/variable-php-handling.xml b/docs/en/programmers/api-variables/variable-php-handling.xml
new file mode 100644
index 00000000..df11594d
--- /dev/null
+++ b/docs/en/programmers/api-variables/variable-php-handling.xml
@@ -0,0 +1,46 @@
+
+
+
+ $php_handling
+
+ This tells Smarty how to handle PHP code embedded in the
+ templates. There are four possible settings, default being
+ SMARTY_PHP_PASSTHRU. Note that this does NOT affect php code
+ within {php}{/php}
+ tags in the template.
+
+
+ SMARTY_PHP_PASSTHRU - Smarty echos tags as-is.
+ SMARTY_PHP_QUOTE - Smarty quotes the tags as
+ html entities.
+ SMARTY_PHP_REMOVE - Smarty removes the tags from
+ the templates.
+ SMARTY_PHP_ALLOW - Smarty will execute the tags
+ as PHP code.
+
+
+ NOTE: Embedding PHP code into templates is highly discouraged.
+ Use custom functions or
+ modifiers instead.
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-variables/variable-plugins-dir.xml b/docs/en/programmers/api-variables/variable-plugins-dir.xml
new file mode 100644
index 00000000..36f4d98f
--- /dev/null
+++ b/docs/en/programmers/api-variables/variable-plugins-dir.xml
@@ -0,0 +1,40 @@
+
+
+
+ $plugins_dir
+
+ This is the directories where Smarty will look for the plugins that it
+ needs. Default is "plugins" under the SMARTY_DIR. If you supply a
+ relative path, Smarty will first look under the SMARTY_DIR, then
+ relative to the cwd (current working directory), then relative to each
+ entry in your PHP include path.
+
+
+ Technical Note
+
+ For best performance, do not setup your plugins_dir to have to use the
+ PHP include path. Use an absolute pathname, or a path relative to
+ SMARTY_DIR or the cwd.
+
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-variables/variable-request-use-auto-globals.xml b/docs/en/programmers/api-variables/variable-request-use-auto-globals.xml
new file mode 100644
index 00000000..1c217e5b
--- /dev/null
+++ b/docs/en/programmers/api-variables/variable-request-use-auto-globals.xml
@@ -0,0 +1,35 @@
+
+
+
+ $request_use_auto_globals
+
+ Specifies if Smarty should use php's $HTTP_*_VARS[]
+ ($request_use_auto_globals=false which is the default value) or
+ $_*[] ($request_use_auto_globals=true). This affects templates
+ that make use of {$smarty.request.*}, {$smarty.get.*} etc. .
+ Caution: If you set $request_use_auto_globals to true, variable.request.vars.order
+ has no effect but php's configuration value
+ gpc_order is used.
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-variables/variable-request-vars-order.xml b/docs/en/programmers/api-variables/variable-request-vars-order.xml
new file mode 100644
index 00000000..ca671cd0
--- /dev/null
+++ b/docs/en/programmers/api-variables/variable-request-vars-order.xml
@@ -0,0 +1,29 @@
+
+
+
+ $request_vars_order
+
+ The order in which request variables are registered, similar to
+ variables_order in php.ini
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-variables/variable-right-delimiter.xml b/docs/en/programmers/api-variables/variable-right-delimiter.xml
new file mode 100644
index 00000000..95316641
--- /dev/null
+++ b/docs/en/programmers/api-variables/variable-right-delimiter.xml
@@ -0,0 +1,29 @@
+
+
+
+ $right_delimiter
+
+ This is the right delimiter used by the template language.
+ Default is "}".
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-variables/variable-secure-dir.xml b/docs/en/programmers/api-variables/variable-secure-dir.xml
new file mode 100644
index 00000000..2f3b1f80
--- /dev/null
+++ b/docs/en/programmers/api-variables/variable-secure-dir.xml
@@ -0,0 +1,29 @@
+
+
+
+ $secure_dir
+
+ This is an array of all local directories that are considered
+ secure. {include} and {fetch} use this when security is enabled.
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-variables/variable-security-settings.xml b/docs/en/programmers/api-variables/variable-security-settings.xml
new file mode 100644
index 00000000..6d19a807
--- /dev/null
+++ b/docs/en/programmers/api-variables/variable-security-settings.xml
@@ -0,0 +1,42 @@
+
+
+
+ $security_settings
+
+ These are used to override or specify the security settings when
+ security is enabled. These are the possible settings:
+
+
+ PHP_HANDLING - true/false. If set to true, the
+ $php_handling setting is not checked for security.
+ IF_FUNCS - This is an array of the names of permitted
+ PHP functions in IF statements.
+ INCLUDE_ANY - true/false. If set to true, any
+ template can be included from the file system, regardless of the
+ $secure_dir list.
+ PHP_TAGS - true/false. If set to true, {php}{/php}
+ tags are permitted in the templates.
+ MODIFIER_FUNCS - This is an array of the names of permitted
+ PHP functions used as variable modifiers.
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-variables/variable-security.xml b/docs/en/programmers/api-variables/variable-security.xml
new file mode 100644
index 00000000..66e56847
--- /dev/null
+++ b/docs/en/programmers/api-variables/variable-security.xml
@@ -0,0 +1,46 @@
+
+
+
+ $security
+
+ $security true/false, default is false. Security is good for
+ situations when you have untrusted parties editing the templates
+ (via ftp for example) and you want to reduce the risk of system
+ security compromises through the template language. Turning on
+ security enforces the following rules to the template language,
+ unless specifially overridden with $security_settings:
+
+
+ If $php_handling is set to SMARTY_PHP_ALLOW, this is
+ implicitly changed to SMARTY_PHP_PASSTHRU
+ PHP functions are not allowed in IF statements,
+ except those specified in the $security_settings
+ templates can only be included from directories
+ listed in the $secure_dir array
+ local files can only be fetched from directories
+ listed in the $secure_dir array using {fetch}
+ {php}{/php} tags are not allowed
+ PHP functions are not allowed as modifiers, except
+ those specified in the $security_settings
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-variables/variable-template-dir.xml b/docs/en/programmers/api-variables/variable-template-dir.xml
new file mode 100644
index 00000000..db48dafd
--- /dev/null
+++ b/docs/en/programmers/api-variables/variable-template-dir.xml
@@ -0,0 +1,39 @@
+
+
+
+ $template_dir
+
+ This is the name of the default template directory. If you do
+ not supply a resource type when including files, they will be
+ found here. By default this is "./templates", meaning that it
+ will look for the templates directory in the same directory as
+ the executing php script.
+
+
+ Technical Note
+
+ It is not recommended to put this directory under
+ the web server document root.
+
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-variables/variable-trusted-dir.xml b/docs/en/programmers/api-variables/variable-trusted-dir.xml
new file mode 100644
index 00000000..6c042cd7
--- /dev/null
+++ b/docs/en/programmers/api-variables/variable-trusted-dir.xml
@@ -0,0 +1,31 @@
+
+
+
+ $trusted_dir
+
+ $trusted_dir is only for use when $security is enabled. This is an array
+ of all directories that are considered trusted. Trusted directories are
+ where you keep php scripts that are executed directly from the templates
+ with {include_php}.
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-variables/variable-undefined.xml b/docs/en/programmers/api-variables/variable-undefined.xml
new file mode 100644
index 00000000..e607f498
--- /dev/null
+++ b/docs/en/programmers/api-variables/variable-undefined.xml
@@ -0,0 +1,30 @@
+
+
+
+ $undefined
+
+ This sets the value of $undefined for Smarty, default is null.
+ Currently this is only used to set undefined variables in
+ $global_assign to a default value.
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/api-variables/variable-use-sub-dirs.xml b/docs/en/programmers/api-variables/variable-use-sub-dirs.xml
new file mode 100644
index 00000000..4e440f7e
--- /dev/null
+++ b/docs/en/programmers/api-variables/variable-use-sub-dirs.xml
@@ -0,0 +1,36 @@
+
+
+
+ $use_sub_dirs
+
+ Set this to false if your PHP environment does not allow the creation of
+ sub directories by Smarty. Sub directories are more efficient, so use them
+ if you can.
+
+
+ Technical Note
+
+ Since Smarty-2.6.2 use_sub_dirs defaults to false.
+
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/caching.xml b/docs/en/programmers/caching.xml
index 6040d44d..aa3c5d44 100644
--- a/docs/en/programmers/caching.xml
+++ b/docs/en/programmers/caching.xml
@@ -20,414 +20,11 @@
displaying a page with a weather map containing new information by the
minute, it would not make sense to cache this page.
-
- Setting Up Caching
-
- The first thing to do is enable caching. This is done by setting $caching = true (or 1.)
-
-
- enabling caching
-
-caching = true;
-
-$smarty->display('index.tpl');
-?>
-]]>
-
-
-
- With caching enabled, the function call to display('index.tpl') will render
- the template as usual, but also saves a copy of its output to a file (a
- cached copy) in the $cache_dir.
- Upon the next call to display('index.tpl'), the cached copy will be used
- instead of rendering the template again.
-
-
- Technical Note
-
- The files in the $cache_dir are named similar to the template name.
- Although they end in the ".php" extention, they are not really executable
- php scripts. Do not edit these files!
-
-
-
- Each cached page has a limited lifetime determined by $cache_lifetime. The default value
- is 3600 seconds, or 1 hour. After that time expires, the cache is
- regenerated. It is possible to give individual caches their own expiration
- time by setting $caching = 2. See the documentation on $cache_lifetime for details.
-
-
- setting cache_lifetime per cache
-
-caching = 2; // lifetime is per cache
-
-// set the cache_lifetime for index.tpl to 5 minutes
-$smarty->cache_lifetime = 300;
-$smarty->display('index.tpl');
-
-// set the cache_lifetime for home.tpl to 1 hour
-$smarty->cache_lifetime = 3600;
-$smarty->display('home.tpl');
-
-// NOTE: the following $cache_lifetime setting will not work when $caching = 2.
-// The cache lifetime for home.tpl has already been set
-// to 1 hour, and will no longer respect the value of $cache_lifetime.
-// The home.tpl cache will still expire after 1 hour.
-$smarty->cache_lifetime = 30; // 30 seconds
-$smarty->display('home.tpl');
-?>
-]]>
-
-
-
- If $compile_check is enabled,
- every template file and config file that is involved with the cache file is
- checked for modification. If any of the files have been modified since the
- cache was generated, the cache is immediately regenerated. This is a slight
- overhead so for optimum performance, leave $compile_check set to false.
-
-
- enabling $compile_check
-
-caching = true;
-$smarty->compile_check = true;
-
-$smarty->display('index.tpl');
-?>
-]]>
-
-
-
- If $force_compile is enabled,
- the cache files will always be regenerated. This effectively turns off
- caching. $force_compile is usually for debugging purposes only, a more
- efficient way of disabling caching is to set $caching = false (or 0.)
-
-
- The is_cached() function
- can be used to test if a template has a valid cache or not. If you have a
- cached template that requires something like a database fetch, you can use
- this to skip that process.
-
-
- using is_cached()
-
-caching = true;
-
-if(!$smarty->is_cached('index.tpl')) {
- // No cache available, do variable assignments here.
- $contents = get_database_contents();
- $smarty->assign($contents);
-}
-
-$smarty->display('index.tpl');
-?>
-]]>
-
-
-
- You can keep parts of a page dynamic with the insert template function. Let's
- say the whole page can be cached except for a banner that is displayed down
- the right side of the page. By using an insert function for the banner, you
- can keep this element dynamic within the cached content. See the
- documentation on insert for
- details and examples.
-
-
- You can clear all the cache files with the clear_all_cache() function, or
- individual cache files (or groups) with the clear_cache() function.
-
-
- clearing the cache
-
-caching = true;
-
-// clear out all cache files
-$smarty->clear_all_cache();
-
-// clear only cache for index.tpl
-$smarty->clear_cache('index.tpl');
-
-$smarty->display('index.tpl');
-?>
-]]>
-
-
-
-
- Multiple Caches Per Page
-
- You can have multiple cache files for a single call to display() or
- fetch(). Let's say that a call to display('index.tpl') may have several
- different output contents depending on some condition, and you want
- separate caches for each one. You can do this by passing a cache_id as the
- second parameter to the function call.
-
-
- passing a cache_id to display()
-
-caching = true;
-
-$my_cache_id = $_GET['article_id'];
-
-$smarty->display('index.tpl',$my_cache_id);
-?>
-]]>
-
-
-
- Above, we are passing the variable $my_cache_id to display() as the
- cache_id. For each unique value of $my_cache_id, a separate cache will be
- generated for index.tpl. In this example, "article_id" was passed in the
- URL and is used as the cache_id.
-
-
- Technical Note
-
- Be very cautious when passing values from a client (web browser) into
- Smarty (or any PHP application.) Although the above example of using the
- article_id from the URL looks handy, it could have bad consequences. The
- cache_id is used to create a directory on the file system, so if the user
- decided to pass an extremely large value for article_id, or write a script
- that sends random article_ids at a rapid pace, this could possibly cause
- problems at the server level. Be sure to sanitize any data passed in before
- using it. In this instance, maybe you know the article_id has a length of
- 10 characters and is made up of alpha-numerics only, and must be a valid
- article_id in the database. Check for this!
-
-
-
- Be sure to pass the same cache_id as the
- second parameter to is_cached() and
- clear_cache().
-
-
- passing a cache_id to is_cached()
-
-caching = true;
-
-$my_cache_id = $_GET['article_id'];
-
-if(!$smarty->is_cached('index.tpl',$my_cache_id)) {
- // No cache available, do variable assignments here.
- $contents = get_database_contents();
- $smarty->assign($contents);
-}
-
-$smarty->display('index.tpl',$my_cache_id);
-?>
-]]>
-
-
-
- You can clear all caches for a particular cache_id by passing null as the
- first parameter to clear_cache().
-
-
- clearing all caches for a particular cache_id
-
-caching = true;
-
-// clear all caches with "sports" as the cache_id
-$smarty->clear_cache(null,"sports");
-
-$smarty->display('index.tpl',"sports");
-?>
-]]>
-
-
-
- In this manner, you can "group" your caches together by giving them the
- same cache_id.
-
-
-
- Cache Groups
-
- You can do more elaborate grouping by setting up cache_id groups. This is
- accomplished by separating each sub-group with a vertical bar "|" in the
- cache_id value. You can have as many sub-groups as you like.
-
-
- cache_id groups
-
-caching = true;
-
-// clear all caches with "sports|basketball" as the first two cache_id groups
-$smarty->clear_cache(null,"sports|basketball");
-
-// clear all caches with "sports" as the first cache_id group. This would
-// include "sports|basketball", or "sports|(anything)|(anything)|(anything)|..."
-$smarty->clear_cache(null,"sports");
-
-$smarty->display('index.tpl',"sports|basketball");
-?>
-]]>
-
-
-
- Technical Note
-
- The cache grouping does NOT use the path to the template as any part of the
- cache_id. For example, if you have display('themes/blue/index.tpl'), you
- cannot clear the cache for everything under the "themes/blue" directory. If
- you want to do that, you must group them in the cache_id, such as
- display('themes/blue/index.tpl','themes|blue'); Then you can clear the
- caches for the blue theme with clear_cache(null,'themes|blue');
-
-
-
-
-
- Controlling Cacheability of Plugins' Output
-
-Since Smarty-2.6.0 plugins the cacheability of plugins can be declared
-when registering them. The third parameter to register_block,
-register_compiler_function and register_function is called
-$cacheable and defaults to true which is also
-the behaviour of plugins in Smarty versions before 2.6.0
-
-
-
-When registering a plugin with $cacheable=false the plugin is called everytime the page is displayed, even if the page comes from the cache. The plugin function behaves a little like an insert function.
-
-
-
-In contrast to {insert} the attributes to the plugins are not cached by default. They can be declared to be cached with the fourth parameter $cache_attrs. $cache_attrs is an array of attribute-names that should be cached, so the plugin-function get value as it was the time the page was written to cache everytime it is fetched from the cache.
-
-
-
- Preventing a plugin's output from being cached
-
-caching = true;
-
-function remaining_seconds($params, &$smarty) {
- $remain = $params['endtime'] - time();
- if ($remain >=0)
- return $remain . " second(s)";
- else
- return "done";
-}
-
-$smarty->register_function('remaining', 'remaining_seconds', false, array('endtime'));
-
-if (!$smarty->is_cached('index.tpl')) {
- // fetch $obj from db and assign...
- $smarty->assign_by_ref('obj', $obj);
-}
-
-$smarty->display('index.tpl');
-?>
-
-
-index.tpl:
-
-Time Remaining: {remain endtime=$obj->endtime}
-]]>
-
-
-The number of seconds till the endtime of $obj is reached changes on each display of the page, even if the page is cached. Since the endtime attribute is cached the object only has to be pulled from the database when page is written to the cache but not on subsequent requests of the page.
-
-
-
-
-
- Preventing a whole passage of a template from being cached
-
-caching = true;
-
-function smarty_block_dynamic($param, $content, &$smarty) {
- return $content;
-}
-$smarty->register_block('dynamic', 'smarty_block_dynamic', false);
-
-$smarty->display('index.tpl');
-?>
-
-
-index.tpl:
-
-Page created: {"0"|date_format:"%D %H:%M:%S"}
-
-{dynamic}
-
-Now is: {"0"|date_format:"%D %H:%M:%S"}
-
-... do other stuff ...
-
-{/dynamic}
-]]>
-
-
-
-
-When reloading the page you will notice that both dates differ. One is "dynamic" one is "static". You can do everything between {dynamic}...{/dynamic} and be sure it will not be cached like the rest of the page.
-
-
+&programmers.caching.caching-cacheable;
+
+ Controlling Cacheability of Plugins' Output
+
+Since Smarty-2.6.0 plugins the cacheability of plugins can be declared
+when registering them. The third parameter to register_block,
+register_compiler_function and register_function is called
+$cacheable and defaults to true which is also
+the behaviour of plugins in Smarty versions before 2.6.0
+
+
+
+When registering a plugin with $cacheable=false the plugin is called everytime the page is displayed, even if the page comes from the cache. The plugin function behaves a little like an insert function.
+
+
+
+In contrast to {insert} the attributes to the plugins are not cached by default. They can be declared to be cached with the fourth parameter $cache_attrs. $cache_attrs is an array of attribute-names that should be cached, so the plugin-function get value as it was the time the page was written to cache everytime it is fetched from the cache.
+
+
+
+ Preventing a plugin's output from being cached
+
+caching = true;
+
+function remaining_seconds($params, &$smarty) {
+ $remain = $params['endtime'] - time();
+ if ($remain >=0)
+ return $remain . " second(s)";
+ else
+ return "done";
+}
+
+$smarty->register_function('remaining', 'remaining_seconds', false, array('endtime'));
+
+if (!$smarty->is_cached('index.tpl')) {
+ // fetch $obj from db and assign...
+ $smarty->assign_by_ref('obj', $obj);
+}
+
+$smarty->display('index.tpl');
+?>
+
+
+index.tpl:
+
+Time Remaining: {remain endtime=$obj->endtime}
+]]>
+
+
+The number of seconds till the endtime of $obj is reached changes on each display of the page, even if the page is cached. Since the endtime attribute is cached the object only has to be pulled from the database when page is written to the cache but not on subsequent requests of the page.
+
+
+
+
+
+ Preventing a whole passage of a template from being cached
+
+caching = true;
+
+function smarty_block_dynamic($param, $content, &$smarty) {
+ return $content;
+}
+$smarty->register_block('dynamic', 'smarty_block_dynamic', false);
+
+$smarty->display('index.tpl');
+?>
+
+
+index.tpl:
+
+Page created: {"0"|date_format:"%D %H:%M:%S"}
+
+{dynamic}
+
+Now is: {"0"|date_format:"%D %H:%M:%S"}
+
+... do other stuff ...
+
+{/dynamic}
+]]>
+
+
+
+
+When reloading the page you will notice that both dates differ. One is "dynamic" one is "static". You can do everything between {dynamic}...{/dynamic} and be sure it will not be cached like the rest of the page.
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/caching/caching-groups.xml b/docs/en/programmers/caching/caching-groups.xml
new file mode 100644
index 00000000..893acd26
--- /dev/null
+++ b/docs/en/programmers/caching/caching-groups.xml
@@ -0,0 +1,63 @@
+
+
+
+ Cache Groups
+
+ You can do more elaborate grouping by setting up cache_id groups. This is
+ accomplished by separating each sub-group with a vertical bar "|" in the
+ cache_id value. You can have as many sub-groups as you like.
+
+
+ cache_id groups
+
+caching = true;
+
+// clear all caches with "sports|basketball" as the first two cache_id groups
+$smarty->clear_cache(null,"sports|basketball");
+
+// clear all caches with "sports" as the first cache_id group. This would
+// include "sports|basketball", or "sports|(anything)|(anything)|(anything)|..."
+$smarty->clear_cache(null,"sports");
+
+$smarty->display('index.tpl',"sports|basketball");
+?>
+]]>
+
+
+
+ Technical Note
+
+ The cache grouping does NOT use the path to the template as any part of the
+ cache_id. For example, if you have display('themes/blue/index.tpl'), you
+ cannot clear the cache for everything under the "themes/blue" directory. If
+ you want to do that, you must group them in the cache_id, such as
+ display('themes/blue/index.tpl','themes|blue'); Then you can clear the
+ caches for the blue theme with clear_cache(null,'themes|blue');
+
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/caching/caching-multiple-caches.xml b/docs/en/programmers/caching/caching-multiple-caches.xml
new file mode 100644
index 00000000..0fd9f02b
--- /dev/null
+++ b/docs/en/programmers/caching/caching-multiple-caches.xml
@@ -0,0 +1,124 @@
+
+
+
+ Multiple Caches Per Page
+
+ You can have multiple cache files for a single call to display() or
+ fetch(). Let's say that a call to display('index.tpl') may have several
+ different output contents depending on some condition, and you want
+ separate caches for each one. You can do this by passing a cache_id as the
+ second parameter to the function call.
+
+
+ passing a cache_id to display()
+
+caching = true;
+
+$my_cache_id = $_GET['article_id'];
+
+$smarty->display('index.tpl',$my_cache_id);
+?>
+]]>
+
+
+
+ Above, we are passing the variable $my_cache_id to display() as the
+ cache_id. For each unique value of $my_cache_id, a separate cache will be
+ generated for index.tpl. In this example, "article_id" was passed in the
+ URL and is used as the cache_id.
+
+
+ Technical Note
+
+ Be very cautious when passing values from a client (web browser) into
+ Smarty (or any PHP application.) Although the above example of using the
+ article_id from the URL looks handy, it could have bad consequences. The
+ cache_id is used to create a directory on the file system, so if the user
+ decided to pass an extremely large value for article_id, or write a script
+ that sends random article_ids at a rapid pace, this could possibly cause
+ problems at the server level. Be sure to sanitize any data passed in before
+ using it. In this instance, maybe you know the article_id has a length of
+ 10 characters and is made up of alpha-numerics only, and must be a valid
+ article_id in the database. Check for this!
+
+
+
+ Be sure to pass the same cache_id as the
+ second parameter to is_cached() and
+ clear_cache().
+
+
+ passing a cache_id to is_cached()
+
+caching = true;
+
+$my_cache_id = $_GET['article_id'];
+
+if(!$smarty->is_cached('index.tpl',$my_cache_id)) {
+ // No cache available, do variable assignments here.
+ $contents = get_database_contents();
+ $smarty->assign($contents);
+}
+
+$smarty->display('index.tpl',$my_cache_id);
+?>
+]]>
+
+
+
+ You can clear all caches for a particular cache_id by passing null as the
+ first parameter to clear_cache().
+
+
+ clearing all caches for a particular cache_id
+
+caching = true;
+
+// clear all caches with "sports" as the cache_id
+$smarty->clear_cache(null,"sports");
+
+$smarty->display('index.tpl',"sports");
+?>
+]]>
+
+
+
+ In this manner, you can "group" your caches together by giving them the
+ same cache_id.
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/caching/caching-setting-up.xml b/docs/en/programmers/caching/caching-setting-up.xml
new file mode 100644
index 00000000..eb9e2f31
--- /dev/null
+++ b/docs/en/programmers/caching/caching-setting-up.xml
@@ -0,0 +1,188 @@
+
+
+
+ Setting Up Caching
+
+ The first thing to do is enable caching. This is done by setting $caching = true (or 1.)
+
+
+ enabling caching
+
+caching = true;
+
+$smarty->display('index.tpl');
+?>
+]]>
+
+
+
+ With caching enabled, the function call to display('index.tpl') will render
+ the template as usual, but also saves a copy of its output to a file (a
+ cached copy) in the $cache_dir.
+ Upon the next call to display('index.tpl'), the cached copy will be used
+ instead of rendering the template again.
+
+
+ Technical Note
+
+ The files in the $cache_dir are named similar to the template name.
+ Although they end in the ".php" extention, they are not really executable
+ php scripts. Do not edit these files!
+
+
+
+ Each cached page has a limited lifetime determined by $cache_lifetime. The default value
+ is 3600 seconds, or 1 hour. After that time expires, the cache is
+ regenerated. It is possible to give individual caches their own expiration
+ time by setting $caching = 2. See the documentation on $cache_lifetime for details.
+
+
+ setting cache_lifetime per cache
+
+caching = 2; // lifetime is per cache
+
+// set the cache_lifetime for index.tpl to 5 minutes
+$smarty->cache_lifetime = 300;
+$smarty->display('index.tpl');
+
+// set the cache_lifetime for home.tpl to 1 hour
+$smarty->cache_lifetime = 3600;
+$smarty->display('home.tpl');
+
+// NOTE: the following $cache_lifetime setting will not work when $caching = 2.
+// The cache lifetime for home.tpl has already been set
+// to 1 hour, and will no longer respect the value of $cache_lifetime.
+// The home.tpl cache will still expire after 1 hour.
+$smarty->cache_lifetime = 30; // 30 seconds
+$smarty->display('home.tpl');
+?>
+]]>
+
+
+
+ If $compile_check is enabled,
+ every template file and config file that is involved with the cache file is
+ checked for modification. If any of the files have been modified since the
+ cache was generated, the cache is immediately regenerated. This is a slight
+ overhead so for optimum performance, leave $compile_check set to false.
+
+
+ enabling $compile_check
+
+caching = true;
+$smarty->compile_check = true;
+
+$smarty->display('index.tpl');
+?>
+]]>
+
+
+
+ If $force_compile is enabled,
+ the cache files will always be regenerated. This effectively turns off
+ caching. $force_compile is usually for debugging purposes only, a more
+ efficient way of disabling caching is to set $caching = false (or 0.)
+
+
+ The is_cached() function
+ can be used to test if a template has a valid cache or not. If you have a
+ cached template that requires something like a database fetch, you can use
+ this to skip that process.
+
+
+ using is_cached()
+
+caching = true;
+
+if(!$smarty->is_cached('index.tpl')) {
+ // No cache available, do variable assignments here.
+ $contents = get_database_contents();
+ $smarty->assign($contents);
+}
+
+$smarty->display('index.tpl');
+?>
+]]>
+
+
+
+ You can keep parts of a page dynamic with the insert template function. Let's
+ say the whole page can be cached except for a banner that is displayed down
+ the right side of the page. By using an insert function for the banner, you
+ can keep this element dynamic within the cached content. See the
+ documentation on insert for
+ details and examples.
+
+
+ You can clear all the cache files with the clear_all_cache() function, or
+ individual cache files (or groups) with the clear_cache() function.
+
+
+ clearing the cache
+
+caching = true;
+
+// clear out all cache files
+$smarty->clear_all_cache();
+
+// clear only cache for index.tpl
+$smarty->clear_cache('index.tpl');
+
+$smarty->display('index.tpl');
+?>
+]]>
+
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/plugins.xml b/docs/en/programmers/plugins.xml
index 7a060708..7c9cd754 100644
--- a/docs/en/programmers/plugins.xml
+++ b/docs/en/programmers/plugins.xml
@@ -24,796 +24,27 @@
use the API or convert your custom functionality into plugins.
-
- How Plugins Work
-
- Plugins are always loaded on demand. Only the specific modifiers,
- functions, resources, etc invoked in the templates scripts will be
- loaded. Moreover, each plugin is loaded only once, even if you have
- several different instances of Smarty running within the same request.
-
-
- Pre/postfilters and output filters are a bit of a special case. Since
- they are not mentioned in the templates, they must be registered or
- loaded explicitly via API functions before the template is processed.
- The order in which multiple filters of the same type are executed
- depends on the order in which they are registered or loaded.
-
-
- The plugins directory
- can be a string containing a path or an array containing multiple
- paths. To install a plugin, simply place it in one of the
- directories and Smarty will use it automatically.
-
-
+&programmers.plugins.plugins-howto;
-
- Naming Conventions
-
- Plugin files and functions must follow a very specific naming
- convention in order to be located by Smarty.
-
-
- The plugin files must be named as follows:
-
-
-
- type.name.php
-
-
-
-
-
- Where type is one of these plugin types:
-
- function
- modifier
- block
- compiler
- prefilter
- postfilter
- outputfilter
- resource
- insert
-
-
-
- And name should be a valid identifier (letters,
- numbers, and underscores only).
-
-
- Some examples: function.html_select_date.php,
- resource.db.php,
- modifier.spacify.php.
-
-
- The plugin functions inside the plugin files must be named as follows:
-
-
- smarty_type_name
-
-
-
-
- The meanings of type and name are
- the same as before.
-
-
- Smarty will output appropriate error messages if the plugin file it
- needs is not found, or if the file or the plugin function are named
- improperly.
-
-
+&programmers.plugins.plugins-naming-conventions;
-
- Writing Plugins
-
- Plugins can be either loaded by Smarty automatically from the
- filesystem or they can be registered at runtime via one of the
- register_* API functions. They can also be unregistered by using
- unregister_* API functions.
-
-
- For the plugins that are registered at runtime, the name of the plugin
- function(s) does not have to follow the naming convention.
-
-
- If a plugin depends on some functionality provided by another plugin
- (as is the case with some plugins bundled with Smarty), then the proper
- way to load the needed plugin is this:
-
-
-_get_plugin_filepath('function', 'html_options');
-?>
-]]>
-
-
- As a general rule, Smarty object is always passed to the plugins
- as the last parameter (with two exceptions: modifiers do not get
- passed the Smarty object at all and blocks get passed
- &$repeat after the Smarty object to keep
- backwards compatibility to older versions of Smarty).
-
-
+&programmers.plugins.plugins-writing;
- Template Functions
-
-
- void smarty_function_name
- array $params
- object &$smarty
-
-
-
- All attributes passed to template functions from the template are
- contained in the $params as an associative
- array.
-
-
- The output (return value) of the function will be substituted in place of the
- function tag in the template (fetch function, for
- example). Alternatively, the function can simply perform some other
- task without any output (assign function).
-
-
- If the function needs to assign some variables to the template or use
- some other Smarty-provided functionality, it can use the supplied
- $smarty object to do so.
-
-
- See also:
- register_function(),
- unregister_function().
-
-
-
- function plugin with output
-
-
-]]>
-
-
-
-
- which can be used in the template as:
-
-
-Question: Will we ever have time travel?
-Answer: {eightball}.
-
-
-
- function plugin without output
-
-trigger_error("assign: missing 'var' parameter");
- return;
- }
+&programmers.plugins.plugins-modifiers;
- if (!in_array('value', array_keys($params))) {
- $smarty->trigger_error("assign: missing 'value' parameter");
- return;
- }
+&programmers.plugins.plugins-block-functions;
- $smarty->assign($params['var'], $params['value']);
-}
-?>
-]]>
-
-
-
-
+&programmers.plugins.plugins-compiler-functions;
- Modifiers
-
- Modifiers are little functions that are applied to a variable in the
- template before it is displayed or used in some other context.
- Modifiers can be chained together.
-
-
-
- mixed smarty_modifier_name
- mixed $value
- [mixed $param1, ...]
-
-
-
- The first parameter to the modifier plugin is the value on which
- the modifier is supposed to operate. The rest of the parameters can be
- optional, depending on what kind of operation is supposed to be
- performed.
-
-
- The modifier has to return the result of its processing.
-
-
- See also
- register_modifier(),
- unregister_modifier().
-
-
- simple modifier plugin
-
- This plugin basically aliases one of the built-in PHP functions. It
- does not have any additional parameters.
-
-
-
-]]>
-
-
-
-
- more complex modifier plugin
-
- $length) {
- $length -= strlen($etc);
- $fragment = substr($string, 0, $length+1);
- if ($break_words)
- $fragment = substr($fragment, 0, -1);
- else
- $fragment = preg_replace('/\s+(\S+)?$/', '', $fragment);
- return $fragment.$etc;
- } else
- return $string;
-}
-?>
-]]>
-
-
-
+&programmers.plugins.plugins-outputfilters;
- Block Functions
-
-
- void smarty_block_name
- array $params
- mixed $content
- object &$smarty
-
-
-
- Block functions are functions of the form: {func} .. {/func}. In other
- words, they enclose a template block and operate on the contents of
- this block. Block functions take precedence over custom functions of
- the same name, that is, you cannot have both custom function {func} and
- block function {func} .. {/func}.
-
-
- By default your function implementation is called twice by
- Smarty: once for the opening tag, and once for the closing tag
- (see &$repeat below how to change this).
-
-
- Only the opening tag of the block function may have attributes. All
- attributes passed to template functions from the template are contained
- in the $params as an associative array. You can
- access those values as e.g. $params['start'].
- The opening tag attributes are also accessible to your function
- when processing the closing tag.
-
-
- The value of $content variable depends on
- whether your function is called for the opening or closing tag. In case
- of the opening tag, it will be null, and in case of
- the closing tag it will be the contents of the template block.
- Note that the template block will have already been processed by
- Smarty, so all you will receive is the template output, not the
- template source.
-
+&programmers.plugins.plugins-resources;
-
- The parameter &$repeat is passed by
- reference to the function implementation and provides a
- possibility for it to control how many times the block is
- displayed. By default $repeat is
- true at the first call of the block-function
- (the block opening tag) and false on all
- subsequent calls to the block function (the block's closing tag).
- Each time the function implementation returns with
- &$repeat being true, the contents between
- {func} .. {/func} are evaluated and the function implementation
- is called again with the new block contents in the parameter
- $content.
-
-
-
-
- If you have nested block functions, it's possible to find out what the
- parent block function is by accessing
- $smarty->_tag_stack variable. Just do a var_dump()
- on it and the structure should be apparent.
-
-
- See also:
- register_block(),
- unregister_block().
-
-
- block function
-
-
-]]>
-
-
-
-
- Compiler Functions
-
- Compiler functions are called only during compilation of the template.
- They are useful for injecting PHP code or time-sensitive static
- content into the template. If there is both a compiler function and a
- custom function registered under the same name, the compiler function
- has precedence.
-
-
-
- mixed smarty_compiler_name
- string $tag_arg
- object &$smarty
-
-
-
- The compiler function is passed two parameters: the tag argument
- string - basically, everything from the function name until the ending
- delimiter, and the Smarty object. It's supposed to return the PHP code
- to be injected into the compiled template.
-
-
- See also
- register_compiler_function(),
- unregister_compiler_function().
-
-
- simple compiler function
-
-_current_file . " compiled at " . date('Y-m-d H:M'). "';";
-}
-?>
-]]>
-
-
- This function can be called from the template as:
-
-
-{* this function gets executed at compile time only *}
-{tplheader}
-
-
- The resulting PHP code in the compiled template would be something like this:
-
-
-
-]]>
-
-
-
-
-
- Prefilters/Postfilters
-
- Prefilter and postfilter plugins are very similar in concept; where
- they differ is in the execution -- more precisely the time of their
- execution.
-
-
-
- string smarty_prefilter_name
- string $source
- object &$smarty
-
-
-
- Prefilters are used to process the source of the template immediately
- before compilation. The first parameter to the prefilter function is
- the template source, possibly modified by some other prefilters. The
- plugin is supposed to return the modified source. Note that this
- source is not saved anywhere, it is only used for compilation.
-
-
-
- string smarty_postfilter_name
- string $compiled
- object &$smarty
-
-
-
- Postfilters are used to process the compiled output of the template
- (the PHP code) immediately after the compilation is done but before the
- compiled template is saved to the filesystem. The first parameter to
- the postfilter function is the compiled template code, possibly
- modified by other postfilters. The plugin is supposed to return the
- modified version of this code.
-
-
- prefilter plugin
-
-]+>!e', 'strtolower("$1")', $source);
- }
-?>
-]]>
-
-
-
-
- postfilter plugin
-
-\nget_template_vars()); ?>\n" . $compiled;
- return $compiled;
- }
-?>
-]]>
-
-
-
-
- Output Filters
-
- Output filter plugins operate on a template's output, after the
- template is loaded and executed, but before the output is displayed.
-
-
-
- string smarty_outputfilter_name
- string $template_output
- object &$smarty
-
-
-
- The first parameter to the output filter function is the template
- output that needs to be processed, and the second parameter is the
- instance of Smarty invoking the plugin. The plugin is supposed to do
- the processing and return the results.
-
-
- output filter plugin
-
-
-]]>
-
-
-
-
- Resources
-
- Resource plugins are meant as a generic way of providing template
- sources or PHP script components to Smarty. Some examples of resources:
- databases, LDAP, shared memory, sockets, and so on.
-
-
-
- There are a total of 4 functions that need to be registered for each
- type of resource. Every function will receive the requested resource as
- the first parameter and the Smarty object as the last parameter. The
- rest of parameters depend on the function.
-
-
-
-
- bool smarty_resource_name_source
- string $rsrc_name
- string &$source
- object &$smarty
-
-
- bool smarty_resource_name_timestamp
- string $rsrc_name
- int &$timestamp
- object &$smarty
-
-
- bool smarty_resource_name_secure
- string $rsrc_name
- object &$smarty
-
-
- bool smarty_resource_name_trusted
- string $rsrc_name
- object &$smarty
-
-
-
-
- The first function is supposed to retrieve the resource. Its second
- parameter is a variable passed by reference where the result should be
- stored. The function is supposed to return true if
- it was able to successfully retrieve the resource and
- false otherwise.
-
-
-
- The second function is supposed to retrieve the last modification time
- of the requested resource (as a UNIX timestamp). The second parameter
- is a variable passed by reference where the timestamp should be stored.
- The function is supposed to return true if the
- timestamp could be succesfully determined, and false
- otherwise.
-
-
-
- The third function is supposed to return true or
- false, depending on whether the requested resource
- is secure or not. This function is used only for template resources but
- should still be defined.
-
-
-
- The fourth function is supposed to return true or
- false, depending on whether the requested resource
- is trusted or not. This function is used for only for PHP script
- components requested by include_php tag or
- insert tag with src
- attribute. However, it should still be defined even for template
- resources.
-
-
- See also
- register_resource(),
- unregister_resource().
-
-
- resource plugin
-
-query("select tpl_source
- from my_table
- where tpl_name='$tpl_name'");
- if ($sql->num_rows) {
- $tpl_source = $sql->record['tpl_source'];
- return true;
- } else {
- return false;
- }
-}
-
-function smarty_resource_db_timestamp($tpl_name, &$tpl_timestamp, &$smarty)
-{
- // do database call here to populate $tpl_timestamp.
- $sql = new SQL;
- $sql->query("select tpl_timestamp
- from my_table
- where tpl_name='$tpl_name'");
- if ($sql->num_rows) {
- $tpl_timestamp = $sql->record['tpl_timestamp'];
- return true;
- } else {
- return false;
- }
-}
-
-function smarty_resource_db_secure($tpl_name, &$smarty)
-{
- // assume all templates are secure
- return true;
-}
-
-function smarty_resource_db_trusted($tpl_name, &$smarty)
-{
- // not used for templates
-}
-?>
-]]>
-
-
-
-
- Inserts
-
- Insert plugins are used to implement functions that are invoked by
- insert
- tags in the template.
-
-
-
- string smarty_insert_name
- array $params
- object &$smarty
-
-
-
- The first parameter to the function is an associative array of
- attributes passed to the insert.
-
-
- The insert function is supposed to return the result which will be
- substituted in place of the insert tag in the
- template.
-
-
- insert plugin
-
-trigger_error("insert time: missing 'format' parameter");
- return;
- }
-
- $datetime = strftime($params['format']);
- return $datetime;
-}
-?>
-]]>
-
-
-
+&programmers.plugins.plugins-inserts;
+ Block Functions
+
+
+ void smarty_block_name
+ array $params
+ mixed $content
+ object &$smarty
+
+
+
+ Block functions are functions of the form: {func} .. {/func}. In other
+ words, they enclose a template block and operate on the contents of
+ this block. Block functions take precedence over custom functions of
+ the same name, that is, you cannot have both custom function {func} and
+ block function {func} .. {/func}.
+
+
+ By default your function implementation is called twice by
+ Smarty: once for the opening tag, and once for the closing tag
+ (see &$repeat below how to change this).
+
+
+ Only the opening tag of the block function may have attributes. All
+ attributes passed to template functions from the template are contained
+ in the $params as an associative array. You can
+ access those values as e.g. $params['start'].
+ The opening tag attributes are also accessible to your function
+ when processing the closing tag.
+
+
+ The value of $content variable depends on
+ whether your function is called for the opening or closing tag. In case
+ of the opening tag, it will be null, and in case of
+ the closing tag it will be the contents of the template block.
+ Note that the template block will have already been processed by
+ Smarty, so all you will receive is the template output, not the
+ template source.
+
+
+
+ The parameter &$repeat is passed by
+ reference to the function implementation and provides a
+ possibility for it to control how many times the block is
+ displayed. By default $repeat is
+ true at the first call of the block-function
+ (the block opening tag) and false on all
+ subsequent calls to the block function (the block's closing tag).
+ Each time the function implementation returns with
+ &$repeat being true, the contents between
+ {func} .. {/func} are evaluated and the function implementation
+ is called again with the new block contents in the parameter
+ $content.
+
+
+
+
+ If you have nested block functions, it's possible to find out what the
+ parent block function is by accessing
+ $smarty->_tag_stack variable. Just do a var_dump()
+ on it and the structure should be apparent.
+
+
+ See also:
+ register_block(),
+ unregister_block().
+
+
+ block function
+
+
+]]>
+
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/plugins/plugins-compiler-functions.xml b/docs/en/programmers/plugins/plugins-compiler-functions.xml
new file mode 100644
index 00000000..7769e593
--- /dev/null
+++ b/docs/en/programmers/plugins/plugins-compiler-functions.xml
@@ -0,0 +1,89 @@
+
+
+ Compiler Functions
+
+ Compiler functions are called only during compilation of the template.
+ They are useful for injecting PHP code or time-sensitive static
+ content into the template. If there is both a compiler function and a
+ custom function registered under the same name, the compiler function
+ has precedence.
+
+
+
+ mixed smarty_compiler_name
+ string $tag_arg
+ object &$smarty
+
+
+
+ The compiler function is passed two parameters: the tag argument
+ string - basically, everything from the function name until the ending
+ delimiter, and the Smarty object. It's supposed to return the PHP code
+ to be injected into the compiled template.
+
+
+ See also
+ register_compiler_function(),
+ unregister_compiler_function().
+
+
+ simple compiler function
+
+_current_file . " compiled at " . date('Y-m-d H:M'). "';";
+}
+?>
+]]>
+
+
+ This function can be called from the template as:
+
+
+{* this function gets executed at compile time only *}
+{tplheader}
+
+
+ The resulting PHP code in the compiled template would be something like this:
+
+
+
+]]>
+
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/plugins/plugins-functions.xml b/docs/en/programmers/plugins/plugins-functions.xml
new file mode 100644
index 00000000..54043c61
--- /dev/null
+++ b/docs/en/programmers/plugins/plugins-functions.xml
@@ -0,0 +1,125 @@
+
+
+ Template Functions
+
+
+ void smarty_function_name
+ array $params
+ object &$smarty
+
+
+
+ All attributes passed to template functions from the template are
+ contained in the $params as an associative
+ array.
+
+
+ The output (return value) of the function will be substituted in place of the
+ function tag in the template (fetch function, for
+ example). Alternatively, the function can simply perform some other
+ task without any output (assign function).
+
+
+ If the function needs to assign some variables to the template or use
+ some other Smarty-provided functionality, it can use the supplied
+ $smarty object to do so.
+
+
+ See also:
+ register_function(),
+ unregister_function().
+
+
+
+ function plugin with output
+
+
+]]>
+
+
+
+
+ which can be used in the template as:
+
+
+Question: Will we ever have time travel?
+Answer: {eightball}.
+
+
+
+ function plugin without output
+
+trigger_error("assign: missing 'var' parameter");
+ return;
+ }
+
+ if (!in_array('value', array_keys($params))) {
+ $smarty->trigger_error("assign: missing 'value' parameter");
+ return;
+ }
+
+ $smarty->assign($params['var'], $params['value']);
+}
+?>
+]]>
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/plugins/plugins-howto.xml b/docs/en/programmers/plugins/plugins-howto.xml
new file mode 100644
index 00000000..d43ea835
--- /dev/null
+++ b/docs/en/programmers/plugins/plugins-howto.xml
@@ -0,0 +1,44 @@
+
+
+
+ How Plugins Work
+
+ Plugins are always loaded on demand. Only the specific modifiers,
+ functions, resources, etc invoked in the templates scripts will be
+ loaded. Moreover, each plugin is loaded only once, even if you have
+ several different instances of Smarty running within the same request.
+
+
+ Pre/postfilters and output filters are a bit of a special case. Since
+ they are not mentioned in the templates, they must be registered or
+ loaded explicitly via API functions before the template is processed.
+ The order in which multiple filters of the same type are executed
+ depends on the order in which they are registered or loaded.
+
+
+ The plugins directory
+ can be a string containing a path or an array containing multiple
+ paths. To install a plugin, simply place it in one of the
+ directories and Smarty will use it automatically.
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/plugins/plugins-inserts.xml b/docs/en/programmers/plugins/plugins-inserts.xml
new file mode 100644
index 00000000..754bc656
--- /dev/null
+++ b/docs/en/programmers/plugins/plugins-inserts.xml
@@ -0,0 +1,73 @@
+
+
+ Inserts
+
+ Insert plugins are used to implement functions that are invoked by
+ insert
+ tags in the template.
+
+
+
+ string smarty_insert_name
+ array $params
+ object &$smarty
+
+
+
+ The first parameter to the function is an associative array of
+ attributes passed to the insert.
+
+
+ The insert function is supposed to return the result which will be
+ substituted in place of the insert tag in the
+ template.
+
+
+ insert plugin
+
+trigger_error("insert time: missing 'format' parameter");
+ return;
+ }
+
+ $datetime = strftime($params['format']);
+ return $datetime;
+}
+?>
+]]>
+
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/plugins/plugins-modifiers.xml b/docs/en/programmers/plugins/plugins-modifiers.xml
new file mode 100644
index 00000000..61147e4b
--- /dev/null
+++ b/docs/en/programmers/plugins/plugins-modifiers.xml
@@ -0,0 +1,114 @@
+
+
+ Modifiers
+
+ Modifiers are little functions that are applied to a variable in the
+ template before it is displayed or used in some other context.
+ Modifiers can be chained together.
+
+
+
+ mixed smarty_modifier_name
+ mixed $value
+ [mixed $param1, ...]
+
+
+
+ The first parameter to the modifier plugin is the value on which
+ the modifier is supposed to operate. The rest of the parameters can be
+ optional, depending on what kind of operation is supposed to be
+ performed.
+
+
+ The modifier has to return the result of its processing.
+
+
+ See also
+ register_modifier(),
+ unregister_modifier().
+
+
+ simple modifier plugin
+
+ This plugin basically aliases one of the built-in PHP functions. It
+ does not have any additional parameters.
+
+
+
+]]>
+
+
+
+
+ more complex modifier plugin
+
+ $length) {
+ $length -= strlen($etc);
+ $fragment = substr($string, 0, $length+1);
+ if ($break_words)
+ $fragment = substr($fragment, 0, -1);
+ else
+ $fragment = preg_replace('/\s+(\S+)?$/', '', $fragment);
+ return $fragment.$etc;
+ } else
+ return $string;
+}
+?>
+]]>
+
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/plugins/plugins-naming-conventions.xml b/docs/en/programmers/plugins/plugins-naming-conventions.xml
new file mode 100644
index 00000000..b7676736
--- /dev/null
+++ b/docs/en/programmers/plugins/plugins-naming-conventions.xml
@@ -0,0 +1,79 @@
+
+
+
+ Naming Conventions
+
+ Plugin files and functions must follow a very specific naming
+ convention in order to be located by Smarty.
+
+
+ The plugin files must be named as follows:
+
+
+
+ type.name.php
+
+
+
+
+
+ Where type is one of these plugin types:
+
+ function
+ modifier
+ block
+ compiler
+ prefilter
+ postfilter
+ outputfilter
+ resource
+ insert
+
+
+
+ And name should be a valid identifier (letters,
+ numbers, and underscores only).
+
+
+ Some examples: function.html_select_date.php,
+ resource.db.php,
+ modifier.spacify.php.
+
+
+ The plugin functions inside the plugin files must be named as follows:
+
+
+ smarty_type_name
+
+
+
+
+ The meanings of type and name are
+ the same as before.
+
+
+ Smarty will output appropriate error messages if the plugin file it
+ needs is not found, or if the file or the plugin function are named
+ improperly.
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/plugins/plugins-outputfilters.xml b/docs/en/programmers/plugins/plugins-outputfilters.xml
new file mode 100644
index 00000000..8b1cfdf6
--- /dev/null
+++ b/docs/en/programmers/plugins/plugins-outputfilters.xml
@@ -0,0 +1,65 @@
+
+
+ Output Filters
+
+ Output filter plugins operate on a template's output, after the
+ template is loaded and executed, but before the output is displayed.
+
+
+
+ string smarty_outputfilter_name
+ string $template_output
+ object &$smarty
+
+
+
+ The first parameter to the output filter function is the template
+ output that needs to be processed, and the second parameter is the
+ instance of Smarty invoking the plugin. The plugin is supposed to do
+ the processing and return the results.
+
+
+ output filter plugin
+
+
+]]>
+
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/plugins/plugins-prefilters-postfilters.xml b/docs/en/programmers/plugins/plugins-prefilters-postfilters.xml
new file mode 100644
index 00000000..8573f4c9
--- /dev/null
+++ b/docs/en/programmers/plugins/plugins-prefilters-postfilters.xml
@@ -0,0 +1,105 @@
+
+
+
+ Prefilters/Postfilters
+
+ Prefilter and postfilter plugins are very similar in concept; where
+ they differ is in the execution -- more precisely the time of their
+ execution.
+
+
+
+ string smarty_prefilter_name
+ string $source
+ object &$smarty
+
+
+
+ Prefilters are used to process the source of the template immediately
+ before compilation. The first parameter to the prefilter function is
+ the template source, possibly modified by some other prefilters. The
+ plugin is supposed to return the modified source. Note that this
+ source is not saved anywhere, it is only used for compilation.
+
+
+
+ string smarty_postfilter_name
+ string $compiled
+ object &$smarty
+
+
+
+ Postfilters are used to process the compiled output of the template
+ (the PHP code) immediately after the compilation is done but before the
+ compiled template is saved to the filesystem. The first parameter to
+ the postfilter function is the compiled template code, possibly
+ modified by other postfilters. The plugin is supposed to return the
+ modified version of this code.
+
+
+ prefilter plugin
+
+]+>!e', 'strtolower("$1")', $source);
+ }
+?>
+]]>
+
+
+
+
+ postfilter plugin
+
+\nget_template_vars()); ?>\n" . $compiled;
+ return $compiled;
+ }
+?>
+]]>
+
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/plugins/plugins-resources.xml b/docs/en/programmers/plugins/plugins-resources.xml
new file mode 100644
index 00000000..0deb6d76
--- /dev/null
+++ b/docs/en/programmers/plugins/plugins-resources.xml
@@ -0,0 +1,159 @@
+
+
+ Resources
+
+ Resource plugins are meant as a generic way of providing template
+ sources or PHP script components to Smarty. Some examples of resources:
+ databases, LDAP, shared memory, sockets, and so on.
+
+
+
+ There are a total of 4 functions that need to be registered for each
+ type of resource. Every function will receive the requested resource as
+ the first parameter and the Smarty object as the last parameter. The
+ rest of parameters depend on the function.
+
+
+
+
+ bool smarty_resource_name_source
+ string $rsrc_name
+ string &$source
+ object &$smarty
+
+
+ bool smarty_resource_name_timestamp
+ string $rsrc_name
+ int &$timestamp
+ object &$smarty
+
+
+ bool smarty_resource_name_secure
+ string $rsrc_name
+ object &$smarty
+
+
+ bool smarty_resource_name_trusted
+ string $rsrc_name
+ object &$smarty
+
+
+
+
+ The first function is supposed to retrieve the resource. Its second
+ parameter is a variable passed by reference where the result should be
+ stored. The function is supposed to return true if
+ it was able to successfully retrieve the resource and
+ false otherwise.
+
+
+
+ The second function is supposed to retrieve the last modification time
+ of the requested resource (as a UNIX timestamp). The second parameter
+ is a variable passed by reference where the timestamp should be stored.
+ The function is supposed to return true if the
+ timestamp could be succesfully determined, and false
+ otherwise.
+
+
+
+ The third function is supposed to return true or
+ false, depending on whether the requested resource
+ is secure or not. This function is used only for template resources but
+ should still be defined.
+
+
+
+ The fourth function is supposed to return true or
+ false, depending on whether the requested resource
+ is trusted or not. This function is used for only for PHP script
+ components requested by include_php tag or
+ insert tag with src
+ attribute. However, it should still be defined even for template
+ resources.
+
+
+ See also
+ register_resource(),
+ unregister_resource().
+
+
+ resource plugin
+
+query("select tpl_source
+ from my_table
+ where tpl_name='$tpl_name'");
+ if ($sql->num_rows) {
+ $tpl_source = $sql->record['tpl_source'];
+ return true;
+ } else {
+ return false;
+ }
+}
+
+function smarty_resource_db_timestamp($tpl_name, &$tpl_timestamp, &$smarty)
+{
+ // do database call here to populate $tpl_timestamp.
+ $sql = new SQL;
+ $sql->query("select tpl_timestamp
+ from my_table
+ where tpl_name='$tpl_name'");
+ if ($sql->num_rows) {
+ $tpl_timestamp = $sql->record['tpl_timestamp'];
+ return true;
+ } else {
+ return false;
+ }
+}
+
+function smarty_resource_db_secure($tpl_name, &$smarty)
+{
+ // assume all templates are secure
+ return true;
+}
+
+function smarty_resource_db_trusted($tpl_name, &$smarty)
+{
+ // not used for templates
+}
+?>
+]]>
+
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/plugins/plugins-writing.xml b/docs/en/programmers/plugins/plugins-writing.xml
new file mode 100644
index 00000000..726668b8
--- /dev/null
+++ b/docs/en/programmers/plugins/plugins-writing.xml
@@ -0,0 +1,54 @@
+
+
+
+ Writing Plugins
+
+ Plugins can be either loaded by Smarty automatically from the
+ filesystem or they can be registered at runtime via one of the
+ register_* API functions. They can also be unregistered by using
+ unregister_* API functions.
+
+
+ For the plugins that are registered at runtime, the name of the plugin
+ function(s) does not have to follow the naming convention.
+
+
+ If a plugin depends on some functionality provided by another plugin
+ (as is the case with some plugins bundled with Smarty), then the proper
+ way to load the needed plugin is this:
+
+
+_get_plugin_filepath('function', 'html_options');
+?>
+]]>
+
+
+ As a general rule, Smarty object is always passed to the plugins
+ as the last parameter (with two exceptions: modifiers do not get
+ passed the Smarty object at all and blocks get passed
+ &$repeat after the Smarty object to keep
+ backwards compatibility to older versions of Smarty).
+
+
+
\ No newline at end of file
diff --git a/docs/en/programmers/smarty-constants.xml b/docs/en/programmers/smarty-constants.xml
index 42b5fe34..675bb9a4 100644
--- a/docs/en/programmers/smarty-constants.xml
+++ b/docs/en/programmers/smarty-constants.xml
@@ -45,4 +45,4 @@ End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
--->
\ No newline at end of file
+-->
diff --git a/docs/fr/programmers/advanced-features.xml b/docs/fr/programmers/advanced-features.xml
index d190d42e..c4f2ce08 100644
--- a/docs/fr/programmers/advanced-features.xml
+++ b/docs/fr/programmers/advanced-features.xml
@@ -2,508 +2,16 @@
Fonctionnalités avancées
-
- Objets
-
- Smarty donne l'accès aux objets PHP a travers les templates. Il y
- a 2 moyens d'y avoir accès. Le premier consiste a allouer les objets
- au template puis de les utiliser avec une syntaxe similaire a celles
- des fonctions personnalisées. Le deuxième moyen consiste a allouer
- des objets aux templates et de les utiliser comme n'importe quelle
- variable. La première méthode a une syntaxe beaucoup plus sympathique.
- Elle est aussi plus sécurisée, puisqu'un objet alloué ne peut avoir accès
- qu'a certaines méthodes et propriétés. Néanmoins, un objet alloué
- ne peut pas avoir de lien sur lui-même ou être mis dans un tableau
- d'objet, etc. Vous devez choisir la méthode qui correspond a vos
- besoins, mais tGchez d'utiliser la première méthode autant que possible
- afin de réduire la syntaxe des templates au minimum.
-
-
- Si l'option de sécurité est activée, aucune méthode ou fonctions privées
- n'est accessible (commentant par "_"). S'il existe une méthode et une
- propriété du même nom, c'est la méthode qui sera utilisée.
-
-
- Vous pouvez restreindre l'accès aux méthodes et aux propriétés en
- les listant dans un tableau en tant que troisième paramètre
- d'allocation.
-
-
- Par défaut, les paramètres passés aux objets depuis le templates le sont de la
- même faton que les fonctions utilisateurs les récupèrent.
- Le premier paramètre correspond a un tableau associatif, le second a l'objet
- Smarty. Si vous souhaitez que les paramètres soient passées un a un, comme
- dans un appel traditionnel, définissez registration, quatrième paramètre optionnel,
- a false.
-
-
- utilisation d'un objet alloué ou assigné
-
-<?php
-// la classe
+&programmers.advanced-features.advanced-features-objects;
+&programmers.advanced-features.advanced-features-prefilters;
-class My_Object() {
- function meth1($params, &$smarty_obj) {
- return "this is my meth1";
- }
-}
+&programmers.advanced-features.advanced-features-postfilters;
-$myobj = new My_Object;
-// enregistre l'objet
-$smarty->register_object("foobar",$myobj);
-// on restreint l'accès a certaines méthodes et propriétés en les listant
-$smarty->register_object("foobar",$myobj,array('meth1','meth2','prop1'));
-// pour utiliser le format habituel de paramètre objet, passez le booléen = false
-$smarty->register_object("foobar",$myobj,null,false);
+&programmers.advanced-features.advanced-features-outputfilters;
-// on peut aussi assigner des objets. Assignez par référence quand c'est possible
-$smarty->assign_by_ref("myobj", $myobj);
+&programmers.advanced-features.section-template-cache-handler-func;
-$smarty->display("index.tpl");
-?>
-
-TEMPLATE:
-
-{* accès a notre objet enregistré *}
-{foobar->meth1 p1="foo" p2=$bar}
-
-{* on peut aussi assigner la sortie *}
-{foobar->meth1 p1="foo" p2=$bar assign="output"}
-the output was {$output)
-
-{* access our assigned object *}
-{$myobj->meth1("foo",$bar)}
-
-
-
- Filtres de pré-compilation
-
- Les filtres de pré-compilation sont des fonctions PHP que vos templates
- exécutent avant qu'ils ne soient compilés. Cela peut être utile
- pour pré-traiter vos templates afin d'enlever les commentaires
- inutiles, garder un oeil sur ce que les gens mettent dans leurs templates, etc.
- Les filtre de pré-compilations peuvent être soit
- déclarés soit chargés
- a partir des répertoires de plugins en utilisant la fonction
- load_filter() ou en réglant
- la variable
- $autoload_filters.
- Smarty passera a la fonction le code source en tant que premier argument,
- et attendra en retour le code modifié.
-
-
- Utilisation un filtre de pré-compilation de template
-
-<?php
-// mettre ceci dans votre application
-function remove_dw_comments($tpl_source, &$smarty)
-{
- return preg_replace("/<!--#.*-->/U","",$tpl_source);
-}
-
-// enregistrer le filtre de pré-compilation
-$smarty->register_prefilter("remove_dw_comments");
-$smarty->display("index.tpl");
-?>
-
-{* template Smarty index.tpl *}
-<!--# cette ligne va être supprimée par le filtre de pré-compilation -->
-
-
-
-
- Filtres de post-compilation
-
- Les filtres de post-compilation sont des fonctions PHP que vos templates
- exécutent après avoir été compilés. Les filtres de post-compilation peuvent
- être soit déclarés soit chargés
- depuis les répertoires des plugins en utilisant la fonction
- load_filter() ou en réglant
- la variable $autoload_filters.
- Smarty passera le template compilé en tant que premier paramètre et attendra
- de la fonction qu'elle retourne le résultat de l'exécution.
-
-
- utilisation d'un filtre de post-compilation de templates
-
-<?php
-// mettez cela dans votre application
-function add_header_comment($tpl_source, &$smarty)
-{
- return "<?php echo \"<!-- Created by Smarty! -->\n\" ?>\n".$tpl_source;
-}
-
-// enregistre le filtre de post-compilation
-$smarty->register_postfilter("add_header_comment");
-$smarty->display("index.tpl");
-?>
-
-{* template Smarty compilé index.tpl *}
-<!-- Created by Smarty! -->
-{* reste du contenu du template... *}
-
-
-
-
- Filtres de sortie
-
- Quand le template est appelé via les fonctions display() ou fetch(),
- sa sortie est envoyée a travers un ou plusieurs filtres de sorties.
- Ils diffèrent des filtres de post-compilation dans le sens ou ils agissent
- sur la sortie des templates, une fois exécutés, et non sur les sources
- des templates.
-
-
- Les filtres de sortie peuvent être soit
- déclarés soit
- chargés depuis les répertoires des plugins en utilisant la fonction
- load_filter()
- ou en réglant la variable
- $autoload_filters.
- Smarty passera la sortie du template en premier argument et attendra
- de la fonction qu'elle retourne le résultat de l'exécution.
-
-
- utilisation d'un filtre de sortie
-
-<?php
-// mettez ceci dans votre application
-function protect_email($tpl_output, &$smarty)
-{
- $tpl_output =
- preg_replace('!(\S+)@([a-zA-Z0-9\.\-]+\.([a-zA-Z]{2,3}|[0-9]{1,3}))!',
- '$1%40$2', $tpl_output);
- return $tpl_output;
-}
-
-// enregistre le filtre de sortie
-$smarty->register_outputfilter("protect_email");
-$smarty->display("index.tpl");
-
-// dorénavant toute occurence d'un adresse email dans le résultat du template
-// aura un protection simple contre les robots spammers
-?>
-
-
-
-
- Fonction de gestion du cache
-
- Une alternative au mécanisme de cache par défaut (basé sur des fichiers
- de cache) consiste a spécifier une fonction de gestion de cache utilisateur
- qui sera utilisée pour lire, écrire et effacer les fichiers de cache.
-
-
- Il suffit de créer dans votre application une fonction que Smarty
- utilisera pour la gestion du cache et d'assigner le nom de cette
- fonction a la variable de classe
- $cache_handler_func.
- Smarty utilisera alors cette fonction pour gérer les données du cache.
- Le premier argument est l'action, qui sera 'read', 'write' ou 'clear'.
- Le second paramètre est l'objet Smarty. Le troisième est le contenu
- du cache. Pour écrire, Smarty passe le contenu du cache dans ces paramètres.
- Pour lire, Smarty s'attend a ce que votre fonction accepte ce paramètre
- par référence et que vous le remplissiez avec les données du cache. Pour effacer,
- il suffit de passer une variable fictive car cette dernière n'est pas utilisée.
- Le quatrième paramètre est le nom du fichier de template (utile pour
- lire/écrire), le cinquième paramètre est l'identifiant de cache (optionnel)
- et le sixième est l'identifiant de compilation.
-
-
- exemple d'utilisation de MySQL pour la source du cache
-
-<?php
-/*
-
-exemple d'usage :
-
-include('Smarty.class.php');
-include('mysql_cache_handler.php');
-
-$smarty = new Smarty;
-$smarty->cache_handler_func = 'mysql_cache_handler';
-
-$smarty->display('index.tpl');
-
-
-la base mysql est attendu dans ce format :
-
-create database SMARTY_CACHE;
-
-create table CACHE_PAGES(
-CacheID char(32) PRIMARY KEY,
-CacheContents MEDIUMTEXT NOT NULL
-);
-
-*/
-
-function mysql_cache_handler($action, &$smarty_obj, &$cache_content, $tpl_file=null, $cache_id=null, $compile_id=null)
-{
- // l'h(te de la bd, l'utilisateur, et le mot de passe
- $db_host = 'localhost';
- $db_user = 'myuser';
- $db_pass = 'mypass';
- $db_name = 'SMARTY_CACHE';
- $use_gzip = false;
-
- // crée un identifiant de cache unique
- $CacheID = md5($tpl_file.$cache_id.$compile_id);
-
- if(! $link = mysql_pconnect($db_host, $db_user, $db_pass)) {
- $smarty_obj->_trigger_error_msg("cache_handler: could not connect to database");
- return false;
- }
- mysql_select_db($db_name);
-
- switch ($action) {
- case 'read':
- // récupère le cache dans la base de données
- $results = mysql_query("select CacheContents from CACHE_PAGES where CacheID='$CacheID'");
- if(!$results) {
- $smarty_obj->_trigger_error_msg("cache_handler: query failed.");
- }
- $row = mysql_fetch_array($results,MYSQL_ASSOC);
-
- if($use_gzip && function_exists("gzuncompress")) {
- $cache_contents = gzuncompress($row["CacheContents"]);
- } else {
- $cache_contents = $row["CacheContents"];
- }
- $return = $results;
- break;
- case 'write':
- // sauvegarde le cache dans la base de données
-
- if($use_gzip && function_exists("gzcompress")) {
- // compresse le contenu pour gagner de la place
- $contents = gzcompress($cache_content);
- } else {
- $contents = $cache_content;
- }
- $results = mysql_query("replace into CACHE_PAGES values(
- '$CacheID',
- '".addslashes($contents)."')
- ");
- if(!$results) {
- $smarty_obj->_trigger_error_msg("cache_handler: query failed.");
- }
- $return = $results;
- break;
- case 'clear':
- // efface les données du cache
- if(empty($cache_id) && empty($compile_id) && empty($tpl_file)) {
- // les efface toutes
- $results = mysql_query("delete from CACHE_PAGES");
- } else {
- $results = mysql_query("delete from CACHE_PAGES where CacheID='$CacheID'");
- }
- if(!$results) {
- $smarty_obj->_trigger_error_msg("cache_handler: query failed.");
- }
- $return = $results;
- break;
- default:
- // erreur, action inconnue
- $smarty_obj->_trigger_error_msg("cache_handler: unknown action \"$action\"");
- $return = false;
- break;
- }
- mysql_close($link);
- return $return;
-
-}
-
-?>
-
-
-
-
- Ressources
-
- Les templates peuvent provenir d'une grande variété de ressources. Quand vous
- affichez ou récupérez un template, ou quand vous incluez un template
- dans un autre template, vous fournissez un type de ressource, suivi
- par le chemin approprié et le nom du template.
-
-
- Templates depuis $template_dir
-
- Les templates du répertoire $template_dir n'ont pas
- besoin d'une ressource template, bien que vous puissiez utiliser
- la ressource "file" pour être cohérent. Vous n'avez qu'a fournir
- le chemin vers le template que vous voulez utiliser, relatif
- au répertoire racine $template_dir.
-
-
- Utilisation de templates depuis $template_dir
-
-// le script PHP
-$smarty->display("index.tpl");
-$smarty->display("admin/menu.tpl");
-$smarty->display("file:admin/menu.tpl"); // le même que celui ci-dessus
-
-{* le template Smarty *}
-{include file="index.tpl"}
-{include file="file:index.tpl"} {* le même que celui ci-dessus *}
-
-
-
- Templates a partir de n'importe quel répertoire
-
- Les templates en-dehors du répertoire $template_dir nécessitent
- le type de ressource template, suivi du chemin absolu et du nom du
- template.
-
-
- utilisation d'un template depuis n'importe quel répertoire
-
-// le script PHP
-$smarty->display("file:/export/templates/index.tpl");
-$smarty->display("file:/path/to/my/templates/menu.tpl");
-
-{* le template Smarty *}
-{include file="file:/usr/local/share/templates/navigation.tpl"}
-
-
-
- Chemin de fichiers Windows
-
- Si vous utilisez Windows, les chemins de fichiers sont la plupart
- du temps sur un disque identifié par une lettre (c:) au début du chemin.
- Assurez-vous de bien mettre "file:" dans le chemin pour éviter des
- conflits d'espace de nommage et obtenir les résultats escomptés.
-
-
- utilisation de templates avec des chemins de fichiers Windows
-
-// le script PHP
-$smarty->display("file:C:/export/templates/index.tpl");
-$smarty->display("file:F:/path/to/my/templates/menu.tpl");
-
-{* le template Smarty *}
-{include file="file:D:/usr/local/share/templates/navigation.tpl"}
-
-
-
-
-
- Templates depuis d'autres sources
-
- Vous pouvez récupérer les templates a partir n'importe quelle
- source a laquelle vous avez accès avec PHP : base de données,
- sockets, LDAP et ainsi de suite. Il suffit d'écrire les fonctions
- de ressource plugins et de les enregistrer auprès de Smarty.
-
-
- Reportez-vous a la section ressource plugins
- pour plus d'informations sur les fonctions que vous Otes censé fournir.
-
-
-
- Notez que vous ne pouvez pas écraser la ressource file native,
- toutefois, vous pouvez fournir une ressource qui récupère un template depuis
- le système de fichier par un autre moyen en l'enregistrant sous un autre
- nom de ressource.
-
-
-
- utilisation de ressources utilisateurs
-
-// le script PHP
-
-// mettez ces fonctions quelque part dans votre application
-function db_get_template ($tpl_name, &$tpl_source, &$smarty_obj)
-{
- // requête BD pour récupérer le template
- // et remplir $tpl_source
- $sql = new SQL;
- $sql->query("select tpl_source
- from my_table
- where tpl_name='$tpl_name'");
- if ($sql->num_rows) {
- $tpl_source = $sql->record['tpl_source'];
- return true;
- } else {
- return false;
- }
-}
-
-function db_get_timestamp($tpl_name, &$tpl_timestamp, &$smarty_obj)
-{
- // requête BD pour remplir $tpl_timestamp
- $sql = new SQL;
- $sql->query("select tpl_timestamp
- from my_table
- where tpl_name='$tpl_name'");
- if ($sql->num_rows) {
- $tpl_timestamp = $sql->record['tpl_timestamp'];
- return true;
- } else {
- return false;
- }
-}
-
-function db_get_secure($tpl_name, &$smarty_obj)
-{
- // on suppose que tous les templates sont svrs
- return true;
-}
-
-function db_get_trusted($tpl_name, &$smarty_obj)
-{
- // pas utilisée pour les templates dans notre cas
-}
-
-// enregistre le nom de ressource "db"
-$smarty->register_resource("db", array("db_get_template",
- "db_get_timestamp",
- "db_get_secure",
- "db_get_trusted"));
-
-// utilise la ressource depuis le script PHP
-$smarty->display("db:index.tpl");
-
-{* utilise la ressource depuis le template Smarty *}
-{include file="db:/extras/navigation.tpl"}
-
-
-
-
- Fonction de gestion de template par défaut
-
- Vous pouvez spécifier une fonction qui sera utilisée pour
- récupérer le contenu d'un template dans le cas oú le template
- ne peut pas être récupéré depuis sa ressource. Une utilisation possible est
- la création de templates a la volée.
-
-
- utilisation de la fonction de gestion de template par défaut
-
-<?php
-// mettez cette fonction quelque part dans votre application
-
-function make_template ($resource_type, $resource_name, &$template_source, &$template_timestamp, &$smarty_obj)
-{
- if( $resource_type == 'file' ) {
- if ( ! is_readable ( $resource_name )) {
- // crée le fichier de template et renvoie le contenu
- $template_source = "This is a new template.";
- $template_timestamp = time();
- $smarty_obj->_write_file($resource_name,$template_source);
- return true;
- }
- } else {
- // pas un fichier
- return false;
- }
-}
-
-// régle la fonction par défaut
-$smarty->default_template_handler_func = 'make_template';
-?>
-
-
-
+&programmers.advanced-features.template-resources;
+
+ Objets
+
+ Smarty donne l'accès aux objets PHP a travers les templates. Il y
+ a 2 moyens d'y avoir accès. Le premier consiste a allouer les objets
+ au template puis de les utiliser avec une syntaxe similaire a celles
+ des fonctions personnalisées. Le deuxième moyen consiste a allouer
+ des objets aux templates et de les utiliser comme n'importe quelle
+ variable. La première méthode a une syntaxe beaucoup plus sympathique.
+ Elle est aussi plus sécurisée, puisqu'un objet alloué ne peut avoir accès
+ qu'a certaines méthodes et propriétés. Néanmoins, un objet alloué
+ ne peut pas avoir de lien sur lui-même ou être mis dans un tableau
+ d'objet, etc. Vous devez choisir la méthode qui correspond a vos
+ besoins, mais tGchez d'utiliser la première méthode autant que possible
+ afin de réduire la syntaxe des templates au minimum.
+
+
+ Si l'option de sécurité est activée, aucune méthode ou fonctions privées
+ n'est accessible (commentant par "_"). S'il existe une méthode et une
+ propriété du même nom, c'est la méthode qui sera utilisée.
+
+
+ Vous pouvez restreindre l'accès aux méthodes et aux propriétés en
+ les listant dans un tableau en tant que troisième paramètre
+ d'allocation.
+
+
+ Par défaut, les paramètres passés aux objets depuis le templates le sont de la
+ même faton que les fonctions utilisateurs les récupèrent.
+ Le premier paramètre correspond a un tableau associatif, le second a l'objet
+ Smarty. Si vous souhaitez que les paramètres soient passées un a un, comme
+ dans un appel traditionnel, définissez registration, quatrième paramètre optionnel,
+ a false.
+
+
+ utilisation d'un objet alloué ou assigné
+
+<?php
+// la classe
+
+class My_Object() {
+ function meth1($params, &$smarty_obj) {
+ return "this is my meth1";
+ }
+}
+
+$myobj = new My_Object;
+// enregistre l'objet
+$smarty->register_object("foobar",$myobj);
+// on restreint l'accès a certaines méthodes et propriétés en les listant
+$smarty->register_object("foobar",$myobj,array('meth1','meth2','prop1'));
+// pour utiliser le format habituel de paramètre objet, passez le booléen = false
+$smarty->register_object("foobar",$myobj,null,false);
+
+// on peut aussi assigner des objets. Assignez par référence quand c'est possible
+$smarty->assign_by_ref("myobj", $myobj);
+
+$smarty->display("index.tpl");
+?>
+
+TEMPLATE:
+
+{* accès a notre objet enregistré *}
+{foobar->meth1 p1="foo" p2=$bar}
+
+{* on peut aussi assigner la sortie *}
+{foobar->meth1 p1="foo" p2=$bar assign="output"}
+the output was {$output)
+
+{* access our assigned object *}
+{$myobj->meth1("foo",$bar)}
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/advanced-features/advanced-features-outputfilters.xml b/docs/fr/programmers/advanced-features/advanced-features-outputfilters.xml
new file mode 100644
index 00000000..840454a4
--- /dev/null
+++ b/docs/fr/programmers/advanced-features/advanced-features-outputfilters.xml
@@ -0,0 +1,63 @@
+
+
+
+ Filtres de sortie
+
+ Quand le template est appelé via les fonctions display() ou fetch(),
+ sa sortie est envoyée a travers un ou plusieurs filtres de sorties.
+ Ils diffèrent des filtres de post-compilation dans le sens ou ils agissent
+ sur la sortie des templates, une fois exécutés, et non sur les sources
+ des templates.
+
+
+ Les filtres de sortie peuvent être soit
+ déclarés soit
+ chargés depuis les répertoires des plugins en utilisant la fonction
+ load_filter()
+ ou en réglant la variable
+ $autoload_filters.
+ Smarty passera la sortie du template en premier argument et attendra
+ de la fonction qu'elle retourne le résultat de l'exécution.
+
+
+ utilisation d'un filtre de sortie
+
+<?php
+// mettez ceci dans votre application
+function protect_email($tpl_output, &$smarty)
+{
+ $tpl_output =
+ preg_replace('!(\S+)@([a-zA-Z0-9\.\-]+\.([a-zA-Z]{2,3}|[0-9]{1,3}))!',
+ '$1%40$2', $tpl_output);
+ return $tpl_output;
+}
+
+// enregistre le filtre de sortie
+$smarty->register_outputfilter("protect_email");
+$smarty->display("index.tpl");
+
+// dorénavant toute occurence d'un adresse email dans le résultat du template
+// aura un protection simple contre les robots spammers
+?>
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/advanced-features/advanced-features-postfilters.xml b/docs/fr/programmers/advanced-features/advanced-features-postfilters.xml
new file mode 100644
index 00000000..a6dd82ab
--- /dev/null
+++ b/docs/fr/programmers/advanced-features/advanced-features-postfilters.xml
@@ -0,0 +1,54 @@
+
+
+
+ Filtres de post-compilation
+
+ Les filtres de post-compilation sont des fonctions PHP que vos templates
+ exécutent après avoir été compilés. Les filtres de post-compilation peuvent
+ être soit déclarés soit chargés
+ depuis les répertoires des plugins en utilisant la fonction
+ load_filter() ou en réglant
+ la variable $autoload_filters.
+ Smarty passera le template compilé en tant que premier paramètre et attendra
+ de la fonction qu'elle retourne le résultat de l'exécution.
+
+
+ utilisation d'un filtre de post-compilation de templates
+
+<?php
+// mettez cela dans votre application
+function add_header_comment($tpl_source, &$smarty)
+{
+ return "<?php echo \"<!-- Created by Smarty! -->\n\" ?>\n".$tpl_source;
+}
+
+// enregistre le filtre de post-compilation
+$smarty->register_postfilter("add_header_comment");
+$smarty->display("index.tpl");
+?>
+
+{* template Smarty compilé index.tpl *}
+<!-- Created by Smarty! -->
+{* reste du contenu du template... *}
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/advanced-features/advanced-features-prefilters.xml b/docs/fr/programmers/advanced-features/advanced-features-prefilters.xml
new file mode 100644
index 00000000..3a5b17f1
--- /dev/null
+++ b/docs/fr/programmers/advanced-features/advanced-features-prefilters.xml
@@ -0,0 +1,57 @@
+
+
+
+ Filtres de pré-compilation
+
+ Les filtres de pré-compilation sont des fonctions PHP que vos templates
+ exécutent avant qu'ils ne soient compilés. Cela peut être utile
+ pour pré-traiter vos templates afin d'enlever les commentaires
+ inutiles, garder un oeil sur ce que les gens mettent dans leurs templates, etc.
+ Les filtre de pré-compilations peuvent être soit
+ déclarés soit chargés
+ a partir des répertoires de plugins en utilisant la fonction
+ load_filter() ou en réglant
+ la variable
+ $autoload_filters.
+ Smarty passera a la fonction le code source en tant que premier argument,
+ et attendra en retour le code modifié.
+
+
+ Utilisation un filtre de pré-compilation de template
+
+<?php
+// mettre ceci dans votre application
+function remove_dw_comments($tpl_source, &$smarty)
+{
+ return preg_replace("/<!--#.*-->/U","",$tpl_source);
+}
+
+// enregistrer le filtre de pré-compilation
+$smarty->register_prefilter("remove_dw_comments");
+$smarty->display("index.tpl");
+?>
+
+{* template Smarty index.tpl *}
+<!--# cette ligne va être supprimée par le filtre de pré-compilation -->
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/advanced-features/section-template-cache-handler-func.xml b/docs/fr/programmers/advanced-features/section-template-cache-handler-func.xml
new file mode 100644
index 00000000..e2915d19
--- /dev/null
+++ b/docs/fr/programmers/advanced-features/section-template-cache-handler-func.xml
@@ -0,0 +1,152 @@
+
+
+
+ Fonction de gestion du cache
+
+ Une alternative au mécanisme de cache par défaut (basé sur des fichiers
+ de cache) consiste a spécifier une fonction de gestion de cache utilisateur
+ qui sera utilisée pour lire, écrire et effacer les fichiers de cache.
+
+
+ Il suffit de créer dans votre application une fonction que Smarty
+ utilisera pour la gestion du cache et d'assigner le nom de cette
+ fonction a la variable de classe
+ $cache_handler_func.
+ Smarty utilisera alors cette fonction pour gérer les données du cache.
+ Le premier argument est l'action, qui sera 'read', 'write' ou 'clear'.
+ Le second paramètre est l'objet Smarty. Le troisième est le contenu
+ du cache. Pour écrire, Smarty passe le contenu du cache dans ces paramètres.
+ Pour lire, Smarty s'attend a ce que votre fonction accepte ce paramètre
+ par référence et que vous le remplissiez avec les données du cache. Pour effacer,
+ il suffit de passer une variable fictive car cette dernière n'est pas utilisée.
+ Le quatrième paramètre est le nom du fichier de template (utile pour
+ lire/écrire), le cinquième paramètre est l'identifiant de cache (optionnel)
+ et le sixième est l'identifiant de compilation.
+
+
+ exemple d'utilisation de MySQL pour la source du cache
+
+<?php
+/*
+
+exemple d'usage :
+
+include('Smarty.class.php');
+include('mysql_cache_handler.php');
+
+$smarty = new Smarty;
+$smarty->cache_handler_func = 'mysql_cache_handler';
+
+$smarty->display('index.tpl');
+
+
+la base mysql est attendu dans ce format :
+
+create database SMARTY_CACHE;
+
+create table CACHE_PAGES(
+CacheID char(32) PRIMARY KEY,
+CacheContents MEDIUMTEXT NOT NULL
+);
+
+*/
+
+function mysql_cache_handler($action, &$smarty_obj, &$cache_content, $tpl_file=null, $cache_id=null, $compile_id=null)
+{
+ // l'h(te de la bd, l'utilisateur, et le mot de passe
+ $db_host = 'localhost';
+ $db_user = 'myuser';
+ $db_pass = 'mypass';
+ $db_name = 'SMARTY_CACHE';
+ $use_gzip = false;
+
+ // crée un identifiant de cache unique
+ $CacheID = md5($tpl_file.$cache_id.$compile_id);
+
+ if(! $link = mysql_pconnect($db_host, $db_user, $db_pass)) {
+ $smarty_obj->_trigger_error_msg("cache_handler: could not connect to database");
+ return false;
+ }
+ mysql_select_db($db_name);
+
+ switch ($action) {
+ case 'read':
+ // récupère le cache dans la base de données
+ $results = mysql_query("select CacheContents from CACHE_PAGES where CacheID='$CacheID'");
+ if(!$results) {
+ $smarty_obj->_trigger_error_msg("cache_handler: query failed.");
+ }
+ $row = mysql_fetch_array($results,MYSQL_ASSOC);
+
+ if($use_gzip && function_exists("gzuncompress")) {
+ $cache_contents = gzuncompress($row["CacheContents"]);
+ } else {
+ $cache_contents = $row["CacheContents"];
+ }
+ $return = $results;
+ break;
+ case 'write':
+ // sauvegarde le cache dans la base de données
+
+ if($use_gzip && function_exists("gzcompress")) {
+ // compresse le contenu pour gagner de la place
+ $contents = gzcompress($cache_content);
+ } else {
+ $contents = $cache_content;
+ }
+ $results = mysql_query("replace into CACHE_PAGES values(
+ '$CacheID',
+ '".addslashes($contents)."')
+ ");
+ if(!$results) {
+ $smarty_obj->_trigger_error_msg("cache_handler: query failed.");
+ }
+ $return = $results;
+ break;
+ case 'clear':
+ // efface les données du cache
+ if(empty($cache_id) && empty($compile_id) && empty($tpl_file)) {
+ // les efface toutes
+ $results = mysql_query("delete from CACHE_PAGES");
+ } else {
+ $results = mysql_query("delete from CACHE_PAGES where CacheID='$CacheID'");
+ }
+ if(!$results) {
+ $smarty_obj->_trigger_error_msg("cache_handler: query failed.");
+ }
+ $return = $results;
+ break;
+ default:
+ // erreur, action inconnue
+ $smarty_obj->_trigger_error_msg("cache_handler: unknown action \"$action\"");
+ $return = false;
+ break;
+ }
+ mysql_close($link);
+ return $return;
+
+}
+
+?>
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/advanced-features/template-resources.xml b/docs/fr/programmers/advanced-features/template-resources.xml
new file mode 100644
index 00000000..f60d699a
--- /dev/null
+++ b/docs/fr/programmers/advanced-features/template-resources.xml
@@ -0,0 +1,209 @@
+
+
+
+ Ressources
+
+ Les templates peuvent provenir d'une grande variété de ressources. Quand vous
+ affichez ou récupérez un template, ou quand vous incluez un template
+ dans un autre template, vous fournissez un type de ressource, suivi
+ par le chemin approprié et le nom du template.
+
+
+ Templates depuis $template_dir
+
+ Les templates du répertoire $template_dir n'ont pas
+ besoin d'une ressource template, bien que vous puissiez utiliser
+ la ressource "file" pour être cohérent. Vous n'avez qu'a fournir
+ le chemin vers le template que vous voulez utiliser, relatif
+ au répertoire racine $template_dir.
+
+
+ Utilisation de templates depuis $template_dir
+
+// le script PHP
+$smarty->display("index.tpl");
+$smarty->display("admin/menu.tpl");
+$smarty->display("file:admin/menu.tpl"); // le même que celui ci-dessus
+
+{* le template Smarty *}
+{include file="index.tpl"}
+{include file="file:index.tpl"} {* le même que celui ci-dessus *}
+
+
+
+ Templates a partir de n'importe quel répertoire
+
+ Les templates en-dehors du répertoire $template_dir nécessitent
+ le type de ressource template, suivi du chemin absolu et du nom du
+ template.
+
+
+ utilisation d'un template depuis n'importe quel répertoire
+
+// le script PHP
+$smarty->display("file:/export/templates/index.tpl");
+$smarty->display("file:/path/to/my/templates/menu.tpl");
+
+{* le template Smarty *}
+{include file="file:/usr/local/share/templates/navigation.tpl"}
+
+
+
+ Chemin de fichiers Windows
+
+ Si vous utilisez Windows, les chemins de fichiers sont la plupart
+ du temps sur un disque identifié par une lettre (c:) au début du chemin.
+ Assurez-vous de bien mettre "file:" dans le chemin pour éviter des
+ conflits d'espace de nommage et obtenir les résultats escomptés.
+
+
+ utilisation de templates avec des chemins de fichiers Windows
+
+// le script PHP
+$smarty->display("file:C:/export/templates/index.tpl");
+$smarty->display("file:F:/path/to/my/templates/menu.tpl");
+
+{* le template Smarty *}
+{include file="file:D:/usr/local/share/templates/navigation.tpl"}
+
+
+
+
+
+ Templates depuis d'autres sources
+
+ Vous pouvez récupérer les templates a partir n'importe quelle
+ source a laquelle vous avez accès avec PHP : base de données,
+ sockets, LDAP et ainsi de suite. Il suffit d'écrire les fonctions
+ de ressource plugins et de les enregistrer auprès de Smarty.
+
+
+ Reportez-vous a la section ressource plugins
+ pour plus d'informations sur les fonctions que vous Otes censé fournir.
+
+
+
+ Notez que vous ne pouvez pas écraser la ressource file native,
+ toutefois, vous pouvez fournir une ressource qui récupère un template depuis
+ le système de fichier par un autre moyen en l'enregistrant sous un autre
+ nom de ressource.
+
+
+
+ utilisation de ressources utilisateurs
+
+// le script PHP
+
+// mettez ces fonctions quelque part dans votre application
+function db_get_template ($tpl_name, &$tpl_source, &$smarty_obj)
+{
+ // requête BD pour récupérer le template
+ // et remplir $tpl_source
+ $sql = new SQL;
+ $sql->query("select tpl_source
+ from my_table
+ where tpl_name='$tpl_name'");
+ if ($sql->num_rows) {
+ $tpl_source = $sql->record['tpl_source'];
+ return true;
+ } else {
+ return false;
+ }
+}
+
+function db_get_timestamp($tpl_name, &$tpl_timestamp, &$smarty_obj)
+{
+ // requête BD pour remplir $tpl_timestamp
+ $sql = new SQL;
+ $sql->query("select tpl_timestamp
+ from my_table
+ where tpl_name='$tpl_name'");
+ if ($sql->num_rows) {
+ $tpl_timestamp = $sql->record['tpl_timestamp'];
+ return true;
+ } else {
+ return false;
+ }
+}
+
+function db_get_secure($tpl_name, &$smarty_obj)
+{
+ // on suppose que tous les templates sont svrs
+ return true;
+}
+
+function db_get_trusted($tpl_name, &$smarty_obj)
+{
+ // pas utilisée pour les templates dans notre cas
+}
+
+// enregistre le nom de ressource "db"
+$smarty->register_resource("db", array("db_get_template",
+ "db_get_timestamp",
+ "db_get_secure",
+ "db_get_trusted"));
+
+// utilise la ressource depuis le script PHP
+$smarty->display("db:index.tpl");
+
+{* utilise la ressource depuis le template Smarty *}
+{include file="db:/extras/navigation.tpl"}
+
+
+
+
+ Fonction de gestion de template par défaut
+
+ Vous pouvez spécifier une fonction qui sera utilisée pour
+ récupérer le contenu d'un template dans le cas oú le template
+ ne peut pas être récupéré depuis sa ressource. Une utilisation possible est
+ la création de templates a la volée.
+
+
+ utilisation de la fonction de gestion de template par défaut
+
+<?php
+// mettez cette fonction quelque part dans votre application
+
+function make_template ($resource_type, $resource_name, &$template_source, &$template_timestamp, &$smarty_obj)
+{
+ if( $resource_type == 'file' ) {
+ if ( ! is_readable ( $resource_name )) {
+ // crée le fichier de template et renvoie le contenu
+ $template_source = "This is a new template.";
+ $template_timestamp = time();
+ $smarty_obj->_write_file($resource_name,$template_source);
+ return true;
+ }
+ } else {
+ // pas un fichier
+ return false;
+ }
+}
+
+// régle la fonction par défaut
+$smarty->default_template_handler_func = 'make_template';
+?>
+
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-functions.xml b/docs/fr/programmers/api-functions.xml
index c14e84f9..522f06aa 100644
--- a/docs/fr/programmers/api-functions.xml
+++ b/docs/fr/programmers/api-functions.xml
@@ -2,977 +2,45 @@
Méthodes
-
- append
-
-
- void append
- mixed var
-
-
- void append
- string varname
- mixed var
-
-
- void append
- string varname
- mixed var
- boolean merge
-
-
-
- Utilisée pour ajouter un élément a un tableau assigné. Si vous utilisez
- cette fonction avec une chaîne de caractères, elle est convertie en
- tableau auquel on ajoute ensuite l'élément. Vous pouvez explicitement passer
- des paires nom/valeur. Si vous passez le troisième paramètre
- (optionel) a vrai, la valeur sera fusionnée avec le tableau plut(t que
- d'être ajoutée.
-
-
- Note technique
-
- Le paramètre de fusion respecte les clés des tableaux, ainsi si vous
- fusionnez deux tableaux indexés numériquement, ils pourront s'écraser
- l'un l'autre ou donner des clés qui ne se suivent pas. Cela diffère
- donc de la fonction PHP array_merge() qui supprime les clés numériques
- et les renumérote.
-
-
-
- append
-
-// passe des paires nom/valeur
-$smarty->append("Name","Fred");
-$smarty->append("Address",$address);
+&programmers.api-functions.api-append;
+&programmers.api-functions.api-append-by-ref;
+&programmers.api-functions.api-assign;
+&programmers.api-functions.api-assign-by-ref;
+&programmers.api-functions.api-clear-all-assign;
+&programmers.api-functions.api-clear-all-cache;
+&programmers.api-functions.api-clear-assign;
+&programmers.api-functions.api-clear-cache;
+&programmers.api-functions.api-clear-compiled-tpl;
+&programmers.api-functions.api-clear-config;
+&programmers.api-functions.api-config-load;
+&programmers.api-functions.api-display;
+&programmers.api-functions.api-fetch;
+&programmers.api-functions.api-get-config-vars;
+&programmers.api-functions.api-get-registered-object;
+&programmers.api-functions.api-get-template-vars;
+&programmers.api-functions.api-is-cached;
+&programmers.api-functions.api-load-filter;
+&programmers.api-functions.api-register-block;
+&programmers.api-functions.api-register-compiler-function;
+&programmers.api-functions.api-register-function;
+&programmers.api-functions.api-register-modifier;
+&programmers.api-functions.api-register-object;
+&programmers.api-functions.api-register-outputfilter;
+&programmers.api-functions.api-register-postfilter;
+&programmers.api-functions.api-register-prefilter;
+&programmers.api-functions.api-register-resource;
+&programmers.api-functions.api-trigger-error;
-// passe un tableau associatif
-$smarty->append(array("city" => "Lincoln","state" => "Nebraska"));
-
-
-
- append_by_ref
-
-
- void append_by_ref
- string varname
- mixed var
-
-
- void append_by_ref
- string varname
- mixed var
- boolean merge
-
-
-
- Utilisée pour ajouter des valeurs a un template par référence plut(t que
- par copie. Si vous ajoutez une variable par référence puis changez sa
- valeur, le changement est aussi répercuté sur la valeur assignée.
- Pour les objets, append_by_ref ne fait pas de copie en mémoire de l'objet
- assigné. Voir la documentation PHP pour plus d'informations sur les
- références de variable.
- Si vous passez le troisième paramètre a vrai, la valeur sera fusionnée
- avec le tableau courant plut(t que d'être ajoutée.
-
-
- Note technique
-
- Le paramètre de fusion respecte les clés des tableaux, ainsi si vous
- fusionnez deux tableaux indexés numériquement, ils pourront s'écraser
- l'un l'autre ou donner des clés qui ne se suivent pas. Cela diffère
- donc de la fonction PHP array_merge() qui supprime les clés numériques
- et les renumérote.
-
-
-
- append_by_ref
-
-// ajoute des paires nom/valeur
-$smarty->append_by_ref("Name",$myname);
-$smarty->append_by_ref("Address",$address);
-
-
-
- assign
-
-
- void assign
- mixed var
-
-
- void assign
- string varname
- mixed var
-
-
-
- Utilisée pour assigner des valeurs aux templates. Vous pouvez
- explicitement passer des paires nom/valeur, ou des tableaux
- associatifs contenant des paires nom/valeur.
-
-
- assign
-
-// passe des paires nom/valeur
-$smarty->assign("Name","Fred");
-$smarty->assign("Address",$address);
-
-// passe un tableau associatif
-$smarty->assign(array("city" => "Lincoln","state" => "Nebraska"));
-
-
-
- assign_by_ref
-
-
- void assign_by_ref
- string varname
- mixed var
-
-
-
- Utilisée pour assigner des valeurs aux templates par référence plut(t
- que par copie. Référez-vous au manuel PHP pour une explication plus précise
- sur les références des variables.
-
-
- Note technique
-
- Si vous assignez une variable par référence puis changez sa
- valeur, le changement est aussi répercuté sur la valeur assignée.
- Pour les objets, assign_by_ref ne fait pas de copie en mémoire de l'objet
- assigné. Référez-vous au manuel PHP pour une explication plus précise sur
- les références de variable.
-
-
-
- assign_by_ref
-
-// passe des paires noms/valeurs
-$smarty->assign_by_ref("Name",$myname);
-$smarty->assign_by_ref("Address",$address);
-
-
-
- clear_all_assign
-
-
- void clear_all_assign
-
-
-
-
- Utilisée pour effacer les valeurs de toutes les variables assignées.
-
-
-clear_all_assign
-
-// efface toutes les variables assignées
-$smarty->clear_all_assign();
-
-
-
- clear_all_cache
-
-
- void clear_all_cache
- int expire time
-
-
-
- Utilisée pour effacer les fichiers de cache des templates. Vous pouvez passer un
- paramètre optionnel afin d'indiquer l'Gge minimun que doivent avoir
- les fichiers de cache pour qu'ils soient effacés.
-
-
-clear_all_cache
-
-// efface le cache
-$smarty->clear_all_cache();
-
-
-
- clear_assign
-
-
- void clear_assign
- string var
-
-
-
- Efface la valeur d'une variable assignée. Il peut s'agir
- d'une simple valeur ou d'un tableau de valeur.
-
-
-clear_assign
-
-// efface une variable
-$smarty->clear_assign("Name");
-
-// efface plusieurs variables
-$smarty->clear_assign(array("Name","Address","Zip"));
-
-
-
- clear_cache
-
- voidclear_cache
- stringtemplate
- stringcache id
- stringcompile id
- intexpire time
-
-
- Utilisée pour nettoyer le(s) fichier(s) de cache d'un template en particulier.
- Si vous avez plusieurs fichiers de cache pour ce template vous
- pouvez en spécifier un en particulier en passant son identifiant
- en deuxième paramètre. Vous pouvez aussi passer un identifiant
- de compilation en troisième paramètre. Vous pouvez grouper des
- templates ensemble afin qu'ils puissent être supprimés en groupe.
- Référez-vous a la section sur le
- cache
- pour plus d'informations. Vous pouvez passer un quatrième paramètre
- pour indiquer un Gge minimum en secondes que le fichier en cache doit
- avoir avant d'être effacé.
-
-
-clear_cache
-
-// efface le fichier de cache de ce template
-$smarty->clear_cache("index.tpl");
-
-// efface un fichier de cache grGce a son identifiant de cache
-$smarty->clear_cache("index.tpl","CACHEID");
-
-
-
- clear_compiled_tpl
-
-
- void clear_compiled_tpl
- string tpl_file
-
-
-
- Utilisée pour effacer la version compilée du template spécifié ou
- de tous les templates si aucun n'est spécifié. Cette fonction
- est destinée a un usage avancé et n'est pas habituellement utilisée.
-
-
-clear_compiled_tpl
-
-// efface la version compilée du template spécifié
-$smarty->clear_compiled_tpl("index.tpl");
-
-// efface tout le contenu du répertoire des templates compilés
-$smarty->clear_compiled_tpl();
-
-
-
- clear_config
-
- voidclear_config
- stringvar
-
-
- Utilisée pour effacer toutes les variables de configuration s'étant
- vues assigner une valeur. Si une variable est spécifiée, seule cette
- variable est effacée.
-
-
-clear_config
-
-// efface toutes les variables de configuration assignées
-$smarty->clear_config();
-
-// efface une seule variable
-$smarty->clear_config('foobar');
-
-
-
- config_load
-
- voidconfig_load
- stringfile
- stringsection
-
-
- Utilisée pour charger des données d'un fichier de config et les
- assigner a un template. Cette fonction fonctionne exactement comme
- la fonction de template config_load.
-
-
- Note technique
-
- Comme pour Smarty 2.4.0, les variables de templates assignées
- sont conservées entre chaque appel a fetch et display.
- Les variables de configuration chargées avec config_load sont
- globales. Les fichiers de config sont aussi compilés pour une
- exécution plus rapide et respecte les réglages de force_compile et de compile_check.
-
-
-
-config_load
-
-// charge les variables de configuration et les assigne
-$smarty->config_load('my.conf');
-
-// charge une section
-$smarty->config_load('my.conf','foobar');
-
-
-
- display
-
- voiddisplay
- stringtemplate
- stringcache_id
- stringcompile_id
-
-
- Utilisée pour afficher un template. Il faut fournir un type et un
- chemin de ressource template
- valides. Vous pouvez passer en second paramètre un identifiant
- de fichier de cache. Reportez-vous a la section
- cache pour plus de renseignements.
-
-
- Le troisième paramètre optionnel est un identifiant de compilation.
- Cela s'avère utile quand vous voulez compiler différentes versions
- d'un même template, pour par exemple avoir des templates
- compilés séparés pour différents langages. Une autre utilité de ce
- paramètre est le cas oú vous utilisez plus d'un $template_dir mais un seul
- $compile_dir, car certains templates avec le même nom s'écraseraient
- entre eux. Vous pouvez aussi régler la variable $compile_id une seule
- fois au lieu de la passer a chaque appel.
-
-
-affichage
-
-include("Smarty.class.php");
-$smarty = new Smarty;
-$smarty->caching = true;
-
-// ne fait un appel a la base de données que si le fichier
-// de cache n'existe pas
-if(!$smarty->is_cached("index.tpl"))
-{
-
- // quelques données
- $address = "245 N 50th";
- $db_data = array(
- "City" => "Lincoln",
- "State" => "Nebraska",
- "Zip" = > "68502"
- );
-
- $smarty->assign("Name","Fred");
- $smarty->assign("Address",$address);
- $smarty->assign($db_data);
-
-}
-
-// display the output
-$smarty->display("index.tpl");
-
-
- Utilisez la syntaxe des ressources templates
- pour afficher des fichiers en-dehors du répertoire
- $template_dir
-
-
-
-exemples de fonction d'affichage de ressources templates
-
-// chemin absolu
-$smarty->display("/usr/local/include/templates/header.tpl");
-
-// chemin absolu (pareil)
-$smarty->display("file:/usr/local/include/templates/header.tpl");
-
-// chemin absolu Windows (on DOIT utiliser le préfixe "file:")
-$smarty->display("file:C:/www/pub/templates/header.tpl");
-
-// inclue a partir de la ressource template "db"
-$smarty->display("db:header.tpl");
-
-
-
-
- fetch
-
- stringfetch
- stringtemplate
- stringcache_id
- stringcompile_id
-
-
- Utilisée pour renvoyer le résultat du template plut(t que de l'afficher.
- Il faut passer un type et un chemin de ressource template
- valides. Vous pouvez passer un identifiant de cache en deuxième
- paramètre. Reportez-vous a la section cache
- pour plus de renseignements.
-
-
- Un troisième paramètre optionnel est un identifiant de compilation.
- Cela s'avère utile quand vous voulez compiler différentes versions
- d'un même template, pour par exemple avoir des templates
- compilés séparés pour différents langages. Une autre utilité de ce
- paramètre est le cas oú vous utilisez plus d'un $template_dir
- mais un seul $compile_dir, car certains templates avec le même nom
- s'écraseraient entre eux. Vous pouvez aussi régler la variable $compile_id une seule
- fois plut(t que de la passer a chaque appel.
-
-
-fetch
-
-include("Smarty.class.php");
-$smarty = new Smarty;
-
-$smarty->caching = true;
-
-// ne fait un appel a la base de données que si le fichier
-// de cache n'existe pas
-if(!$smarty->is_cached("index.tpl"))
-{
-
- // quelques données
- $address = "245 N 50th";
- $db_data = array(
- "City" => "Lincoln",
- "State" => "Nebraska",
- "Zip" = > "68502"
- );
-
- $smarty->assign("Name","Fred");
- $smarty->assign("Address",$address);
- $smarty->assign($db_data);
-
-}
-
-// récupère le résultat
-$output = $smarty->fetch("index.tpl");
-
-// fait quelque chose avec $output
-
-echo $output;
-
-
-
- get_config_vars
-
- arrayget_config_vars
- stringvarname
-
-
- Retourne la valeur de la variable de configuration passée en paramètre.
- Si aucun paramètre n'est donné, un tableau de toutes les variables de
- configuration chargées est renvoyé.
-
-
-get_config_vars
-
-// récupère la variable de configuration chargée 'foo'
-$foo = $smarty->get_config_vars('foo');
-
-// récupère toutes les variables de configuration chargées
-$config_vars = $smarty->get_config_vars();
-
-// les affiche a l'écran
-print_r($config_vars);
-
-
-
- get_registered_object
-
-
- array get_registered_object
- string object_name
-
-
-
- Retourne la référence d'un objet enregistré. Utile quand vous
- voulez accéder directement a un objet enregistré avec une
- fonction utilisateur.
-
-
-get_registered_object
-
-function smarty_block_foo($params, &$smarty) {
- if (isset[$params['object']]) {
- // récupère la référence de l'objet enregistré
- $obj_ref =& $smarty->get_registered_object($params['object']);
- // $obj_ref est maintenant une référence vers l'objet
- }
-}
-
-
-
- get_template_vars
-
- arrayget_template_vars
- stringvarname
-
-
- Retourne la valeur assignée passée en paramètre. Si aucun paramètre
- n'est donné, un tableau de toutes les variables assignées est
- renvoyé.
-
-
-get_template_vars
-
-// récupère la variable 'foo' assignée au template
-// get assigned template var 'foo'
-$foo = $smarty->get_template_vars('foo');
-
-// récupère toutes les variables assignées a ce template
-$tpl_vars = $smarty->get_template_vars();
-
-// les affiche a l'écran
-print_r($tpl_vars);
-
-
-
- is_cached
-
-
- void is_cached
- string template
- [string cache_id]
-
-
-
- Retourne vrai s'il y a un fichier de cache valide pour ce template.
- Cela fonctionne seulement si caching est a vrai.
-
-
-is_cached
-
-$smarty->caching = true;
-
-if(!$smarty->is_cached("index.tpl")) {
- // faire des requêtes base de données et assigner
- // des variables ici.
-}
-
-$smarty->display("index.tpl");
-
-
- Vous pouvez aussi passer en second paramètre un identifiant
- de cache au cas oú vous voudriez plusieurs fichiers de cache
- pour ce template.
-
-
-is_cached with multiple-cache template
-
-$smarty->caching = true;
-
-if(!$smarty->is_cached("index.tpl","FrontPage")) {
- // faire des requêtes base de données et assigner
- // des variables ici.
-}
-
-$smarty->display("index.tpl","FrontPage");
-
-
-
- load_filter
-
-
- void load_filter
- string type
- string name
-
-
-
- Cette fonction peut être utilisée pour charger un plugin
- de filtrage. Le premier argument spécifie le type du filtre
- et peut prendre l'une des valeurs suivantes : 'pre', 'post'
- ou 'output'. Le second argument spécifie le nom du plugin
- de filtrage, par exemple 'trim'.
-
-
-Chargement de plugins de filtrage
-
-$smarty->load_filter('pre', 'trim'); // charge le filtre 'trim' de type 'pre'
-$smarty->load_filter('pre', 'datefooter'); // charge un autre filtre de type 'pre' appelé 'datefooter'
-$smarty->load_filter('output', 'compress'); // charge le filtre 'compress' de type 'output'
-
-
-
- register_block
-
-
- void register_block
- string name
- string impl
-
-
-
- Utilisée pour déclarrer dynamiquement des plugins de fonction
- de blocs. Il faut passer en paramètre le nom de la fonction
- de blocs, suivi du nom de la fonction PHP qui l'implémente.
-
-
-register_block
-
-/* PHP */
-$smarty->register_block("translate", "do_translation");
-
-function do_translation ($params, $content, &$smarty) {
- if ($content) {
- $lang = $params['lang'];
- // fait de la traduction avec la variable $content
- echo $translation;
- }
-}
-
-{* template *}
-{translate lang="br"}
- Hello, world!
-{/translate}
-
-
-
- register_compiler_function
-
-
- void register_compiler_function
- string name
- string impl
-
-
-
- Utilisée pour déclarer dynamiquement un plugin de fonction
- de compilation. Il faut passer en paramètres le nom de la fonction
- de compilation, suivi par la fonction PHP qui
- l'implémente.
-
-
-
- register_function
-
-
- void register_function
- string name
- string impl
-
-
-
- Utilisée pour déclarer dynamiquement des plugins de fonction
- de templates. Il faut passer en paramètres le nom de la fonction
- de templates, suivi par le nom de la fonction PHP qui l'implémente.
-
-
-register_function
-
-$smarty->register_function("date_now", "print_current_date");
-
-function print_current_date ($params) {
- extract($params);
- if(empty($format))
- $format="%b %e, %Y";
- echo strftime($format,time());
-}
-
-// vous pouvez maintenant utiliser ceci dans Smarty pour afficher
-// la date actuelle : {date_now} ou {date_now format="%Y/%m/%d"}
-// pour la formater
-
-
-
- register_modifier
-
-
- void register_modifier
- string name
- string impl
-
-
-
- Utilisée pour déclarer dynamiquement un plugin de modificateur.
- Il faut passer en paramètre le nom du modificateur de variables,
- suivi de la fonction PHP qui l'implémente.
-
-
-register_modifier
-
-// associons la fonction PHP stripslashes a un modificateur Smarty.
-
-$smarty->register_modifier("sslash","stripslashes");
-
-// vous pouvez maintenant utiliser {$var|sslash} pour supprimer les slash des variables
-
-
-
- register_object
-
-
- void register_object
- string object_name
- object $object
- array allowed methods/properties
- boolean format
-
-
-
- Utilisée pour enregistrer un objet a utiliser dans un template.
- Reportez-vous a la section
- objet de
- ce manuel pour des exemples.
-
-
-
- register_outputfilter
-
-
- void register_outputfilter
- string function_name
-
-
-
- Utilisée pour déclarer dynamiquement des filtres de sortie, pour
- agir sur la sortie d'un template avant qu'elle ne soit affichée.
- Reportez-vous a la section
- filtres de sortie pour plus d'information sur le sujet.
-
-
-
- register_postfilter
-
-
- void register_postfilter
- string function_name
-
-
-
- Utilisée pour déclarer dynamiquement des filtres de post-compilation pour y faire
- passer des templates une fois qu'ils ont été compilés. Reportez-vous
- a la section
- filtres de post-compilation de templates
- pour avoir plus de renseignements sur la faton de paramétrer les fonctions
- de post-compilation.
-
-
-
- register_prefilter
-
-
- void register_prefilter
- string function_name
-
-
-
- Utilisée pour déclarer dynamiquement des filtres de pré-compilation pour y faire
- passer des templates avant qu'ils ne soient compilés. Reportez-vous
- a la section
- filtres de pré-compilation de templates
- pour avoir plus de renseignements sur la faton de paramétrer les fonctions
- de pré-compilation.
-
-
-
- register_resource
-
-
- void register_resource
- string name
- array resource_funcs
-
-
-
- Utilisée pour déclarer dynamiquement une ressource plugin
- dans Smarty. Il faut passer en paramètre le nom de la ressource
- et le tableau des fonctions PHP qui l'implémentent. Reportez-vous
- a la section ressources templates
- pour avoir plus d'informations sur la faton de paramétrer une fonction
- récupérant des templates.
-
-
-register_resource
-
-$smarty->register_resource("db", array("db_get_template",
- "db_get_timestamp",
- "db_get_secure",
- "db_get_trusted"));
-
-
-
- trigger_error
-
-
- void trigger_error
- string error_msg
- [int level]
-
-
-
- Cette fonction peut-être utilisée pour afficher un message d'erreur
- en utilisant Smarty. Le paramètre level
- peut prendre l'une des valeures utilisées par la fonction PHP
- trigger_error, i.e. E_USER_NOTICE, E_USER_WARNING, etc. Par défaut
- il s'agit de E_USER_WARNING.
-
-
-
-
- template_exists
-
-
- bool template_exists
- string template
-
-
-
- Cette fonction vérifie si le template spécifié existe. Elle accepte
- soit un chemin vers le template, soit une ressource de type
- chaene de caractères précisant le nom du template.
-
-
-
- unregister_block
-
-
- void unregister_block
- string name
-
-
-
- Utilisée pour désallouer dynamiquement un plugin de fonction
- de blocs. Passez en paramètre le nom du bloc.
-
-
-
- unregister_compiler_function
-
-
- void unregister_compiler_function
- string name
-
-
-
- Utilisée pour désallouer dynamiquement un fonction de compilation.
- Passez en paramètre le nom de la fonction de compilation.
-
-
-
- unregister_function
-
-
- void unregister_function
- string name
-
-
-
- Utilisée pour désallouer dynamiquement un plugin de fonction
- de templates. Passez en paramètres le nom de la fonction de templates.
-
-
-unregister_function
-
-// nous ne voulons pas que les designers de templates aient accès
-// au système de fichiers.
-
-$smarty->unregister_function("fetch");
-
-
-
- unregister_modifier
-
-
- void unregister_modifier
- string name
-
-
-
- Utilisée pour désallouer dynamiquement un plugin modificateur de variable.
- Passez en paramètre le nom du modificateur de templates.
-
-
-unregister_modifier
-
-// nous ne voulons pas que les designers de templates
-// suppriment les balises des élements
-
-$smarty->unregister_modifier("strip_tags");
-
-
-
- unregister_object
-
-
- void unregister_object
- string object_name
-
-
-
- Utilisée pour désallouer un objet.
-
-
-
- unregister_outputfilter
-
-
- void unregister_outputfilter
- string function_name
-
-
-
- Utilisée pour désallouer dynamiquement un filtre de sortie.
-
-
-
- unregister_postfilter
-
-
- void unregister_postfilter
- string function_name
-
-
-
- Utilisée pour désallouer dynamiquement un filtre de post-compilation.
-
-
-
- unregister_prefilter
-
-
- void unregister_prefilter
- string function_name
-
-
-
- Utilisée pour désallouer dynamiquement un filtre de pré-compilation.
-
-
-
- unregister_resource
-
-
- void unregister_resource
- string name
-
-
-
- Utilisée pour désallouer dynamiquement un plugin ressource.
- Passez en paramètre le nom de la ressource.
-
-
-unregister_resource
-
-$smarty->unregister_resource("db");
-
-
+&programmers.api-functions.api-template-exists;
+&programmers.api-functions.api-unregister-block;
+&programmers.api-functions.api-unregister-compiler-function;
+&programmers.api-functions.api-unregister-function;
+&programmers.api-functions.api-unregister-modifier;
+&programmers.api-functions.api-unregister-object;
+&programmers.api-functions.api-unregister-outputfilter;
+&programmers.api-functions.api-unregister-postfilter;
+&programmers.api-functions.api-unregister-prefilter;
+&programmers.api-functions.api-unregister-resource;
+
+ append_by_ref
+
+
+ void append_by_ref
+ string varname
+ mixed var
+
+
+ void append_by_ref
+ string varname
+ mixed var
+ boolean merge
+
+
+
+ Utilisée pour ajouter des valeurs a un template par référence plut(t que
+ par copie. Si vous ajoutez une variable par référence puis changez sa
+ valeur, le changement est aussi répercuté sur la valeur assignée.
+ Pour les objets, append_by_ref ne fait pas de copie en mémoire de l'objet
+ assigné. Voir la documentation PHP pour plus d'informations sur les
+ références de variable.
+ Si vous passez le troisième paramètre a vrai, la valeur sera fusionnée
+ avec le tableau courant plut(t que d'être ajoutée.
+
+
+ Note technique
+
+ Le paramètre de fusion respecte les clés des tableaux, ainsi si vous
+ fusionnez deux tableaux indexés numériquement, ils pourront s'écraser
+ l'un l'autre ou donner des clés qui ne se suivent pas. Cela diffère
+ donc de la fonction PHP array_merge() qui supprime les clés numériques
+ et les renumérote.
+
+
+
+ append_by_ref
+
+// ajoute des paires nom/valeur
+$smarty->append_by_ref("Name",$myname);
+$smarty->append_by_ref("Address",$address);
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-functions/api-append.xml b/docs/fr/programmers/api-functions/api-append.xml
new file mode 100644
index 00000000..a5722f33
--- /dev/null
+++ b/docs/fr/programmers/api-functions/api-append.xml
@@ -0,0 +1,70 @@
+
+
+
+ append
+
+
+ void append
+ mixed var
+
+
+ void append
+ string varname
+ mixed var
+
+
+ void append
+ string varname
+ mixed var
+ boolean merge
+
+
+
+ Utilisée pour ajouter un élément a un tableau assigné. Si vous utilisez
+ cette fonction avec une chaîne de caractères, elle est convertie en
+ tableau auquel on ajoute ensuite l'élément. Vous pouvez explicitement passer
+ des paires nom/valeur. Si vous passez le troisième paramètre
+ (optionel) a vrai, la valeur sera fusionnée avec le tableau plut(t que
+ d'être ajoutée.
+
+
+ Note technique
+
+ Le paramètre de fusion respecte les clés des tableaux, ainsi si vous
+ fusionnez deux tableaux indexés numériquement, ils pourront s'écraser
+ l'un l'autre ou donner des clés qui ne se suivent pas. Cela diffère
+ donc de la fonction PHP array_merge() qui supprime les clés numériques
+ et les renumérote.
+
+
+
+ append
+
+// passe des paires nom/valeur
+$smarty->append("Name","Fred");
+$smarty->append("Address",$address);
+
+// passe un tableau associatif
+$smarty->append(array("city" => "Lincoln","state" => "Nebraska"));
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-functions/api-assign-by-ref.xml b/docs/fr/programmers/api-functions/api-assign-by-ref.xml
new file mode 100644
index 00000000..5a677018
--- /dev/null
+++ b/docs/fr/programmers/api-functions/api-assign-by-ref.xml
@@ -0,0 +1,54 @@
+
+
+
+ assign_by_ref
+
+
+ void assign_by_ref
+ string varname
+ mixed var
+
+
+
+ Utilisée pour assigner des valeurs aux templates par référence plut(t
+ que par copie. Référez-vous au manuel PHP pour une explication plus précise
+ sur les références des variables.
+
+
+ Note technique
+
+ Si vous assignez une variable par référence puis changez sa
+ valeur, le changement est aussi répercuté sur la valeur assignée.
+ Pour les objets, assign_by_ref ne fait pas de copie en mémoire de l'objet
+ assigné. Référez-vous au manuel PHP pour une explication plus précise sur
+ les références de variable.
+
+
+
+ assign_by_ref
+
+// passe des paires noms/valeurs
+$smarty->assign_by_ref("Name",$myname);
+$smarty->assign_by_ref("Address",$address);
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-functions/api-assign.xml b/docs/fr/programmers/api-functions/api-assign.xml
new file mode 100644
index 00000000..a0df7a6d
--- /dev/null
+++ b/docs/fr/programmers/api-functions/api-assign.xml
@@ -0,0 +1,51 @@
+
+
+
+ assign
+
+
+ void assign
+ mixed var
+
+
+ void assign
+ string varname
+ mixed var
+
+
+
+ Utilisée pour assigner des valeurs aux templates. Vous pouvez
+ explicitement passer des paires nom/valeur, ou des tableaux
+ associatifs contenant des paires nom/valeur.
+
+
+ assign
+
+// passe des paires nom/valeur
+$smarty->assign("Name","Fred");
+$smarty->assign("Address",$address);
+
+// passe un tableau associatif
+$smarty->assign(array("city" => "Lincoln","state" => "Nebraska"));
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-functions/api-clear-all-assign.xml b/docs/fr/programmers/api-functions/api-clear-all-assign.xml
new file mode 100644
index 00000000..7077babb
--- /dev/null
+++ b/docs/fr/programmers/api-functions/api-clear-all-assign.xml
@@ -0,0 +1,40 @@
+
+
+
+ clear_all_assign
+
+
+ void clear_all_assign
+
+
+
+
+ Utilisée pour effacer les valeurs de toutes les variables assignées.
+
+
+clear_all_assign
+
+// efface toutes les variables assignées
+$smarty->clear_all_assign();
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-functions/api-clear-all-cache.xml b/docs/fr/programmers/api-functions/api-clear-all-cache.xml
new file mode 100644
index 00000000..68d4fbd8
--- /dev/null
+++ b/docs/fr/programmers/api-functions/api-clear-all-cache.xml
@@ -0,0 +1,42 @@
+
+
+
+ clear_all_cache
+
+
+ void clear_all_cache
+ int expire time
+
+
+
+ Utilisée pour effacer les fichiers de cache des templates. Vous pouvez passer un
+ paramètre optionnel afin d'indiquer l'Gge minimun que doivent avoir
+ les fichiers de cache pour qu'ils soient effacés.
+
+
+clear_all_cache
+
+// efface le cache
+$smarty->clear_all_cache();
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-functions/api-clear-assign.xml b/docs/fr/programmers/api-functions/api-clear-assign.xml
new file mode 100644
index 00000000..40459933
--- /dev/null
+++ b/docs/fr/programmers/api-functions/api-clear-assign.xml
@@ -0,0 +1,44 @@
+
+
+
+ clear_assign
+
+
+ void clear_assign
+ string var
+
+
+
+ Efface la valeur d'une variable assignée. Il peut s'agir
+ d'une simple valeur ou d'un tableau de valeur.
+
+
+clear_assign
+
+// efface une variable
+$smarty->clear_assign("Name");
+
+// efface plusieurs variables
+$smarty->clear_assign(array("Name","Address","Zip"));
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-functions/api-clear-cache.xml b/docs/fr/programmers/api-functions/api-clear-cache.xml
new file mode 100644
index 00000000..54df24ba
--- /dev/null
+++ b/docs/fr/programmers/api-functions/api-clear-cache.xml
@@ -0,0 +1,54 @@
+
+
+
+ clear_cache
+
+ voidclear_cache
+ stringtemplate
+ stringcache id
+ stringcompile id
+ intexpire time
+
+
+ Utilisée pour nettoyer le(s) fichier(s) de cache d'un template en particulier.
+ Si vous avez plusieurs fichiers de cache pour ce template vous
+ pouvez en spécifier un en particulier en passant son identifiant
+ en deuxième paramètre. Vous pouvez aussi passer un identifiant
+ de compilation en troisième paramètre. Vous pouvez grouper des
+ templates ensemble afin qu'ils puissent être supprimés en groupe.
+ Référez-vous a la section sur le
+ cache
+ pour plus d'informations. Vous pouvez passer un quatrième paramètre
+ pour indiquer un Gge minimum en secondes que le fichier en cache doit
+ avoir avant d'être effacé.
+
+
+clear_cache
+
+// efface le fichier de cache de ce template
+$smarty->clear_cache("index.tpl");
+
+// efface un fichier de cache grGce a son identifiant de cache
+$smarty->clear_cache("index.tpl","CACHEID");
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-functions/api-clear-compiled-tpl.xml b/docs/fr/programmers/api-functions/api-clear-compiled-tpl.xml
new file mode 100644
index 00000000..92574b85
--- /dev/null
+++ b/docs/fr/programmers/api-functions/api-clear-compiled-tpl.xml
@@ -0,0 +1,45 @@
+
+
+
+ clear_compiled_tpl
+
+
+ void clear_compiled_tpl
+ string tpl_file
+
+
+
+ Utilisée pour effacer la version compilée du template spécifié ou
+ de tous les templates si aucun n'est spécifié. Cette fonction
+ est destinée a un usage avancé et n'est pas habituellement utilisée.
+
+
+clear_compiled_tpl
+
+// efface la version compilée du template spécifié
+$smarty->clear_compiled_tpl("index.tpl");
+
+// efface tout le contenu du répertoire des templates compilés
+$smarty->clear_compiled_tpl();
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-functions/api-clear-config.xml b/docs/fr/programmers/api-functions/api-clear-config.xml
new file mode 100644
index 00000000..0fc56c2d
--- /dev/null
+++ b/docs/fr/programmers/api-functions/api-clear-config.xml
@@ -0,0 +1,43 @@
+
+
+
+ clear_config
+
+ voidclear_config
+ stringvar
+
+
+ Utilisée pour effacer toutes les variables de configuration s'étant
+ vues assigner une valeur. Si une variable est spécifiée, seule cette
+ variable est effacée.
+
+
+clear_config
+
+// efface toutes les variables de configuration assignées
+$smarty->clear_config();
+
+// efface une seule variable
+$smarty->clear_config('foobar');
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-functions/api-config-load.xml b/docs/fr/programmers/api-functions/api-config-load.xml
new file mode 100644
index 00000000..ee14517c
--- /dev/null
+++ b/docs/fr/programmers/api-functions/api-config-load.xml
@@ -0,0 +1,57 @@
+
+
+
+ config_load
+
+ voidconfig_load
+ stringfile
+ stringsection
+
+
+ Utilisée pour charger des données d'un fichier de config et les
+ assigner a un template. Cette fonction fonctionne exactement comme
+ la fonction de template config_load.
+
+
+ Note technique
+
+ Comme pour Smarty 2.4.0, les variables de templates assignées
+ sont conservées entre chaque appel a fetch et display.
+ Les variables de configuration chargées avec config_load sont
+ globales. Les fichiers de config sont aussi compilés pour une
+ exécution plus rapide et respecte les réglages de force_compile et de compile_check.
+
+
+
+config_load
+
+// charge les variables de configuration et les assigne
+$smarty->config_load('my.conf');
+
+// charge une section
+$smarty->config_load('my.conf','foobar');
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-functions/api-display.xml b/docs/fr/programmers/api-functions/api-display.xml
new file mode 100644
index 00000000..ae5f8b1b
--- /dev/null
+++ b/docs/fr/programmers/api-functions/api-display.xml
@@ -0,0 +1,102 @@
+
+
+
+ display
+
+ voiddisplay
+ stringtemplate
+ stringcache_id
+ stringcompile_id
+
+
+ Utilisée pour afficher un template. Il faut fournir un type et un
+ chemin de ressource template
+ valides. Vous pouvez passer en second paramètre un identifiant
+ de fichier de cache. Reportez-vous a la section
+ cache pour plus de renseignements.
+
+
+ Le troisième paramètre optionnel est un identifiant de compilation.
+ Cela s'avère utile quand vous voulez compiler différentes versions
+ d'un même template, pour par exemple avoir des templates
+ compilés séparés pour différents langages. Une autre utilité de ce
+ paramètre est le cas oú vous utilisez plus d'un $template_dir mais un seul
+ $compile_dir, car certains templates avec le même nom s'écraseraient
+ entre eux. Vous pouvez aussi régler la variable $compile_id une seule
+ fois au lieu de la passer a chaque appel.
+
+
+affichage
+
+include("Smarty.class.php");
+$smarty = new Smarty;
+$smarty->caching = true;
+
+// ne fait un appel a la base de données que si le fichier
+// de cache n'existe pas
+if(!$smarty->is_cached("index.tpl"))
+{
+
+ // quelques données
+ $address = "245 N 50th";
+ $db_data = array(
+ "City" => "Lincoln",
+ "State" => "Nebraska",
+ "Zip" = > "68502"
+ );
+
+ $smarty->assign("Name","Fred");
+ $smarty->assign("Address",$address);
+ $smarty->assign($db_data);
+
+}
+
+// display the output
+$smarty->display("index.tpl");
+
+
+ Utilisez la syntaxe des ressources templates
+ pour afficher des fichiers en-dehors du répertoire
+ $template_dir
+
+
+
+exemples de fonction d'affichage de ressources templates
+
+// chemin absolu
+$smarty->display("/usr/local/include/templates/header.tpl");
+
+// chemin absolu (pareil)
+$smarty->display("file:/usr/local/include/templates/header.tpl");
+
+// chemin absolu Windows (on DOIT utiliser le préfixe "file:")
+$smarty->display("file:C:/www/pub/templates/header.tpl");
+
+// inclue a partir de la ressource template "db"
+$smarty->display("db:header.tpl");
+
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-functions/api-fetch.xml b/docs/fr/programmers/api-functions/api-fetch.xml
new file mode 100644
index 00000000..c4b4e262
--- /dev/null
+++ b/docs/fr/programmers/api-functions/api-fetch.xml
@@ -0,0 +1,84 @@
+
+
+
+ fetch
+
+ stringfetch
+ stringtemplate
+ stringcache_id
+ stringcompile_id
+
+
+ Utilisée pour renvoyer le résultat du template plut(t que de l'afficher.
+ Il faut passer un type et un chemin de ressource template
+ valides. Vous pouvez passer un identifiant de cache en deuxième
+ paramètre. Reportez-vous a la section cache
+ pour plus de renseignements.
+
+
+ Un troisième paramètre optionnel est un identifiant de compilation.
+ Cela s'avère utile quand vous voulez compiler différentes versions
+ d'un même template, pour par exemple avoir des templates
+ compilés séparés pour différents langages. Une autre utilité de ce
+ paramètre est le cas oú vous utilisez plus d'un $template_dir
+ mais un seul $compile_dir, car certains templates avec le même nom
+ s'écraseraient entre eux. Vous pouvez aussi régler la variable $compile_id une seule
+ fois plut(t que de la passer a chaque appel.
+
+
+fetch
+
+include("Smarty.class.php");
+$smarty = new Smarty;
+
+$smarty->caching = true;
+
+// ne fait un appel a la base de données que si le fichier
+// de cache n'existe pas
+if(!$smarty->is_cached("index.tpl"))
+{
+
+ // quelques données
+ $address = "245 N 50th";
+ $db_data = array(
+ "City" => "Lincoln",
+ "State" => "Nebraska",
+ "Zip" = > "68502"
+ );
+
+ $smarty->assign("Name","Fred");
+ $smarty->assign("Address",$address);
+ $smarty->assign($db_data);
+
+}
+
+// récupère le résultat
+$output = $smarty->fetch("index.tpl");
+
+// fait quelque chose avec $output
+
+echo $output;
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-functions/api-get-config-vars.xml b/docs/fr/programmers/api-functions/api-get-config-vars.xml
new file mode 100644
index 00000000..650f78d3
--- /dev/null
+++ b/docs/fr/programmers/api-functions/api-get-config-vars.xml
@@ -0,0 +1,46 @@
+
+
+
+ get_config_vars
+
+ arrayget_config_vars
+ stringvarname
+
+
+ Retourne la valeur de la variable de configuration passée en paramètre.
+ Si aucun paramètre n'est donné, un tableau de toutes les variables de
+ configuration chargées est renvoyé.
+
+
+get_config_vars
+
+// récupère la variable de configuration chargée 'foo'
+$foo = $smarty->get_config_vars('foo');
+
+// récupère toutes les variables de configuration chargées
+$config_vars = $smarty->get_config_vars();
+
+// les affiche a l'écran
+print_r($config_vars);
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-functions/api-get-registered-object.xml b/docs/fr/programmers/api-functions/api-get-registered-object.xml
new file mode 100644
index 00000000..77f91de3
--- /dev/null
+++ b/docs/fr/programmers/api-functions/api-get-registered-object.xml
@@ -0,0 +1,47 @@
+
+
+
+ get_registered_object
+
+
+ array get_registered_object
+ string object_name
+
+
+
+ Retourne la référence d'un objet enregistré. Utile quand vous
+ voulez accéder directement a un objet enregistré avec une
+ fonction utilisateur.
+
+
+get_registered_object
+
+function smarty_block_foo($params, &$smarty) {
+ if (isset[$params['object']]) {
+ // récupère la référence de l'objet enregistré
+ $obj_ref =& $smarty->get_registered_object($params['object']);
+ // $obj_ref est maintenant une référence vers l'objet
+ }
+}
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-functions/api-get-template-vars.xml b/docs/fr/programmers/api-functions/api-get-template-vars.xml
new file mode 100644
index 00000000..68e26360
--- /dev/null
+++ b/docs/fr/programmers/api-functions/api-get-template-vars.xml
@@ -0,0 +1,47 @@
+
+
+
+ get_template_vars
+
+ arrayget_template_vars
+ stringvarname
+
+
+ Retourne la valeur assignée passée en paramètre. Si aucun paramètre
+ n'est donné, un tableau de toutes les variables assignées est
+ renvoyé.
+
+
+get_template_vars
+
+// récupère la variable 'foo' assignée au template
+// get assigned template var 'foo'
+$foo = $smarty->get_template_vars('foo');
+
+// récupère toutes les variables assignées a ce template
+$tpl_vars = $smarty->get_template_vars();
+
+// les affiche a l'écran
+print_r($tpl_vars);
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-functions/api-is-cached.xml b/docs/fr/programmers/api-functions/api-is-cached.xml
new file mode 100644
index 00000000..90bec755
--- /dev/null
+++ b/docs/fr/programmers/api-functions/api-is-cached.xml
@@ -0,0 +1,66 @@
+
+
+
+ is_cached
+
+
+ void is_cached
+ string template
+ [string cache_id]
+
+
+
+ Retourne vrai s'il y a un fichier de cache valide pour ce template.
+ Cela fonctionne seulement si caching est a vrai.
+
+
+is_cached
+
+$smarty->caching = true;
+
+if(!$smarty->is_cached("index.tpl")) {
+ // faire des requêtes base de données et assigner
+ // des variables ici.
+}
+
+$smarty->display("index.tpl");
+
+
+ Vous pouvez aussi passer en second paramètre un identifiant
+ de cache au cas oú vous voudriez plusieurs fichiers de cache
+ pour ce template.
+
+
+is_cached with multiple-cache template
+
+$smarty->caching = true;
+
+if(!$smarty->is_cached("index.tpl","FrontPage")) {
+ // faire des requêtes base de données et assigner
+ // des variables ici.
+}
+
+$smarty->display("index.tpl","FrontPage");
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-functions/api-load-filter.xml b/docs/fr/programmers/api-functions/api-load-filter.xml
new file mode 100644
index 00000000..ec326c05
--- /dev/null
+++ b/docs/fr/programmers/api-functions/api-load-filter.xml
@@ -0,0 +1,46 @@
+
+
+
+ load_filter
+
+
+ void load_filter
+ string type
+ string name
+
+
+
+ Cette fonction peut être utilisée pour charger un plugin
+ de filtrage. Le premier argument spécifie le type du filtre
+ et peut prendre l'une des valeurs suivantes : 'pre', 'post'
+ ou 'output'. Le second argument spécifie le nom du plugin
+ de filtrage, par exemple 'trim'.
+
+
+Chargement de plugins de filtrage
+
+$smarty->load_filter('pre', 'trim'); // charge le filtre 'trim' de type 'pre'
+$smarty->load_filter('pre', 'datefooter'); // charge un autre filtre de type 'pre' appelé 'datefooter'
+$smarty->load_filter('output', 'compress'); // charge le filtre 'compress' de type 'output'
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-functions/api-register-block.xml b/docs/fr/programmers/api-functions/api-register-block.xml
new file mode 100644
index 00000000..a34acb35
--- /dev/null
+++ b/docs/fr/programmers/api-functions/api-register-block.xml
@@ -0,0 +1,56 @@
+
+
+
+ register_block
+
+
+ void register_block
+ string name
+ string impl
+
+
+
+ Utilisée pour déclarrer dynamiquement des plugins de fonction
+ de blocs. Il faut passer en paramètre le nom de la fonction
+ de blocs, suivi du nom de la fonction PHP qui l'implémente.
+
+
+register_block
+
+/* PHP */
+$smarty->register_block("translate", "do_translation");
+
+function do_translation ($params, $content, &$smarty) {
+ if ($content) {
+ $lang = $params['lang'];
+ // fait de la traduction avec la variable $content
+ echo $translation;
+ }
+}
+
+{* template *}
+{translate lang="br"}
+ Hello, world!
+{/translate}
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-functions/api-register-compiler-function.xml b/docs/fr/programmers/api-functions/api-register-compiler-function.xml
new file mode 100644
index 00000000..0d433d28
--- /dev/null
+++ b/docs/fr/programmers/api-functions/api-register-compiler-function.xml
@@ -0,0 +1,38 @@
+
+
+
+ register_compiler_function
+
+
+ void register_compiler_function
+ string name
+ string impl
+
+
+
+ Utilisée pour déclarer dynamiquement un plugin de fonction
+ de compilation. Il faut passer en paramètres le nom de la fonction
+ de compilation, suivi par la fonction PHP qui
+ l'implémente.
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-functions/api-register-function.xml b/docs/fr/programmers/api-functions/api-register-function.xml
new file mode 100644
index 00000000..739c24cd
--- /dev/null
+++ b/docs/fr/programmers/api-functions/api-register-function.xml
@@ -0,0 +1,53 @@
+
+
+
+ register_function
+
+
+ void register_function
+ string name
+ string impl
+
+
+
+ Utilisée pour déclarer dynamiquement des plugins de fonction
+ de templates. Il faut passer en paramètres le nom de la fonction
+ de templates, suivi par le nom de la fonction PHP qui l'implémente.
+
+
+register_function
+
+$smarty->register_function("date_now", "print_current_date");
+
+function print_current_date ($params) {
+ extract($params);
+ if(empty($format))
+ $format="%b %e, %Y";
+ echo strftime($format,time());
+}
+
+// vous pouvez maintenant utiliser ceci dans Smarty pour afficher
+// la date actuelle : {date_now} ou {date_now format="%Y/%m/%d"}
+// pour la formater
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-functions/api-register-modifier.xml b/docs/fr/programmers/api-functions/api-register-modifier.xml
new file mode 100644
index 00000000..3176eb58
--- /dev/null
+++ b/docs/fr/programmers/api-functions/api-register-modifier.xml
@@ -0,0 +1,46 @@
+
+
+
+ register_modifier
+
+
+ void register_modifier
+ string name
+ string impl
+
+
+
+ Utilisée pour déclarer dynamiquement un plugin de modificateur.
+ Il faut passer en paramètre le nom du modificateur de variables,
+ suivi de la fonction PHP qui l'implémente.
+
+
+register_modifier
+
+// associons la fonction PHP stripslashes a un modificateur Smarty.
+
+$smarty->register_modifier("sslash","stripslashes");
+
+// vous pouvez maintenant utiliser {$var|sslash} pour supprimer les slash des variables
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-functions/api-register-object.xml b/docs/fr/programmers/api-functions/api-register-object.xml
new file mode 100644
index 00000000..bdf56675
--- /dev/null
+++ b/docs/fr/programmers/api-functions/api-register-object.xml
@@ -0,0 +1,40 @@
+
+
+
+ register_object
+
+
+ void register_object
+ string object_name
+ object $object
+ array allowed methods/properties
+ boolean format
+
+
+
+ Utilisée pour enregistrer un objet a utiliser dans un template.
+ Reportez-vous a la section
+ objet de
+ ce manuel pour des exemples.
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-functions/api-register-outputfilter.xml b/docs/fr/programmers/api-functions/api-register-outputfilter.xml
new file mode 100644
index 00000000..ac1c5db1
--- /dev/null
+++ b/docs/fr/programmers/api-functions/api-register-outputfilter.xml
@@ -0,0 +1,37 @@
+
+
+
+ register_outputfilter
+
+
+ void register_outputfilter
+ string function_name
+
+
+
+ Utilisée pour déclarer dynamiquement des filtres de sortie, pour
+ agir sur la sortie d'un template avant qu'elle ne soit affichée.
+ Reportez-vous a la section
+ filtres de sortie pour plus d'information sur le sujet.
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-functions/api-register-postfilter.xml b/docs/fr/programmers/api-functions/api-register-postfilter.xml
new file mode 100644
index 00000000..82c0ddb0
--- /dev/null
+++ b/docs/fr/programmers/api-functions/api-register-postfilter.xml
@@ -0,0 +1,39 @@
+
+
+
+ register_postfilter
+
+
+ void register_postfilter
+ string function_name
+
+
+
+ Utilisée pour déclarer dynamiquement des filtres de post-compilation pour y faire
+ passer des templates une fois qu'ils ont été compilés. Reportez-vous
+ a la section
+ filtres de post-compilation de templates
+ pour avoir plus de renseignements sur la faton de paramétrer les fonctions
+ de post-compilation.
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-functions/api-register-prefilter.xml b/docs/fr/programmers/api-functions/api-register-prefilter.xml
new file mode 100644
index 00000000..d05cefa9
--- /dev/null
+++ b/docs/fr/programmers/api-functions/api-register-prefilter.xml
@@ -0,0 +1,39 @@
+
+
+
+ register_prefilter
+
+
+ void register_prefilter
+ string function_name
+
+
+
+ Utilisée pour déclarer dynamiquement des filtres de pré-compilation pour y faire
+ passer des templates avant qu'ils ne soient compilés. Reportez-vous
+ a la section
+ filtres de pré-compilation de templates
+ pour avoir plus de renseignements sur la faton de paramétrer les fonctions
+ de pré-compilation.
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-functions/api-register-resource.xml b/docs/fr/programmers/api-functions/api-register-resource.xml
new file mode 100644
index 00000000..93690aa1
--- /dev/null
+++ b/docs/fr/programmers/api-functions/api-register-resource.xml
@@ -0,0 +1,48 @@
+
+
+
+ register_resource
+
+
+ void register_resource
+ string name
+ array resource_funcs
+
+
+
+ Utilisée pour déclarer dynamiquement une ressource plugin
+ dans Smarty. Il faut passer en paramètre le nom de la ressource
+ et le tableau des fonctions PHP qui l'implémentent. Reportez-vous
+ a la section ressources templates
+ pour avoir plus d'informations sur la faton de paramétrer une fonction
+ récupérant des templates.
+
+
+register_resource
+
+$smarty->register_resource("db", array("db_get_template",
+ "db_get_timestamp",
+ "db_get_secure",
+ "db_get_trusted"));
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-functions/api-template-exists.xml b/docs/fr/programmers/api-functions/api-template-exists.xml
new file mode 100644
index 00000000..121685e2
--- /dev/null
+++ b/docs/fr/programmers/api-functions/api-template-exists.xml
@@ -0,0 +1,36 @@
+
+
+
+ template_exists
+
+
+ bool template_exists
+ string template
+
+
+
+ Cette fonction vérifie si le template spécifié existe. Elle accepte
+ soit un chemin vers le template, soit une ressource de type
+ chaene de caractères précisant le nom du template.
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-functions/api-trigger-error.xml b/docs/fr/programmers/api-functions/api-trigger-error.xml
new file mode 100644
index 00000000..d12612aa
--- /dev/null
+++ b/docs/fr/programmers/api-functions/api-trigger-error.xml
@@ -0,0 +1,39 @@
+
+
+
+ trigger_error
+
+
+ void trigger_error
+ string error_msg
+ [int level]
+
+
+
+ Cette fonction peut-être utilisée pour afficher un message d'erreur
+ en utilisant Smarty. Le paramètre level
+ peut prendre l'une des valeures utilisées par la fonction PHP
+ trigger_error, i.e. E_USER_NOTICE, E_USER_WARNING, etc. Par défaut
+ il s'agit de E_USER_WARNING.
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-functions/api-unregister-block.xml b/docs/fr/programmers/api-functions/api-unregister-block.xml
new file mode 100644
index 00000000..dc687b94
--- /dev/null
+++ b/docs/fr/programmers/api-functions/api-unregister-block.xml
@@ -0,0 +1,35 @@
+
+
+
+ unregister_block
+
+
+ void unregister_block
+ string name
+
+
+
+ Utilisée pour désallouer dynamiquement un plugin de fonction
+ de blocs. Passez en paramètre le nom du bloc.
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-functions/api-unregister-compiler-function.xml b/docs/fr/programmers/api-functions/api-unregister-compiler-function.xml
new file mode 100644
index 00000000..08808c6d
--- /dev/null
+++ b/docs/fr/programmers/api-functions/api-unregister-compiler-function.xml
@@ -0,0 +1,35 @@
+
+
+
+ unregister_compiler_function
+
+
+ void unregister_compiler_function
+ string name
+
+
+
+ Utilisée pour désallouer dynamiquement un fonction de compilation.
+ Passez en paramètre le nom de la fonction de compilation.
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-functions/api-unregister-function.xml b/docs/fr/programmers/api-functions/api-unregister-function.xml
new file mode 100644
index 00000000..b42fedf1
--- /dev/null
+++ b/docs/fr/programmers/api-functions/api-unregister-function.xml
@@ -0,0 +1,43 @@
+
+
+
+ unregister_function
+
+
+ void unregister_function
+ string name
+
+
+
+ Utilisée pour désallouer dynamiquement un plugin de fonction
+ de templates. Passez en paramètres le nom de la fonction de templates.
+
+
+unregister_function
+
+// nous ne voulons pas que les designers de templates aient accès
+// au système de fichiers.
+
+$smarty->unregister_function("fetch");
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-functions/api-unregister-modifier.xml b/docs/fr/programmers/api-functions/api-unregister-modifier.xml
new file mode 100644
index 00000000..9d87c716
--- /dev/null
+++ b/docs/fr/programmers/api-functions/api-unregister-modifier.xml
@@ -0,0 +1,43 @@
+
+
+
+ unregister_modifier
+
+
+ void unregister_modifier
+ string name
+
+
+
+ Utilisée pour désallouer dynamiquement un plugin modificateur de variable.
+ Passez en paramètre le nom du modificateur de templates.
+
+
+unregister_modifier
+
+// nous ne voulons pas que les designers de templates
+// suppriment les balises des élements
+
+$smarty->unregister_modifier("strip_tags");
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-functions/api-unregister-object.xml b/docs/fr/programmers/api-functions/api-unregister-object.xml
new file mode 100644
index 00000000..14aa002c
--- /dev/null
+++ b/docs/fr/programmers/api-functions/api-unregister-object.xml
@@ -0,0 +1,34 @@
+
+
+
+ unregister_object
+
+
+ void unregister_object
+ string object_name
+
+
+
+ Utilisée pour désallouer un objet.
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-functions/api-unregister-outputfilter.xml b/docs/fr/programmers/api-functions/api-unregister-outputfilter.xml
new file mode 100644
index 00000000..be319ec8
--- /dev/null
+++ b/docs/fr/programmers/api-functions/api-unregister-outputfilter.xml
@@ -0,0 +1,34 @@
+
+
+
+ unregister_outputfilter
+
+
+ void unregister_outputfilter
+ string function_name
+
+
+
+ Utilisée pour désallouer dynamiquement un filtre de sortie.
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-functions/api-unregister-postfilter.xml b/docs/fr/programmers/api-functions/api-unregister-postfilter.xml
new file mode 100644
index 00000000..894ceba1
--- /dev/null
+++ b/docs/fr/programmers/api-functions/api-unregister-postfilter.xml
@@ -0,0 +1,34 @@
+
+
+
+ unregister_postfilter
+
+
+ void unregister_postfilter
+ string function_name
+
+
+
+ Utilisée pour désallouer dynamiquement un filtre de post-compilation.
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-functions/api-unregister-prefilter.xml b/docs/fr/programmers/api-functions/api-unregister-prefilter.xml
new file mode 100644
index 00000000..2f62dedb
--- /dev/null
+++ b/docs/fr/programmers/api-functions/api-unregister-prefilter.xml
@@ -0,0 +1,34 @@
+
+
+
+ unregister_prefilter
+
+
+ void unregister_prefilter
+ string function_name
+
+
+
+ Utilisée pour désallouer dynamiquement un filtre de pré-compilation.
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-functions/api-unregister-resource.xml b/docs/fr/programmers/api-functions/api-unregister-resource.xml
new file mode 100644
index 00000000..c90c278e
--- /dev/null
+++ b/docs/fr/programmers/api-functions/api-unregister-resource.xml
@@ -0,0 +1,40 @@
+
+
+
+ unregister_resource
+
+
+ void unregister_resource
+ string name
+
+
+
+ Utilisée pour désallouer dynamiquement un plugin ressource.
+ Passez en paramètre le nom de la ressource.
+
+
+unregister_resource
+
+$smarty->unregister_resource("db");
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-variables.xml b/docs/fr/programmers/api-variables.xml
index 1a804264..12a6af6f 100644
--- a/docs/fr/programmers/api-variables.xml
+++ b/docs/fr/programmers/api-variables.xml
@@ -3,491 +3,40 @@
Variables
-
- $template_dir
-
- C'est le nom par défaut du répertoire des templates.
- Si vous ne spécifiez aucun chemin lors de l'utilisation de templates, Smarty
- les cherchera a cet emplacement.
- Par défaut, il s'agit de "./templates", ce qui signifie
- qu'il va chercher le répertoire templates
- dans le répertoire oú se trouve le script PHP en cours d'exécution.
-
-
-
- Note technique
-
- Il n'est pas conseillé de mettre ce répertoire
- dans l'arborescence Web.
-
-
-
-
- $compile_dir
-
- C'est le nom du répertoire oú se trouvent les templates
- compilés. Par défaut, il s'agit de "./templates_c",
- ce qui signifie que Smarty va chercher ce répertoire
- dans le même répertoire que le script PHP en cours d'exécution.
-
-
- Note technique
-
- Ce réglage doit être soit un chemin absolu, soit un chemin
- relatif. include_path n'est pas utilisé pour écrire des fichiers.
-
-
-
- Note technique
-
- Il n'est pas conseillé de mettre ce répertoire
- sous la racine de l'arborescence Web.
-
-
-
-
- $config_dir
-
- Il s'agit du répertoire utilisé pour stocker les
- fichiers de configuration utilisés dans les templates.
- La valeur par défaut est "./configs", ce qui signifie
- que Smarty va chercher ce répertoire
- dans le même répertoire que le script PHP qui s'exécute.
-
-
- Note technique
-
- Il n'est pas conseillé de mettre ce répertoire
- sous la racine de l'arborescence Web.
-
-
-
-
- $plugins_dir
-
- Ce sont les répertoire dans lesquels Smarty ira chercher les plugins
- dont il a besoin. La valeur par défaut est "plugins" sous le
- répertoire SMARTY_DIR. Si vous donnez un chemin relatif, Smarty
- regardera d'abord relativement au SMARTY_DIR, puis relativement au rtc (répertoire
- de travail courant), puis relativement a chaque entrée de votre répertoire
- d'inclusion PHP.
-
-
- Note technique
-
- Pour des raisons de performances, ne réglez pas votre plugins_dir
- pour qu'il utilise votre include_path PHP. Utilisez un
- chemin absolu ou un chemin relatif a SMARTY_DIR ou au rtc.
-
-
-
-
- $debugging
-
- Cela active la
- console de débogage.
- La console est une fenêtre javascript qui vous informe des templates
- inclus et des variables assignées dans la page courante.
-
-
-
- $debug_tpl
-
- C'est le nom du fichier template utilisé pour la
- console de débuggage. Par défaut debug.tpl, il se situe dans SMARTY_DIR
-
-
-
- $debugging_ctrl
-
- Cela permet d'avoir différents moyens pour activer
- le débogage. URL signifie que si SMARTY_DEBUG se
- trouve dans QUERY_STRING, le débuggage
- est activé a l'invocation du script. Si $debugging
- est a vrai, cette valeur est sans effet.
-
-
-
- $global_assign
-
- C'est une liste de variable qui sont toujours
- implicitement assignées au moteur de templates.
- Ceci est commode pour rendre des variables globales
- ou des variables du serveur accessibles a tous les templates
- plut(t que de devoir les assigner a la main. Chaque élément
- de $global_assign doit être soit le nom de la variable
- globale, soit une paire clef/valeur, oú clef est le
- nom du tableau global et valeur le tableau de variable
- assignées depuis ce tableau global.
- $SCRIPT_NAME est globalement assigné par défaut depuis
- $HTTP_SERVER_VARS.
-
-
- Note technique
-
- On peut accéder aux variables du serveur avec la variable
- $smarty, par exemple {$smarty.server.SCRIPT_NAME}.
- Se reporter a la section sur la variable
- $smarty.
-
-
-
-
- $undefined
-
- Cela régle la valeur de $undefined, null par défaut.
- N'est actuellement utilisé que pour initialiser
- des variables non-définies dans $global_assign a des
- valeurs par défaut.
-
-
-
- $autoload_filters
-
- Si vous désirez charger des filtres a chaque invocation
- de templates, vous pouvez le spécifier en utilisant cette
- variable. Les types de filtres et les valeurs sont des
- tableaux comportant le nom des filtres.
-
-
-$smarty->autoload_filters = array('pre' => array('trim', 'stamp'),
- 'output' => array('convert'));
-
-
-
-
-
- $compile_check
-
- A chaque invocation de l'application PHP, Smarty fait
- un test pour voir si le template courant a été modifié
- (date de derniére modification différente) depuis sa
- derniére compilation. S'il a changé, le template est recompilé.
- Si le template n'a pas encore été compilé, il le sera
- quelle que soit la valeur ce réglage.
- Par défaut cette valeur est a vrai. Quand
- une application est mise en production (les templates
- ne changent plus), cette vérification n'est pas nécessaire.
- Assurez-vous de mettre $compile_check a "false" pour des performances
- maximales. Notez que si vous mettez ce paramétre a "false" et qu'un
- template est modifié, vous ne verrez *pas* le changement
- car le template ne sera *pas* recompilé. Si le processus de cache
- est activé et que $compile_check l'est aussi, alors les fichiers
- du cache seront regénérés si un template concerné ou un fichier de
- configuration concerné est modifié. Voir aussi $force_compile ou clear_compiled_tpl.
-
-
-
-
- $force_compile
-
- Cela oblige Smarty a (re)compiler les templates a chaque
- invocation. Ce réglage supplante $compile_check. Par défaut, il
- est désactivé. Ceci est commode pour le développement et le
- débogage mais ne devrait jamais être utilisé dans un environnment
- de production. Si le systéme de cache est actif, les
- fichiers du cache seront regénérés a chaque appel.
-
-
-
- $caching
-
- Ce paramétre demande a Smarty de mettre ou non en cache la sortie des
- templates.
- Par défaut ce réglage est a 0 (désactivé). Si vos templates
- générent du contenu redondant, il est conseillé d'activer le
- cache. Cela permettra un gain de performance conséquent.
- Vous pouvez aussi avoir de nombreux fichiers de cache pour un même template.
- Une valeur de 1 ou 2 active le cache. 1 indique a Smarty d'utiliser
- la variable $cache_lifetime pour déterminer si le fichier de cache a expiré.
- Une valeur de 2 indique a Smarty d'utiliser la valeur
- $cache_lifetime spécifiée a la génération du cache. Ainsi vous pouvez régler
- la durée de vie d'un fichier de cache avant de récupérer le template pour avoir
- un certain contr(le quand ce fichier en particulier expire. Voir
- aussi is_cached.
-
-
- Si $compile_check est actif, le contenu du cache sera regénéré
- si un des templates ou un des fichiers de configuration qui fait partie
- de ce fichier de cache a été modifié. Si $force_compile est actif, le contenu
- du cache est toujours regénéré.
-
-
-
- $cache_dir
-
- Il s'agit du nom du répertoire oú les caches des templates
- sont stockés. Par défaut il s'agit de "./cache", ce qui signifie
- que Smarty va chercher ce répertoire
- dans le même répertoire que le script PHP en cours d'exécution.
-
-
- Note technique
-
- Ce réglage doit être soit un chemin absolu, soit un chemin
- relatif. include_path n'a aucune influence lors de l'écriture des fichiers.
-
-
-
- Note technique
-
- Il n'est pas conseillé de mettre ce répertoire
- dans l'arborescence Web.
-
-
-
-
- $cache_lifetime
-
- Il s'agit de la durée en secondes pendant laquelle un cache de template
- est valide. Une fois cette durée dépassée, le cache est regénéré.
- $caching doit être a "true" pour que $cache_lifetime ait une
- quelconque utilité. Avec une valeur de -1, le cache n'expire jamais.
- Avec une valeur de 0, le cache est toujours regénéré (utile
- a des fins de tests seulement. Une meilleure faton de désactiver
- le cache est de mettre $caching a "false").
-
-
- Si $force_compile est
- activé, les fichiers du cache seront regénérés a chaque fois,
- désactivant ainsi le cache. Vous pouvez effacer tous les fichiers du cache
- avec la function
- clear_all_cache()
- ou de faton individuelle (ou groupée)
- avec la fonction clear_cache().
-
-
- Note technique
-
- Si vous souhaitez donner a certains templates leur propre durée de vie
- en cache, vous pouvez le faire en réglant
- $caching a 2,
- puis $cache_lifetime a une unique valeur juste avant d'appeler
- display ou fetch().
-
-
-
-
- $cache_handler_func
-
- Vous pouvez utiliser votre propre fonction de gestion du cache plut(t que
- d'utiliser celle livrée avec Smarty.
- Référez-vous a la section sur la fonction de gestion de cache
- personnalisée pour plus de détails.
-
-
-
- $cache_modified_check
-
- Si cette variable est a vrai, Smarty respectera l'en-tête
- If-Modified-Since envoyé par le client. Si la date de derniére
- modification du fichier de cache n'a pas changé depuis la derniére
- visite, alors un en-tête "304 Not Modified" sera envoyé a la place
- du contenu. Cela ne fonctionne qu'avec du contenu mis en cache hors de la
- balise insert.
-
-
-
- $config_overwrite
-
- Si cette variable est a vrai, les variables lues dans les fichiers
- de configuration peuvent s'écraser entre elles. Sinon les variables
- seront mises dans un tableau. Très utile si vous voulez stocker
- des tableaux de données dans des fichiers de configuration, listez
- simplement chaque élément plusieurs fois. Mise a faux par défaut.
-
-
-
- $config_booleanize
-
- Si cette variable est a vrai, les valeurs on/true/yes et off/false/no
- dans les fichiers de configuration sont automitiquement converties
- en booléen. De cette faton vous pouvez utiliser ces valeurs dans le
- template de la faton suivante : {if #foobar#} ... {/if}. Si foobar
- est a on, true ou yes, l'instruction {if} sera exécutée. vrai
- par défaut.
-
-
-
- $config_read_hidden
-
- Si cette variable est a vrai, les sections cachés (dont les noms
- commencent par un point) dans les fichiers de configuration peuvent
- être lues depuis les templates. On laisse habituellement cela a faux, de
- cette faton vous pouvez stocker des données sensibles dans les fichiers
- de configuration, comme par exemple des paramétres de base de données,
- sans vous soucier de la faton dont les templates les chargent.
- Mise a faux par défaut.
-
-
-
- $config_fix_newlines
-
- Si cette variable est mise a vrai, les caractéres de nouvelles lignes mac et dos
- (\r et \r\n) sont convertis en \n quand ils sont analysés. vrai par défaut.
-
-
-
- $default_template_handler_func
-
- Cette fonction est appelée quand un template ne peut pas être
- obtenu avec sa ressource.
-
-
-
- $php_handling
-
- Indique a Smarty comment interpréter le code PHP
- intégré dans les templates. Il y a quatre valeurs possibles, par
- défaut SMARTY_PHP_PASSTHRU. Notez que cela n'affecte PAS le code
- PHP entouré des balises
- {php}{/php}
- dans le template.
-
-
- SMARTY_PHP_PASSTHRU - Smarty écrit les balises
- telles quelles.
- SMARTY_PHP_QUOTE - Smarty transforme les balises
- en entités HTML.
- SMARTY_PHP_REMOVE - Smarty supprime les balises
- des templates.
- SMARTY_PHP_ALLOW - Smarty exécute les balises
- comme du code PHP.
-
-
- NOTE : Intégrer du code PHP dans les templates est vivement
- déconseillé. Préférez les
- fonctions utilisateurs
- ou les modificateurs de variables.
-
-
-
- $security
-
- Cette variable est a faux par défaut. $security est de rigueur
- quand vous n'Otes pas complétement svr des personnes qui éditent les templates
- (par ftp par exemple) et que vous voulez réduire le risque que
- la sécurité du systéme soit compromise par le language de template.
- Activer cette option de sécurité applique les régles suivantes
- au langage de template, a moins que $security_settings ne spécifie
- le contraire :
-
-
- Si $php_handling est réglée a SMARTY_PHP_ALLOW,
- cela est implicitement changé a SMARTY_PHP_PASSTHRU.
- Les fonctions PHP ne sont pas autorisées dans les
- instructions IF, a part celles déclarées dans
- $security_settings.
- Les templates ne peuvent être inclus que depuis
- des répertoires listés dans le tableau $security_dir.
- Les fichiers locaux ne peuvent être récupérés que depuis
- les répertoires listés dans le tableau $security_dir en
- utilisant {fetch}.
- Les balises {php}{/php} ne sont pas autorisées.
- Les fonctions PHP ne sont pas autorisées en tant
- modificateurs, a part celles spécifiées dans $security_settings.
-
-
-
- $secure_dir
-
- Il s'agit d'un tableau contenant tous les répertoires locaux qui sont
- considérés comme sécurisés. {include} et {fetch} l'utilisent quand
- la sécurité est activée.
-
-
-
- $security_settings
-
- Ces réglages servent à écraser ou spécifier les paramétres de sécurité
- quand celle-ci est activée. Les réglages possibles sont les suivants :
-
-
- PHP_HANDLING - true/false. Si vrai, le
- réglage $php_handling n'est pas vérifié.
- IF_FUNCS - Le tableau des noms de fonctions
- PHP autorisées dans les intructions IF.
- INCLUDE_ANY - true/false. Si vrai,
- les templates peuvent être inclus de n'importe oú, quelque soit
- le contenu de $secure_dir.
- PHP_TAGS - true/false. Si vrai,
- les balises {php}{/php} sont autorisées dans les templates.
- MODIFIER_FUNCS - Le tableau des noms de fonctions
- autorisées a être utilisées comme modificateurs de variables.
-
-
-
- $trusted_dir
-
- $trusted_dir n'est utilisée lorsque $security est activée. C'est un
- tableau de tous les répertoires qui peuvent être considérés comme svrs.
- Les répertoires svrs sont ceux qui contiennent des scripts PHP qui
- sont exécutés directement depuis les templates avec
- {include_php}.
-
-
-
- $left_delimiter
-
- Il s'agit du délimiteur gauche utilisé par le moteur de templates. La
- valeur par défaut est "{".
-
-
-
- $right_delimiter
-
- Il s'agit du délimiteur droit utilisé par le moteur de templates.
- La valeur par défaut est "}".
-
-
-
- $compiler_class
-
- Spécifie le nom de la classe du compilateur qui va être utilisée pour
- compiler les templates. Le compilateur par défaut est
- 'Smarty_Compiler'. Réservé aux utilisateurs avancés.
-
-
-
- $request_vars_order
-
- L'ordre dans lequel les variables de requêtes sont enregistrées,
- identique a variables_order dans php.ini.
-
-
-
- $compile_id
-
- Identifiant persistant du compilateur. On peut passer le même compile_id
- a chaque appel de fonction mais une alternative consiste a régler ce
- compile_id, qui sera utilisé implicitement.
-
-
-
- $use_sub_dirs
-
- Régler cela a faux si votre environnement PHP n'autorise pas Smarty a créer
- des sous-répertoires. Les sous-répertoires sont efficaces, utilisez-les quand
- vous le pouvez.
-
-
-
- $default_modifiers
-
- Il s'agit d'un tableau de modificateurs utilisé pour assigner
- une valeur par défaut a chaque variable dans un template.
- Par exemple, pour par défaut échapper les caractéres HTML de chaque variable,
- utilisez array('escape:"htmlall"'); Pour rendre une variable indépendante
- des modificateurs par défaut, passez-lui en paramétre le modificateur
- "nodefaults" : {$var|nodefaults}.
-
-
+&programmers.api-variables.variable-template-dir;
+&programmers.api-variables.variable-compile-dir;
+&programmers.api-variables.variable-config-dir;
+&programmers.api-variables.variable-plugins-dir;
+&programmers.api-variables.variable-debugging;
+&programmers.api-variables.variable-debug-tpl;
+&programmers.api-variables.variable-debugging-ctrl;
+&programmers.api-variables.variable-global-assign;
+&programmers.api-variables.variable-undefined;
+&programmers.api-variables.variable-autoload-filters;
+&programmers.api-variables.variable-compile-check;
+&programmers.api-variables.variable-force-compile;
+&programmers.api-variables.variable-caching;
+&programmers.api-variables.variable-cache-dir;
+&programmers.api-variables.variable-cache-lifetime;
+&programmers.api-variables.variable-cache-handler-func;
+&programmers.api-variables.variable-cache-modified-check;
+&programmers.api-variables.variable-config-overwrite;
+&programmers.api-variables.variable-config-booleanize;
+&programmers.api-variables.variable-config-read-hidden;
+&programmers.api-variables.variable-config-fix-newlines;
+&programmers.api-variables.variable-default-template-handler-func;
+&programmers.api-variables.variable-php-handling;
+&programmers.api-variables.variable-security;
+&programmers.api-variables.variable-secure-dir;
+&programmers.api-variables.variable-security-settings;
+&programmers.api-variables.variable-trusted-dir;
+&programmers.api-variables.variable-left-delimiter;
+&programmers.api-variables.variable-right-delimiter;
+&programmers.api-variables.variable-compiler-class;
+&programmers.api-variables.variable-request-vars-order;
+&programmers.api-variables.variable-compile-id;
+&programmers.api-variables.variable-use-sub-dirs;
+&programmers.api-variables.variable-default-modifiers;
+
+ $autoload_filters
+
+ Si vous désirez charger des filtres a chaque invocation
+ de templates, vous pouvez le spécifier en utilisant cette
+ variable. Les types de filtres et les valeurs sont des
+ tableaux comportant le nom des filtres.
+
+
+$smarty->autoload_filters = array('pre' => array('trim', 'stamp'),
+ 'output' => array('convert'));
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-variables/variable-cache-dir.xml b/docs/fr/programmers/api-variables/variable-cache-dir.xml
new file mode 100644
index 00000000..101981bd
--- /dev/null
+++ b/docs/fr/programmers/api-variables/variable-cache-dir.xml
@@ -0,0 +1,45 @@
+
+
+
+ $cache_dir
+
+ Il s'agit du nom du répertoire oú les caches des templates
+ sont stockés. Par défaut il s'agit de "./cache", ce qui signifie
+ que Smarty va chercher ce répertoire
+ dans le même répertoire que le script PHP en cours d'exécution.
+
+
+ Note technique
+
+ Ce réglage doit être soit un chemin absolu, soit un chemin
+ relatif. include_path n'a aucune influence lors de l'écriture des fichiers.
+
+
+
+ Note technique
+
+ Il n'est pas conseillé de mettre ce répertoire
+ dans l'arborescence Web.
+
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-variables/variable-cache-handler-func.xml b/docs/fr/programmers/api-variables/variable-cache-handler-func.xml
new file mode 100644
index 00000000..9ae60ced
--- /dev/null
+++ b/docs/fr/programmers/api-variables/variable-cache-handler-func.xml
@@ -0,0 +1,31 @@
+
+
+
+ $cache_handler_func
+
+ Vous pouvez utiliser votre propre fonction de gestion du cache plut(t que
+ d'utiliser celle livrée avec Smarty.
+ Référez-vous a la section sur la fonction de gestion de cache
+ personnalisée pour plus de détails.
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-variables/variable-cache-lifetime.xml b/docs/fr/programmers/api-variables/variable-cache-lifetime.xml
new file mode 100644
index 00000000..ad1ea65d
--- /dev/null
+++ b/docs/fr/programmers/api-variables/variable-cache-lifetime.xml
@@ -0,0 +1,55 @@
+
+
+
+ $cache_lifetime
+
+ Il s'agit de la durée en secondes pendant laquelle un cache de template
+ est valide. Une fois cette durée dépassée, le cache est regénéré.
+ $caching doit être a "true" pour que $cache_lifetime ait une
+ quelconque utilité. Avec une valeur de -1, le cache n'expire jamais.
+ Avec une valeur de 0, le cache est toujours regénéré (utile
+ a des fins de tests seulement. Une meilleure faton de désactiver
+ le cache est de mettre $caching a "false").
+
+
+ Si $force_compile est
+ activé, les fichiers du cache seront regénérés a chaque fois,
+ désactivant ainsi le cache. Vous pouvez effacer tous les fichiers du cache
+ avec la function
+ clear_all_cache()
+ ou de faton individuelle (ou groupée)
+ avec la fonction clear_cache().
+
+
+ Note technique
+
+ Si vous souhaitez donner a certains templates leur propre durée de vie
+ en cache, vous pouvez le faire en réglant
+ $caching a 2,
+ puis $cache_lifetime a une unique valeur juste avant d'appeler
+ display ou fetch().
+
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-variables/variable-cache-modified-check.xml b/docs/fr/programmers/api-variables/variable-cache-modified-check.xml
new file mode 100644
index 00000000..6d19bdc2
--- /dev/null
+++ b/docs/fr/programmers/api-variables/variable-cache-modified-check.xml
@@ -0,0 +1,33 @@
+
+
+
+ $cache_modified_check
+
+ Si cette variable est a vrai, Smarty respectera l'en-tête
+ If-Modified-Since envoyé par le client. Si la date de derniére
+ modification du fichier de cache n'a pas changé depuis la derniére
+ visite, alors un en-tête "304 Not Modified" sera envoyé a la place
+ du contenu. Cela ne fonctionne qu'avec du contenu mis en cache hors de la
+ balise insert.
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-variables/variable-caching.xml b/docs/fr/programmers/api-variables/variable-caching.xml
new file mode 100644
index 00000000..5c669cc6
--- /dev/null
+++ b/docs/fr/programmers/api-variables/variable-caching.xml
@@ -0,0 +1,46 @@
+
+
+
+ $caching
+
+ Ce paramétre demande a Smarty de mettre ou non en cache la sortie des
+ templates.
+ Par défaut ce réglage est a 0 (désactivé). Si vos templates
+ générent du contenu redondant, il est conseillé d'activer le
+ cache. Cela permettra un gain de performance conséquent.
+ Vous pouvez aussi avoir de nombreux fichiers de cache pour un même template.
+ Une valeur de 1 ou 2 active le cache. 1 indique a Smarty d'utiliser
+ la variable $cache_lifetime pour déterminer si le fichier de cache a expiré.
+ Une valeur de 2 indique a Smarty d'utiliser la valeur
+ $cache_lifetime spécifiée a la génération du cache. Ainsi vous pouvez régler
+ la durée de vie d'un fichier de cache avant de récupérer le template pour avoir
+ un certain contr(le quand ce fichier en particulier expire. Voir
+ aussi is_cached.
+
+
+ Si $compile_check est actif, le contenu du cache sera regénéré
+ si un des templates ou un des fichiers de configuration qui fait partie
+ de ce fichier de cache a été modifié. Si $force_compile est actif, le contenu
+ du cache est toujours regénéré.
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-variables/variable-compile-check.xml b/docs/fr/programmers/api-variables/variable-compile-check.xml
new file mode 100644
index 00000000..472fdeac
--- /dev/null
+++ b/docs/fr/programmers/api-variables/variable-compile-check.xml
@@ -0,0 +1,46 @@
+
+
+
+ $compile_check
+
+ A chaque invocation de l'application PHP, Smarty fait
+ un test pour voir si le template courant a été modifié
+ (date de derniére modification différente) depuis sa
+ derniére compilation. S'il a changé, le template est recompilé.
+ Si le template n'a pas encore été compilé, il le sera
+ quelle que soit la valeur ce réglage.
+ Par défaut cette valeur est a vrai. Quand
+ une application est mise en production (les templates
+ ne changent plus), cette vérification n'est pas nécessaire.
+ Assurez-vous de mettre $compile_check a "false" pour des performances
+ maximales. Notez que si vous mettez ce paramétre a "false" et qu'un
+ template est modifié, vous ne verrez *pas* le changement
+ car le template ne sera *pas* recompilé. Si le processus de cache
+ est activé et que $compile_check l'est aussi, alors les fichiers
+ du cache seront regénérés si un template concerné ou un fichier de
+ configuration concerné est modifié. Voir aussi $force_compile ou clear_compiled_tpl.
+
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-variables/variable-compile-dir.xml b/docs/fr/programmers/api-variables/variable-compile-dir.xml
new file mode 100644
index 00000000..d89b7c35
--- /dev/null
+++ b/docs/fr/programmers/api-variables/variable-compile-dir.xml
@@ -0,0 +1,45 @@
+
+
+
+ $compile_dir
+
+ C'est le nom du répertoire oú se trouvent les templates
+ compilés. Par défaut, il s'agit de "./templates_c",
+ ce qui signifie que Smarty va chercher ce répertoire
+ dans le même répertoire que le script PHP en cours d'exécution.
+
+
+ Note technique
+
+ Ce réglage doit être soit un chemin absolu, soit un chemin
+ relatif. include_path n'est pas utilisé pour écrire des fichiers.
+
+
+
+ Note technique
+
+ Il n'est pas conseillé de mettre ce répertoire
+ sous la racine de l'arborescence Web.
+
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-variables/variable-compile-id.xml b/docs/fr/programmers/api-variables/variable-compile-id.xml
new file mode 100644
index 00000000..5cba539a
--- /dev/null
+++ b/docs/fr/programmers/api-variables/variable-compile-id.xml
@@ -0,0 +1,30 @@
+
+
+
+ $compile_id
+
+ Identifiant persistant du compilateur. On peut passer le même compile_id
+ a chaque appel de fonction mais une alternative consiste a régler ce
+ compile_id, qui sera utilisé implicitement.
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-variables/variable-compiler-class.xml b/docs/fr/programmers/api-variables/variable-compiler-class.xml
new file mode 100644
index 00000000..76ae5ae8
--- /dev/null
+++ b/docs/fr/programmers/api-variables/variable-compiler-class.xml
@@ -0,0 +1,30 @@
+
+
+
+ $compiler_class
+
+ Spécifie le nom de la classe du compilateur qui va être utilisée pour
+ compiler les templates. Le compilateur par défaut est
+ 'Smarty_Compiler'. Réservé aux utilisateurs avancés.
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-variables/variable-config-booleanize.xml b/docs/fr/programmers/api-variables/variable-config-booleanize.xml
new file mode 100644
index 00000000..b687c151
--- /dev/null
+++ b/docs/fr/programmers/api-variables/variable-config-booleanize.xml
@@ -0,0 +1,33 @@
+
+
+
+ $config_booleanize
+
+ Si cette variable est a vrai, les valeurs on/true/yes et off/false/no
+ dans les fichiers de configuration sont automitiquement converties
+ en booléen. De cette faton vous pouvez utiliser ces valeurs dans le
+ template de la faton suivante : {if #foobar#} ... {/if}. Si foobar
+ est a on, true ou yes, l'instruction {if} sera exécutée. vrai
+ par défaut.
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-variables/variable-config-dir.xml b/docs/fr/programmers/api-variables/variable-config-dir.xml
new file mode 100644
index 00000000..fb72056b
--- /dev/null
+++ b/docs/fr/programmers/api-variables/variable-config-dir.xml
@@ -0,0 +1,39 @@
+
+
+
+ $config_dir
+
+ Il s'agit du répertoire utilisé pour stocker les
+ fichiers de configuration utilisés dans les templates.
+ La valeur par défaut est "./configs", ce qui signifie
+ que Smarty va chercher ce répertoire
+ dans le même répertoire que le script PHP qui s'exécute.
+
+
+ Note technique
+
+ Il n'est pas conseillé de mettre ce répertoire
+ sous la racine de l'arborescence Web.
+
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-variables/variable-config-fix-newlines.xml b/docs/fr/programmers/api-variables/variable-config-fix-newlines.xml
new file mode 100644
index 00000000..3f9ca4c6
--- /dev/null
+++ b/docs/fr/programmers/api-variables/variable-config-fix-newlines.xml
@@ -0,0 +1,29 @@
+
+
+
+ $config_fix_newlines
+
+ Si cette variable est mise a vrai, les caractéres de nouvelles lignes mac et dos
+ (\r et \r\n) sont convertis en \n quand ils sont analysés. vrai par défaut.
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-variables/variable-config-overwrite.xml b/docs/fr/programmers/api-variables/variable-config-overwrite.xml
new file mode 100644
index 00000000..c48c0f6b
--- /dev/null
+++ b/docs/fr/programmers/api-variables/variable-config-overwrite.xml
@@ -0,0 +1,32 @@
+
+
+
+ $config_overwrite
+
+ Si cette variable est a vrai, les variables lues dans les fichiers
+ de configuration peuvent s'écraser entre elles. Sinon les variables
+ seront mises dans un tableau. Très utile si vous voulez stocker
+ des tableaux de données dans des fichiers de configuration, listez
+ simplement chaque élément plusieurs fois. Mise a faux par défaut.
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-variables/variable-config-read-hidden.xml b/docs/fr/programmers/api-variables/variable-config-read-hidden.xml
new file mode 100644
index 00000000..5cd52d7b
--- /dev/null
+++ b/docs/fr/programmers/api-variables/variable-config-read-hidden.xml
@@ -0,0 +1,34 @@
+
+
+
+ $config_read_hidden
+
+ Si cette variable est a vrai, les sections cachés (dont les noms
+ commencent par un point) dans les fichiers de configuration peuvent
+ être lues depuis les templates. On laisse habituellement cela a faux, de
+ cette faton vous pouvez stocker des données sensibles dans les fichiers
+ de configuration, comme par exemple des paramétres de base de données,
+ sans vous soucier de la faton dont les templates les chargent.
+ Mise a faux par défaut.
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-variables/variable-debug-tpl.xml b/docs/fr/programmers/api-variables/variable-debug-tpl.xml
new file mode 100644
index 00000000..b4a80a8f
--- /dev/null
+++ b/docs/fr/programmers/api-variables/variable-debug-tpl.xml
@@ -0,0 +1,30 @@
+
+
+
+ $debug_tpl
+
+ C'est le nom du fichier template utilisé pour la
+ console de débuggage. Par défaut debug.tpl, il se situe dans SMARTY_DIR
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-variables/variable-debugging-ctrl.xml b/docs/fr/programmers/api-variables/variable-debugging-ctrl.xml
new file mode 100644
index 00000000..e605cdd7
--- /dev/null
+++ b/docs/fr/programmers/api-variables/variable-debugging-ctrl.xml
@@ -0,0 +1,32 @@
+
+
+
+ $debugging_ctrl
+
+ Cela permet d'avoir différents moyens pour activer
+ le débogage. URL signifie que si SMARTY_DEBUG se
+ trouve dans QUERY_STRING, le débuggage
+ est activé a l'invocation du script. Si $debugging
+ est a vrai, cette valeur est sans effet.
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-variables/variable-debugging.xml b/docs/fr/programmers/api-variables/variable-debugging.xml
new file mode 100644
index 00000000..595df152
--- /dev/null
+++ b/docs/fr/programmers/api-variables/variable-debugging.xml
@@ -0,0 +1,32 @@
+
+
+
+ $debugging
+
+ Cela active la
+ console de débogage.
+ La console est une fenêtre javascript qui vous informe des templates
+ inclus et des variables assignées dans la page courante.
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-variables/variable-default-modifiers.xml b/docs/fr/programmers/api-variables/variable-default-modifiers.xml
new file mode 100644
index 00000000..499b0ab3
--- /dev/null
+++ b/docs/fr/programmers/api-variables/variable-default-modifiers.xml
@@ -0,0 +1,33 @@
+
+
+
+ $default_modifiers
+
+ Il s'agit d'un tableau de modificateurs utilisé pour assigner
+ une valeur par défaut a chaque variable dans un template.
+ Par exemple, pour par défaut échapper les caractéres HTML de chaque variable,
+ utilisez array('escape:"htmlall"'); Pour rendre une variable indépendante
+ des modificateurs par défaut, passez-lui en paramétre le modificateur
+ "nodefaults" : {$var|nodefaults}.
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-variables/variable-default-template-handler-func.xml b/docs/fr/programmers/api-variables/variable-default-template-handler-func.xml
new file mode 100644
index 00000000..6f7f8593
--- /dev/null
+++ b/docs/fr/programmers/api-variables/variable-default-template-handler-func.xml
@@ -0,0 +1,29 @@
+
+
+
+ $default_template_handler_func
+
+ Cette fonction est appelée quand un template ne peut pas être
+ obtenu avec sa ressource.
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-variables/variable-force-compile.xml b/docs/fr/programmers/api-variables/variable-force-compile.xml
new file mode 100644
index 00000000..21d24960
--- /dev/null
+++ b/docs/fr/programmers/api-variables/variable-force-compile.xml
@@ -0,0 +1,33 @@
+
+
+
+ $force_compile
+
+ Cela oblige Smarty a (re)compiler les templates a chaque
+ invocation. Ce réglage supplante $compile_check. Par défaut, il
+ est désactivé. Ceci est commode pour le développement et le
+ débogage mais ne devrait jamais être utilisé dans un environnment
+ de production. Si le systéme de cache est actif, les
+ fichiers du cache seront regénérés a chaque appel.
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-variables/variable-global-assign.xml b/docs/fr/programmers/api-variables/variable-global-assign.xml
new file mode 100644
index 00000000..194bd501
--- /dev/null
+++ b/docs/fr/programmers/api-variables/variable-global-assign.xml
@@ -0,0 +1,47 @@
+
+
+
+ $global_assign
+
+ C'est une liste de variable qui sont toujours
+ implicitement assignées au moteur de templates.
+ Ceci est commode pour rendre des variables globales
+ ou des variables du serveur accessibles a tous les templates
+ plut(t que de devoir les assigner a la main. Chaque élément
+ de $global_assign doit être soit le nom de la variable
+ globale, soit une paire clef/valeur, oú clef est le
+ nom du tableau global et valeur le tableau de variable
+ assignées depuis ce tableau global.
+ $SCRIPT_NAME est globalement assigné par défaut depuis
+ $HTTP_SERVER_VARS.
+
+
+ Note technique
+
+ On peut accéder aux variables du serveur avec la variable
+ $smarty, par exemple {$smarty.server.SCRIPT_NAME}.
+ Se reporter a la section sur la variable
+ $smarty.
+
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-variables/variable-left-delimiter.xml b/docs/fr/programmers/api-variables/variable-left-delimiter.xml
new file mode 100644
index 00000000..13ac4274
--- /dev/null
+++ b/docs/fr/programmers/api-variables/variable-left-delimiter.xml
@@ -0,0 +1,29 @@
+
+
+
+ $left_delimiter
+
+ Il s'agit du délimiteur gauche utilisé par le moteur de templates. La
+ valeur par défaut est "{".
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-variables/variable-php-handling.xml b/docs/fr/programmers/api-variables/variable-php-handling.xml
new file mode 100644
index 00000000..ab1b6c87
--- /dev/null
+++ b/docs/fr/programmers/api-variables/variable-php-handling.xml
@@ -0,0 +1,49 @@
+
+
+
+ $php_handling
+
+ Indique a Smarty comment interpréter le code PHP
+ intégré dans les templates. Il y a quatre valeurs possibles, par
+ défaut SMARTY_PHP_PASSTHRU. Notez que cela n'affecte PAS le code
+ PHP entouré des balises
+ {php}{/php}
+ dans le template.
+
+
+ SMARTY_PHP_PASSTHRU - Smarty écrit les balises
+ telles quelles.
+ SMARTY_PHP_QUOTE - Smarty transforme les balises
+ en entités HTML.
+ SMARTY_PHP_REMOVE - Smarty supprime les balises
+ des templates.
+ SMARTY_PHP_ALLOW - Smarty exécute les balises
+ comme du code PHP.
+
+
+ NOTE : Intégrer du code PHP dans les templates est vivement
+ déconseillé. Préférez les
+ fonctions utilisateurs
+ ou les modificateurs de variables.
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-variables/variable-plugins-dir.xml b/docs/fr/programmers/api-variables/variable-plugins-dir.xml
new file mode 100644
index 00000000..5f0bea40
--- /dev/null
+++ b/docs/fr/programmers/api-variables/variable-plugins-dir.xml
@@ -0,0 +1,41 @@
+
+
+
+ $plugins_dir
+
+ Ce sont les répertoire dans lesquels Smarty ira chercher les plugins
+ dont il a besoin. La valeur par défaut est "plugins" sous le
+ répertoire SMARTY_DIR. Si vous donnez un chemin relatif, Smarty
+ regardera d'abord relativement au SMARTY_DIR, puis relativement au rtc (répertoire
+ de travail courant), puis relativement a chaque entrée de votre répertoire
+ d'inclusion PHP.
+
+
+ Note technique
+
+ Pour des raisons de performances, ne réglez pas votre plugins_dir
+ pour qu'il utilise votre include_path PHP. Utilisez un
+ chemin absolu ou un chemin relatif a SMARTY_DIR ou au rtc.
+
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-variables/variable-request-vars-order.xml b/docs/fr/programmers/api-variables/variable-request-vars-order.xml
new file mode 100644
index 00000000..1a4bb700
--- /dev/null
+++ b/docs/fr/programmers/api-variables/variable-request-vars-order.xml
@@ -0,0 +1,29 @@
+
+
+
+ $request_vars_order
+
+ L'ordre dans lequel les variables de requêtes sont enregistrées,
+ identique a variables_order dans php.ini.
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-variables/variable-right-delimiter.xml b/docs/fr/programmers/api-variables/variable-right-delimiter.xml
new file mode 100644
index 00000000..32539a59
--- /dev/null
+++ b/docs/fr/programmers/api-variables/variable-right-delimiter.xml
@@ -0,0 +1,29 @@
+
+
+
+ $right_delimiter
+
+ Il s'agit du délimiteur droit utilisé par le moteur de templates.
+ La valeur par défaut est "}".
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-variables/variable-secure-dir.xml b/docs/fr/programmers/api-variables/variable-secure-dir.xml
new file mode 100644
index 00000000..f918a5f4
--- /dev/null
+++ b/docs/fr/programmers/api-variables/variable-secure-dir.xml
@@ -0,0 +1,30 @@
+
+
+
+ $secure_dir
+
+ Il s'agit d'un tableau contenant tous les répertoires locaux qui sont
+ considérés comme sécurisés. {include} et {fetch} l'utilisent quand
+ la sécurité est activée.
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-variables/variable-security-settings.xml b/docs/fr/programmers/api-variables/variable-security-settings.xml
new file mode 100644
index 00000000..ba8da3f9
--- /dev/null
+++ b/docs/fr/programmers/api-variables/variable-security-settings.xml
@@ -0,0 +1,42 @@
+
+
+
+ $security_settings
+
+ Ces réglages servent à écraser ou spécifier les paramétres de sécurité
+ quand celle-ci est activée. Les réglages possibles sont les suivants :
+
+
+ PHP_HANDLING - true/false. Si vrai, le
+ réglage $php_handling n'est pas vérifié.
+ IF_FUNCS - Le tableau des noms de fonctions
+ PHP autorisées dans les intructions IF.
+ INCLUDE_ANY - true/false. Si vrai,
+ les templates peuvent être inclus de n'importe oú, quelque soit
+ le contenu de $secure_dir.
+ PHP_TAGS - true/false. Si vrai,
+ les balises {php}{/php} sont autorisées dans les templates.
+ MODIFIER_FUNCS - Le tableau des noms de fonctions
+ autorisées a être utilisées comme modificateurs de variables.
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-variables/variable-security.xml b/docs/fr/programmers/api-variables/variable-security.xml
new file mode 100644
index 00000000..aea1fefb
--- /dev/null
+++ b/docs/fr/programmers/api-variables/variable-security.xml
@@ -0,0 +1,49 @@
+
+
+
+ $security
+
+ Cette variable est a faux par défaut. $security est de rigueur
+ quand vous n'Otes pas complétement svr des personnes qui éditent les templates
+ (par ftp par exemple) et que vous voulez réduire le risque que
+ la sécurité du systéme soit compromise par le language de template.
+ Activer cette option de sécurité applique les régles suivantes
+ au langage de template, a moins que $security_settings ne spécifie
+ le contraire :
+
+
+ Si $php_handling est réglée a SMARTY_PHP_ALLOW,
+ cela est implicitement changé a SMARTY_PHP_PASSTHRU.
+ Les fonctions PHP ne sont pas autorisées dans les
+ instructions IF, a part celles déclarées dans
+ $security_settings.
+ Les templates ne peuvent être inclus que depuis
+ des répertoires listés dans le tableau $security_dir.
+ Les fichiers locaux ne peuvent être récupérés que depuis
+ les répertoires listés dans le tableau $security_dir en
+ utilisant {fetch}.
+ Les balises {php}{/php} ne sont pas autorisées.
+ Les fonctions PHP ne sont pas autorisées en tant
+ modificateurs, a part celles spécifiées dans $security_settings.
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-variables/variable-template-dir.xml b/docs/fr/programmers/api-variables/variable-template-dir.xml
new file mode 100644
index 00000000..8185fecf
--- /dev/null
+++ b/docs/fr/programmers/api-variables/variable-template-dir.xml
@@ -0,0 +1,41 @@
+
+
+
+ $template_dir
+
+ C'est le nom par défaut du répertoire des templates.
+ Si vous ne spécifiez aucun chemin lors de l'utilisation de templates, Smarty
+ les cherchera a cet emplacement.
+ Par défaut, il s'agit de "./templates", ce qui signifie
+ qu'il va chercher le répertoire templates
+ dans le répertoire oú se trouve le script PHP en cours d'exécution.
+
+
+
+ Note technique
+
+ Il n'est pas conseillé de mettre ce répertoire
+ dans l'arborescence Web.
+
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-variables/variable-trusted-dir.xml b/docs/fr/programmers/api-variables/variable-trusted-dir.xml
new file mode 100644
index 00000000..68ee3544
--- /dev/null
+++ b/docs/fr/programmers/api-variables/variable-trusted-dir.xml
@@ -0,0 +1,32 @@
+
+
+
+ $trusted_dir
+
+ $trusted_dir n'est utilisée lorsque $security est activée. C'est un
+ tableau de tous les répertoires qui peuvent être considérés comme svrs.
+ Les répertoires svrs sont ceux qui contiennent des scripts PHP qui
+ sont exécutés directement depuis les templates avec
+ {include_php}.
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-variables/variable-undefined.xml b/docs/fr/programmers/api-variables/variable-undefined.xml
new file mode 100644
index 00000000..dafc23d9
--- /dev/null
+++ b/docs/fr/programmers/api-variables/variable-undefined.xml
@@ -0,0 +1,31 @@
+
+
+
+ $undefined
+
+ Cela régle la valeur de $undefined, null par défaut.
+ N'est actuellement utilisé que pour initialiser
+ des variables non-définies dans $global_assign a des
+ valeurs par défaut.
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/api-variables/variable-use-sub-dirs.xml b/docs/fr/programmers/api-variables/variable-use-sub-dirs.xml
new file mode 100644
index 00000000..ef75404c
--- /dev/null
+++ b/docs/fr/programmers/api-variables/variable-use-sub-dirs.xml
@@ -0,0 +1,30 @@
+
+
+
+ $use_sub_dirs
+
+ Régler cela a faux si votre environnement PHP n'autorise pas Smarty a créer
+ des sous-répertoires. Les sous-répertoires sont efficaces, utilisez-les quand
+ vous le pouvez.
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/caching.xml b/docs/fr/programmers/caching.xml
index c22ac744..9143579c 100644
--- a/docs/fr/programmers/caching.xml
+++ b/docs/fr/programmers/caching.xml
@@ -24,288 +24,9 @@
de météo mises a jour toutes les minutes, mettre cette page en cache
n'a aucun sens.
-
- Paramétrer le cache
-
- La premiére chose a faire est d'activer le cache. Cela est fait en
- mettant $caching = true
- (ou 1).
-
-
- activation du cache
-
-require('Smarty.class.php');
-$smarty = new Smarty;
-
-$smarty->caching = true;
-
-$smarty->display('index.tpl');
-
-
- Avec le cache activé, la fonction display('index.tpl') va afficher
- le template mais sauvegardera par la même occasion une copie du résultat
- dans un fichier (de cache) du répertoire
- $cache_dir. Au prochain appel de
- display('index.tpl'), le fichier de cache sera préféré a la réutilisation
- du template.
-
-
- Note technique
-
- Les fichiers situés dans $cache_dir sont nommés de la même faton que les templates.
- Bien qu'ils aient une extension ".php", ils ne sont pas vraiment exécutable.
- N'éditez surtout pas ces fichiers !
-
-
-
- Tout fichier de cache a une durée de vie limitée déterminée par $cache_lifetime. La valeur par
- défaut est 3600 secondes, i.e. 1 heure. Une fois que cette durée est
- dépassée, le cache est regénéré. Il est possible de donner
- une durée d'expiration propre a chaque fichier de cache en réglant
- $caching = 2.
- Se reporter a la documentation de $cache_lifetime pour plus de
- détails.
-
-
- réglage individuel de cache_lifetime
-
-require('Smarty.class.php');
-$smarty = new Smarty;
-
-$smarty->caching = 2; // régler la durée de vie individuellement
-
-// régle la durée de vie du cache a 15 minutes pour index.tpl
-$smarty->cache_lifetime = 300;
-$smarty->display('index.tpl');
-
-// régle la durée de vie du cache a 1 heure pour home.tpl
-$smarty->cache_lifetime = 3600;
-$smarty->display('home.tpl');
-
-// NOTE : le réglage suivant ne fonctionne pas quand $caching = 2. La durée de vie
-// du fichier de cache de home.tpl a déja été réglée a 1 heure et ne respectera
-// plus la valeur de $cache_lifetime. Le cache de home.tpl expirera toujours
-// dans 1 heure.
-$smarty->cache_lifetime = 30; // 30 secondes
-$smarty->display('home.tpl');
-
-
- Si $compile_check est actif,
- chaque fichier de template et de configuration qui a un rapport
- avec le fichier de cache sera vérifié pour détecter une éventuelle
- modification. Si l'un de ces fichiers a été modifié depuis que le fichier de cache a été
- généré, le cache est immédiatement regénéré. Ce processus est covteux, donc,
- pour des raisons de performances, mettez ce paramétre a false pour une application
- en production.
-
-
- activation de $compile_check
-
-require('Smarty.class.php');
-$smarty = new Smarty;
-
-$smarty->caching = true;
-$smarty->compile_check = true;
-
-$smarty->display('index.tpl');
-
-
- Si $force_compile est actif,
- les fichiers de cache sont toujours regénérés. Ceci revient finalement a
- désactiver le cache. $force_compile est utilisé a des fins de débogage,
- un moyen plus efficace de désactiver le cache est de régler
- $caching = false (ou 0).
-
-
- La fonction is_cached() permet
- de tester si un template a ou non un fichier de cache valide.
- Si vous disposez d'un template en cache qui requiert une requête
- a une base de données, vous pouvez utiliser cette méthode plut(t
- que $compile_check.
-
-
- utilisation de is_cached()
-
-require('Smarty.class.php');
-$smarty = new Smarty;
-
-$smarty->caching = true;
-
-if(!$smarty->is_cached('index.tpl')) {
- // pas de cache disponible, on assigne
- $contents = get_database_contents();
- $smarty->assign($contents);
-}
-
-$smarty->display('index.tpl');
-
-
- Vous pouvez rendre dynamiques seulement certaines parties d'une
- page avec la fonction de templates insert.
- Imaginons que toute une page doit être mise en cache a part
- une banniére en bas a droite. En utilisant une fonction insert pour la
- banniére, vous pouvez garder cet élément dynamique dans le contenu qui
- est en cache. Reportez-vous a la documentation
- insert pour plus de détails
- et des exemples.
-
-
- Vous pouvez effacer tous les fichiers du cache avec la fonction clear_all_cache(), ou de faton
- individuelle (ou par groupe) avec la fonction clear_cache().
-
-
- nettoyage du cache
-
-require('Smarty.class.php');
-$smarty = new Smarty;
-
-$smarty->caching = true;
-
-// efface tous les fichiers du cache
-$smarty->clear_all_cache();
-
-// efface le fichier de cache du template 'index.tpl'
-$smarty->clear_cache('index.tpl');
-
-$smarty->display('index.tpl');
-
-
-
- Caches multiples pour une seule page
-
- Vous pouvez avoir plusieurs fichiers de caches pour un même appel
- aux fonctions display() ou fetch(). Imaginons qu'un appel a display('index.tpl')
- puisse avoir plusieurs résultats, en fonction de certaines conditions, et que
- vous vouliez des fichiers de cache séparés pour chacun d'eux. Vous
- pouvez faire cela en passant un identifiant de cache (cache_id) en
- deuxiéme paramétre a l'appel de fonction.
-
-
- Passage d'un cache_id a display()
-
-require('Smarty.class.php');
-$smarty = new Smarty;
-
-$smarty->caching = true;
-
-$my_cache_id = $_GET['article_id'];
-
-$smarty->display('index.tpl',$my_cache_id);
-
-
- Nous passons ci-dessus la variable $my_cache_id a display() comme
- identifiant de cache. Pour chaque valeur distincte de $my_cache_id,
- un fichier de cache distinct va être créé. Dans cet exemple,
- "article_id" a été passé dans l'URL et est utilisé en tant qu'identifiant
- de cache.
-
-
- Note technique
-
- Soyez prudent en passant des valeurs depuis un client (navigateur Web)
- vers Smarty (ou vers n'importe quelle application PHP). Bien que l'exemple
- ci-dessus consistant a utiliser article_id depuis l'URL puisse paraetre
- commode, le résultat peut s'avérer mauvais. L'identifiant
- de cache est utilisé pour créer un répertoire sur le systéme de fichiers,
- donc si l'utilisateur décide de donner une trés grande valeur a article_id
- ou d'écrire un script qui envoie des article_id de faton aléatoire,
- cela pourra causer des problémes coté serveur. Assurez-vous de bien
- tester toute donnée passée en paramétre avant de l'utiliser. Dans cet
- exemple, peut-être savez-vous que article_id a une longueur de 10
- caractéres, est exclusivement composé de caractéres alph-numériques et
- doit avoir une valeur contenue dans la base de données. Vérifiez-le bien !
-
-
-
- Assurez-vous de bien passer le même identifiant aux fonctions
- is_cached() et
- clear_cache().
-
-
- passer un cache_id a is_cached()
-
-require('Smarty.class.php');
-$smarty = new Smarty;
-
-$smarty->caching = true;
-
-$my_cache_id = $_GET['article_id'];
-
-if(!$smarty->is_cached('index.tpl',$my_cache_id)) {
- // pas de fichier de cache dispo, on assigne donc les variables
- $contents = get_database_contents();
- $smarty->assign($contents);
-}
-
-$smarty->display('index.tpl',$my_cache_id);
-
-
- Vous pouvez effacer tous les fichiers de cache pour un identifiant
- de cache particulier en passant null en tant que premier paramétre
- a clear_cache().
-
-
- effacement de tous les fichiers de cache pour un identifiant de cache particulier
-
-require('Smarty.class.php');
-$smarty = new Smarty;
-
-$smarty->caching = true;
-
-// efface tous les fichiers de cache avec "sports" comme identifiant
-$smarty->clear_cache(null,"sports");
-
-$smarty->display('index.tpl',"sports");
-
-
- De cette maniére vous pouvez "grouper" vos fichiers de cache en leur
- donnant le même identifiant.
-
-
-
- groupes de fichiers de cache
-
- Vous pouvez faire des groupements plus élaborés en paramétrant les
- groupes d'identifiant de cache. Il suffit de séparer chaque sous-groupes
- avec une barre verticale "|" dans la valeur de l'identifiant de cache.
- Vous pouvez faire autant de sous-groupes que vous le désirez.
-
-
- groupes d'identifiants de cache
-
-require('Smarty.class.php');
-$smarty = new Smarty;
-
-$smarty->caching = true;
-
-// efface tous les fichiers de cache avec "sports|basketball" comme premiers
-// groupes d'identifiants de cache
-$smarty->clear_cache(null,"sports|basketball");
-
-// efface tous les fichiers de cache "sports" comme premier groupe d'identifiants.
-// Inclue donc "sports|basketball" ou "sports|nimportequoi|nimportequoi|..."
-$smarty->clear_cache(null,"sports");
-
-$smarty->display('index.tpl',"sports|basketball");
-
-
- Note technique
-
- Le systéme de cache n'utilise PAS le chemin vers le template en quoi
- que ce soit pour l'identifiant de cache. Si par exemple vous
- faites display('themes/blue/index.tpl'), vous ne pouvez pas effacer tous
- les fichiers de cache dans le répertoire "theme/blue". Si vous voulez
- faire cela, vous devez les grouper avec un même identifiant de cache,
- display('themes/blue/index.tpl','themes|blue'). Vous pouvez ensuite effacer les
- fichiers de cache pour blue et theme avec clear_cache(null,'theme|blue').
-
-
-
+&programmers.caching.caching-setting-up;
+&programmers.caching.caching-multiple-caches;
+&programmers.caching.caching-groups;
+
+ groupes de fichiers de cache
+
+ Vous pouvez faire des groupements plus élaborés en paramétrant les
+ groupes d'identifiant de cache. Il suffit de séparer chaque sous-groupes
+ avec une barre verticale "|" dans la valeur de l'identifiant de cache.
+ Vous pouvez faire autant de sous-groupes que vous le désirez.
+
+
+ groupes d'identifiants de cache
+
+require('Smarty.class.php');
+$smarty = new Smarty;
+
+$smarty->caching = true;
+
+// efface tous les fichiers de cache avec "sports|basketball" comme premiers
+// groupes d'identifiants de cache
+$smarty->clear_cache(null,"sports|basketball");
+
+// efface tous les fichiers de cache "sports" comme premier groupe d'identifiants.
+// Inclue donc "sports|basketball" ou "sports|nimportequoi|nimportequoi|..."
+$smarty->clear_cache(null,"sports");
+
+$smarty->display('index.tpl',"sports|basketball");
+
+
+ Note technique
+
+ Le systéme de cache n'utilise PAS le chemin vers le template en quoi
+ que ce soit pour l'identifiant de cache. Si par exemple vous
+ faites display('themes/blue/index.tpl'), vous ne pouvez pas effacer tous
+ les fichiers de cache dans le répertoire "theme/blue". Si vous voulez
+ faire cela, vous devez les grouper avec un même identifiant de cache,
+ display('themes/blue/index.tpl','themes|blue'). Vous pouvez ensuite effacer les
+ fichiers de cache pour blue et theme avec clear_cache(null,'theme|blue').
+
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/caching/caching-multiple-caches.xml b/docs/fr/programmers/caching/caching-multiple-caches.xml
new file mode 100644
index 00000000..19e7f5b1
--- /dev/null
+++ b/docs/fr/programmers/caching/caching-multiple-caches.xml
@@ -0,0 +1,114 @@
+
+
+
+ Caches multiples pour une seule page
+
+ Vous pouvez avoir plusieurs fichiers de caches pour un même appel
+ aux fonctions display() ou fetch(). Imaginons qu'un appel a display('index.tpl')
+ puisse avoir plusieurs résultats, en fonction de certaines conditions, et que
+ vous vouliez des fichiers de cache séparés pour chacun d'eux. Vous
+ pouvez faire cela en passant un identifiant de cache (cache_id) en
+ deuxiéme paramétre a l'appel de fonction.
+
+
+ Passage d'un cache_id a display()
+
+require('Smarty.class.php');
+$smarty = new Smarty;
+
+$smarty->caching = true;
+
+$my_cache_id = $_GET['article_id'];
+
+$smarty->display('index.tpl',$my_cache_id);
+
+
+ Nous passons ci-dessus la variable $my_cache_id a display() comme
+ identifiant de cache. Pour chaque valeur distincte de $my_cache_id,
+ un fichier de cache distinct va être créé. Dans cet exemple,
+ "article_id" a été passé dans l'URL et est utilisé en tant qu'identifiant
+ de cache.
+
+
+ Note technique
+
+ Soyez prudent en passant des valeurs depuis un client (navigateur Web)
+ vers Smarty (ou vers n'importe quelle application PHP). Bien que l'exemple
+ ci-dessus consistant a utiliser article_id depuis l'URL puisse paraetre
+ commode, le résultat peut s'avérer mauvais. L'identifiant
+ de cache est utilisé pour créer un répertoire sur le systéme de fichiers,
+ donc si l'utilisateur décide de donner une trés grande valeur a article_id
+ ou d'écrire un script qui envoie des article_id de faton aléatoire,
+ cela pourra causer des problémes coté serveur. Assurez-vous de bien
+ tester toute donnée passée en paramétre avant de l'utiliser. Dans cet
+ exemple, peut-être savez-vous que article_id a une longueur de 10
+ caractéres, est exclusivement composé de caractéres alph-numériques et
+ doit avoir une valeur contenue dans la base de données. Vérifiez-le bien !
+
+
+
+ Assurez-vous de bien passer le même identifiant aux fonctions
+ is_cached() et
+ clear_cache().
+
+
+ passer un cache_id a is_cached()
+
+require('Smarty.class.php');
+$smarty = new Smarty;
+
+$smarty->caching = true;
+
+$my_cache_id = $_GET['article_id'];
+
+if(!$smarty->is_cached('index.tpl',$my_cache_id)) {
+ // pas de fichier de cache dispo, on assigne donc les variables
+ $contents = get_database_contents();
+ $smarty->assign($contents);
+}
+
+$smarty->display('index.tpl',$my_cache_id);
+
+
+ Vous pouvez effacer tous les fichiers de cache pour un identifiant
+ de cache particulier en passant null en tant que premier paramétre
+ a clear_cache().
+
+
+ effacement de tous les fichiers de cache pour un identifiant de cache particulier
+
+require('Smarty.class.php');
+$smarty = new Smarty;
+
+$smarty->caching = true;
+
+// efface tous les fichiers de cache avec "sports" comme identifiant
+$smarty->clear_cache(null,"sports");
+
+$smarty->display('index.tpl',"sports");
+
+
+ De cette maniére vous pouvez "grouper" vos fichiers de cache en leur
+ donnant le même identifiant.
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/caching/caching-setting-up.xml b/docs/fr/programmers/caching/caching-setting-up.xml
new file mode 100644
index 00000000..2794afa3
--- /dev/null
+++ b/docs/fr/programmers/caching/caching-setting-up.xml
@@ -0,0 +1,173 @@
+
+
+
+ Paramétrer le cache
+
+ La premiére chose a faire est d'activer le cache. Cela est fait en
+ mettant $caching = true
+ (ou 1).
+
+
+ activation du cache
+
+require('Smarty.class.php');
+$smarty = new Smarty;
+
+$smarty->caching = true;
+
+$smarty->display('index.tpl');
+
+
+ Avec le cache activé, la fonction display('index.tpl') va afficher
+ le template mais sauvegardera par la même occasion une copie du résultat
+ dans un fichier (de cache) du répertoire
+ $cache_dir. Au prochain appel de
+ display('index.tpl'), le fichier de cache sera préféré a la réutilisation
+ du template.
+
+
+ Note technique
+
+ Les fichiers situés dans $cache_dir sont nommés de la même faton que les templates.
+ Bien qu'ils aient une extension ".php", ils ne sont pas vraiment exécutable.
+ N'éditez surtout pas ces fichiers !
+
+
+
+ Tout fichier de cache a une durée de vie limitée déterminée par $cache_lifetime. La valeur par
+ défaut est 3600 secondes, i.e. 1 heure. Une fois que cette durée est
+ dépassée, le cache est regénéré. Il est possible de donner
+ une durée d'expiration propre a chaque fichier de cache en réglant
+ $caching = 2.
+ Se reporter a la documentation de $cache_lifetime pour plus de
+ détails.
+
+
+ réglage individuel de cache_lifetime
+
+require('Smarty.class.php');
+$smarty = new Smarty;
+
+$smarty->caching = 2; // régler la durée de vie individuellement
+
+// régle la durée de vie du cache a 15 minutes pour index.tpl
+$smarty->cache_lifetime = 300;
+$smarty->display('index.tpl');
+
+// régle la durée de vie du cache a 1 heure pour home.tpl
+$smarty->cache_lifetime = 3600;
+$smarty->display('home.tpl');
+
+// NOTE : le réglage suivant ne fonctionne pas quand $caching = 2. La durée de vie
+// du fichier de cache de home.tpl a déja été réglée a 1 heure et ne respectera
+// plus la valeur de $cache_lifetime. Le cache de home.tpl expirera toujours
+// dans 1 heure.
+$smarty->cache_lifetime = 30; // 30 secondes
+$smarty->display('home.tpl');
+
+
+ Si $compile_check est actif,
+ chaque fichier de template et de configuration qui a un rapport
+ avec le fichier de cache sera vérifié pour détecter une éventuelle
+ modification. Si l'un de ces fichiers a été modifié depuis que le fichier de cache a été
+ généré, le cache est immédiatement regénéré. Ce processus est covteux, donc,
+ pour des raisons de performances, mettez ce paramétre a false pour une application
+ en production.
+
+
+ activation de $compile_check
+
+require('Smarty.class.php');
+$smarty = new Smarty;
+
+$smarty->caching = true;
+$smarty->compile_check = true;
+
+$smarty->display('index.tpl');
+
+
+ Si $force_compile est actif,
+ les fichiers de cache sont toujours regénérés. Ceci revient finalement a
+ désactiver le cache. $force_compile est utilisé a des fins de débogage,
+ un moyen plus efficace de désactiver le cache est de régler
+ $caching = false (ou 0).
+
+
+ La fonction is_cached() permet
+ de tester si un template a ou non un fichier de cache valide.
+ Si vous disposez d'un template en cache qui requiert une requête
+ a une base de données, vous pouvez utiliser cette méthode plut(t
+ que $compile_check.
+
+
+ utilisation de is_cached()
+
+require('Smarty.class.php');
+$smarty = new Smarty;
+
+$smarty->caching = true;
+
+if(!$smarty->is_cached('index.tpl')) {
+ // pas de cache disponible, on assigne
+ $contents = get_database_contents();
+ $smarty->assign($contents);
+}
+
+$smarty->display('index.tpl');
+
+
+ Vous pouvez rendre dynamiques seulement certaines parties d'une
+ page avec la fonction de templates insert.
+ Imaginons que toute une page doit être mise en cache a part
+ une banniére en bas a droite. En utilisant une fonction insert pour la
+ banniére, vous pouvez garder cet élément dynamique dans le contenu qui
+ est en cache. Reportez-vous a la documentation
+ insert pour plus de détails
+ et des exemples.
+
+
+ Vous pouvez effacer tous les fichiers du cache avec la fonction clear_all_cache(), ou de faton
+ individuelle (ou par groupe) avec la fonction clear_cache().
+
+
+ nettoyage du cache
+
+require('Smarty.class.php');
+$smarty = new Smarty;
+
+$smarty->caching = true;
+
+// efface tous les fichiers du cache
+$smarty->clear_all_cache();
+
+// efface le fichier de cache du template 'index.tpl'
+$smarty->clear_cache('index.tpl');
+
+$smarty->display('index.tpl');
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/plugins.xml b/docs/fr/programmers/plugins.xml
index 8dd69c30..923b7b08 100644
--- a/docs/fr/programmers/plugins.xml
+++ b/docs/fr/programmers/plugins.xml
@@ -26,747 +26,27 @@
l'API ou convertir vos fonctionnalités personnalisées en plugins.
-
- Comment fonctionnent les plugins
-
- Les plugins sont toujours chargés a la demande. Seuls les modificateurs
- de variables, les ressources, etc invoqués dans les scripts de templates
- seront chargés. De plus, chaque plugin n'est chargé qu'une fois, et ce
- même si vous avez plusieurs instances de Smarty qui tournent dans
- la même requête.
-
-
- Les filtres de post/pré-compilation et les filtres de sortie sont des cas
- un peu spéciaux.
- Comme ils ne sont pas mentionnés dans les templates, ils doivent être déclarés
- ou chargés explicitement via les fonctions de l'API avant que le template
- ne soit exécuté. L'ordre dans lequel les filtres multiples d'un même type
- sont exécutés dépend de l'ordre dans lequel ils sont enregistrés ou chargés.
-
-
- Il n'existe qu'un seul répertoire de plugin (pour des raisons de performances).
- Pour installer un plugin, copiez-le simplement dans le répertoire et Smarty
- l'utilisera automatiquement.
-
-
+&programmers.plugins.plugins-howto;
-
- Conventions de nommage
-
- Les fichiers et les fonctions de plugins doivent suivre une convention
- de nommage trés spécifique pour être localisés par Smarty.
-
-
- Les fichiers de plugins doivent être nommés de la faton suivante :
-
-
-
- type.nom.php
-
-
-
-
-
- Oú type est l'une des valeurs suivantes :
-
- function
- modifier
- block
- compiler
- prefilter
- postfilter
- outputfilter
- resource
- insert
-
-
-
- Et nom doit être un identifiant valide (lettres, nombres
- et underscore seulement).
-
-
- Quelques exemples : function.html_select_date.php,
- resource.db.php,
- modifier.spacify.php.
-
-
- Les fonctions de plugins dans les fichiers de plugins doivent être
- nommées de la faton suivante :
-
-
- smarty_type_nom
-
-
-
-
- Les significations de type et de nom sont les mêmes
- que précédemment.
-
-
- Smarty donnera des messages d'erreur approprié si le fichier de plugin
- n'est pas trouvé, ou si le fichier ou la fonction de plugin ne sont
- pas nommés correctement.
-
-
+&programmers.plugins.plugins-naming-conventions;
-
- Ecrire des plugins
-
- Les plugins peuvent être soit chargés automatiquement par Smarty
- depuis le systéme de fichier, soit être déclarés
- pendant l'exécution via une fonction register_* de l'API. Ils peuvent
- aussi être désalloués en utilisant une fonction unregister_* de
- l'API.
-
-
- Pour les plugins qui ne sont pas enregistrés pendant l'exécution, le nom
- des fonctions n'ont pas a suivre la convention de nommage.
-
-
- Si certaines fonctionnalités d'un plugin dépendent d'un autre plugin
- (comme c'est le cas de certains plugins accompagnant Smarty), alors la maniére appropriée
- de charger le plugin est la suivante :
-
-
-
-require_once SMARTY_DIR . 'plugins/function.html_options.php';
-
- Une régle générale est que chaque objet Smarty est toujours passé au plugin
- en tant que dernier paramétre (a part pour les modificateurs).
-
-
+&programmers.plugins.plugins-writing;
- Les fonctions de templates
-
-
- void smarty_function_name
- array $params
- object &$smarty
-
-
-
- Tous les attributs passés aux fonctions de template a partir du template
- sont contenus dans le tableau associatif $params.
- Vous pouvez accéder a ces valeurs soit directement, par exemple
- $params['start'], soit en utilisant
- extract($params) pour les importer dans la table
- des symboles.
-
-
- Le retour de la fonction sera substituée a la balise de fonction
- du template (fonction fetch par exemple). Sinon,
- la fonction peut simplement accomplir une autre tGche sans sortie
- (la fonction assign par exemple)
-
-
- Si la fonction a besoin d'assigner des variables aux templates ou d'utiliser
- d'autres fonctionnalités fournies par Smarty, elle peut recevoir un
- objet $smarty pour cela.
-
-
- Référez-vous aussi a :
- register_function(),
- unregister_function().
-
-
-
- fonction de plugin avec sortie
-
-<?php
-/*
- * Smarty plugin
- * -------------------------------------------------------------
- * Fichier : function.eightball.php
- * Type : fonction
- * Nom : eightball
- * Rôle : renvoie une phrase magique au hasard
- * -------------------------------------------------------------
- */
-function smarty_function_eightball($params, &$smarty)
-{
- $answers = array('Yes',
- 'No',
- 'No way',
- 'Outlook not so good',
- 'Ask again soon',
- 'Maybe in your reality');
+&programmers.plugins.plugins-functions;
- $result = array_rand($answers);
- return $answers[$result];
-}
-?>
-
-
-
- peut être utilisée dans le template de la faton suivante :
-
-
-Question: Will we ever have time travel?
-Answer: {eightball}.
-
-
- fonction de plugin sans sortie
-
-<?php
-/*
- * Smarty plugin
- * -------------------------------------------------------------
- * Fichier : function.assign.php
- * Type : fonction
- * Nom : assign
- * Purpose : assigne une valeur a une variable de template
- * -------------------------------------------------------------
- */
-function smarty_function_assign($params, &$smarty)
-{
- extract($params);
+&programmers.plugins.plugins-modifiers;
- if (empty($var)) {
- $smarty->trigger_error("assign: missing 'var' parameter");
- return;
- }
+&programmers.plugins.plugins-block-functions;
- if (!in_array('value', array_keys($params))) {
- $smarty->trigger_error("assign: missing 'value' parameter");
- return;
- }
+&programmers.plugins.plugins-compiler-functions;
- $smarty->assign($var, $value);
-}
-?>
-
-
-
+&programmers.plugins.plugins-prefilters-postfilters;
- Modificateurs
-
- Les modificateurs sont des petites fonctions appliquées a une variable
- de template avant qu'elle ne soit affichée ou utilisée dans un autre contexte.
- Les modificateurs peuvent être chaenés entre eux.
-
-
-
- mixed smarty_modifier_name
- mixed $value
- [mixed $param1, ...]
-
-
-
- Le premier paramétre passé au modificateur est la valeur
- sur laquelle le modificateur est supposé opérer. Les autres paramétres
- peuvent être optionnels, dépendant de quel genre d'opération doit être
- effectué.
-
-
- Le modificateur doit retourner le résultat de son exécution.
-
-
- Regardez aussi
- register_modifier(),
- unregister_modifier().
-
-
- plugin modificateur simple
-
- Ce plugin est un alias d'une fonction PHP. Il n'a aucun paramétre
- supplémentaires.
-
-
-<?php
-/*
- * Smarty plugin
- * -------------------------------------------------------------
- * Fichier : modifier.capitalize.php
- * Type : modificateur
- * Name : capitalize
- * Rôle : met une majuscule aux mots d'une phrase
- * -------------------------------------------------------------
- */
-function smarty_modifier_capitalize($string)
-{
- return ucwords($string);
-}
-?>
-
-
-
- un plugin modificateur un peu plus complexe
-
-<?php
-/*
- * Smarty plugin
- * -------------------------------------------------------------
- * Fichier : modifier.truncate.php
- * Type : modificateur
- * Name : truncate
- * Rôle : Tronque une chaene a une certaine longueur si
- * nécessaire, la coupe optionnellement au milieu
- * d'un mot et ajoute la chaene $etc
- * -------------------------------------------------------------
- */
-function smarty_modifier_truncate($string, $length = 80, $etc = '...',
- $break_words = false)
-{
- if ($length == 0)
- return '';
+&programmers.plugins.plugins-outputfilters;
- if (strlen($string) > $length) {
- $length -= strlen($etc);
- $fragment = substr($string, 0, $length+1);
- if ($break_words)
- $fragment = substr($fragment, 0, -1);
- else
- $fragment = preg_replace('/\s+(\S+)?$/', '', $fragment);
- return $fragment.$etc;
- } else
- return $string;
-}
-?>
-
-
+&programmers.plugins.plugins-resources;
- Fonctions de blocs
-
-
- void smarty_block_name
- array $params
- mixed $content
- object &$smarty
-
-
-
- Les fonctions de blocs sont des fonctions de la forme {func} .. {/func}.
- En d'autres mots, elles englobent des blocs de template et opérent sur les
- contenus de ces blocs. Les fonctions de blocs ont la priorité sur les
- fonctions utilisateurs de même nom, ce qui signifie que vous ne
- pouvez avoir une fonction utilisateur {func} et une fonction de bloc
- {func} .. {/func}.
-
-
- L'implémentation de votre fonction est appelée deux fois par Smarty :
- une fois pour la balise ouvrante et une autre fois pour la balise
- fermante.
-
-
- Seule la balise ouvrante d'une fonction de bloc peut avoir des attributs.
- Tous les attributs passés par le template aux fonctions de templates sont
- contenues dans le tableau associatif $params.
- Vous pouvez accéder a ces valeurs soit directement, par exemple
- $params['start'], soit en utilisant
- extract($params) pour les importer dans la table
- des symboles. Votre fonction a aussi accés aux attributs de la balise
- ouvrante quand c'est la balise fermante qui est exécutée.
-
-
- La valeur de la variable $content est différente
- selon si votre fonction est appelée pour la balise ouvrante ou la
- balise fermante. Si c'est pour la balise ouvrante, elle sera a
- null et si c'est la balise fermante elle sera
- égale au contenu du bloc de template. Notez que le bloc de template
- aura déjà été exécuté par Smarty, vous recevrez donc la sortie du
- template et non sa source.
-
-
- Si vous imbriqué des fonctions de bloc, il est possible de connaetre
- la fonction de bloc parente grGce a la variable $smarty->_tag_stack.
- Faites un var_dump() dessus et la structure devrait apparaetre.
-
-
- Regardez aussi :
- register_block(),
- unregister_block().
-
-
- fonction de bloc
-
-<?php
-/*
- * Smarty plugin
- * -------------------------------------------------------------
- * Fichier : block.translate.php
- * Type : bloc
- * Nom : translate
- * Rôle : traduire un bloc de texte
- * -------------------------------------------------------------
- */
-function smarty_block_translate($params, $content, &$smarty)
-{
- if ($content) {
- $lang = $params['lang'];
- // fait une traduction de $content
- echo $translation;
- }
-}
-
-
-
- Fonctions de compilation
-
- Les fonctions de compilation sont appelées durant la compilation du template.
- Elles sont utiles pour injecter du code PHP ou du contenu "statique variant
- avec le temps" (bandeau de pub par ex.). Si une fonction de compilation et
- une fonction personnalisée ont le même
- nom, la fonction de compilation a priorité.
-
-
-
- mixed smarty_compiler_name
- string $tag_arg
- object &$smarty
-
-
-
- Les fonctions de compilation ont deux paramétres : une chaene contenant
- la balise - en gros, tout, depuis le nom de la fonction jusqu'au délimiteur de fin - et
- l'objet Smarty. Elles sont censées retourner le code PHP qui doit être
- injecté dans le template compilé.
-
-
- Regardez aussi
- register_compiler_function(),
- unregister_compiler_function().
-
-
- fonction de compilation simple
-
-<?php
-/*
- * Smarty plugin
- * -------------------------------------------------------------
- * Fichier : compiler.tplheader.php
- * Type : compilation
- * Nom : tplheader
- * Rôle : Renvoie l'en-tête contenant le nom du fichier
- * source et le temps de compilation.
- * -------------------------------------------------------------
- */
-function smarty_compiler_tplheader($tag_arg, &$smarty)
-{
- return "\necho '" . $smarty->_current_file . " compiled at " . date('Y-m-d H:M'). "';";
-}
-?>
-
- Cette fonction peut-être appelé depuis le template comme suivant :
-
-
-{* cette fonction n'est executée que lors de la compilation *}
-{tplheader}
-
- Le code PHP résultant dans les templates compilés ressemblerait a ta :
-
-
-<php
-echo 'index.tpl compiled at 2002-02-20 20:02';
-?>
-
-
-
-
- filtres de pré-compilation/filtres de post-compilation
-
- Les filtres de pré-compilation et les filtres de post-compilation ont des concepts trés
- proches. Ils différent dans leur exécution, plus précisément dans le
- moment oú ils sont exécutés.
-
-
-
- string smarty_prefilter_name
- string $source
- object &$smarty
-
-
-
- Les filtres de pré-compilation sont utilisés pour transformer la source d'un template
- juste avant la compilation. Le premier paramétre passé a la fonction
- de filtre de pré-compilation est la source du template, éventuellement modifiée par
- d'autres filtre de pré-compilations. Le plugin est supposé retourner la source modifiée.
- Notez que cette source n'est sauvegardée nulle part, elle est seulement
- utilisé pour la compilation.
-
-
-
- string smarty_postfilter_name
- string $compiled
- object &$smarty
-
-
-
- Les filtres de post-compilation sont utilisés pour modifier la sortie du template
- (le code PHP) juste aprés que la compilation a été faite mais juste
- avant que le template ne soit sauvegardé sur le systéme de fichiers.
- Le premier paramétre passé a la fonction de filtre de post-compilation est le code
- du template compilé, éventuellement déja modifié par d'autres filtre de post-compilations.
- Le plugin est censé retourner la version modifié du code.
-
-
- plugin de filtre de post-compilation
-
-<?php
-/*
- * Smarty plugin
- * -------------------------------------------------------------
- * Fichier : prefilter.pre01.php
- * Type : filtre de pré-compilation
- * Nom : pre01
- * Rôle : Passe les balises HTML en minuscules.
- * -------------------------------------------------------------
- */
- function smarty_prefilter_pre01($source, &$smarty)
- {
- return preg_replace('!<(\w+)[^>]+>!e', 'strtolower("$1")', $source);
- }
-?>
-
-
-
- plugin de filtre de post-compilation
-
-<?php
-/*
- * Smarty plugin
- * -------------------------------------------------------------
- * Fichier : postfilter.post01.php
- * Type: filtre de post-compilation
- * Nom : post01
- * Rôle : Renvoie du code qui liste toutes les variables
- * du template.
- * -------------------------------------------------------------
- */
- function smarty_postfilter_post01($compiled, &$smarty)
- {
- $compiled = "<pre>\n<?php print_r(\$this->get_template_vars()); ?>\n</pre>" . $compiled;
- return $compiled;
- }
-?>
-
-
-
- Filtres de sortie
-
- Les plugins de filtres de sortie opérent sur la sortie du template,
- aprés que le template a été chargé et exécuté, mais avant que
- la sortie ne soit affichée.
-
-
-
- string smarty_outputfilter_name
- string $template_output
- object &$smarty
-
-
-
- Le premier paramétre passé a la fonction du filtre de sortie est la
- sortie du template qui doit être modifiée et le second paramétre
- est l'instance de Smarty appelant le plugin. Le plugin est supposé
- faire un traitement et en retourner le résultat.
-
-
- plugin de filtre de sortie
-
-/*
- * Smarty plugin
- * -------------------------------------------------------------
- * Fichier : outputfilter.protect_email.php
- * Type : filtre de sortie
- * Nom : protect_email
- * Rôle: Convertie les @ en %40 pour protéger des
- * robots spammers.
- * -------------------------------------------------------------
- */
- function smarty_outputfilter_protect_email($output, &$smarty)
- {
- return preg_replace('!(\S+)@([a-zA-Z0-9\.\-]+\.([a-zA-Z]{2,3}|[0-9]{1,3}))!',
- '$1%40$2', $output);
- }
-
-
-
-
- Ressources
-
- Les plugins ressources sont un moyen générique de fournir des sources
- de templates ou des composants de scripts PHP a Smarty. Quelques exemples
- de ressources : bases de données, LDAP, mémoire partagée, sockets, et ainsi
- de suite.
-
-
- Il y au total 4 fonctions qui ont besoin d'être enregistrées pour
- chaque type de ressource. Chaque fonction retoit le nom de la ressource demandée
- comme premier paramétre et l'objet Smarty comme dernier paramétre.
- Les autres paramétres dépendent de la fonction.
-
-
-
- bool smarty_resource_name_source
- string $rsrc_name
- string &$source
- object &$smarty
-
-
- bool smarty_resource_name_timestamp
- string $rsrc_name
- int &$timestamp
- object &$smarty
-
-
- bool smarty_resource_name_secure
- string $rsrc_name
- object &$smarty
-
-
- bool smarty_resource_name_trusted
- string $rsrc_name
- object &$smarty
-
-
-
-
- La premiére fonction est supposée récupérer la ressource. Son second
- paramétre est une variable passée par référence oú le résultat doit être
- stocké. La fonction est supposée retourner true si
- elle réussi a récupérer la ressource et false sinon.
-
-
-
- La seconde fonction est supposée récupérer la date de derniére modification
- de la ressource demandée (comme un timestamp UNIX). Le second paramétre
- est une variable passée par référence dans laquelle la date doit
- être stockée. La fonction est supposée renvoyer true si elle
- a réussi a récupérer la date et false sinon.
-
-
-
- La troisiéme fonction est supposée retourner true
- ou false selon si la ressource demandée est svre
- ou non. La fonction est utilisée seulement pour les ressources templates
- mais doit tout de même être définie.
-
-
-
- La quatriéme fonction est supposée retourner true
- ou false selon si on peut faire confiance ou
- non a la ressource demandée. Cette fonction est utilisée seulement
- pour les composants de scripts PHP demandés par les balises
- include_php ou insert
- ayant un attribut src. Quoiqu'il en soit,
- elle doit être définie pour les ressources templates.
-
-
-
- Regardez aussi
- register_resource(),
- unregister_resource().
-
-
- resource plugin
-
-<?php
-/*
- * Smarty plugin
- * -------------------------------------------------------------
- * Fichier : resource.db.php
- * Type : ressource
- * Nom : db
- * Rôle : Récupére des templates depuis une base de données
- * -------------------------------------------------------------
- */
-function smarty_resource_db_source($tpl_name, &$tpl_source, &$smarty)
-{
- // fait des requêtes BD pour récupérer votre template
- // et remplir $tpl_source
- $sql = new SQL;
- $sql->query("select tpl_source
- from my_table
- where tpl_name='$tpl_name'");
- if ($sql->num_rows) {
- $tpl_source = $sql->record['tpl_source'];
- return true;
- } else {
- return false;
- }
-}
-
-function smarty_resource_db_timestamp($tpl_name, &$tpl_timestamp, &$smarty)
-{
- // fait des requêtes BD pour remplir $tpl_timestamp
- $sql = new SQL;
- $sql->query("select tpl_timestamp
- from my_table
- where tpl_name='$tpl_name'");
- if ($sql->num_rows) {
- $tpl_timestamp = $sql->record['tpl_timestamp'];
- return true;
- } else {
- return false;
- }
-}
-
-function smarty_resource_db_secure($tpl_name, &$smarty)
-{
- // suppose que tous les templates sont svrs
- return true;
-}
-
-function smarty_resource_db_trusted($tpl_name, &$smarty)
-{
- // inutilisée pour les templates
-}
-?>
-
-
-
- Insertions
-
- Les plugins d'insertion sont utilisés pour implémenter les fonctions
- qui sont appelées par les balises
- insert
- dans les templates.
-
-
-
- string smarty_insert_name
- array $params
- object &$smarty
-
-
-
- Le premier paramétre passé a la fonction est une tableau associatif
- d'attributs. Vous pouvez accéder a ces valeurs soit directement, par exemple
- $params['start'], soit en utilisant
- extract($params) pour les importer dans la table
- des symboles.
-
-
- La fonction d'insertion est supposée retourner le résultat qui sera
- substitué a la balise insert dans le template.
-
-
- plugin d'insertion
-
-<?php
-/*
- * Smarty plugin
- * -------------------------------------------------------------
- * Fichier : insert.time.php
- * Type : temps
- * Nom : time
- * Rôle : Insert la date/heure courante conformément
- * au format
- * -------------------------------------------------------------
- */
-function smarty_insert_time($params, &$smarty)
-{
- if (empty($params['format'])) {
- $smarty->trigger_error("insert time: missing 'format' parameter");
- return;
- }
-
- $datetime = strftime($params['format']);
- return $datetime;
-}
-?>
-
-
+&programmers.plugins.plugins-inserts;
+ Fonctions de blocs
+
+
+ void smarty_block_name
+ array $params
+ mixed $content
+ object &$smarty
+
+
+
+ Les fonctions de blocs sont des fonctions de la forme {func} .. {/func}.
+ En d'autres mots, elles englobent des blocs de template et opérent sur les
+ contenus de ces blocs. Les fonctions de blocs ont la priorité sur les
+ fonctions utilisateurs de même nom, ce qui signifie que vous ne
+ pouvez avoir une fonction utilisateur {func} et une fonction de bloc
+ {func} .. {/func}.
+
+
+ L'implémentation de votre fonction est appelée deux fois par Smarty :
+ une fois pour la balise ouvrante et une autre fois pour la balise
+ fermante.
+
+
+ Seule la balise ouvrante d'une fonction de bloc peut avoir des attributs.
+ Tous les attributs passés par le template aux fonctions de templates sont
+ contenues dans le tableau associatif $params.
+ Vous pouvez accéder a ces valeurs soit directement, par exemple
+ $params['start'], soit en utilisant
+ extract($params) pour les importer dans la table
+ des symboles. Votre fonction a aussi accés aux attributs de la balise
+ ouvrante quand c'est la balise fermante qui est exécutée.
+
+
+ La valeur de la variable $content est différente
+ selon si votre fonction est appelée pour la balise ouvrante ou la
+ balise fermante. Si c'est pour la balise ouvrante, elle sera a
+ null et si c'est la balise fermante elle sera
+ égale au contenu du bloc de template. Notez que le bloc de template
+ aura déjà été exécuté par Smarty, vous recevrez donc la sortie du
+ template et non sa source.
+
+
+ Si vous imbriqué des fonctions de bloc, il est possible de connaetre
+ la fonction de bloc parente grGce a la variable $smarty->_tag_stack.
+ Faites un var_dump() dessus et la structure devrait apparaetre.
+
+
+ Regardez aussi :
+ register_block(),
+ unregister_block().
+
+
+ fonction de bloc
+
+<?php
+/*
+ * Smarty plugin
+ * -------------------------------------------------------------
+ * Fichier : block.translate.php
+ * Type : bloc
+ * Nom : translate
+ * Rôle : traduire un bloc de texte
+ * -------------------------------------------------------------
+ */
+function smarty_block_translate($params, $content, &$smarty)
+{
+ if ($content) {
+ $lang = $params['lang'];
+ // fait une traduction de $content
+ echo $translation;
+ }
+}
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/plugins/plugins-compiler-functions.xml b/docs/fr/programmers/plugins/plugins-compiler-functions.xml
new file mode 100644
index 00000000..03a94318
--- /dev/null
+++ b/docs/fr/programmers/plugins/plugins-compiler-functions.xml
@@ -0,0 +1,82 @@
+
+
+ Fonctions de compilation
+
+ Les fonctions de compilation sont appelées durant la compilation du template.
+ Elles sont utiles pour injecter du code PHP ou du contenu "statique variant
+ avec le temps" (bandeau de pub par ex.). Si une fonction de compilation et
+ une fonction personnalisée ont le même
+ nom, la fonction de compilation a priorité.
+
+
+
+ mixed smarty_compiler_name
+ string $tag_arg
+ object &$smarty
+
+
+
+ Les fonctions de compilation ont deux paramétres : une chaene contenant
+ la balise - en gros, tout, depuis le nom de la fonction jusqu'au délimiteur de fin - et
+ l'objet Smarty. Elles sont censées retourner le code PHP qui doit être
+ injecté dans le template compilé.
+
+
+ Regardez aussi
+ register_compiler_function(),
+ unregister_compiler_function().
+
+
+ fonction de compilation simple
+
+<?php
+/*
+ * Smarty plugin
+ * -------------------------------------------------------------
+ * Fichier : compiler.tplheader.php
+ * Type : compilation
+ * Nom : tplheader
+ * Rôle : Renvoie l'en-tête contenant le nom du fichier
+ * source et le temps de compilation.
+ * -------------------------------------------------------------
+ */
+function smarty_compiler_tplheader($tag_arg, &$smarty)
+{
+ return "\necho '" . $smarty->_current_file . " compiled at " . date('Y-m-d H:M'). "';";
+}
+?>
+
+ Cette fonction peut-être appelé depuis le template comme suivant :
+
+
+{* cette fonction n'est executée que lors de la compilation *}
+{tplheader}
+
+ Le code PHP résultant dans les templates compilés ressemblerait a ta :
+
+
+<php
+echo 'index.tpl compiled at 2002-02-20 20:02';
+?>
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/plugins/plugins-functions.xml b/docs/fr/programmers/plugins/plugins-functions.xml
new file mode 100644
index 00000000..8187661f
--- /dev/null
+++ b/docs/fr/programmers/plugins/plugins-functions.xml
@@ -0,0 +1,123 @@
+
+
+ Les fonctions de templates
+
+
+ void smarty_function_name
+ array $params
+ object &$smarty
+
+
+
+ Tous les attributs passés aux fonctions de template a partir du template
+ sont contenus dans le tableau associatif $params.
+ Vous pouvez accéder a ces valeurs soit directement, par exemple
+ $params['start'], soit en utilisant
+ extract($params) pour les importer dans la table
+ des symboles.
+
+
+ Le retour de la fonction sera substituée a la balise de fonction
+ du template (fonction fetch par exemple). Sinon,
+ la fonction peut simplement accomplir une autre tGche sans sortie
+ (la fonction assign par exemple)
+
+
+ Si la fonction a besoin d'assigner des variables aux templates ou d'utiliser
+ d'autres fonctionnalités fournies par Smarty, elle peut recevoir un
+ objet $smarty pour cela.
+
+
+ Référez-vous aussi a :
+ register_function(),
+ unregister_function().
+
+
+
+ fonction de plugin avec sortie
+
+<?php
+/*
+ * Smarty plugin
+ * -------------------------------------------------------------
+ * Fichier : function.eightball.php
+ * Type : fonction
+ * Nom : eightball
+ * Rôle : renvoie une phrase magique au hasard
+ * -------------------------------------------------------------
+ */
+function smarty_function_eightball($params, &$smarty)
+{
+ $answers = array('Yes',
+ 'No',
+ 'No way',
+ 'Outlook not so good',
+ 'Ask again soon',
+ 'Maybe in your reality');
+
+ $result = array_rand($answers);
+ return $answers[$result];
+}
+?>
+
+
+
+ peut être utilisée dans le template de la faton suivante :
+
+
+Question: Will we ever have time travel?
+Answer: {eightball}.
+
+
+ fonction de plugin sans sortie
+
+<?php
+/*
+ * Smarty plugin
+ * -------------------------------------------------------------
+ * Fichier : function.assign.php
+ * Type : fonction
+ * Nom : assign
+ * Purpose : assigne une valeur a une variable de template
+ * -------------------------------------------------------------
+ */
+function smarty_function_assign($params, &$smarty)
+{
+ extract($params);
+
+ if (empty($var)) {
+ $smarty->trigger_error("assign: missing 'var' parameter");
+ return;
+ }
+
+ if (!in_array('value', array_keys($params))) {
+ $smarty->trigger_error("assign: missing 'value' parameter");
+ return;
+ }
+
+ $smarty->assign($var, $value);
+}
+?>
+
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/plugins/plugins-howto.xml b/docs/fr/programmers/plugins/plugins-howto.xml
new file mode 100644
index 00000000..5bb54593
--- /dev/null
+++ b/docs/fr/programmers/plugins/plugins-howto.xml
@@ -0,0 +1,45 @@
+
+
+
+ Comment fonctionnent les plugins
+
+ Les plugins sont toujours chargés a la demande. Seuls les modificateurs
+ de variables, les ressources, etc invoqués dans les scripts de templates
+ seront chargés. De plus, chaque plugin n'est chargé qu'une fois, et ce
+ même si vous avez plusieurs instances de Smarty qui tournent dans
+ la même requête.
+
+
+ Les filtres de post/pré-compilation et les filtres de sortie sont des cas
+ un peu spéciaux.
+ Comme ils ne sont pas mentionnés dans les templates, ils doivent être déclarés
+ ou chargés explicitement via les fonctions de l'API avant que le template
+ ne soit exécuté. L'ordre dans lequel les filtres multiples d'un même type
+ sont exécutés dépend de l'ordre dans lequel ils sont enregistrés ou chargés.
+
+
+ Il n'existe qu'un seul répertoire de plugin (pour des raisons de performances).
+ Pour installer un plugin, copiez-le simplement dans le répertoire et Smarty
+ l'utilisera automatiquement.
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/plugins/plugins-inserts.xml b/docs/fr/programmers/plugins/plugins-inserts.xml
new file mode 100644
index 00000000..e536a559
--- /dev/null
+++ b/docs/fr/programmers/plugins/plugins-inserts.xml
@@ -0,0 +1,74 @@
+
+
+ Insertions
+
+ Les plugins d'insertion sont utilisés pour implémenter les fonctions
+ qui sont appelées par les balises
+ insert
+ dans les templates.
+
+
+
+ string smarty_insert_name
+ array $params
+ object &$smarty
+
+
+
+ Le premier paramétre passé a la fonction est une tableau associatif
+ d'attributs. Vous pouvez accéder a ces valeurs soit directement, par exemple
+ $params['start'], soit en utilisant
+ extract($params) pour les importer dans la table
+ des symboles.
+
+
+ La fonction d'insertion est supposée retourner le résultat qui sera
+ substitué a la balise insert dans le template.
+
+
+ plugin d'insertion
+
+<?php
+/*
+ * Smarty plugin
+ * -------------------------------------------------------------
+ * Fichier : insert.time.php
+ * Type : temps
+ * Nom : time
+ * Rôle : Insert la date/heure courante conformément
+ * au format
+ * -------------------------------------------------------------
+ */
+function smarty_insert_time($params, &$smarty)
+{
+ if (empty($params['format'])) {
+ $smarty->trigger_error("insert time: missing 'format' parameter");
+ return;
+ }
+
+ $datetime = strftime($params['format']);
+ return $datetime;
+}
+?>
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/plugins/plugins-modifiers.xml b/docs/fr/programmers/plugins/plugins-modifiers.xml
new file mode 100644
index 00000000..6ca59ba0
--- /dev/null
+++ b/docs/fr/programmers/plugins/plugins-modifiers.xml
@@ -0,0 +1,108 @@
+
+
+ Modificateurs
+
+ Les modificateurs sont des petites fonctions appliquées a une variable
+ de template avant qu'elle ne soit affichée ou utilisée dans un autre contexte.
+ Les modificateurs peuvent être chaenés entre eux.
+
+
+
+ mixed smarty_modifier_name
+ mixed $value
+ [mixed $param1, ...]
+
+
+
+ Le premier paramétre passé au modificateur est la valeur
+ sur laquelle le modificateur est supposé opérer. Les autres paramétres
+ peuvent être optionnels, dépendant de quel genre d'opération doit être
+ effectué.
+
+
+ Le modificateur doit retourner le résultat de son exécution.
+
+
+ Regardez aussi
+ register_modifier(),
+ unregister_modifier().
+
+
+ plugin modificateur simple
+
+ Ce plugin est un alias d'une fonction PHP. Il n'a aucun paramétre
+ supplémentaires.
+
+
+<?php
+/*
+ * Smarty plugin
+ * -------------------------------------------------------------
+ * Fichier : modifier.capitalize.php
+ * Type : modificateur
+ * Name : capitalize
+ * Rôle : met une majuscule aux mots d'une phrase
+ * -------------------------------------------------------------
+ */
+function smarty_modifier_capitalize($string)
+{
+ return ucwords($string);
+}
+?>
+
+
+
+ un plugin modificateur un peu plus complexe
+
+<?php
+/*
+ * Smarty plugin
+ * -------------------------------------------------------------
+ * Fichier : modifier.truncate.php
+ * Type : modificateur
+ * Name : truncate
+ * Rôle : Tronque une chaene a une certaine longueur si
+ * nécessaire, la coupe optionnellement au milieu
+ * d'un mot et ajoute la chaene $etc
+ * -------------------------------------------------------------
+ */
+function smarty_modifier_truncate($string, $length = 80, $etc = '...',
+ $break_words = false)
+{
+ if ($length == 0)
+ return '';
+
+ if (strlen($string) > $length) {
+ $length -= strlen($etc);
+ $fragment = substr($string, 0, $length+1);
+ if ($break_words)
+ $fragment = substr($fragment, 0, -1);
+ else
+ $fragment = preg_replace('/\s+(\S+)?$/', '', $fragment);
+ return $fragment.$etc;
+ } else
+ return $string;
+}
+?>
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/plugins/plugins-naming-conventions.xml b/docs/fr/programmers/plugins/plugins-naming-conventions.xml
new file mode 100644
index 00000000..e1375abf
--- /dev/null
+++ b/docs/fr/programmers/plugins/plugins-naming-conventions.xml
@@ -0,0 +1,80 @@
+
+
+
+ Conventions de nommage
+
+ Les fichiers et les fonctions de plugins doivent suivre une convention
+ de nommage trés spécifique pour être localisés par Smarty.
+
+
+ Les fichiers de plugins doivent être nommés de la faton suivante :
+
+
+
+ type.nom.php
+
+
+
+
+
+ Oú type est l'une des valeurs suivantes :
+
+ function
+ modifier
+ block
+ compiler
+ prefilter
+ postfilter
+ outputfilter
+ resource
+ insert
+
+
+
+ Et nom doit être un identifiant valide (lettres, nombres
+ et underscore seulement).
+
+
+ Quelques exemples : function.html_select_date.php,
+ resource.db.php,
+ modifier.spacify.php.
+
+
+ Les fonctions de plugins dans les fichiers de plugins doivent être
+ nommées de la faton suivante :
+
+
+ smarty_type_nom
+
+
+
+
+ Les significations de type et de nom sont les mêmes
+ que précédemment.
+
+
+ Smarty donnera des messages d'erreur approprié si le fichier de plugin
+ n'est pas trouvé, ou si le fichier ou la fonction de plugin ne sont
+ pas nommés correctement.
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/plugins/plugins-outputfilters.xml b/docs/fr/programmers/plugins/plugins-outputfilters.xml
new file mode 100644
index 00000000..d4f903ba
--- /dev/null
+++ b/docs/fr/programmers/plugins/plugins-outputfilters.xml
@@ -0,0 +1,62 @@
+
+
+ Filtres de sortie
+
+ Les plugins de filtres de sortie opérent sur la sortie du template,
+ aprés que le template a été chargé et exécuté, mais avant que
+ la sortie ne soit affichée.
+
+
+
+ string smarty_outputfilter_name
+ string $template_output
+ object &$smarty
+
+
+
+ Le premier paramétre passé a la fonction du filtre de sortie est la
+ sortie du template qui doit être modifiée et le second paramétre
+ est l'instance de Smarty appelant le plugin. Le plugin est supposé
+ faire un traitement et en retourner le résultat.
+
+
+ plugin de filtre de sortie
+
+/*
+ * Smarty plugin
+ * -------------------------------------------------------------
+ * Fichier : outputfilter.protect_email.php
+ * Type : filtre de sortie
+ * Nom : protect_email
+ * Rôle: Convertie les @ en %40 pour protéger des
+ * robots spammers.
+ * -------------------------------------------------------------
+ */
+ function smarty_outputfilter_protect_email($output, &$smarty)
+ {
+ return preg_replace('!(\S+)@([a-zA-Z0-9\.\-]+\.([a-zA-Z]{2,3}|[0-9]{1,3}))!',
+ '$1%40$2', $output);
+ }
+
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/plugins/plugins-prefilters-postfilters.xml b/docs/fr/programmers/plugins/plugins-prefilters-postfilters.xml
new file mode 100644
index 00000000..ef1b2702
--- /dev/null
+++ b/docs/fr/programmers/plugins/plugins-prefilters-postfilters.xml
@@ -0,0 +1,101 @@
+
+
+
+ filtres de pré-compilation/filtres de post-compilation
+
+ Les filtres de pré-compilation et les filtres de post-compilation ont des concepts trés
+ proches. Ils différent dans leur exécution, plus précisément dans le
+ moment oú ils sont exécutés.
+
+
+
+ string smarty_prefilter_name
+ string $source
+ object &$smarty
+
+
+
+ Les filtres de pré-compilation sont utilisés pour transformer la source d'un template
+ juste avant la compilation. Le premier paramétre passé a la fonction
+ de filtre de pré-compilation est la source du template, éventuellement modifiée par
+ d'autres filtre de pré-compilations. Le plugin est supposé retourner la source modifiée.
+ Notez que cette source n'est sauvegardée nulle part, elle est seulement
+ utilisé pour la compilation.
+
+
+
+ string smarty_postfilter_name
+ string $compiled
+ object &$smarty
+
+
+
+ Les filtres de post-compilation sont utilisés pour modifier la sortie du template
+ (le code PHP) juste aprés que la compilation a été faite mais juste
+ avant que le template ne soit sauvegardé sur le systéme de fichiers.
+ Le premier paramétre passé a la fonction de filtre de post-compilation est le code
+ du template compilé, éventuellement déja modifié par d'autres filtre de post-compilations.
+ Le plugin est censé retourner la version modifié du code.
+
+
+ plugin de filtre de post-compilation
+
+<?php
+/*
+ * Smarty plugin
+ * -------------------------------------------------------------
+ * Fichier : prefilter.pre01.php
+ * Type : filtre de pré-compilation
+ * Nom : pre01
+ * Rôle : Passe les balises HTML en minuscules.
+ * -------------------------------------------------------------
+ */
+ function smarty_prefilter_pre01($source, &$smarty)
+ {
+ return preg_replace('!<(\w+)[^>]+>!e', 'strtolower("$1")', $source);
+ }
+?>
+
+
+
+ plugin de filtre de post-compilation
+
+<?php
+/*
+ * Smarty plugin
+ * -------------------------------------------------------------
+ * Fichier : postfilter.post01.php
+ * Type: filtre de post-compilation
+ * Nom : post01
+ * Rôle : Renvoie du code qui liste toutes les variables
+ * du template.
+ * -------------------------------------------------------------
+ */
+ function smarty_postfilter_post01($compiled, &$smarty)
+ {
+ $compiled = "<pre>\n<?php print_r(\$this->get_template_vars()); ?>\n</pre>" . $compiled;
+ return $compiled;
+ }
+?>
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/plugins/plugins-resources.xml b/docs/fr/programmers/plugins/plugins-resources.xml
new file mode 100644
index 00000000..0f9569b0
--- /dev/null
+++ b/docs/fr/programmers/plugins/plugins-resources.xml
@@ -0,0 +1,154 @@
+
+
+ Ressources
+
+ Les plugins ressources sont un moyen générique de fournir des sources
+ de templates ou des composants de scripts PHP a Smarty. Quelques exemples
+ de ressources : bases de données, LDAP, mémoire partagée, sockets, et ainsi
+ de suite.
+
+
+ Il y au total 4 fonctions qui ont besoin d'être enregistrées pour
+ chaque type de ressource. Chaque fonction retoit le nom de la ressource demandée
+ comme premier paramétre et l'objet Smarty comme dernier paramétre.
+ Les autres paramétres dépendent de la fonction.
+
+
+
+ bool smarty_resource_name_source
+ string $rsrc_name
+ string &$source
+ object &$smarty
+
+
+ bool smarty_resource_name_timestamp
+ string $rsrc_name
+ int &$timestamp
+ object &$smarty
+
+
+ bool smarty_resource_name_secure
+ string $rsrc_name
+ object &$smarty
+
+
+ bool smarty_resource_name_trusted
+ string $rsrc_name
+ object &$smarty
+
+
+
+
+ La premiére fonction est supposée récupérer la ressource. Son second
+ paramétre est une variable passée par référence oú le résultat doit être
+ stocké. La fonction est supposée retourner true si
+ elle réussi a récupérer la ressource et false sinon.
+
+
+
+ La seconde fonction est supposée récupérer la date de derniére modification
+ de la ressource demandée (comme un timestamp UNIX). Le second paramétre
+ est une variable passée par référence dans laquelle la date doit
+ être stockée. La fonction est supposée renvoyer true si elle
+ a réussi a récupérer la date et false sinon.
+
+
+
+ La troisiéme fonction est supposée retourner true
+ ou false selon si la ressource demandée est svre
+ ou non. La fonction est utilisée seulement pour les ressources templates
+ mais doit tout de même être définie.
+
+
+
+ La quatriéme fonction est supposée retourner true
+ ou false selon si on peut faire confiance ou
+ non a la ressource demandée. Cette fonction est utilisée seulement
+ pour les composants de scripts PHP demandés par les balises
+ include_php ou insert
+ ayant un attribut src. Quoiqu'il en soit,
+ elle doit être définie pour les ressources templates.
+
+
+
+ Regardez aussi
+ register_resource(),
+ unregister_resource().
+
+
+ resource plugin
+
+<?php
+/*
+ * Smarty plugin
+ * -------------------------------------------------------------
+ * Fichier : resource.db.php
+ * Type : ressource
+ * Nom : db
+ * Rôle : Récupére des templates depuis une base de données
+ * -------------------------------------------------------------
+ */
+function smarty_resource_db_source($tpl_name, &$tpl_source, &$smarty)
+{
+ // fait des requêtes BD pour récupérer votre template
+ // et remplir $tpl_source
+ $sql = new SQL;
+ $sql->query("select tpl_source
+ from my_table
+ where tpl_name='$tpl_name'");
+ if ($sql->num_rows) {
+ $tpl_source = $sql->record['tpl_source'];
+ return true;
+ } else {
+ return false;
+ }
+}
+
+function smarty_resource_db_timestamp($tpl_name, &$tpl_timestamp, &$smarty)
+{
+ // fait des requêtes BD pour remplir $tpl_timestamp
+ $sql = new SQL;
+ $sql->query("select tpl_timestamp
+ from my_table
+ where tpl_name='$tpl_name'");
+ if ($sql->num_rows) {
+ $tpl_timestamp = $sql->record['tpl_timestamp'];
+ return true;
+ } else {
+ return false;
+ }
+}
+
+function smarty_resource_db_secure($tpl_name, &$smarty)
+{
+ // suppose que tous les templates sont svrs
+ return true;
+}
+
+function smarty_resource_db_trusted($tpl_name, &$smarty)
+{
+ // inutilisée pour les templates
+}
+?>
+
+
+
\ No newline at end of file
diff --git a/docs/fr/programmers/plugins/plugins-writing.xml b/docs/fr/programmers/plugins/plugins-writing.xml
new file mode 100644
index 00000000..22d328db
--- /dev/null
+++ b/docs/fr/programmers/plugins/plugins-writing.xml
@@ -0,0 +1,48 @@
+
+
+
+ Ecrire des plugins
+
+ Les plugins peuvent être soit chargés automatiquement par Smarty
+ depuis le systéme de fichier, soit être déclarés
+ pendant l'exécution via une fonction register_* de l'API. Ils peuvent
+ aussi être désalloués en utilisant une fonction unregister_* de
+ l'API.
+
+
+ Pour les plugins qui ne sont pas enregistrés pendant l'exécution, le nom
+ des fonctions n'ont pas a suivre la convention de nommage.
+
+
+ Si certaines fonctionnalités d'un plugin dépendent d'un autre plugin
+ (comme c'est le cas de certains plugins accompagnant Smarty), alors la maniére appropriée
+ de charger le plugin est la suivante :
+
+
+
+require_once SMARTY_DIR . 'plugins/function.html_options.php';
+
+ Une régle générale est que chaque objet Smarty est toujours passé au plugin
+ en tant que dernier paramétre (a part pour les modificateurs).
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/advanced-features.xml b/docs/pt_BR/programmers/advanced-features.xml
index e65a732f..28cec01a 100644
--- a/docs/pt_BR/programmers/advanced-features.xml
+++ b/docs/pt_BR/programmers/advanced-features.xml
@@ -2,527 +2,16 @@
Advanced Features
-
- Objetos
-
- O Smarty permite acesso a objetos do PHP através de seus templates. Há duas formas de acessá-los.
- Uma forma é registrar objetos para o template, então os acessa via sintaxe similar a funções
- customizáveis. A outra forma é atribuir objetos para os templates e acessá-los como se fossem
- uma variável atribuída. O primeiro método tem uma sintaxe de template muito mais legal. E também
- mais segura, à medida que um objeto registrado pode ser restrito a certos métodos e
- propriedades. Entretanto, um objeto registrado não pode ser
- posto em loop ou ser atribuido em arrays de
- objetos, etc. O método que você escolher será determinado pelas suas necessidades, mas use o
- primeiro método se possível para
- manter um mínimo de sintaxe no template.
-
-
- Se a segurança está habilitada, nenhum dos métodos privados ou funções podem acessados
- (começando com "_"). Se um método e propriedade de um mesmo nome existir, o método será
- usado.
-
-
- Você pode restringir os métodos e propriedades que podem ser acessados listando os em um array
- como o terceiro parâmetro de registração.
-
-
- Por definição, parâmetros passados para objetos através dos templates são passados da mesma
- forma que funções customizáveis os obtém. Um array associativo é passado como o primeiro parâmetro,
- e o objeto smarty como o segundo. Se você quer que os parâmetros passados um de cada vez
- por cada argumento como passagem de parâmetro de objeto tradicional, defina o quarto parâmetro
- de registração para falso.
-
-
- O quinto parâmetro opcional só tem efeito com format
- sendo true e contém
- uma lista de métods de ob que seriam tratados como
- blocos. Isso significa que estes métodos
- tem uma tag de fechamento no template
- ({foobar->meth2}...{/foobar->meth2}) e
- os parâmetros para os métodos tem a mesma sinopse como os parâmetros para
- block-function-plugins: Eles pegam 4 parâmetros
- $params,
- $content,
- &$smarty e
- &$repeat e eles também comportam-se como
- block-function-plugins.
-
-
- usando um objeto registrado ou atribuído
-
-<?php
-// O objeto
+&programmers.advanced-features.advanced-features-objects;
+&programmers.advanced-features.advanced-features-prefilters;
-class My_Object {
- function meth1($params, &$smarty_obj) {
- return "this is my meth1";
- }
-}
+&programmers.advanced-features.advanced-features-postfilters;
-$myobj = new My_Object;
-// registrando o objeto (será por referência)
-$smarty->register_object("foobar",$myobj);
-// Se você quer restringie acesso a certos métodos ou propriedades, liste-os
-$smarty->register_object("foobar",$myobj,array('meth1','meth2','prop1'));
-// Se você quer usar o formato de parâmetro de objeto tradicional, passe um booleano de false
-$smarty->register_object("foobar",$myobj,null,false);
+&programmers.advanced-features.advanced-features-outputfilters;
-// Você pode também atribuir objetos. Atribua por referência quando possível.
-$smarty->assign_by_ref("myobj", $myobj);
+&programmers.advanced-features.section-template-cache-handler-func;
-$smarty->display("index.tpl");
-?>
-
-TEMPLATE:
-
-{* accessa nosso objeto registrado *}
-{foobar->meth1 p1="foo" p2=$bar}
-
-{* você pode também atribuir a saída *}
-{foobar->meth1 p1="foo" p2=$bar assign="output"}
-the output was {$output}
-
-{* acessa nosso objeto atribuído *}
-{$myobj->meth1("foo",$bar)}
-
-
-
- Prefilters
-
- Os prefilters de Template são funções de PHP nas quais seus templates são rodados
- antes de serem compilados. Isto é bom para preprocessamento de seus templates para remover
- comentários indesejados, mantendo o olho no que as pessoas estão colocando nos seus templates,
- etc. Prefilters podem ser ou registrado
- ou carregado do diretório de plugins usando a função
- load_filter()
- ou pela configuração da variável
- $autoload_filters.
- O Smarty passará o código fonte do template como o
- primeiro argumeto, e espera a função retornar
- o código fonte do template resultante.
-
-
- Usando um prefilter de template
-
-<?php
-// Ponha isto em sua aplicação
-function remove_dw_comments($tpl_source, &$smarty)
-{
- return preg_replace("/<!--#.*-->/U","",$tpl_source);
-}
-
-// registrar o prefilter
-$smarty->register_prefilter("remove_dw_comments");
-$smarty->display("index.tpl");
-?>
-
-{* Smarty template index.tpl *}
-<!--# esta linha será removida pelo prefilter -->
-
-
-
-
- Postfilters
-
- Os postfilters de template são funções de PHP nas quais seus templates são rodados
- imediatamente depois de serem compilados. Os postfilters podem ser ou
- registradocarrgados do diretório de
- plugins usando a função
- load_filter() ou pela
- variável de configuração
- $autoload_filters.
- O Smarty passará o código fonte do template compilado
- como o primeiro argumento, e espera
- a função retornar o resultado do processamento.
-
-
- usando um postfilter de template
-
-<?php
-// ponha isto em sua aplicação
-function add_header_comment($tpl_source, &$smarty)
-{
- return "<?php echo \"<!-- Created by Smarty! -->\n\" ?>\n".$tpl_source;
-}
-
-// registra o postfilter
-$smarty->register_postfilter("add_header_comment");
-$smarty->display("index.tpl");
-?>
-
-{* compiled Smarty template index.tpl *}
-<!-- Created by Smarty! -->
-{* rest of template content... *}
-
-
-
-
- Output Filters (Filtros de Saída)
-
- Quando o template é invocado via display() ou fetch(), sua saída pode ser enviada
- através de um ou mais filtros de saída. Estes diferem dos postfilters porque postfilters
- operam em templates compilados antes de serem salvos para o disco, e os filtros de saída
- operam na saída do template quando
- ele é executado.
-
-
-
- Filtros de Saída podem ser ou
- registrado ou carregado
- do diretório de plugins usando a função
- load_filter() ou configurando a variável
- $autoload_filters.
- O Smarty passará a saída como o primeiro argumento,
- e espera a função retornar o resultado
- do processamento.
-
-
- usando um filtro de saída de template
-
-<?php
-// ponha isto em sua aplicação
-function protect_email($tpl_output, &$smarty)
-{
- $tpl_output =
- preg_replace('!(\S+)@([a-zA-Z0-9\.\-]+\.([a-zA-Z]{2,3}|[0-9]{1,3}))!',
- '$1%40$2', $tpl_output);
- return $tpl_output;
-}
-
-// registra o outputfilter
-$smarty->register_outputfilter("protect_email");
-$smarty->display("index.tpl");
-
-// agora qualquer ocorrência de um endereço de email na saída do template terá uma
-// simples proteção contra spambots
-?>
-
-
-
-
- Função Manipuladora de Cache
-
- Como uma alternativa ao uso do mecanismo de caching padrão baseado em arquivo, você pode
- especificar uma função de manipulação de cache customizada que será usada para ler, escrever
- e limpar arquivos de cache.
-
-
- Crie uma função em sua aplicação que o Smarty usará como um manipulador de cache. Defina o
- nome dela na variável de classe
- $cache_handler_func.
- O Smarty agora usará esta para manipular dados no cache. O primeiro argumento é a ação,
- que é um desses 'read', 'write' e 'clear'. O segundo parâmetro é o objeto do Smarty. O
- terceiro parâmetro é o conteúdo que está no cache.
- No write, o Smarty passa o conteúdo em
- cache nestes parâmetros. No 'read', o Smarty espera sua função aceitar este parâmetro por
- referência e preenche ele com os dados em cache. No 'clear', passa uma variável simulacra aqui
- visto que ela não é usada. O quarto parâmetro
- é o nome do arquivo de template (necessário para
- ler/escrever), o quinto parâmetro é a cache_id (opcional),
- e o sexto é a compile_id (opcional).
-
-
- Note que: O último parâmetro ($exp_time)foi adicionado no Smarty-2.6.0.
-
-
- exemplo usando MySQL como uma fonte de cache
-
-<?php
-/*
-
-exemplo de uso:
-
-include('Smarty.class.php');
-include('mysql_cache_handler.php');
-
-$smarty = new Smarty;
-$smarty->cache_handler_func = 'mysql_cache_handler';
-
-$smarty->display('index.tpl');
-
-
-mysql database is expected in this format:
-
-create database SMARTY_CACHE;
-
-create table CACHE_PAGES(
-CacheID char(32) PRIMARY KEY,
-CacheContents MEDIUMTEXT NOT NULL
-);
-
-*/
-
-function mysql_cache_handler($action, &$smarty_obj, &$cache_content, $tpl_file=null, $cache_id=null, $compile_id=null, $exp_time=null)
-{
- // set db host, user and pass here
- $db_host = 'localhost';
- $db_user = 'myuser';
- $db_pass = 'mypass';
- $db_name = 'SMARTY_CACHE';
- $use_gzip = false;
-
- // cria um cache id unico
- $CacheID = md5($tpl_file.$cache_id.$compile_id);
-
- if(! $link = mysql_pconnect($db_host, $db_user, $db_pass)) {
- $smarty_obj->_trigger_error_msg("cache_handler: could not connect to database");
- return false;
- }
- mysql_select_db($db_name);
-
- switch ($action) {
- case 'read':
- // save cache to database
- $results = mysql_query("select CacheContents from CACHE_PAGES where CacheID='$CacheID'");
- if(!$results) {
- $smarty_obj->_trigger_error_msg("cache_handler: query failed.");
- }
- $row = mysql_fetch_array($results,MYSQL_ASSOC);
-
- if($use_gzip && function_exists("gzuncompress")) {
- $cache_contents = gzuncompress($row["CacheContents"]);
- } else {
- $cache_contents = $row["CacheContents"];
- }
- $return = $results;
- break;
- case 'write':
- // save cache to database
-
- if($use_gzip && function_exists("gzcompress")) {
- // compress the contents for storage efficiency
- $contents = gzcompress($cache_content);
- } else {
- $contents = $cache_content;
- }
- $results = mysql_query("replace into CACHE_PAGES values(
- '$CacheID',
- '".addslashes($contents)."')
- ");
- if(!$results) {
- $smarty_obj->_trigger_error_msg("cache_handler: query failed.");
- }
- $return = $results;
- break;
- case 'clear':
- // clear cache info
- if(empty($cache_id) && empty($compile_id) && empty($tpl_file)) {
- // clear them all
- $results = mysql_query("delete from CACHE_PAGES");
- } else {
- $results = mysql_query("delete from CACHE_PAGES where CacheID='$CacheID'");
- }
- if(!$results) {
- $smarty_obj->_trigger_error_msg("cache_handler: query failed.");
- }
- $return = $results;
- break;
- default:
- // error, unknown action
- $smarty_obj->_trigger_error_msg("cache_handler: unknown action \"$action\"");
- $return = false;
- break;
- }
- mysql_close($link);
- return $return;
-
-}
-
-?>
-
-
-
-
- Recursos (Resources)
-
- Os templates podem vir de uma variedade de fontes. Quando você exibe (display) ou
- busca (fetch) um template, ou inclui um template de dentro de outro template, você
- fornece um tipo de recurso, seguido pelo
- caminho e nome do template apropriado. Se um
- recurso não é dado explicitamente o valor de
- $default_resource_type é assumido.
-
-
- Templates partindo do $template_dir
-
- Templates a partir do $template_dir não exigem um recurso de template,
- apesar de você usar o arquivo: resource for consistancy.
- Apenas forneça o caminho para o template que você quer usar em relação ao diretório
- root $template_dir.
-
-
- Usando templates partindo do $template_dir
-
-// from PHP script
-$smarty->display("index.tpl");
-$smarty->display("admin/menu.tpl");
-$smarty->display("file:admin/menu.tpl"); // Igual ao de cima
-
-{* de dentro do template do Smarty *}
-{include file="index.tpl"}
-{include file="file:index.tpl"} {* igual ao de cima *}
-
-
-
- Templates partindo de qualquer diretório
-
- Os Templates de fora do $template_dir exigem o arquivo:
- tipo de recurso do template,
- seguido pelo caminho absoluto e nome do template.
-
-
- usando templates partindo de qualquer diretório
-
-// de dentro do script PHP
-$smarty->display("file:/export/templates/index.tpl");
-$smarty->display("file:/path/to/my/templates/menu.tpl");
-
-{* de dentro do template do Smarty *}
-{include file="file:/usr/local/share/templates/navigation.tpl"}
-
-
-
- Caminhos de arquivos do Windows
-
- Se você está usando uma máquina windows, caminhos de arquivos normalmente incluem uma letra
- do drive (C:) no começo do nome do caminho.
- Esteja certo de usar "file:" no caminho para
- evitar conflitos de nome e obter os resultados desejados.
-
-
- usando templates com caminhos de arquivo do windows
-
-// de dentro do script PHP
-$smarty->display("file:C:/export/templates/index.tpl");
-$smarty->display("file:F:/path/to/my/templates/menu.tpl");
-
-{* de dentro do template do Smarty *}
-{include file="file:D:/usr/local/share/templates/navigation.tpl"}
-
-
-
-
-
- Templates partindo de outras fontes
-
- Você pode resgatar templates usando qualquer fonte possível de você acessar com PHP: banco
- de dados, sockets, LDAP, e assim por diante.
- Você faz isto escrevendo as funções de plugin
- de recurso e registrando elas com o Smarty.
-
-
-
- Veja a seção plugins de recurso
- para mais informação sobre as funções
- que você deve fornecer.
-
-
-
-
- Note que você pode ativar manualmente o recurso de arquivo embutido, mas não pode fornecer um recurso que busca templates a partir do sistema de arquivos de alguma outra forma registrando sob um outro nome de recurso.
- file resource, but you can provide a resource
- that fetches templates from the file system in some other way by
- registering under another resource name.
-
-
-
- usando recursos customizáveis
-
-// no script PHP
-
-// ponha estas funções em algum lugar de sua aplicação
-function db_get_template ($tpl_name, &$tpl_source, &$smarty_obj)
-{
- // faça o banco de dados chamar aqui para buscar o seu template,
- // preenchendo o $tpl_source
- $sql = new SQL;
- $sql->query("select tpl_source
- from my_table
- where tpl_name='$tpl_name'");
- if ($sql->num_rows) {
- $tpl_source = $sql->record['tpl_source'];
- return true;
- } else {
- return false;
- }
-}
-
-function db_get_timestamp($tpl_name, &$tpl_timestamp, &$smarty_obj)
-{
- // faça o banco de dados chamar daqui para preencher a $tpl_timestamp.
- $sql = new SQL;
- $sql->query("select tpl_timestamp
- from my_table
- where tpl_name='$tpl_name'");
- if ($sql->num_rows) {
- $tpl_timestamp = $sql->record['tpl_timestamp'];
- return true;
- } else {
- return false;
- }
-}
-
-function db_get_secure($tpl_name, &$smarty_obj)
-{
- // assume-se que todos os templates são seguros
- return true;
-}
-
-function db_get_trusted($tpl_name, &$smarty_obj)
-{
- // não usado para templates
-}
-
-// registrar o nome de recurso "db"
-$smarty->register_resource("db", array("db_get_template",
- "db_get_timestamp",
- "db_get_secure",
- "db_get_trusted"));
-
-// usando o recurso a partir do script PHP
-$smarty->display("db:index.tpl");
-
-{* usando o recurso de dentro do template do Smarty *}
-{include file="db:/extras/navigation.tpl"}
-
-
-
-
- Função Manipuladora de Template Padrão
-
- Você pode especificar a função que é usada para devolver o conteúdo do template no evento
- em que o template não pode ser devolvido de seu recurso. Um uso disto é para criar templates
- que não existem "on-the-fly"
- (templates cujo conteúdo flutua muito, bastante variável).
-
-
- usando a função manipuladora de template padrão
-
-<?php
-// ponha esta função em algum lugar de sua aplicação
-
-function make_template ($resource_type, $resource_name, &$template_source, &$template_timestamp, &$smarty_obj)
-{
- if( $resource_type == 'file' ) {
- if ( ! is_readable ( $resource_name )) {
- // cria um arquivo de template, retorna o conteúdo.
- $template_source = "This is a new template.";
- $template_timestamp = time();
- $smarty_obj->_write_file($resource_name,$template_source);
- return true;
- }
- } else {
- // não é arquivo
- return false;
- }
-}
-
-// defina a manipuladora padrão
-$smarty->default_template_handler_func = 'make_template';
-?>
-
-
-
+&programmers.advanced-features.template-resources;
+
+ Objetos
+
+ O Smarty permite acesso a objetos do PHP através de seus templates. Há duas formas de acessá-los.
+ Uma forma é registrar objetos para o template, então os acessa via sintaxe similar a funções
+ customizáveis. A outra forma é atribuir objetos para os templates e acessá-los como se fossem
+ uma variável atribuída. O primeiro método tem uma sintaxe de template muito mais legal. E também
+ mais segura, à medida que um objeto registrado pode ser restrito a certos métodos e
+ propriedades. Entretanto, um objeto registrado não pode ser
+ posto em loop ou ser atribuido em arrays de
+ objetos, etc. O método que você escolher será determinado pelas suas necessidades, mas use o
+ primeiro método se possível para
+ manter um mínimo de sintaxe no template.
+
+
+ Se a segurança está habilitada, nenhum dos métodos privados ou funções podem acessados
+ (começando com "_"). Se um método e propriedade de um mesmo nome existir, o método será
+ usado.
+
+
+ Você pode restringir os métodos e propriedades que podem ser acessados listando os em um array
+ como o terceiro parâmetro de registração.
+
+
+ Por definição, parâmetros passados para objetos através dos templates são passados da mesma
+ forma que funções customizáveis os obtém. Um array associativo é passado como o primeiro parâmetro,
+ e o objeto smarty como o segundo. Se você quer que os parâmetros passados um de cada vez
+ por cada argumento como passagem de parâmetro de objeto tradicional, defina o quarto parâmetro
+ de registração para falso.
+
+
+ O quinto parâmetro opcional só tem efeito com format
+ sendo true e contém
+ uma lista de métods de ob que seriam tratados como
+ blocos. Isso significa que estes métodos
+ tem uma tag de fechamento no template
+ ({foobar->meth2}...{/foobar->meth2}) e
+ os parâmetros para os métodos tem a mesma sinopse como os parâmetros para
+ block-function-plugins: Eles pegam 4 parâmetros
+ $params,
+ $content,
+ &$smarty e
+ &$repeat e eles também comportam-se como
+ block-function-plugins.
+
+
+ usando um objeto registrado ou atribuído
+
+<?php
+// O objeto
+
+class My_Object {
+ function meth1($params, &$smarty_obj) {
+ return "this is my meth1";
+ }
+}
+
+$myobj = new My_Object;
+// registrando o objeto (será por referência)
+$smarty->register_object("foobar",$myobj);
+// Se você quer restringie acesso a certos métodos ou propriedades, liste-os
+$smarty->register_object("foobar",$myobj,array('meth1','meth2','prop1'));
+// Se você quer usar o formato de parâmetro de objeto tradicional, passe um booleano de false
+$smarty->register_object("foobar",$myobj,null,false);
+
+// Você pode também atribuir objetos. Atribua por referência quando possível.
+$smarty->assign_by_ref("myobj", $myobj);
+
+$smarty->display("index.tpl");
+?>
+
+TEMPLATE:
+
+{* accessa nosso objeto registrado *}
+{foobar->meth1 p1="foo" p2=$bar}
+
+{* você pode também atribuir a saída *}
+{foobar->meth1 p1="foo" p2=$bar assign="output"}
+the output was {$output}
+
+{* acessa nosso objeto atribuído *}
+{$myobj->meth1("foo",$bar)}
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/advanced-features/advanced-features-outputfilters.xml b/docs/pt_BR/programmers/advanced-features/advanced-features-outputfilters.xml
new file mode 100644
index 00000000..df0273cb
--- /dev/null
+++ b/docs/pt_BR/programmers/advanced-features/advanced-features-outputfilters.xml
@@ -0,0 +1,64 @@
+
+
+
+ Output Filters (Filtros de Saída)
+
+ Quando o template é invocado via display() ou fetch(), sua saída pode ser enviada
+ através de um ou mais filtros de saída. Estes diferem dos postfilters porque postfilters
+ operam em templates compilados antes de serem salvos para o disco, e os filtros de saída
+ operam na saída do template quando
+ ele é executado.
+
+
+
+ Filtros de Saída podem ser ou
+ registrado ou carregado
+ do diretório de plugins usando a função
+ load_filter() ou configurando a variável
+ $autoload_filters.
+ O Smarty passará a saída como o primeiro argumento,
+ e espera a função retornar o resultado
+ do processamento.
+
+
+ usando um filtro de saída de template
+
+<?php
+// ponha isto em sua aplicação
+function protect_email($tpl_output, &$smarty)
+{
+ $tpl_output =
+ preg_replace('!(\S+)@([a-zA-Z0-9\.\-]+\.([a-zA-Z]{2,3}|[0-9]{1,3}))!',
+ '$1%40$2', $tpl_output);
+ return $tpl_output;
+}
+
+// registra o outputfilter
+$smarty->register_outputfilter("protect_email");
+$smarty->display("index.tpl");
+
+// agora qualquer ocorrência de um endereço de email na saída do template terá uma
+// simples proteção contra spambots
+?>
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/advanced-features/advanced-features-postfilters.xml b/docs/pt_BR/programmers/advanced-features/advanced-features-postfilters.xml
new file mode 100644
index 00000000..140f62fe
--- /dev/null
+++ b/docs/pt_BR/programmers/advanced-features/advanced-features-postfilters.xml
@@ -0,0 +1,56 @@
+
+
+
+ Postfilters
+
+ Os postfilters de template são funções de PHP nas quais seus templates são rodados
+ imediatamente depois de serem compilados. Os postfilters podem ser ou
+ registradocarrgados do diretório de
+ plugins usando a função
+ load_filter() ou pela
+ variável de configuração
+ $autoload_filters.
+ O Smarty passará o código fonte do template compilado
+ como o primeiro argumento, e espera
+ a função retornar o resultado do processamento.
+
+
+ usando um postfilter de template
+
+<?php
+// ponha isto em sua aplicação
+function add_header_comment($tpl_source, &$smarty)
+{
+ return "<?php echo \"<!-- Created by Smarty! -->\n\" ?>\n".$tpl_source;
+}
+
+// registra o postfilter
+$smarty->register_postfilter("add_header_comment");
+$smarty->display("index.tpl");
+?>
+
+{* compiled Smarty template index.tpl *}
+<!-- Created by Smarty! -->
+{* rest of template content... *}
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/advanced-features/advanced-features-prefilters.xml b/docs/pt_BR/programmers/advanced-features/advanced-features-prefilters.xml
new file mode 100644
index 00000000..ba4fc7a7
--- /dev/null
+++ b/docs/pt_BR/programmers/advanced-features/advanced-features-prefilters.xml
@@ -0,0 +1,56 @@
+
+
+
+ Prefilters
+
+ Os prefilters de Template são funções de PHP nas quais seus templates são rodados
+ antes de serem compilados. Isto é bom para preprocessamento de seus templates para remover
+ comentários indesejados, mantendo o olho no que as pessoas estão colocando nos seus templates,
+ etc. Prefilters podem ser ou registrado
+ ou carregado do diretório de plugins usando a função
+ load_filter()
+ ou pela configuração da variável
+ $autoload_filters.
+ O Smarty passará o código fonte do template como o
+ primeiro argumeto, e espera a função retornar
+ o código fonte do template resultante.
+
+
+ Usando um prefilter de template
+
+<?php
+// Ponha isto em sua aplicação
+function remove_dw_comments($tpl_source, &$smarty)
+{
+ return preg_replace("/<!--#.*-->/U","",$tpl_source);
+}
+
+// registrar o prefilter
+$smarty->register_prefilter("remove_dw_comments");
+$smarty->display("index.tpl");
+?>
+
+{* Smarty template index.tpl *}
+<!--# esta linha será removida pelo prefilter -->
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/advanced-features/section-template-cache-handler-func.xml b/docs/pt_BR/programmers/advanced-features/section-template-cache-handler-func.xml
new file mode 100644
index 00000000..9c62cfb3
--- /dev/null
+++ b/docs/pt_BR/programmers/advanced-features/section-template-cache-handler-func.xml
@@ -0,0 +1,154 @@
+
+
+
+ Função Manipuladora de Cache
+
+ Como uma alternativa ao uso do mecanismo de caching padrão baseado em arquivo, você pode
+ especificar uma função de manipulação de cache customizada que será usada para ler, escrever
+ e limpar arquivos de cache.
+
+
+ Crie uma função em sua aplicação que o Smarty usará como um manipulador de cache. Defina o
+ nome dela na variável de classe
+ $cache_handler_func.
+ O Smarty agora usará esta para manipular dados no cache. O primeiro argumento é a ação,
+ que é um desses 'read', 'write' e 'clear'. O segundo parâmetro é o objeto do Smarty. O
+ terceiro parâmetro é o conteúdo que está no cache.
+ No write, o Smarty passa o conteúdo em
+ cache nestes parâmetros. No 'read', o Smarty espera sua função aceitar este parâmetro por
+ referência e preenche ele com os dados em cache. No 'clear', passa uma variável simulacra aqui
+ visto que ela não é usada. O quarto parâmetro
+ é o nome do arquivo de template (necessário para
+ ler/escrever), o quinto parâmetro é a cache_id (opcional),
+ e o sexto é a compile_id (opcional).
+
+
+ Note que: O último parâmetro ($exp_time)foi adicionado no Smarty-2.6.0.
+
+
+ exemplo usando MySQL como uma fonte de cache
+
+<?php
+/*
+
+exemplo de uso:
+
+include('Smarty.class.php');
+include('mysql_cache_handler.php');
+
+$smarty = new Smarty;
+$smarty->cache_handler_func = 'mysql_cache_handler';
+
+$smarty->display('index.tpl');
+
+
+mysql database is expected in this format:
+
+create database SMARTY_CACHE;
+
+create table CACHE_PAGES(
+CacheID char(32) PRIMARY KEY,
+CacheContents MEDIUMTEXT NOT NULL
+);
+
+*/
+
+function mysql_cache_handler($action, &$smarty_obj, &$cache_content, $tpl_file=null, $cache_id=null, $compile_id=null, $exp_time=null)
+{
+ // set db host, user and pass here
+ $db_host = 'localhost';
+ $db_user = 'myuser';
+ $db_pass = 'mypass';
+ $db_name = 'SMARTY_CACHE';
+ $use_gzip = false;
+
+ // cria um cache id unico
+ $CacheID = md5($tpl_file.$cache_id.$compile_id);
+
+ if(! $link = mysql_pconnect($db_host, $db_user, $db_pass)) {
+ $smarty_obj->_trigger_error_msg("cache_handler: could not connect to database");
+ return false;
+ }
+ mysql_select_db($db_name);
+
+ switch ($action) {
+ case 'read':
+ // save cache to database
+ $results = mysql_query("select CacheContents from CACHE_PAGES where CacheID='$CacheID'");
+ if(!$results) {
+ $smarty_obj->_trigger_error_msg("cache_handler: query failed.");
+ }
+ $row = mysql_fetch_array($results,MYSQL_ASSOC);
+
+ if($use_gzip && function_exists("gzuncompress")) {
+ $cache_contents = gzuncompress($row["CacheContents"]);
+ } else {
+ $cache_contents = $row["CacheContents"];
+ }
+ $return = $results;
+ break;
+ case 'write':
+ // save cache to database
+
+ if($use_gzip && function_exists("gzcompress")) {
+ // compress the contents for storage efficiency
+ $contents = gzcompress($cache_content);
+ } else {
+ $contents = $cache_content;
+ }
+ $results = mysql_query("replace into CACHE_PAGES values(
+ '$CacheID',
+ '".addslashes($contents)."')
+ ");
+ if(!$results) {
+ $smarty_obj->_trigger_error_msg("cache_handler: query failed.");
+ }
+ $return = $results;
+ break;
+ case 'clear':
+ // clear cache info
+ if(empty($cache_id) && empty($compile_id) && empty($tpl_file)) {
+ // clear them all
+ $results = mysql_query("delete from CACHE_PAGES");
+ } else {
+ $results = mysql_query("delete from CACHE_PAGES where CacheID='$CacheID'");
+ }
+ if(!$results) {
+ $smarty_obj->_trigger_error_msg("cache_handler: query failed.");
+ }
+ $return = $results;
+ break;
+ default:
+ // error, unknown action
+ $smarty_obj->_trigger_error_msg("cache_handler: unknown action \"$action\"");
+ $return = false;
+ break;
+ }
+ mysql_close($link);
+ return $return;
+
+}
+
+?>
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/advanced-features/template-resources.xml b/docs/pt_BR/programmers/advanced-features/template-resources.xml
new file mode 100644
index 00000000..00cfb2c4
--- /dev/null
+++ b/docs/pt_BR/programmers/advanced-features/template-resources.xml
@@ -0,0 +1,213 @@
+
+
+
+ Recursos (Resources)
+
+ Os templates podem vir de uma variedade de fontes. Quando você exibe (display) ou
+ busca (fetch) um template, ou inclui um template de dentro de outro template, você
+ fornece um tipo de recurso, seguido pelo
+ caminho e nome do template apropriado. Se um
+ recurso não é dado explicitamente o valor de
+ $default_resource_type é assumido.
+
+
+ Templates partindo do $template_dir
+
+ Templates a partir do $template_dir não exigem um recurso de template,
+ apesar de você usar o arquivo: resource for consistancy.
+ Apenas forneça o caminho para o template que você quer usar em relação ao diretório
+ root $template_dir.
+
+
+ Usando templates partindo do $template_dir
+
+// from PHP script
+$smarty->display("index.tpl");
+$smarty->display("admin/menu.tpl");
+$smarty->display("file:admin/menu.tpl"); // Igual ao de cima
+
+{* de dentro do template do Smarty *}
+{include file="index.tpl"}
+{include file="file:index.tpl"} {* igual ao de cima *}
+
+
+
+ Templates partindo de qualquer diretório
+
+ Os Templates de fora do $template_dir exigem o arquivo:
+ tipo de recurso do template,
+ seguido pelo caminho absoluto e nome do template.
+
+
+ usando templates partindo de qualquer diretório
+
+// de dentro do script PHP
+$smarty->display("file:/export/templates/index.tpl");
+$smarty->display("file:/path/to/my/templates/menu.tpl");
+
+{* de dentro do template do Smarty *}
+{include file="file:/usr/local/share/templates/navigation.tpl"}
+
+
+
+ Caminhos de arquivos do Windows
+
+ Se você está usando uma máquina windows, caminhos de arquivos normalmente incluem uma letra
+ do drive (C:) no começo do nome do caminho.
+ Esteja certo de usar "file:" no caminho para
+ evitar conflitos de nome e obter os resultados desejados.
+
+
+ usando templates com caminhos de arquivo do windows
+
+// de dentro do script PHP
+$smarty->display("file:C:/export/templates/index.tpl");
+$smarty->display("file:F:/path/to/my/templates/menu.tpl");
+
+{* de dentro do template do Smarty *}
+{include file="file:D:/usr/local/share/templates/navigation.tpl"}
+
+
+
+
+
+ Templates partindo de outras fontes
+
+ Você pode resgatar templates usando qualquer fonte possível de você acessar com PHP: banco
+ de dados, sockets, LDAP, e assim por diante.
+ Você faz isto escrevendo as funções de plugin
+ de recurso e registrando elas com o Smarty.
+
+
+
+ Veja a seção plugins de recurso
+ para mais informação sobre as funções
+ que você deve fornecer.
+
+
+
+
+ Note que você pode ativar manualmente o recurso de arquivo embutido, mas não pode fornecer um recurso que busca templates a partir do sistema de arquivos de alguma outra forma registrando sob um outro nome de recurso.
+ file resource, but you can provide a resource
+ that fetches templates from the file system in some other way by
+ registering under another resource name.
+
+
+
+ usando recursos customizáveis
+
+// no script PHP
+
+// ponha estas funções em algum lugar de sua aplicação
+function db_get_template ($tpl_name, &$tpl_source, &$smarty_obj)
+{
+ // faça o banco de dados chamar aqui para buscar o seu template,
+ // preenchendo o $tpl_source
+ $sql = new SQL;
+ $sql->query("select tpl_source
+ from my_table
+ where tpl_name='$tpl_name'");
+ if ($sql->num_rows) {
+ $tpl_source = $sql->record['tpl_source'];
+ return true;
+ } else {
+ return false;
+ }
+}
+
+function db_get_timestamp($tpl_name, &$tpl_timestamp, &$smarty_obj)
+{
+ // faça o banco de dados chamar daqui para preencher a $tpl_timestamp.
+ $sql = new SQL;
+ $sql->query("select tpl_timestamp
+ from my_table
+ where tpl_name='$tpl_name'");
+ if ($sql->num_rows) {
+ $tpl_timestamp = $sql->record['tpl_timestamp'];
+ return true;
+ } else {
+ return false;
+ }
+}
+
+function db_get_secure($tpl_name, &$smarty_obj)
+{
+ // assume-se que todos os templates são seguros
+ return true;
+}
+
+function db_get_trusted($tpl_name, &$smarty_obj)
+{
+ // não usado para templates
+}
+
+// registrar o nome de recurso "db"
+$smarty->register_resource("db", array("db_get_template",
+ "db_get_timestamp",
+ "db_get_secure",
+ "db_get_trusted"));
+
+// usando o recurso a partir do script PHP
+$smarty->display("db:index.tpl");
+
+{* usando o recurso de dentro do template do Smarty *}
+{include file="db:/extras/navigation.tpl"}
+
+
+
+
+ Função Manipuladora de Template Padrão
+
+ Você pode especificar a função que é usada para devolver o conteúdo do template no evento
+ em que o template não pode ser devolvido de seu recurso. Um uso disto é para criar templates
+ que não existem "on-the-fly"
+ (templates cujo conteúdo flutua muito, bastante variável).
+
+
+ usando a função manipuladora de template padrão
+
+<?php
+// ponha esta função em algum lugar de sua aplicação
+
+function make_template ($resource_type, $resource_name, &$template_source, &$template_timestamp, &$smarty_obj)
+{
+ if( $resource_type == 'file' ) {
+ if ( ! is_readable ( $resource_name )) {
+ // cria um arquivo de template, retorna o conteúdo.
+ $template_source = "This is a new template.";
+ $template_timestamp = time();
+ $smarty_obj->_write_file($resource_name,$template_source);
+ return true;
+ }
+ } else {
+ // não é arquivo
+ return false;
+ }
+}
+
+// defina a manipuladora padrão
+$smarty->default_template_handler_func = 'make_template';
+?>
+
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-functions.xml b/docs/pt_BR/programmers/api-functions.xml
index 822552dd..d701a973 100644
--- a/docs/pt_BR/programmers/api-functions.xml
+++ b/docs/pt_BR/programmers/api-functions.xml
@@ -2,1074 +2,45 @@
Métodos
-
- append
-
-
- void append
- mixed var
-
-
- void append
- string varname
- mixed var
-
-
- void append
- string varname
- mixed var
- boolean merge
-
-
-
- Isso é usado para adicionar um elemento para um array fixado. Se você adicionar
- uma string como valor, isso irá converter-se para um valor de array e então adicioná-lo.
- Você pode explicitamente passar pares nomes/valores, ou arrays associativos
- contendo o par nome/valor. Se você passar o terceiro parâmetro opcional para true,
- o valor unir-se ao array atual
- ao invés de ser adicionado.
-
-
- Notas Técnicas
-
- O parâmetro de união respeita a chave do array, então se você
- mesclar dois índices númericos de um array, eles devem sobrescrever-se
- um ao outro ou em resultados não sequências de chave. Isso é diferente da função de PHP array_merge()
- que apaga as chaves e as renumera.
-
-
-
- append
-
-// passing name/value pairs
-$smarty->append("Name","Fred");
-$smarty->append("Address",$address);
+&programmers.api-functions.api-append;
+&programmers.api-functions.api-append-by-ref;
+&programmers.api-functions.api-assign;
+&programmers.api-functions.api-assign-by-ref;
+&programmers.api-functions.api-clear-all-assign;
+&programmers.api-functions.api-clear-all-cache;
+&programmers.api-functions.api-clear-assign;
+&programmers.api-functions.api-clear-cache;
+&programmers.api-functions.api-clear-compiled-tpl;
+&programmers.api-functions.api-clear-config;
+&programmers.api-functions.api-config-load;
+&programmers.api-functions.api-display;
+&programmers.api-functions.api-fetch;
+&programmers.api-functions.api-get-config-vars;
+&programmers.api-functions.api-get-registered-object;
+&programmers.api-functions.api-get-template-vars;
+&programmers.api-functions.api-is-cached;
+&programmers.api-functions.api-load-filter;
+&programmers.api-functions.api-register-block;
+&programmers.api-functions.api-register-compiler-function;
+&programmers.api-functions.api-register-function;
+&programmers.api-functions.api-register-modifier;
+&programmers.api-functions.api-register-object;
+&programmers.api-functions.api-register-outputfilter;
+&programmers.api-functions.api-register-postfilter;
+&programmers.api-functions.api-register-prefilter;
+&programmers.api-functions.api-register-resource;
+&programmers.api-functions.api-trigger-error;
-// passing an associative array
-$smarty->append(array("city" => "Lincoln","state" => "Nebraska"));
-
-
-
- append_by_ref
-
-
- void append_by_ref
- string varname
- mixed var
-
-
- void append_by_ref
- string varname
- mixed var
- boolean merge
-
-
-
- Isso é usado para adicionar vlaores para o template por referência.
- Se você adicionar uma variável por referência e então alterar este valor
- o valor adicionado enxergará a alteração também. Para objetos,
- append_by_ref() também evita uma cópia em memória do objeto adicionado.
- Veja o manual do PHP em referenciando variáveis para uma melhor explanação sobre o assunto.
- Se você passar o terceiro parâmetro opcional para true,
- o valor irá ser mesclado com o array atual ao invés de adicioná-lo.
-
-
- Notas Técnicas
-
- O parâmetro de união respeita a chave do array, então se você mesclar
- dois índices númericos de arrays, eles devem sobrescrever-se um ao outro ou
- em resultados não sequências de chave. Isso é diferente da função de PHP array_merge()
- que apaga as chaves numéricas e as renumera.
-
-
-
- append_by_ref
-
-// appending name/value pairs
-$smarty->append_by_ref("Name",$myname);
-$smarty->append_by_ref("Address",$address);
-
-
-
- assign
-
-
- void assign
- mixed var
-
-
- void assign
- string varname
- mixed var
-
-
-
- Isso é usado para fixar valores para o template. Você pode
- explicitamente passar pares de nomes/valores, ou um array associativo
- contendo o par de nome/valor.
-
-
- assign
-
-// passing name/value pairs
-$smarty->assign("Name","Fred");
-$smarty->assign("Address",$address);
-
-// passing an associative array
-$smarty->assign(array("city" => "Lincoln","state" => "Nebraska"));
-
-
-
- assign_by_ref
-
-
- void assign_by_ref
- string varname
- mixed var
-
-
-
- Isso é usado para fixar valores para o template por referência ao invés de fazer uma cópia.
- Veja o manual do PHP na parte sobre referência de variáveis para uma explanação mais detalhada.
-
-
- Notas Técnicas
-
- Isso é usado para fixar valores para o template por referência.
- Se você fixar uma variável por referência e então alterar o valor dela,
- o valor fixado enxergará o valor alterado também.
- Para objetos, assign_by_ref() também restringe uma cópia de objetos fixados
- em memória.
- Veja o manual do php em refereciando variáveis para uma melhor explanação.
-
-
-
- assign_by_ref
-
-// passing name/value pairs
-$smarty->assign_by_ref("Name",$myname);
-$smarty->assign_by_ref("Address",$address);
-
-
-
- clear_all_assign
-
-
- void clear_all_assign
-
-
-
-
- Isso limpa o valor de todas as variáveis fixadas.
-
-
-clear_all_assign
-
-// clear all assigned variables
-$smarty->clear_all_assign();
-
-
-
- clear_all_cache
-
-
- void clear_all_cache
- int expire time
-
-
-
- Isso limpa completamente o cache de template. Como um parâmetro
- opcional, você pode fornecer um ano mínimo em segundos
- que o arquivo de cache deve ter antes deles serem apagados.
-
-
-clear_all_cache
-
-// clear the entire cache
-$smarty->clear_all_cache();
-
-
-
- clear_assign
-
-
- void clear_assign
- string var
-
-
-
- Isso limpa o valor de uma variável fixada. Isso
- pode ser um valor simples, ou um array de valores.
-
-
-clear_assign
-
-// clear a single variable
-$smarty->clear_assign("Name");
-
-// clear multiple variables
-$smarty->clear_assign(array("Name","Address","Zip"));
-
-
-
- clear_cache
-
- voidclear_cache
- stringtemplate
- stringcache id
- stringcompile id
- intexpire time
-
-
- Isso limpa o cache de um template específico. Se você tem
- múltiplos caches para este arquivo, você limpa o cache
- específico fornecendo o cache id como o segundo parâmetro.
- Você pode também passar um compile id como um terceiro parâmetro.
- Você pode "agrupar" templates juntos e então eles podem ser removidos
- como um grupo. Veja o caching section para maiores informações. Como um quarto
- parâmetro opcional, você pode fornecer um ano mínimo em segundos
- que o arquivo de cache deve
- ter antes dele ser apagado.
-
-
-clear_cache
-
-// clear the cache for a template
-$smarty->clear_cache("index.tpl");
-
-// clear the cache for a particular cache id in an multiple-cache template
-$smarty->clear_cache("index.tpl","CACHEID");
-
-
-
- clear_compiled_tpl
-
-
- void clear_compiled_tpl
- string tpl_file
-
-
-
- Isso limpa a versão compilada do recurso de template especificado,
- ou todos os arquivos de templates compilados se nenhum for especificado.
- Essa função é para uso avançado somente, não normalmente necessária.
-
-
-clear_compiled_tpl
-
-// clear a specific template resource
-$smarty->clear_compiled_tpl("index.tpl");
-
-// clear entire compile directory
-$smarty->clear_compiled_tpl();
-
-
-
- clear_config
-
- voidclear_config
- stringvar
-
-
-
- Isso limpa todas as variáveis de configuração fixadas. Se um nome de variável
- é fornecido, somente esta variável é apagada.
-
-
-clear_config
-
-// clear all assigned config variables.
-$smarty->clear_config();
-
-// clear one variable
-$smarty->clear_config('foobar');
-
-
-
- config_load
-
- voidconfig_load
- stringfile
- stringsection
-
-
- Isso carrega o arquivo de configuração de dados e fixa-o para o
- template. Isso funciona idêntico a função
- config_load.
-
-
- Notas Técnicas
-
- À partir da Smarty 2.4.0, variáveis de template fixadas são
- mantidas através de fetch() e display(). Variáveis de configuração carregadas
- de config_load() são sempre de escopo global. Arquivos de configuração
- também são compilados para execução rápida, e repeita o force_compile e compile_check parâmetros de configuração.
-
-
-
-config_load
-
-// load config variables and assign them
-$smarty->config_load('my.conf');
-
-// load a section
-$smarty->config_load('my.conf','foobar');
-
-
-
- display
-
- voiddisplay
- stringtemplate
- stringcache_id
- stringcompile_id
-
-
- Isso mostra o template. Fornecendo um válido template resource
- tipo e path. Como um segundo parâmetro opcional, você pode passar
- um cache id. Veja o caching
- section para maiores informações.
-
-
- Como um terceiro parâmetro opcional, você pode passar um compile id.
- Isso está no evento que você quer compilar diferentes versões do
- mesmo template, como ter templates compilados separadamente para diferentes linguagens.
- Outro uso para compile_id é quando você usa mais do que um $template_dir
- mas somente um $compile_dir. Seta um compile_id em separado para cada $template_dir,
- de outra maneira templates com mesmo nome irão sobrescrever-se um ao outro.
- Você pode também setar a variável $compile_id ao invés de
- passar isso para cada chamada
- de display().
-
-
-display
-
-include("Smarty.class.php");
-$smarty = new Smarty;
-$smarty->caching = true;
-
-// only do db calls if cache doesn't exist
-if(!$smarty->is_cached("index.tpl"))
-{
-
- // dummy up some data
- $address = "245 N 50th";
- $db_data = array(
- "City" => "Lincoln",
- "State" => "Nebraska",
- "Zip" = > "68502"
- );
-
- $smarty->assign("Name","Fred");
- $smarty->assign("Address",$address);
- $smarty->assign($db_data);
-
-}
-
-// display the output
-$smarty->display("index.tpl");
-
-
- Use a sintaxe para template resources para
- mostrar arquivos fora do $template_dir directory.
-
-
-Exemplos de recursos da função display
-
-// absolute filepath
-$smarty->display("/usr/local/include/templates/header.tpl");
-
-// absolute filepath (same thing)
-$smarty->display("file:/usr/local/include/templates/header.tpl");
-
-// windows absolute filepath (MUST use "file:" prefix)
-$smarty->display("file:C:/www/pub/templates/header.tpl");
-
-// include from template resource named "db"
-$smarty->display("db:header.tpl");
-
-
-
-
- fetch
-
- stringfetch
- stringtemplate
- stringcache_id
- stringcompile_id
-
-
- Isso retorna a saída do template ao invés de mostrá-lo.
- Fornecendo um tipo ou path válido template resource.
- Como um segundo parâmetro opcional, você pode passar o cache id.
- Veja o caching
- section para maiores informações.
-
-
- Como um terceiro parâmetro opcional, você pode passar um compile id.
- Isso está no evento que você quer compilar diferentes versões do
- mesmo template, como ter templates compilados separadamente para
- diferentes linguagens. Outro uso para compile_id é quando você
- usa mais do que um $template_dir mas somente um $compile_dir. Seta
- um compile_id em separado para cada $template_dir, de outra maneira
- templates com mesmo nome irão sobrescrever-se uns aos outros. Você
- pode também setar a variável $compile_id ao invés
- de passá-la para cada chamada de fetch().
-
-
-fetch
-
-include("Smarty.class.php");
-$smarty = new Smarty;
-
-$smarty->caching = true;
-
-// only do db calls if cache doesn't exist
-if(!$smarty->is_cached("index.tpl"))
-{
-
- // dummy up some data
- $address = "245 N 50th";
- $db_data = array(
- "City" => "Lincoln",
- "State" => "Nebraska",
- "Zip" = > "68502"
- );
-
- $smarty->assign("Name","Fred");
- $smarty->assign("Address",$address);
- $smarty->assign($db_data);
-
-}
-
-// capture the output
-$output = $smarty->fetch("index.tpl");
-
-// do something with $output here
-
-echo $output;
-
-
-
- get_config_vars
-
- arrayget_config_vars
- stringvarname
-
-
- Isso retorna o valor da variável de configuração dada.
- Se nenhum parâmetro é dado, um array de todas as variáveis dos arquivos de configurações é retornado.
-
-
-get_config_vars
-
-// get loaded config template var 'foo'
-$foo = $smarty->get_config_vars('foo');
-
-// get all loaded config template vars
-$config_vars = $smarty->get_config_vars();
-
-// take a look at them
-print_r($config_vars);
-
-
-
- get_registered_object
-
-
- array get_registered_object
- string object_name
-
-
-
- Isso retorna uma referência para um objeto registrado.
- Isso é útil para dentro de uma função customizada quando você
- precisa acessar diretamente um objeto registrado.
-
-
-get_registered_object
-
-function smarty_block_foo($params, &$smarty) {
- if (isset[$params['object']]) {
- // get reference to registered object
- $obj_ref =& $smarty->&get_registered_object($params['object']);
- // use $obj_ref is now a reference to the object
- }
-}
-
-
-
- get_template_vars
-
- arrayget_template_vars
- stringvarname
-
-
- Isso retorna o valor de uma variável fixada. Se nenhum parâmetro
- é dado, um array de todas as variávels fixadas é retornado.
-
-
-get_template_vars
-
-// get assigned template var 'foo'
-$foo = $smarty->get_template_vars('foo');
-
-// get all assigned template vars
-$tpl_vars = $smarty->get_template_vars();
-
-// take a look at them
-print_r($tpl_vars);
-
-
-
- is_cached
-
-
- void is_cached
- string template
- [string cache_id]
-
-
-
- Isso retorna true se há um cache válido para esse template.
- Isso somente funciona se caching está setado para true.
-
-
-is_cached
-
-$smarty->caching = true;
-
-if(!$smarty->is_cached("index.tpl")) {
- // do database calls, assign vars here
-}
-
-$smarty->display("index.tpl");
-
-
- Você pode também passar um cache id como um segundo parâmetro opcional
- no caso você quer múltiplos caches para o template dado.
-
-
-is_cached with multiple-cache template
-
-$smarty->caching = true;
-
-if(!$smarty->is_cached("index.tpl","FrontPage")) {
- // do database calls, assign vars here
-}
-
-$smarty->display("index.tpl","FrontPage");
-
-
-
- load_filter
-
-
- void load_filter
- string type
- string name
-
-
-
- Essa função pode ser usada para carregar um filtro de plugin. O primeiro
- argumento especifica o tipo do filtro para carregar e pode ser um
- dos seguintes: 'pre', 'post', ou 'output'. O segundo argumento
- especifica o nome do filtro de plugin, por exemplo, 'trim'.
-
-
-Carregando filtros de plugins
-
-$smarty->load_filter('pre', 'trim'); // load prefilter named 'trim'
-$smarty->load_filter('pre', 'datefooter'); // load another prefilter named 'datefooter'
-$smarty->load_filter('output', 'compress'); // load output filter named 'compress'
-
-
-
- register_block
-
-
- void register_block
- string name
- mixed impl
- bool cacheable
- array or null cache_attrs
-
-
-
- Use isso para registrar dinamicamente blocos de funções de plugins.
- Passe no bloco de nomes de função, seguido por uma chamada de função PHP
- que implemente isso.
-
-
-
- A chamada de uma função-php impl pode ser (a)
- uma string contendo o nome da função ou (b) um array no formato
- array(&$object, $method) com
- &$object sendo uma referência para um
- objeto e $method sendo uma string
- contendo o nome do método ou (c) um array no formato
- array(&$class, $method) com
- $class sendo um nome de classe e
- $method sendo um
- método desta classe.
-
-
-$cacheable e $cache_attrs podem ser omitidos na maior parte dos casos. Veja Controlando modos de Saída de Cache dos Plugins para obter informações apropriadas.
-
-
-register_block
-
-/* PHP */
-$smarty->register_block("translate", "do_translation");
-
-function do_translation ($params, $content, &$smarty, &$repeat) {
- if (isset($content)) {
- $lang = $params['lang'];
- // do some translation with $content
- return $translation;
- }
-}
-
-{* template *}
-{translate lang="br"}
- Hello, world!
-{/translate}
-
-
-
- register_compiler_function
-
-
- void register_compiler_function
- string name
- mixed impl
- bool cacheable
-
-
-
- Use isso para registrar dinamicamente uma função de plugin compilador.
- Passe no nome da função compilador, seguido pela função
- PHP que implemente isso.
-
-
- A chamada para função-php impl
- pode ser uma string contendo o nome da função ou (b) um array
- no formato array(&$object, $method) com
- &$object sendo uma referência para um
- objeto e $method sendo uma string
- contendo o nome do método ou (c) um array no formato
- array(&$class, $method) com
- $class sendo um nome de classe e
- $method sendo o método
- desta classe.
-
-
- $cacheable pode ser omitido na maioria
- dos casos. Veja Controlando modos de Saída de Cache dos Plugins
- para obter informações apropriadas.
-
-
-
- register_function
-
-
- void register_function
- string name
- mixed impl
- bool cacheable
- array or null cache_attrs
-
-
-
- Use isso para registrar funções de plugins dinamicamente para o template.
- Passe no template o nome da função,
- seguido pelo nome da função PHP que implemente isso.
-
-
- A chamada para função-php impl pode ser (a)
- uma string contendo o nome da função ou (b) um array no formato
- array(&$object, $method) com
- &$object sendo uma referência para um
- objeto e $method sendo uma string
- contendo o nome do método ou (c) um array no formato
- array(&$class, $method) com
- $class sendo um nome de classe e
- $method sendo um método
- desta classe.
-
-
-$cacheable e $cache_attrs podem ser omitidos na maioria dos casos. Veja Controlando modos de Saída Cache dos Plugins para obter informações apropriadas.
-
-
-register_function
-
-$smarty->register_function("date_now", "print_current_date");
-
-function print_current_date ($params) {
- extract($params);
- if(empty($format))
- $format="%b %e, %Y";
- return strftime($format,time());
-}
-
-// agora você pode usar isso no Smarty para mostrar a data atual: {date_now}
-// ou, {date_now format="%Y/%m/%d"} para formatar isso.
-
-
-
- register_modifier
-
-
- void register_modifier
- string name
- mixed impl
-
-
-
- Use isso para modificar dinamicamente plugins registrados.
- Passe no template o nome do modificador, seguido da função PHP
- que implemente isso.
-
-
- A chamada da função-php impl
- pode ser (a) uma strin contendo o nome da função
- ou (b) um array no formato
- array(&$object, $method) com
- &$object sendo uma referência para um
- objeto e $method sendo uma string
- contendo o nome do método ou (c) um array no formato
- array(&$class, $method) com
- $class sendo um nome de classe e
- $method sendo um método desta classe.
-
-
-
-register_modifier
-
-// let's map PHP's stripslashes function to a Smarty modifier.
-
-$smarty->register_modifier("sslash","stripslashes");
-
-// now you can use {$var|sslash} to strip slashes from variables
-
-
-
- register_object
-
-
- void register_object
- string object_name
- object $object
- array allowed methods/properties
- boolean format
- array block methods
-
-
-
- Isso é para registrar um objeto para uso no template. Veja a
- seção de objetos
- do manual para examplos.
-
-
-
- register_outputfilter
-
-
- void register_outputfilter
- mixed function
-
-
-
- Use isso para registrar dinamicamente filtros de saída para operações
- na saída do template antes de mostrá-lo. Veja
- Filtros de Saída de Templates
- para maiores informações de como configurar uma
- função de filtro de saída.
-
-
- A chamada da função-php function pode
- ser (a) uma string contendo um nome de função ou (b) um array no formato
- array(&$object, $method) com
- &$object sendo uma referência para um
- objeto e $method sendo uma string
- contendo o nome do método ou (c) um array no formato
- array(&$class, $method) com
- $class sendo um nome de classe e
- $method sendo um método
- desta classe.
-
-
-
- register_postfilter
-
-
- void register_postfilter
- mixed function
-
-
-
- Use isso para registrar dinamicamente pósfiltros para rodar templates
- após eles terem sido compilados. Veja
- pósfiltros de template para
- maiores informações de como configurar funções de pósfiltragem.
-
-
- A chamada da função-php function pode
- ser (a) uma string contendo um nome de função ou (b) um array no formato
- array(&$object, $method) com
- &$object sendo uma referência para um
- objeto e $method sendo uma string
- contendo o nome do método ou (c) um array no formato
- array(&$class, $method) com
- $class sendo um nome de classe e
- $method sendo um método
- desta classe.
-
-
-
- register_prefilter
-
-
- void register_prefilter
- mixed function
-
-
-
- Use isso para registrar préfiltros dinamicamente para rodar
- templates antes deles serem compilados. Veja template prefilters para
- maiores informações de como configurar uma função de préfiltragem.
-
-
- A chamada da função-php function pode
- ser (a) uma string contendo um nome de função ou (b) um array no formato
- array(&$object, $method) com
- &$object sendo uma referência para um
- objeto e $method sendo uma string
- contendo o nome do método ou (c) um array no formato
- array(&$class, $method) com
- $class sendo um nome de classe e
- $method sendo um método
- desta classe.
-
-
-
- register_resource
-
-
- void register_resource
- string name
- array resource_funcs
-
-
-
- Use isso para registrar dinamicamente um recurso de plugin com a Smarty.
- Passe no nome o recurso e o array de funções
- PHP que implementam isso. Veja
- template resources
- para maiores informações de como configurar uma função para retornar
- templates.
-
-
- Notas Técnicas
-
- Um nome de recurso deve ter ao menos dois caracteres de comprimento.
- Um caracter do nome de recurso irá ser ignorado e usado como parte do
- path do arquivo como, $smarty->display('c:/path/to/index.tpl');
-
-
-
- A função-php-array resource_funcs
- deve ter 4 ou 5 elementos. Com 4 elementos os elementos são
- as functions-callbacks para as respectivas funções "source",
- "timestamp", "secure" e "trusted" de recurso.
- Com 5 elementos o primeiro elemento tem que ser um objeto por referência
- ou um nome de classe do objeto ou uma classe implementando o recurso e os 4
- elementos seguintes tem que ter os nomes de métodos
- implementando "source", "timestamp",
- "secure" e "trusted".
-
-
-register_resource
-
-$smarty->register_resource("db", array("db_get_template",
- "db_get_timestamp",
- "db_get_secure",
- "db_get_trusted"));
-
-
-
- trigger_error
-
-
- void trigger_error
- string error_msg
- [int level]
-
-
-
- Essa função pode ser usada para saída de uma mensagem de erro usando Smarty.
- O parâmetro level pode ser um dos valores usados
- para a função de php trigger_error(), ex.: E_USER_NOTICE,
- E_USER_WARNING, etc. Por padrão é E_USER_WARNING.
-
-
-
-
- template_exists
-
-
- bool template_exists
- string template
-
-
-
- Essa função checa se o template especificado existe. Isso pode
- aceitar um path para o template no filesystem ou um recurso de string
- especificando o template.
-
-
-
- unregister_block
-
-
- void unregister_block
- string name
-
-
-
- Use isso para desregistrar dinamicamente um bloco de funções de plugin.
- Passe no bloco o nome da função.
-
-
-
- unregister_compiler_function
-
-
- void unregister_compiler_function
- string name
-
-
-
- Use essa função para desregistrar uma função de compilador. Passe
- o nome da função de compilador.
-
-
-
- unregister_function
-
-
- void unregister_function
- string name
-
-
-
- Use isso para desregistrar dinamicamente uma função de plugin do template.
- Passe no template o nome da função.
-
-
-unregister_function
-
-// nós não queremos que designers template tenham acesso aos nossos arquivos do sistema
-
-$smarty->unregister_function("fetch");
-
-
-
- unregister_modifier
-
-
- void unregister_modifier
- string name
-
-
-
- Use isso para desregistrar dincamimente um modificador de plugin.
- Passe no template o nome do modificador.
-
-
-unregister_modifier
-
-// nós não queremos que designers de template usem strip tags para os elementos
-
-$smarty->unregister_modifier("strip_tags");
-
-
-
- unregister_object
-
-
- void unregister_object
- string object_name
-
-
-
- Use isso para desregistrar um objeto.
-
-
-
- unregister_outputfilter
-
-
- void unregister_outputfilter
- string function_name
-
-
-
- Use isso para desregistrar dinamicamente um filtro de saída.
-
-
-
- unregister_postfilter
-
-
- void unregister_postfilter
- string function_name
-
-
-
- Use isso para dinamicamente desregistrar um pósfiltro.
-
-
-
- unregister_prefilter
-
-
- void unregister_prefilter
- string function_name
-
-
-
- Use isso para dinamicamente desregistrar um préfiltro.
-
-
-
- unregister_resource
-
-
- void unregister_resource
- string name
-
-
-
- Use isso para dinamicamente desregistrar um recurso de plugin.
- Passe no parâmetro nome o nome do recurso.
-
-
-unregister_resource
-
-$smarty->unregister_resource("db");
-
-
+&programmers.api-functions.api-template-exists;
+&programmers.api-functions.api-unregister-block;
+&programmers.api-functions.api-unregister-compiler-function;
+&programmers.api-functions.api-unregister-function;
+&programmers.api-functions.api-unregister-modifier;
+&programmers.api-functions.api-unregister-object;
+&programmers.api-functions.api-unregister-outputfilter;
+&programmers.api-functions.api-unregister-postfilter;
+&programmers.api-functions.api-unregister-prefilter;
+&programmers.api-functions.api-unregister-resource;
+
+ append_by_ref
+
+
+ void append_by_ref
+ string varname
+ mixed var
+
+
+ void append_by_ref
+ string varname
+ mixed var
+ boolean merge
+
+
+
+ Isso é usado para adicionar vlaores para o template por referência.
+ Se você adicionar uma variável por referência e então alterar este valor
+ o valor adicionado enxergará a alteração também. Para objetos,
+ append_by_ref() também evita uma cópia em memória do objeto adicionado.
+ Veja o manual do PHP em referenciando variáveis para uma melhor explanação sobre o assunto.
+ Se você passar o terceiro parâmetro opcional para true,
+ o valor irá ser mesclado com o array atual ao invés de adicioná-lo.
+
+
+ Notas Técnicas
+
+ O parâmetro de união respeita a chave do array, então se você mesclar
+ dois índices númericos de arrays, eles devem sobrescrever-se um ao outro ou
+ em resultados não sequências de chave. Isso é diferente da função de PHP array_merge()
+ que apaga as chaves numéricas e as renumera.
+
+
+
+ append_by_ref
+
+// appending name/value pairs
+$smarty->append_by_ref("Name",$myname);
+$smarty->append_by_ref("Address",$address);
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-functions/api-append.xml b/docs/pt_BR/programmers/api-functions/api-append.xml
new file mode 100644
index 00000000..707125a1
--- /dev/null
+++ b/docs/pt_BR/programmers/api-functions/api-append.xml
@@ -0,0 +1,69 @@
+
+
+
+ append
+
+
+ void append
+ mixed var
+
+
+ void append
+ string varname
+ mixed var
+
+
+ void append
+ string varname
+ mixed var
+ boolean merge
+
+
+
+ Isso é usado para adicionar um elemento para um array fixado. Se você adicionar
+ uma string como valor, isso irá converter-se para um valor de array e então adicioná-lo.
+ Você pode explicitamente passar pares nomes/valores, ou arrays associativos
+ contendo o par nome/valor. Se você passar o terceiro parâmetro opcional para true,
+ o valor unir-se ao array atual
+ ao invés de ser adicionado.
+
+
+ Notas Técnicas
+
+ O parâmetro de união respeita a chave do array, então se você
+ mesclar dois índices númericos de um array, eles devem sobrescrever-se
+ um ao outro ou em resultados não sequências de chave. Isso é diferente da função de PHP array_merge()
+ que apaga as chaves e as renumera.
+
+
+
+ append
+
+// passing name/value pairs
+$smarty->append("Name","Fred");
+$smarty->append("Address",$address);
+
+// passing an associative array
+$smarty->append(array("city" => "Lincoln","state" => "Nebraska"));
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-functions/api-assign-by-ref.xml b/docs/pt_BR/programmers/api-functions/api-assign-by-ref.xml
new file mode 100644
index 00000000..23df2015
--- /dev/null
+++ b/docs/pt_BR/programmers/api-functions/api-assign-by-ref.xml
@@ -0,0 +1,54 @@
+
+
+
+ assign_by_ref
+
+
+ void assign_by_ref
+ string varname
+ mixed var
+
+
+
+ Isso é usado para fixar valores para o template por referência ao invés de fazer uma cópia.
+ Veja o manual do PHP na parte sobre referência de variáveis para uma explanação mais detalhada.
+
+
+ Notas Técnicas
+
+ Isso é usado para fixar valores para o template por referência.
+ Se você fixar uma variável por referência e então alterar o valor dela,
+ o valor fixado enxergará o valor alterado também.
+ Para objetos, assign_by_ref() também restringe uma cópia de objetos fixados
+ em memória.
+ Veja o manual do php em refereciando variáveis para uma melhor explanação.
+
+
+
+ assign_by_ref
+
+// passing name/value pairs
+$smarty->assign_by_ref("Name",$myname);
+$smarty->assign_by_ref("Address",$address);
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-functions/api-assign.xml b/docs/pt_BR/programmers/api-functions/api-assign.xml
new file mode 100644
index 00000000..7ccd2b7d
--- /dev/null
+++ b/docs/pt_BR/programmers/api-functions/api-assign.xml
@@ -0,0 +1,51 @@
+
+
+
+ assign
+
+
+ void assign
+ mixed var
+
+
+ void assign
+ string varname
+ mixed var
+
+
+
+ Isso é usado para fixar valores para o template. Você pode
+ explicitamente passar pares de nomes/valores, ou um array associativo
+ contendo o par de nome/valor.
+
+
+ assign
+
+// passing name/value pairs
+$smarty->assign("Name","Fred");
+$smarty->assign("Address",$address);
+
+// passing an associative array
+$smarty->assign(array("city" => "Lincoln","state" => "Nebraska"));
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-functions/api-clear-all-assign.xml b/docs/pt_BR/programmers/api-functions/api-clear-all-assign.xml
new file mode 100644
index 00000000..a1f9f7d1
--- /dev/null
+++ b/docs/pt_BR/programmers/api-functions/api-clear-all-assign.xml
@@ -0,0 +1,40 @@
+
+
+
+ clear_all_assign
+
+
+ void clear_all_assign
+
+
+
+
+ Isso limpa o valor de todas as variáveis fixadas.
+
+
+clear_all_assign
+
+// clear all assigned variables
+$smarty->clear_all_assign();
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-functions/api-clear-all-cache.xml b/docs/pt_BR/programmers/api-functions/api-clear-all-cache.xml
new file mode 100644
index 00000000..f041df20
--- /dev/null
+++ b/docs/pt_BR/programmers/api-functions/api-clear-all-cache.xml
@@ -0,0 +1,42 @@
+
+
+
+ clear_all_cache
+
+
+ void clear_all_cache
+ int expire time
+
+
+
+ Isso limpa completamente o cache de template. Como um parâmetro
+ opcional, você pode fornecer um ano mínimo em segundos
+ que o arquivo de cache deve ter antes deles serem apagados.
+
+
+clear_all_cache
+
+// clear the entire cache
+$smarty->clear_all_cache();
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-functions/api-clear-assign.xml b/docs/pt_BR/programmers/api-functions/api-clear-assign.xml
new file mode 100644
index 00000000..f1fb20c2
--- /dev/null
+++ b/docs/pt_BR/programmers/api-functions/api-clear-assign.xml
@@ -0,0 +1,44 @@
+
+
+
+ clear_assign
+
+
+ void clear_assign
+ string var
+
+
+
+ Isso limpa o valor de uma variável fixada. Isso
+ pode ser um valor simples, ou um array de valores.
+
+
+clear_assign
+
+// clear a single variable
+$smarty->clear_assign("Name");
+
+// clear multiple variables
+$smarty->clear_assign(array("Name","Address","Zip"));
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-functions/api-clear-cache.xml b/docs/pt_BR/programmers/api-functions/api-clear-cache.xml
new file mode 100644
index 00000000..76e99525
--- /dev/null
+++ b/docs/pt_BR/programmers/api-functions/api-clear-cache.xml
@@ -0,0 +1,52 @@
+
+
+
+ clear_cache
+
+ voidclear_cache
+ stringtemplate
+ stringcache id
+ stringcompile id
+ intexpire time
+
+
+ Isso limpa o cache de um template específico. Se você tem
+ múltiplos caches para este arquivo, você limpa o cache
+ específico fornecendo o cache id como o segundo parâmetro.
+ Você pode também passar um compile id como um terceiro parâmetro.
+ Você pode "agrupar" templates juntos e então eles podem ser removidos
+ como um grupo. Veja o caching section para maiores informações. Como um quarto
+ parâmetro opcional, você pode fornecer um ano mínimo em segundos
+ que o arquivo de cache deve
+ ter antes dele ser apagado.
+
+
+clear_cache
+
+// clear the cache for a template
+$smarty->clear_cache("index.tpl");
+
+// clear the cache for a particular cache id in an multiple-cache template
+$smarty->clear_cache("index.tpl","CACHEID");
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-functions/api-clear-compiled-tpl.xml b/docs/pt_BR/programmers/api-functions/api-clear-compiled-tpl.xml
new file mode 100644
index 00000000..bb1aeeac
--- /dev/null
+++ b/docs/pt_BR/programmers/api-functions/api-clear-compiled-tpl.xml
@@ -0,0 +1,45 @@
+
+
+
+ clear_compiled_tpl
+
+
+ void clear_compiled_tpl
+ string tpl_file
+
+
+
+ Isso limpa a versão compilada do recurso de template especificado,
+ ou todos os arquivos de templates compilados se nenhum for especificado.
+ Essa função é para uso avançado somente, não normalmente necessária.
+
+
+clear_compiled_tpl
+
+// clear a specific template resource
+$smarty->clear_compiled_tpl("index.tpl");
+
+// clear entire compile directory
+$smarty->clear_compiled_tpl();
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-functions/api-clear-config.xml b/docs/pt_BR/programmers/api-functions/api-clear-config.xml
new file mode 100644
index 00000000..aae1b096
--- /dev/null
+++ b/docs/pt_BR/programmers/api-functions/api-clear-config.xml
@@ -0,0 +1,43 @@
+
+
+
+ clear_config
+
+ voidclear_config
+ stringvar
+
+
+
+ Isso limpa todas as variáveis de configuração fixadas. Se um nome de variável
+ é fornecido, somente esta variável é apagada.
+
+
+clear_config
+
+// clear all assigned config variables.
+$smarty->clear_config();
+
+// clear one variable
+$smarty->clear_config('foobar');
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-functions/api-config-load.xml b/docs/pt_BR/programmers/api-functions/api-config-load.xml
new file mode 100644
index 00000000..b2b5fdc8
--- /dev/null
+++ b/docs/pt_BR/programmers/api-functions/api-config-load.xml
@@ -0,0 +1,56 @@
+
+
+
+ config_load
+
+ voidconfig_load
+ stringfile
+ stringsection
+
+
+ Isso carrega o arquivo de configuração de dados e fixa-o para o
+ template. Isso funciona idêntico a função
+ config_load.
+
+
+ Notas Técnicas
+
+ À partir da Smarty 2.4.0, variáveis de template fixadas são
+ mantidas através de fetch() e display(). Variáveis de configuração carregadas
+ de config_load() são sempre de escopo global. Arquivos de configuração
+ também são compilados para execução rápida, e repeita o force_compile e compile_check parâmetros de configuração.
+
+
+
+config_load
+
+// load config variables and assign them
+$smarty->config_load('my.conf');
+
+// load a section
+$smarty->config_load('my.conf','foobar');
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-functions/api-display.xml b/docs/pt_BR/programmers/api-functions/api-display.xml
new file mode 100644
index 00000000..ecca8ccf
--- /dev/null
+++ b/docs/pt_BR/programmers/api-functions/api-display.xml
@@ -0,0 +1,99 @@
+
+
+
+ display
+
+ voiddisplay
+ stringtemplate
+ stringcache_id
+ stringcompile_id
+
+
+ Isso mostra o template. Fornecendo um válido template resource
+ tipo e path. Como um segundo parâmetro opcional, você pode passar
+ um cache id. Veja o caching
+ section para maiores informações.
+
+
+ Como um terceiro parâmetro opcional, você pode passar um compile id.
+ Isso está no evento que você quer compilar diferentes versões do
+ mesmo template, como ter templates compilados separadamente para diferentes linguagens.
+ Outro uso para compile_id é quando você usa mais do que um $template_dir
+ mas somente um $compile_dir. Seta um compile_id em separado para cada $template_dir,
+ de outra maneira templates com mesmo nome irão sobrescrever-se um ao outro.
+ Você pode também setar a variável $compile_id ao invés de
+ passar isso para cada chamada
+ de display().
+
+
+display
+
+include("Smarty.class.php");
+$smarty = new Smarty;
+$smarty->caching = true;
+
+// only do db calls if cache doesn't exist
+if(!$smarty->is_cached("index.tpl"))
+{
+
+ // dummy up some data
+ $address = "245 N 50th";
+ $db_data = array(
+ "City" => "Lincoln",
+ "State" => "Nebraska",
+ "Zip" = > "68502"
+ );
+
+ $smarty->assign("Name","Fred");
+ $smarty->assign("Address",$address);
+ $smarty->assign($db_data);
+
+}
+
+// display the output
+$smarty->display("index.tpl");
+
+
+ Use a sintaxe para template resources para
+ mostrar arquivos fora do $template_dir directory.
+
+
+Exemplos de recursos da função display
+
+// absolute filepath
+$smarty->display("/usr/local/include/templates/header.tpl");
+
+// absolute filepath (same thing)
+$smarty->display("file:/usr/local/include/templates/header.tpl");
+
+// windows absolute filepath (MUST use "file:" prefix)
+$smarty->display("file:C:/www/pub/templates/header.tpl");
+
+// include from template resource named "db"
+$smarty->display("db:header.tpl");
+
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-functions/api-fetch.xml b/docs/pt_BR/programmers/api-functions/api-fetch.xml
new file mode 100644
index 00000000..6210fb60
--- /dev/null
+++ b/docs/pt_BR/programmers/api-functions/api-fetch.xml
@@ -0,0 +1,84 @@
+
+
+
+ fetch
+
+ stringfetch
+ stringtemplate
+ stringcache_id
+ stringcompile_id
+
+
+ Isso retorna a saída do template ao invés de mostrá-lo.
+ Fornecendo um tipo ou path válido template resource.
+ Como um segundo parâmetro opcional, você pode passar o cache id.
+ Veja o caching
+ section para maiores informações.
+
+
+ Como um terceiro parâmetro opcional, você pode passar um compile id.
+ Isso está no evento que você quer compilar diferentes versões do
+ mesmo template, como ter templates compilados separadamente para
+ diferentes linguagens. Outro uso para compile_id é quando você
+ usa mais do que um $template_dir mas somente um $compile_dir. Seta
+ um compile_id em separado para cada $template_dir, de outra maneira
+ templates com mesmo nome irão sobrescrever-se uns aos outros. Você
+ pode também setar a variável $compile_id ao invés
+ de passá-la para cada chamada de fetch().
+
+
+fetch
+
+include("Smarty.class.php");
+$smarty = new Smarty;
+
+$smarty->caching = true;
+
+// only do db calls if cache doesn't exist
+if(!$smarty->is_cached("index.tpl"))
+{
+
+ // dummy up some data
+ $address = "245 N 50th";
+ $db_data = array(
+ "City" => "Lincoln",
+ "State" => "Nebraska",
+ "Zip" = > "68502"
+ );
+
+ $smarty->assign("Name","Fred");
+ $smarty->assign("Address",$address);
+ $smarty->assign($db_data);
+
+}
+
+// capture the output
+$output = $smarty->fetch("index.tpl");
+
+// do something with $output here
+
+echo $output;
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-functions/api-get-config-vars.xml b/docs/pt_BR/programmers/api-functions/api-get-config-vars.xml
new file mode 100644
index 00000000..d7dee3eb
--- /dev/null
+++ b/docs/pt_BR/programmers/api-functions/api-get-config-vars.xml
@@ -0,0 +1,45 @@
+
+
+
+ get_config_vars
+
+ arrayget_config_vars
+ stringvarname
+
+
+ Isso retorna o valor da variável de configuração dada.
+ Se nenhum parâmetro é dado, um array de todas as variáveis dos arquivos de configurações é retornado.
+
+
+get_config_vars
+
+// get loaded config template var 'foo'
+$foo = $smarty->get_config_vars('foo');
+
+// get all loaded config template vars
+$config_vars = $smarty->get_config_vars();
+
+// take a look at them
+print_r($config_vars);
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-functions/api-get-registered-object.xml b/docs/pt_BR/programmers/api-functions/api-get-registered-object.xml
new file mode 100644
index 00000000..bfc31ae1
--- /dev/null
+++ b/docs/pt_BR/programmers/api-functions/api-get-registered-object.xml
@@ -0,0 +1,47 @@
+
+
+
+ get_registered_object
+
+
+ array get_registered_object
+ string object_name
+
+
+
+ Isso retorna uma referência para um objeto registrado.
+ Isso é útil para dentro de uma função customizada quando você
+ precisa acessar diretamente um objeto registrado.
+
+
+get_registered_object
+
+function smarty_block_foo($params, &$smarty) {
+ if (isset[$params['object']]) {
+ // get reference to registered object
+ $obj_ref =& $smarty->&get_registered_object($params['object']);
+ // use $obj_ref is now a reference to the object
+ }
+}
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-functions/api-get-template-vars.xml b/docs/pt_BR/programmers/api-functions/api-get-template-vars.xml
new file mode 100644
index 00000000..57ebea10
--- /dev/null
+++ b/docs/pt_BR/programmers/api-functions/api-get-template-vars.xml
@@ -0,0 +1,45 @@
+
+
+
+ get_template_vars
+
+ arrayget_template_vars
+ stringvarname
+
+
+ Isso retorna o valor de uma variável fixada. Se nenhum parâmetro
+ é dado, um array de todas as variávels fixadas é retornado.
+
+
+get_template_vars
+
+// get assigned template var 'foo'
+$foo = $smarty->get_template_vars('foo');
+
+// get all assigned template vars
+$tpl_vars = $smarty->get_template_vars();
+
+// take a look at them
+print_r($tpl_vars);
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-functions/api-is-cached.xml b/docs/pt_BR/programmers/api-functions/api-is-cached.xml
new file mode 100644
index 00000000..31aa9606
--- /dev/null
+++ b/docs/pt_BR/programmers/api-functions/api-is-cached.xml
@@ -0,0 +1,63 @@
+
+
+
+ is_cached
+
+
+ void is_cached
+ string template
+ [string cache_id]
+
+
+
+ Isso retorna true se há um cache válido para esse template.
+ Isso somente funciona se caching está setado para true.
+
+
+is_cached
+
+$smarty->caching = true;
+
+if(!$smarty->is_cached("index.tpl")) {
+ // do database calls, assign vars here
+}
+
+$smarty->display("index.tpl");
+
+
+ Você pode também passar um cache id como um segundo parâmetro opcional
+ no caso você quer múltiplos caches para o template dado.
+
+
+is_cached with multiple-cache template
+
+$smarty->caching = true;
+
+if(!$smarty->is_cached("index.tpl","FrontPage")) {
+ // do database calls, assign vars here
+}
+
+$smarty->display("index.tpl","FrontPage");
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-functions/api-load-filter.xml b/docs/pt_BR/programmers/api-functions/api-load-filter.xml
new file mode 100644
index 00000000..5c40f4e0
--- /dev/null
+++ b/docs/pt_BR/programmers/api-functions/api-load-filter.xml
@@ -0,0 +1,45 @@
+
+
+
+ load_filter
+
+
+ void load_filter
+ string type
+ string name
+
+
+
+ Essa função pode ser usada para carregar um filtro de plugin. O primeiro
+ argumento especifica o tipo do filtro para carregar e pode ser um
+ dos seguintes: 'pre', 'post', ou 'output'. O segundo argumento
+ especifica o nome do filtro de plugin, por exemplo, 'trim'.
+
+
+Carregando filtros de plugins
+
+$smarty->load_filter('pre', 'trim'); // load prefilter named 'trim'
+$smarty->load_filter('pre', 'datefooter'); // load another prefilter named 'datefooter'
+$smarty->load_filter('output', 'compress'); // load output filter named 'compress'
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-functions/api-register-block.xml b/docs/pt_BR/programmers/api-functions/api-register-block.xml
new file mode 100644
index 00000000..0d972a2f
--- /dev/null
+++ b/docs/pt_BR/programmers/api-functions/api-register-block.xml
@@ -0,0 +1,74 @@
+
+
+
+ register_block
+
+
+ void register_block
+ string name
+ mixed impl
+ bool cacheable
+ array or null cache_attrs
+
+
+
+ Use isso para registrar dinamicamente blocos de funções de plugins.
+ Passe no bloco de nomes de função, seguido por uma chamada de função PHP
+ que implemente isso.
+
+
+
+ A chamada de uma função-php impl pode ser (a)
+ uma string contendo o nome da função ou (b) um array no formato
+ array(&$object, $method) com
+ &$object sendo uma referência para um
+ objeto e $method sendo uma string
+ contendo o nome do método ou (c) um array no formato
+ array(&$class, $method) com
+ $class sendo um nome de classe e
+ $method sendo um
+ método desta classe.
+
+
+$cacheable e $cache_attrs podem ser omitidos na maior parte dos casos. Veja Controlando modos de Saída de Cache dos Plugins para obter informações apropriadas.
+
+
+register_block
+
+/* PHP */
+$smarty->register_block("translate", "do_translation");
+
+function do_translation ($params, $content, &$smarty, &$repeat) {
+ if (isset($content)) {
+ $lang = $params['lang'];
+ // do some translation with $content
+ return $translation;
+ }
+}
+
+{* template *}
+{translate lang="br"}
+ Hello, world!
+{/translate}
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-functions/api-register-compiler-function.xml b/docs/pt_BR/programmers/api-functions/api-register-compiler-function.xml
new file mode 100644
index 00000000..3a830253
--- /dev/null
+++ b/docs/pt_BR/programmers/api-functions/api-register-compiler-function.xml
@@ -0,0 +1,55 @@
+
+
+
+ register_compiler_function
+
+
+ void register_compiler_function
+ string name
+ mixed impl
+ bool cacheable
+
+
+
+ Use isso para registrar dinamicamente uma função de plugin compilador.
+ Passe no nome da função compilador, seguido pela função
+ PHP que implemente isso.
+
+
+ A chamada para função-php impl
+ pode ser uma string contendo o nome da função ou (b) um array
+ no formato array(&$object, $method) com
+ &$object sendo uma referência para um
+ objeto e $method sendo uma string
+ contendo o nome do método ou (c) um array no formato
+ array(&$class, $method) com
+ $class sendo um nome de classe e
+ $method sendo o método
+ desta classe.
+
+
+ $cacheable pode ser omitido na maioria
+ dos casos. Veja Controlando modos de Saída de Cache dos Plugins
+ para obter informações apropriadas.
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-functions/api-register-function.xml b/docs/pt_BR/programmers/api-functions/api-register-function.xml
new file mode 100644
index 00000000..a7207adc
--- /dev/null
+++ b/docs/pt_BR/programmers/api-functions/api-register-function.xml
@@ -0,0 +1,69 @@
+
+
+
+ register_function
+
+
+ void register_function
+ string name
+ mixed impl
+ bool cacheable
+ array or null cache_attrs
+
+
+
+ Use isso para registrar funções de plugins dinamicamente para o template.
+ Passe no template o nome da função,
+ seguido pelo nome da função PHP que implemente isso.
+
+
+ A chamada para função-php impl pode ser (a)
+ uma string contendo o nome da função ou (b) um array no formato
+ array(&$object, $method) com
+ &$object sendo uma referência para um
+ objeto e $method sendo uma string
+ contendo o nome do método ou (c) um array no formato
+ array(&$class, $method) com
+ $class sendo um nome de classe e
+ $method sendo um método
+ desta classe.
+
+
+$cacheable e $cache_attrs podem ser omitidos na maioria dos casos. Veja Controlando modos de Saída Cache dos Plugins para obter informações apropriadas.
+
+
+register_function
+
+$smarty->register_function("date_now", "print_current_date");
+
+function print_current_date ($params) {
+ extract($params);
+ if(empty($format))
+ $format="%b %e, %Y";
+ return strftime($format,time());
+}
+
+// agora você pode usar isso no Smarty para mostrar a data atual: {date_now}
+// ou, {date_now format="%Y/%m/%d"} para formatar isso.
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-functions/api-register-modifier.xml b/docs/pt_BR/programmers/api-functions/api-register-modifier.xml
new file mode 100644
index 00000000..183757ab
--- /dev/null
+++ b/docs/pt_BR/programmers/api-functions/api-register-modifier.xml
@@ -0,0 +1,59 @@
+
+
+
+ register_modifier
+
+
+ void register_modifier
+ string name
+ mixed impl
+
+
+
+ Use isso para modificar dinamicamente plugins registrados.
+ Passe no template o nome do modificador, seguido da função PHP
+ que implemente isso.
+
+
+ A chamada da função-php impl
+ pode ser (a) uma strin contendo o nome da função
+ ou (b) um array no formato
+ array(&$object, $method) com
+ &$object sendo uma referência para um
+ objeto e $method sendo uma string
+ contendo o nome do método ou (c) um array no formato
+ array(&$class, $method) com
+ $class sendo um nome de classe e
+ $method sendo um método desta classe.
+
+
+
+register_modifier
+
+// let's map PHP's stripslashes function to a Smarty modifier.
+
+$smarty->register_modifier("sslash","stripslashes");
+
+// now you can use {$var|sslash} to strip slashes from variables
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-functions/api-register-object.xml b/docs/pt_BR/programmers/api-functions/api-register-object.xml
new file mode 100644
index 00000000..01c855a8
--- /dev/null
+++ b/docs/pt_BR/programmers/api-functions/api-register-object.xml
@@ -0,0 +1,40 @@
+
+
+
+ register_object
+
+
+ void register_object
+ string object_name
+ object $object
+ array allowed methods/properties
+ boolean format
+ array block methods
+
+
+
+ Isso é para registrar um objeto para uso no template. Veja a
+ seção de objetos
+ do manual para examplos.
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-functions/api-register-outputfilter.xml b/docs/pt_BR/programmers/api-functions/api-register-outputfilter.xml
new file mode 100644
index 00000000..b0eb282b
--- /dev/null
+++ b/docs/pt_BR/programmers/api-functions/api-register-outputfilter.xml
@@ -0,0 +1,50 @@
+
+
+
+ register_outputfilter
+
+
+ void register_outputfilter
+ mixed function
+
+
+
+ Use isso para registrar dinamicamente filtros de saída para operações
+ na saída do template antes de mostrá-lo. Veja
+ Filtros de Saída de Templates
+ para maiores informações de como configurar uma
+ função de filtro de saída.
+
+
+ A chamada da função-php function pode
+ ser (a) uma string contendo um nome de função ou (b) um array no formato
+ array(&$object, $method) com
+ &$object sendo uma referência para um
+ objeto e $method sendo uma string
+ contendo o nome do método ou (c) um array no formato
+ array(&$class, $method) com
+ $class sendo um nome de classe e
+ $method sendo um método
+ desta classe.
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-functions/api-register-postfilter.xml b/docs/pt_BR/programmers/api-functions/api-register-postfilter.xml
new file mode 100644
index 00000000..1fc3de5e
--- /dev/null
+++ b/docs/pt_BR/programmers/api-functions/api-register-postfilter.xml
@@ -0,0 +1,49 @@
+
+
+
+ register_postfilter
+
+
+ void register_postfilter
+ mixed function
+
+
+
+ Use isso para registrar dinamicamente pósfiltros para rodar templates
+ após eles terem sido compilados. Veja
+ pósfiltros de template para
+ maiores informações de como configurar funções de pósfiltragem.
+
+
+ A chamada da função-php function pode
+ ser (a) uma string contendo um nome de função ou (b) um array no formato
+ array(&$object, $method) com
+ &$object sendo uma referência para um
+ objeto e $method sendo uma string
+ contendo o nome do método ou (c) um array no formato
+ array(&$class, $method) com
+ $class sendo um nome de classe e
+ $method sendo um método
+ desta classe.
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-functions/api-register-prefilter.xml b/docs/pt_BR/programmers/api-functions/api-register-prefilter.xml
new file mode 100644
index 00000000..26209c18
--- /dev/null
+++ b/docs/pt_BR/programmers/api-functions/api-register-prefilter.xml
@@ -0,0 +1,49 @@
+
+
+
+ register_prefilter
+
+
+ void register_prefilter
+ mixed function
+
+
+
+ Use isso para registrar préfiltros dinamicamente para rodar
+ templates antes deles serem compilados. Veja template prefilters para
+ maiores informações de como configurar uma função de préfiltragem.
+
+
+ A chamada da função-php function pode
+ ser (a) uma string contendo um nome de função ou (b) um array no formato
+ array(&$object, $method) com
+ &$object sendo uma referência para um
+ objeto e $method sendo uma string
+ contendo o nome do método ou (c) um array no formato
+ array(&$class, $method) com
+ $class sendo um nome de classe e
+ $method sendo um método
+ desta classe.
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-functions/api-register-resource.xml b/docs/pt_BR/programmers/api-functions/api-register-resource.xml
new file mode 100644
index 00000000..a9b38ef2
--- /dev/null
+++ b/docs/pt_BR/programmers/api-functions/api-register-resource.xml
@@ -0,0 +1,67 @@
+
+
+
+ register_resource
+
+
+ void register_resource
+ string name
+ array resource_funcs
+
+
+
+ Use isso para registrar dinamicamente um recurso de plugin com a Smarty.
+ Passe no nome o recurso e o array de funções
+ PHP que implementam isso. Veja
+ template resources
+ para maiores informações de como configurar uma função para retornar
+ templates.
+
+
+ Notas Técnicas
+
+ Um nome de recurso deve ter ao menos dois caracteres de comprimento.
+ Um caracter do nome de recurso irá ser ignorado e usado como parte do
+ path do arquivo como, $smarty->display('c:/path/to/index.tpl');
+
+
+
+ A função-php-array resource_funcs
+ deve ter 4 ou 5 elementos. Com 4 elementos os elementos são
+ as functions-callbacks para as respectivas funções "source",
+ "timestamp", "secure" e "trusted" de recurso.
+ Com 5 elementos o primeiro elemento tem que ser um objeto por referência
+ ou um nome de classe do objeto ou uma classe implementando o recurso e os 4
+ elementos seguintes tem que ter os nomes de métodos
+ implementando "source", "timestamp",
+ "secure" e "trusted".
+
+
+register_resource
+
+$smarty->register_resource("db", array("db_get_template",
+ "db_get_timestamp",
+ "db_get_secure",
+ "db_get_trusted"));
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-functions/api-template-exists.xml b/docs/pt_BR/programmers/api-functions/api-template-exists.xml
new file mode 100644
index 00000000..c255ec3d
--- /dev/null
+++ b/docs/pt_BR/programmers/api-functions/api-template-exists.xml
@@ -0,0 +1,36 @@
+
+
+
+ template_exists
+
+
+ bool template_exists
+ string template
+
+
+
+ Essa função checa se o template especificado existe. Isso pode
+ aceitar um path para o template no filesystem ou um recurso de string
+ especificando o template.
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-functions/api-trigger-error.xml b/docs/pt_BR/programmers/api-functions/api-trigger-error.xml
new file mode 100644
index 00000000..eaeaabd5
--- /dev/null
+++ b/docs/pt_BR/programmers/api-functions/api-trigger-error.xml
@@ -0,0 +1,38 @@
+
+
+
+ trigger_error
+
+
+ void trigger_error
+ string error_msg
+ [int level]
+
+
+
+ Essa função pode ser usada para saída de uma mensagem de erro usando Smarty.
+ O parâmetro level pode ser um dos valores usados
+ para a função de php trigger_error(), ex.: E_USER_NOTICE,
+ E_USER_WARNING, etc. Por padrão é E_USER_WARNING.
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-functions/api-unregister-block.xml b/docs/pt_BR/programmers/api-functions/api-unregister-block.xml
new file mode 100644
index 00000000..7b592b3f
--- /dev/null
+++ b/docs/pt_BR/programmers/api-functions/api-unregister-block.xml
@@ -0,0 +1,35 @@
+
+
+
+ unregister_block
+
+
+ void unregister_block
+ string name
+
+
+
+ Use isso para desregistrar dinamicamente um bloco de funções de plugin.
+ Passe no bloco o nome da função.
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-functions/api-unregister-compiler-function.xml b/docs/pt_BR/programmers/api-functions/api-unregister-compiler-function.xml
new file mode 100644
index 00000000..dacbed67
--- /dev/null
+++ b/docs/pt_BR/programmers/api-functions/api-unregister-compiler-function.xml
@@ -0,0 +1,35 @@
+
+
+
+ unregister_compiler_function
+
+
+ void unregister_compiler_function
+ string name
+
+
+
+ Use essa função para desregistrar uma função de compilador. Passe
+ o nome da função de compilador.
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-functions/api-unregister-function.xml b/docs/pt_BR/programmers/api-functions/api-unregister-function.xml
new file mode 100644
index 00000000..5dfbe0a7
--- /dev/null
+++ b/docs/pt_BR/programmers/api-functions/api-unregister-function.xml
@@ -0,0 +1,42 @@
+
+
+
+ unregister_function
+
+
+ void unregister_function
+ string name
+
+
+
+ Use isso para desregistrar dinamicamente uma função de plugin do template.
+ Passe no template o nome da função.
+
+
+unregister_function
+
+// nós não queremos que designers template tenham acesso aos nossos arquivos do sistema
+
+$smarty->unregister_function("fetch");
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-functions/api-unregister-modifier.xml b/docs/pt_BR/programmers/api-functions/api-unregister-modifier.xml
new file mode 100644
index 00000000..d09f12f7
--- /dev/null
+++ b/docs/pt_BR/programmers/api-functions/api-unregister-modifier.xml
@@ -0,0 +1,42 @@
+
+
+
+ unregister_modifier
+
+
+ void unregister_modifier
+ string name
+
+
+
+ Use isso para desregistrar dincamimente um modificador de plugin.
+ Passe no template o nome do modificador.
+
+
+unregister_modifier
+
+// nós não queremos que designers de template usem strip tags para os elementos
+
+$smarty->unregister_modifier("strip_tags");
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-functions/api-unregister-object.xml b/docs/pt_BR/programmers/api-functions/api-unregister-object.xml
new file mode 100644
index 00000000..9789990e
--- /dev/null
+++ b/docs/pt_BR/programmers/api-functions/api-unregister-object.xml
@@ -0,0 +1,34 @@
+
+
+
+ unregister_object
+
+
+ void unregister_object
+ string object_name
+
+
+
+ Use isso para desregistrar um objeto.
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-functions/api-unregister-outputfilter.xml b/docs/pt_BR/programmers/api-functions/api-unregister-outputfilter.xml
new file mode 100644
index 00000000..7d72f485
--- /dev/null
+++ b/docs/pt_BR/programmers/api-functions/api-unregister-outputfilter.xml
@@ -0,0 +1,34 @@
+
+
+
+ unregister_outputfilter
+
+
+ void unregister_outputfilter
+ string function_name
+
+
+
+ Use isso para desregistrar dinamicamente um filtro de saída.
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-functions/api-unregister-postfilter.xml b/docs/pt_BR/programmers/api-functions/api-unregister-postfilter.xml
new file mode 100644
index 00000000..9077633e
--- /dev/null
+++ b/docs/pt_BR/programmers/api-functions/api-unregister-postfilter.xml
@@ -0,0 +1,34 @@
+
+
+
+ unregister_postfilter
+
+
+ void unregister_postfilter
+ string function_name
+
+
+
+ Use isso para dinamicamente desregistrar um pósfiltro.
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-functions/api-unregister-prefilter.xml b/docs/pt_BR/programmers/api-functions/api-unregister-prefilter.xml
new file mode 100644
index 00000000..f05ce628
--- /dev/null
+++ b/docs/pt_BR/programmers/api-functions/api-unregister-prefilter.xml
@@ -0,0 +1,34 @@
+
+
+
+ unregister_prefilter
+
+
+ void unregister_prefilter
+ string function_name
+
+
+
+ Use isso para dinamicamente desregistrar um préfiltro.
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-functions/api-unregister-resource.xml b/docs/pt_BR/programmers/api-functions/api-unregister-resource.xml
new file mode 100644
index 00000000..e3bf5dc3
--- /dev/null
+++ b/docs/pt_BR/programmers/api-functions/api-unregister-resource.xml
@@ -0,0 +1,40 @@
+
+
+
+ unregister_resource
+
+
+ void unregister_resource
+ string name
+
+
+
+ Use isso para dinamicamente desregistrar um recurso de plugin.
+ Passe no parâmetro nome o nome do recurso.
+
+
+unregister_resource
+
+$smarty->unregister_resource("db");
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-variables.xml b/docs/pt_BR/programmers/api-variables.xml
index b8476ba2..f5dd3b3a 100644
--- a/docs/pt_BR/programmers/api-variables.xml
+++ b/docs/pt_BR/programmers/api-variables.xml
@@ -3,483 +3,42 @@
Variáveis
-
- $template_dir
-
- Este é o nome padrão do diretório de template. Se você não fornecer
- um tipo de recurso quando incluir arquivos, então ele irá ser encontrado aqui.
- Por padrão isso é "./templates", significando que isso irá
- olhar para o diretório de templates no mesmo diretório que está executando
- o script PHP.
-
-
- Notas Técnicas
-
- Não é recomendado colocar este diretório sob um diretório
- document root do seu webserver.
-
-
-
-
- $compile_dir
-
- Esse é o nome do diretório onde os template compilados estão localizados
- Por padrão isso é "./templates_c", significando que isso irá
- olhar para o diretório de templates no mesmo diretório que está executando
- o script PHP.
-
-
- Notas Técnicas
-
- Essa configuração deve ser um path relativo ou um path absoluto.
- include_path não é usado para escrever em arquivos.
-
-
-
- Notas Técnicas
-
- Não é recomendado colocar este diretório sob um diretório
- document root do seu webserver.
-
-
-
-
- $config_dir
-
- Este é o diretório usado para armazenar arquivos de configuração usados nos
- templates. O padrão é "./configs", significando que isso irá
- olhar para o diretório de templates no mesmo diretório que está executando
- o script PHP.
-
-
- Notas Técnicas
-
- Não é recomendado colocar este diretório sob um diretório
- document root do seu webserver.
-
-
-
-
- $plugins_dir
-
- Esse é o diretório onde Smarty irá procurar por plugins que são necessários.
- O Padrão é "plugins" sob o SMARTY_DIR. Se vocêes especificar um
- path relativo, Smarty irá primeiro procurar sob o SMARTY_DIR, então
- relativo para o cwd (current working directory), então relativo para cada
- entrada no seu PHP include path.
-
-
- Notas técnicas
-
- Para uma melhor performance, não configure seu plugins_dir para ter que usar o
- PHP include path. Use um path absoluto, ou um path relativo para
- SMARTY_DIR ou o cwd.
-
-
-
-
- $debugging
-
- Isso habilita o debugging console.
- O console é uma janela de javascript que informa à você
- sobre os arquivos de template incluídos e variáveis
- destinadas para a página de template atual.
-
-
-
- $debug_tpl
-
- Este é o nome do arquivo de template usado para o console de debug.
- Por padrão, é nomeado como debug.tpl e está localizado no SMARTY_DIR.
-
-
-
- $debugging_ctrl
-
- Isso permite caminhos alternativos de habilitar o debug. NONE não significa
- que métodos alternativos são permitidos. URL significa quando a palavra
- SMARTY_DEBUG foi encontrado na QUERY_STRING, que o debug está habilitado
- para a chamada do script.
- Se $debugging é true, esse valor é ignorado.
-
-
-
- $global_assign
-
- Essa é a lista de variáveis que estão sempre implicitamente fixadas
- para o template engine. Isso está acessível para fazer variáveis
- globais ou variáveis do servidor disponíveis para todo o template
- sem ter que fixá-las manualmente. Cada elemento em
- $global_assign deve ser um nome de uma variável global,
- ou um par de chave/valor, onde a chave é o nome do array global
- array e o valor é o array de variáveis fixadas deste array global. $SCRIPT_NAME é
- globalmente fixado por padrão
- para $HTTP_SERVER_VARS.
-
-
- Notas Técnicas
-
- Variáveis de servidor podem ser acessadas através da variável
- $smarty, como {$smarty.server.SCRIPT_NAME}. Veja a seção
- da variável
- $smarty.
-
-
-
-
- $undefined
-
- Isso seta o valor de $undefined para Smarty, o padrão é null.
- Atualmente isso é somente usado para setar variáveis indefinidas em
- $global_assign para o valor padrão.
-
-
-
- $autoload_filters
-
- Se há algum filtro que você deseja carregar em cada chamada de template,
- você pode especificar-lhes usando essa variável e a Smarty irá
- automaticamente carregá-los para você. A variável é um array associativo
- onde as chaves são tipos de filtro e os valores são arrays de nomes de filtros.
- Por exemplo:
-
-
-$smarty->autoload_filters = array('pre' => array('trim', 'stamp'),
- 'output' => array('convert'));
-
-
-
-
-
- $compile_check
-
- Em cima de cada requisição da aplicação PHP , Smarty testa para ver se o
- template atual foi alterado (diferentes time stamp) desde a última
- compilação. Se isso foi alterado, ele irá recompilar o template. Se o template
- não foi compilado, ele irá compilar de qualquer maneira dessa configuração.
- Por padrão esta variável é setada como true. Uma vez que a aplicação está
- em produção (templates não serão alterados), o passo compile_check
- não é necessário. Tenha certeza de setar $compile_check para "false" para
- maior performance. Note que se você alterar isso para "false" e o
- arquivo de template está alterado, você *não* irá ver a alteração desde que
- o template seja recompilado. Se caching está habilitado e
- compile_check está habilitado, então os arquivos de cache não serão regerados se
- um complexo arquivo de ou um arquivo de configuração foi atualizado. Veja $force_compile ou clear_compiled_tpl.
-
-
-
- $force_compile
-
- Isso força Smarty para (re)compilar templates a cada requisição.
- Essa configuração sobreescreve $compile_check. Por padrão
- isso está desabilitado. Isso é útil para desenvolvimento e debug.
- Isso nunca deve ser usado em ambiente de produção. Se caching
- está habilitado, os arquivo(s) de cache serão regerados à todo momento.
-
-
-
- $caching
-
- Isto diz à Smarty se há ou não saída de cache para o template.
- Por padrão isso está setado para 0, ou desabilitado. Se seu template gerar
- conteúdo redundante, é necessário ligar o caching. Isso
- irá resultar num ganho significativo de performance. Você pode também ter múltiplos
- caches para o mesmo template. Um valor de 1 ou 2 caching habilitados. 1 diz
- à Smarty para usar a variável atual $cache_lifetime para determinar se o
- cache expirou. Um valor 2 diz à Smarty para usar o valor cache_lifetime
- então para quando o cache foi gerado. Desta maneira você pode setar o
- cache_lifetime imediatamente antes de buscar o template para ter controle
- sobre quando este cache em particular expira. Veja também is_cached.
-
-
- Se $compile_check está habilitado, o conteúdo do cache irá ser regerado se
- algum dos templates ou arquivos de configuração que são parte deste cache estiverem
- alterados. Se $force_compile está habilitado, o conteúdo do cache irá sempre ser
- regerado.
-
-
-
- $cache_dir
-
- Isso é o nome do diretório onde os caches do template são
- armazenados. Por padrão isso é "./cache", significando que isso irá olhar
- para o diretório de cache no mesmo diretório que executar scripts PHP.
- Você pode tambe usar sua própria função customizada de manuseamento de cache
- para manipular arquivos de cache,
- que irão ignorar esta configuração.
-
-
- Notas Técnicas
-
- Essa configuração deve ser ou um relativo
- ou absoluto path. include_path não é usado para escrever em arquivos.
-
-
-
- Notas Técnicas
-
- Não é recomendado colocar este diretório sob um diretório
- document root do seu webserver.
-
-
-
-
- $cache_lifetime
-
- Isso é o comprimento de tempo em segundos que um cache de template é válido.
- Uma vez que este tempo está expirado, o cache irá ser regerado. $caching deve
- ser configurado para "true" para $cache_lifetime para ter algum propósito. Um valor de -1
- irá forçar o cache a nunca expirar. Um valor de 0 irá fazer com que o cache seja sempre regerado
- (bom somente para testes, o método mais eficiente de desabilitar caching é setá-lo para
- $caching = false.)
-
-
- Se $force_compile está
- habilitado, os arquivos de cache serão regerados todo o tempo, eficazmente
- desativando caching. Você pode limpar todos os arquivos de cache com a função clear_all_cache(), ou
- arquivos individuais de cache (ou grupos) com a função clear_cache().
-
-
- Notas Técnicas
-
- Se você quiser dar para certos templates seu próprio tempo de vida de um cache,
- você poderia fazer isso configurando $caching = 2,
- então configure $cache_lifetime para um único valor somente antes de chamar display()
- ou fetch().
-
-
-
-
- $cache_handler_func
-
- Você pode fornecer uma função padrão para manipular arquivos de cache ao invés de
- usar o método built-in usando o $cache_dir. Veja a
- seção cache
- handler function section para obter detalhes.
-
-
-
- $cache_modified_check
-
- Se configurado para true, Smarty irá respeitar o If-Modified-Since
- header enviado para o cliente. Se o timestamp do arquivo de cache
- não foi alterado desde a última visita, então um header "304 Not Modified"
- irá ser enviado ao invés do conteúdo. Isso funciona somente em arquivos
- de cache sem tags insert.
-
-
-
- $config_overwrite
-
- Se configurado para true, variáveis lidas no arquivo de configurações irão sobrescrever
- uma a outra. Do contrário, as variáveis serão guardadas em um array. Isso é
- útil se você quer armazenar arrays de dados em arquivos de configuração, somente lista
- tempos de cada elemento múltiplo. true por padrão.
-
-
-
- $config_booleanize
-
- Se setado para true, os valores do arquivo de configuração de on/true/yes e off/false/no
- ficará convertido para valores booleanos automaticamente. Desta forma você pode usar os
- valores em um template como: {if #foobar#} ... {/if}. Se foobar estiver
- on, true ou yes, a condição {if} irá executar. true por padrão.
-
-
-
- $config_read_hidden
-
- Se configurado para true, esconde seções (nomes de seções começados com um período)
- no arquivo de configuração podem ser lidos do template. Tipicamente você deixaria
- isto como false, desta forma você pode armazenar dados sensitivos no arquivo de configuração
- como um parâmetro de banco de
- dados e sem preocupar-se sobre o template carregá-los. false é o padrão.
-
-
-
- $config_fix_newlines
-
- Se setado para true, mac e dos newlines (\r e \r\n) no arquivo de configuração serão
- convertidos para \n quando eles forem interpretados. true é o padrão.
-
-
-
- $default_template_handler_func
-
- Essa função é chamada quando um template não pode ser obtido
- de seu recurso.
-
-
-
- $php_handling
-
- Isso diz à Smarty como manipular códigos PHP contido nos
- templates. Há quatro possíveis configurações, padrão sendo
- SMARTY_PHP_PASSTHRU. Note que isso NÃO fará efeito com códigos php
- dentro de tags {php}{/php}
- no template.
-
-
- SMARTY_PHP_PASSTHRU - Smarty echos tags as-is.
- SMARTY_PHP_QUOTE - Smarty quotes the
- tags as html entities.
- SMARTY_PHP_REMOVE - Smarty
- irá remover as tags do template.
- SMARTY_PHP_ALLOW - Smarty irá executar as
- tags como códigos PHP.
-
-
- NOTE: Usando códigos PHP code dentro de templates é altamente desencorajado.
- Use custom functions ou
- modifiers ao invés disso.
-
-
-
- $security
-
- $security true/false, o padrão é false. Security é bom para situações
- quando você tem partes inconfiáveis editando o template
- (via ftp por exemplo) e você quer reduzir os riscos de comprometimento
- da segurança do sistema através da linguagem de template.
- Habilitando-o faz-se cumprir as regras da linguagem de template,
- a menos que especificamente cancelada com $security_settings:
-
-
- Se $php_handling está setado para SMARTY_PHP_ALLOW, isso é implicitamente
- alterado para SMARTY_PHP_PASSTHRU
- Funçõs PHP não são permitidas em blocos IF,
- exceto estes especificados no $security_settings
- templates podem ser somente incluidos no diretório
- listado em $secure_dir array
- Arquivos locais podem ser somente trazidos do diretório
- listado em $secure_dir usando no array {fetch}
- Estas tags {php}{/php} não são permitidas
- Funções PHP não são permitidas como modificadores, exceto
- estes especificados no $security_settings
-
-
-
- $secure_dir
-
- Isso é um array de todos os diretórios locais que são considerados
- seguros. {include} e {fetch} usam estes (diretórios) quando security está habilitado.
-
-
-
- $security_settings
-
- Essas configurações são usadas para cancelar ou especificar configurações
- de segurança quando security está habilitado. Estas possuem as seguintes configurações possíveis:
-
-
- PHP_HANDLING - true/false. Se setado para true,
- a configuração de $php_handling não é checada para security.
- IF_FUNCS - Isso é um array de nomes de funções PHP permitidas
- nos blocos IF.
- INCLUDE_ANY - true/false. Se setado para true, algum
- template pode ser incluído para um arquivo do sistema, apesar de toda a lista de
- $secure_dir.
- PHP_TAGS - true/false. Se setado para true, as tags {php}{/php}
- são permitidas nos templates.
- MODIFIER_FUNCS - Isso é um array de nomes de funções PHP permitidas
- usadas como modificadores de variável.
-
-
-
- $trusted_dir
-
- $trusted_dir somente usado quando $security está habilitado. Isso é um array
- de todos os diretórios que são considerados confiáveis. Diretórios confiáveis
- são onde você irá deixar seus scripts php que são executados diretamente para o
- template com {include_php}.
-
-
-
- $left_delimiter
-
- Este é o delimitador esquerdo usado para a linguagem de template.
- O padrão é "{".
-
-
-
- $right_delimiter
-
- Este é o delimitador direito usado para a linguagem de template.
- O padrão é "}".
-
-
-
- $compiler_class
-
- Especifica o nome do compilador de classes que
- Smarty irá usar para compilar templates. O padrão é 'Smarty_Compiler'.
- Para usuários avançados somente.
-
-
-
- $request_vars_order
-
- A ordem na qual as variáveis requeridas serão registradas, similar ao
- variables_order no php.ini
-
-
-
- $request_use_auto_globals
-
- Especifica se a Smarty deve usar variáveis globais do php $HTTP_*_VARS[]
- ($request_use_auto_globals=false que é o valor padrão) ou
- $_*[] ($request_use_auto_globals=true). Isso afeta templates
- que fazem uso do {$smarty.request.*}, {$smarty.get.*} etc. .
- Atenção: Se você setar $request_use_auto_globals para true, variable.request.vars.order
- não terão efeito mas valores de configurações do php
- gpc_order são usados.
-
-
-
- $compile_id
-
- Identificador de compilação persistente. Como uma alternativa
- para passar o mesmo compile_id para cada chamada de função, você
- pode setar este compile_id e isso irá ser usado implicitamente após isso.
-
-
-
- $use_sub_dirs
-
- Configure isso para false se seu ambiente de PHP não permite a criação de
- subdiretórios pela Smarty. Subdiretórios são muito eficientes, então use-os se você
- conseguir.
-
-
-
- $default_modifiers
-
- Isso é um array de modificadores implicitamente aplicados par cada
- variável no template. Por Exemplo, para cada variável HTML-escape por padrão,
- use o array('escape:"htmlall"'); Para fazer a variável isenta para modificadores
- padrão, passe o modificador especial "smarty" com um valor de parâmetro "nodefaults"
- modificando isso, como
- {$var|smarty:nodefaults}.
-
-
-
- $default_resource_type
-
- Isso diz à Smarty qual tipo de recurso usar implicitamente.
- O valor padrão é 'file', significando que $smarty->display('index.tpl'); e
- $smarty->display('file:index.tpl'); são idênticos no significado.
- Veja o capítulo resource para detalhes.
-
-
+&programmers.api-variables.variable-template-dir;
+&programmers.api-variables.variable-compile-dir;
+&programmers.api-variables.variable-config-dir;
+&programmers.api-variables.variable-plugins-dir;
+&programmers.api-variables.variable-debugging;
+&programmers.api-variables.variable-debug-tpl;
+&programmers.api-variables.variable-debugging-ctrl;
+&programmers.api-variables.variable-global-assign;
+&programmers.api-variables.variable-undefined;
+&programmers.api-variables.variable-autoload-filters;
+&programmers.api-variables.variable-compile-check;
+&programmers.api-variables.variable-force-compile;
+&programmers.api-variables.variable-caching;
+&programmers.api-variables.variable-cache-dir;
+&programmers.api-variables.variable-cache-lifetime;
+&programmers.api-variables.variable-cache-handler-func;
+&programmers.api-variables.variable-cache-modified-check;
+&programmers.api-variables.variable-config-overwrite;
+&programmers.api-variables.variable-config-booleanize;
+&programmers.api-variables.variable-config-read-hidden;
+&programmers.api-variables.variable-config-fix-newlines;
+&programmers.api-variables.variable-default-template-handler-func;
+&programmers.api-variables.variable-php-handling;
+&programmers.api-variables.variable-security;
+&programmers.api-variables.variable-secure-dir;
+&programmers.api-variables.variable-security-settings;
+&programmers.api-variables.variable-trusted-dir;
+&programmers.api-variables.variable-left-delimiter;
+&programmers.api-variables.variable-right-delimiter;
+&programmers.api-variables.variable-compiler-class;
+&programmers.api-variables.variable-request-vars-order;
+&programmers.api-variables.variable-request-use-auto-globals;
+&programmers.api-variables.variable-compile-id;
+&programmers.api-variables.variable-use-sub-dirs;
+&programmers.api-variables.variable-default-modifiers;
+&programmers.api-variables.variable-default-resource-type;
+
+ $autoload_filters
+
+ Se há algum filtro que você deseja carregar em cada chamada de template,
+ você pode especificar-lhes usando essa variável e a Smarty irá
+ automaticamente carregá-los para você. A variável é um array associativo
+ onde as chaves são tipos de filtro e os valores são arrays de nomes de filtros.
+ Por exemplo:
+
+
+$smarty->autoload_filters = array('pre' => array('trim', 'stamp'),
+ 'output' => array('convert'));
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-variables/variable-cache-dir.xml b/docs/pt_BR/programmers/api-variables/variable-cache-dir.xml
new file mode 100644
index 00000000..52cb0712
--- /dev/null
+++ b/docs/pt_BR/programmers/api-variables/variable-cache-dir.xml
@@ -0,0 +1,47 @@
+
+
+
+ $cache_dir
+
+ Isso é o nome do diretório onde os caches do template são
+ armazenados. Por padrão isso é "./cache", significando que isso irá olhar
+ para o diretório de cache no mesmo diretório que executar scripts PHP.
+ Você pode tambe usar sua própria função customizada de manuseamento de cache
+ para manipular arquivos de cache,
+ que irão ignorar esta configuração.
+
+
+ Notas Técnicas
+
+ Essa configuração deve ser ou um relativo
+ ou absoluto path. include_path não é usado para escrever em arquivos.
+
+
+
+ Notas Técnicas
+
+ Não é recomendado colocar este diretório sob um diretório
+ document root do seu webserver.
+
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-variables/variable-cache-handler-func.xml b/docs/pt_BR/programmers/api-variables/variable-cache-handler-func.xml
new file mode 100644
index 00000000..11a4a5b5
--- /dev/null
+++ b/docs/pt_BR/programmers/api-variables/variable-cache-handler-func.xml
@@ -0,0 +1,31 @@
+
+
+
+ $cache_handler_func
+
+ Você pode fornecer uma função padrão para manipular arquivos de cache ao invés de
+ usar o método built-in usando o $cache_dir. Veja a
+ seção cache
+ handler function section para obter detalhes.
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-variables/variable-cache-lifetime.xml b/docs/pt_BR/programmers/api-variables/variable-cache-lifetime.xml
new file mode 100644
index 00000000..48925727
--- /dev/null
+++ b/docs/pt_BR/programmers/api-variables/variable-cache-lifetime.xml
@@ -0,0 +1,51 @@
+
+
+
+ $cache_lifetime
+
+ Isso é o comprimento de tempo em segundos que um cache de template é válido.
+ Uma vez que este tempo está expirado, o cache irá ser regerado. $caching deve
+ ser configurado para "true" para $cache_lifetime para ter algum propósito. Um valor de -1
+ irá forçar o cache a nunca expirar. Um valor de 0 irá fazer com que o cache seja sempre regerado
+ (bom somente para testes, o método mais eficiente de desabilitar caching é setá-lo para
+ $caching = false.)
+
+
+ Se $force_compile está
+ habilitado, os arquivos de cache serão regerados todo o tempo, eficazmente
+ desativando caching. Você pode limpar todos os arquivos de cache com a função clear_all_cache(), ou
+ arquivos individuais de cache (ou grupos) com a função clear_cache().
+
+
+ Notas Técnicas
+
+ Se você quiser dar para certos templates seu próprio tempo de vida de um cache,
+ você poderia fazer isso configurando $caching = 2,
+ então configure $cache_lifetime para um único valor somente antes de chamar display()
+ ou fetch().
+
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-variables/variable-cache-modified-check.xml b/docs/pt_BR/programmers/api-variables/variable-cache-modified-check.xml
new file mode 100644
index 00000000..70359836
--- /dev/null
+++ b/docs/pt_BR/programmers/api-variables/variable-cache-modified-check.xml
@@ -0,0 +1,32 @@
+
+
+
+ $cache_modified_check
+
+ Se configurado para true, Smarty irá respeitar o If-Modified-Since
+ header enviado para o cliente. Se o timestamp do arquivo de cache
+ não foi alterado desde a última visita, então um header "304 Not Modified"
+ irá ser enviado ao invés do conteúdo. Isso funciona somente em arquivos
+ de cache sem tags insert.
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-variables/variable-caching.xml b/docs/pt_BR/programmers/api-variables/variable-caching.xml
new file mode 100644
index 00000000..0a5b3248
--- /dev/null
+++ b/docs/pt_BR/programmers/api-variables/variable-caching.xml
@@ -0,0 +1,44 @@
+
+
+
+ $caching
+
+ Isto diz à Smarty se há ou não saída de cache para o template.
+ Por padrão isso está setado para 0, ou desabilitado. Se seu template gerar
+ conteúdo redundante, é necessário ligar o caching. Isso
+ irá resultar num ganho significativo de performance. Você pode também ter múltiplos
+ caches para o mesmo template. Um valor de 1 ou 2 caching habilitados. 1 diz
+ à Smarty para usar a variável atual $cache_lifetime para determinar se o
+ cache expirou. Um valor 2 diz à Smarty para usar o valor cache_lifetime
+ então para quando o cache foi gerado. Desta maneira você pode setar o
+ cache_lifetime imediatamente antes de buscar o template para ter controle
+ sobre quando este cache em particular expira. Veja também is_cached.
+
+
+ Se $compile_check está habilitado, o conteúdo do cache irá ser regerado se
+ algum dos templates ou arquivos de configuração que são parte deste cache estiverem
+ alterados. Se $force_compile está habilitado, o conteúdo do cache irá sempre ser
+ regerado.
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-variables/variable-compile-check.xml b/docs/pt_BR/programmers/api-variables/variable-compile-check.xml
new file mode 100644
index 00000000..9b162979
--- /dev/null
+++ b/docs/pt_BR/programmers/api-variables/variable-compile-check.xml
@@ -0,0 +1,41 @@
+
+
+
+ $compile_check
+
+ Em cima de cada requisição da aplicação PHP , Smarty testa para ver se o
+ template atual foi alterado (diferentes time stamp) desde a última
+ compilação. Se isso foi alterado, ele irá recompilar o template. Se o template
+ não foi compilado, ele irá compilar de qualquer maneira dessa configuração.
+ Por padrão esta variável é setada como true. Uma vez que a aplicação está
+ em produção (templates não serão alterados), o passo compile_check
+ não é necessário. Tenha certeza de setar $compile_check para "false" para
+ maior performance. Note que se você alterar isso para "false" e o
+ arquivo de template está alterado, você *não* irá ver a alteração desde que
+ o template seja recompilado. Se caching está habilitado e
+ compile_check está habilitado, então os arquivos de cache não serão regerados se
+ um complexo arquivo de ou um arquivo de configuração foi atualizado. Veja $force_compile ou clear_compiled_tpl.
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-variables/variable-compile-dir.xml b/docs/pt_BR/programmers/api-variables/variable-compile-dir.xml
new file mode 100644
index 00000000..6b47204c
--- /dev/null
+++ b/docs/pt_BR/programmers/api-variables/variable-compile-dir.xml
@@ -0,0 +1,45 @@
+
+
+
+ $compile_dir
+
+ Esse é o nome do diretório onde os template compilados estão localizados
+ Por padrão isso é "./templates_c", significando que isso irá
+ olhar para o diretório de templates no mesmo diretório que está executando
+ o script PHP.
+
+
+ Notas Técnicas
+
+ Essa configuração deve ser um path relativo ou um path absoluto.
+ include_path não é usado para escrever em arquivos.
+
+
+
+ Notas Técnicas
+
+ Não é recomendado colocar este diretório sob um diretório
+ document root do seu webserver.
+
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-variables/variable-compile-id.xml b/docs/pt_BR/programmers/api-variables/variable-compile-id.xml
new file mode 100644
index 00000000..fdbfefec
--- /dev/null
+++ b/docs/pt_BR/programmers/api-variables/variable-compile-id.xml
@@ -0,0 +1,30 @@
+
+
+
+ $compile_id
+
+ Identificador de compilação persistente. Como uma alternativa
+ para passar o mesmo compile_id para cada chamada de função, você
+ pode setar este compile_id e isso irá ser usado implicitamente após isso.
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-variables/variable-compiler-class.xml b/docs/pt_BR/programmers/api-variables/variable-compiler-class.xml
new file mode 100644
index 00000000..d7e1656f
--- /dev/null
+++ b/docs/pt_BR/programmers/api-variables/variable-compiler-class.xml
@@ -0,0 +1,30 @@
+
+
+
+ $compiler_class
+
+ Especifica o nome do compilador de classes que
+ Smarty irá usar para compilar templates. O padrão é 'Smarty_Compiler'.
+ Para usuários avançados somente.
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-variables/variable-config-booleanize.xml b/docs/pt_BR/programmers/api-variables/variable-config-booleanize.xml
new file mode 100644
index 00000000..35b77a6a
--- /dev/null
+++ b/docs/pt_BR/programmers/api-variables/variable-config-booleanize.xml
@@ -0,0 +1,31 @@
+
+
+
+ $config_booleanize
+
+ Se setado para true, os valores do arquivo de configuração de on/true/yes e off/false/no
+ ficará convertido para valores booleanos automaticamente. Desta forma você pode usar os
+ valores em um template como: {if #foobar#} ... {/if}. Se foobar estiver
+ on, true ou yes, a condição {if} irá executar. true por padrão.
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-variables/variable-config-dir.xml b/docs/pt_BR/programmers/api-variables/variable-config-dir.xml
new file mode 100644
index 00000000..02a78322
--- /dev/null
+++ b/docs/pt_BR/programmers/api-variables/variable-config-dir.xml
@@ -0,0 +1,38 @@
+
+
+
+ $config_dir
+
+ Este é o diretório usado para armazenar arquivos de configuração usados nos
+ templates. O padrão é "./configs", significando que isso irá
+ olhar para o diretório de templates no mesmo diretório que está executando
+ o script PHP.
+
+
+ Notas Técnicas
+
+ Não é recomendado colocar este diretório sob um diretório
+ document root do seu webserver.
+
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-variables/variable-config-fix-newlines.xml b/docs/pt_BR/programmers/api-variables/variable-config-fix-newlines.xml
new file mode 100644
index 00000000..99be20b1
--- /dev/null
+++ b/docs/pt_BR/programmers/api-variables/variable-config-fix-newlines.xml
@@ -0,0 +1,29 @@
+
+
+
+ $config_fix_newlines
+
+ Se setado para true, mac e dos newlines (\r e \r\n) no arquivo de configuração serão
+ convertidos para \n quando eles forem interpretados. true é o padrão.
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-variables/variable-config-overwrite.xml b/docs/pt_BR/programmers/api-variables/variable-config-overwrite.xml
new file mode 100644
index 00000000..c4cb1c27
--- /dev/null
+++ b/docs/pt_BR/programmers/api-variables/variable-config-overwrite.xml
@@ -0,0 +1,31 @@
+
+
+
+ $config_overwrite
+
+ Se configurado para true, variáveis lidas no arquivo de configurações irão sobrescrever
+ uma a outra. Do contrário, as variáveis serão guardadas em um array. Isso é
+ útil se você quer armazenar arrays de dados em arquivos de configuração, somente lista
+ tempos de cada elemento múltiplo. true por padrão.
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-variables/variable-config-read-hidden.xml b/docs/pt_BR/programmers/api-variables/variable-config-read-hidden.xml
new file mode 100644
index 00000000..da86dbab
--- /dev/null
+++ b/docs/pt_BR/programmers/api-variables/variable-config-read-hidden.xml
@@ -0,0 +1,32 @@
+
+
+
+ $config_read_hidden
+
+ Se configurado para true, esconde seções (nomes de seções começados com um período)
+ no arquivo de configuração podem ser lidos do template. Tipicamente você deixaria
+ isto como false, desta forma você pode armazenar dados sensitivos no arquivo de configuração
+ como um parâmetro de banco de
+ dados e sem preocupar-se sobre o template carregá-los. false é o padrão.
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-variables/variable-debug-tpl.xml b/docs/pt_BR/programmers/api-variables/variable-debug-tpl.xml
new file mode 100644
index 00000000..bda6a78d
--- /dev/null
+++ b/docs/pt_BR/programmers/api-variables/variable-debug-tpl.xml
@@ -0,0 +1,30 @@
+
+
+
+ $debug_tpl
+
+ Este é o nome do arquivo de template usado para o console de debug.
+ Por padrão, é nomeado como debug.tpl e está localizado no SMARTY_DIR.
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-variables/variable-debugging-ctrl.xml b/docs/pt_BR/programmers/api-variables/variable-debugging-ctrl.xml
new file mode 100644
index 00000000..5072236f
--- /dev/null
+++ b/docs/pt_BR/programmers/api-variables/variable-debugging-ctrl.xml
@@ -0,0 +1,32 @@
+
+
+
+ $debugging_ctrl
+
+ Isso permite caminhos alternativos de habilitar o debug. NONE não significa
+ que métodos alternativos são permitidos. URL significa quando a palavra
+ SMARTY_DEBUG foi encontrado na QUERY_STRING, que o debug está habilitado
+ para a chamada do script.
+ Se $debugging é true, esse valor é ignorado.
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-variables/variable-debugging.xml b/docs/pt_BR/programmers/api-variables/variable-debugging.xml
new file mode 100644
index 00000000..a1005a74
--- /dev/null
+++ b/docs/pt_BR/programmers/api-variables/variable-debugging.xml
@@ -0,0 +1,32 @@
+
+
+
+ $debugging
+
+ Isso habilita o debugging console.
+ O console é uma janela de javascript que informa à você
+ sobre os arquivos de template incluídos e variáveis
+ destinadas para a página de template atual.
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-variables/variable-default-modifiers.xml b/docs/pt_BR/programmers/api-variables/variable-default-modifiers.xml
new file mode 100644
index 00000000..14b0c81d
--- /dev/null
+++ b/docs/pt_BR/programmers/api-variables/variable-default-modifiers.xml
@@ -0,0 +1,33 @@
+
+
+
+ $default_modifiers
+
+ Isso é um array de modificadores implicitamente aplicados par cada
+ variável no template. Por Exemplo, para cada variável HTML-escape por padrão,
+ use o array('escape:"htmlall"'); Para fazer a variável isenta para modificadores
+ padrão, passe o modificador especial "smarty" com um valor de parâmetro "nodefaults"
+ modificando isso, como
+ {$var|smarty:nodefaults}.
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-variables/variable-default-resource-type.xml b/docs/pt_BR/programmers/api-variables/variable-default-resource-type.xml
new file mode 100644
index 00000000..e06e16b1
--- /dev/null
+++ b/docs/pt_BR/programmers/api-variables/variable-default-resource-type.xml
@@ -0,0 +1,31 @@
+
+
+
+ $default_resource_type
+
+ Isso diz à Smarty qual tipo de recurso usar implicitamente.
+ O valor padrão é 'file', significando que $smarty->display('index.tpl'); e
+ $smarty->display('file:index.tpl'); são idênticos no significado.
+ Veja o capítulo resource para detalhes.
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-variables/variable-default-template-handler-func.xml b/docs/pt_BR/programmers/api-variables/variable-default-template-handler-func.xml
new file mode 100644
index 00000000..1b6e9f18
--- /dev/null
+++ b/docs/pt_BR/programmers/api-variables/variable-default-template-handler-func.xml
@@ -0,0 +1,29 @@
+
+
+
+ $default_template_handler_func
+
+ Essa função é chamada quando um template não pode ser obtido
+ de seu recurso.
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-variables/variable-force-compile.xml b/docs/pt_BR/programmers/api-variables/variable-force-compile.xml
new file mode 100644
index 00000000..91cd4f9f
--- /dev/null
+++ b/docs/pt_BR/programmers/api-variables/variable-force-compile.xml
@@ -0,0 +1,32 @@
+
+
+
+ $force_compile
+
+ Isso força Smarty para (re)compilar templates a cada requisição.
+ Essa configuração sobreescreve $compile_check. Por padrão
+ isso está desabilitado. Isso é útil para desenvolvimento e debug.
+ Isso nunca deve ser usado em ambiente de produção. Se caching
+ está habilitado, os arquivo(s) de cache serão regerados à todo momento.
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-variables/variable-global-assign.xml b/docs/pt_BR/programmers/api-variables/variable-global-assign.xml
new file mode 100644
index 00000000..d8756ce6
--- /dev/null
+++ b/docs/pt_BR/programmers/api-variables/variable-global-assign.xml
@@ -0,0 +1,45 @@
+
+
+
+ $global_assign
+
+ Essa é a lista de variáveis que estão sempre implicitamente fixadas
+ para o template engine. Isso está acessível para fazer variáveis
+ globais ou variáveis do servidor disponíveis para todo o template
+ sem ter que fixá-las manualmente. Cada elemento em
+ $global_assign deve ser um nome de uma variável global,
+ ou um par de chave/valor, onde a chave é o nome do array global
+ array e o valor é o array de variáveis fixadas deste array global. $SCRIPT_NAME é
+ globalmente fixado por padrão
+ para $HTTP_SERVER_VARS.
+
+
+ Notas Técnicas
+
+ Variáveis de servidor podem ser acessadas através da variável
+ $smarty, como {$smarty.server.SCRIPT_NAME}. Veja a seção
+ da variável
+ $smarty.
+
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-variables/variable-left-delimiter.xml b/docs/pt_BR/programmers/api-variables/variable-left-delimiter.xml
new file mode 100644
index 00000000..3ccf5235
--- /dev/null
+++ b/docs/pt_BR/programmers/api-variables/variable-left-delimiter.xml
@@ -0,0 +1,29 @@
+
+
+
+ $left_delimiter
+
+ Este é o delimitador esquerdo usado para a linguagem de template.
+ O padrão é "{".
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-variables/variable-php-handling.xml b/docs/pt_BR/programmers/api-variables/variable-php-handling.xml
new file mode 100644
index 00000000..5a7fb0d8
--- /dev/null
+++ b/docs/pt_BR/programmers/api-variables/variable-php-handling.xml
@@ -0,0 +1,46 @@
+
+
+
+ $php_handling
+
+ Isso diz à Smarty como manipular códigos PHP contido nos
+ templates. Há quatro possíveis configurações, padrão sendo
+ SMARTY_PHP_PASSTHRU. Note que isso NÃO fará efeito com códigos php
+ dentro de tags {php}{/php}
+ no template.
+
+
+ SMARTY_PHP_PASSTHRU - Smarty echos tags as-is.
+ SMARTY_PHP_QUOTE - Smarty quotes the
+ tags as html entities.
+ SMARTY_PHP_REMOVE - Smarty
+ irá remover as tags do template.
+ SMARTY_PHP_ALLOW - Smarty irá executar as
+ tags como códigos PHP.
+
+
+ NOTE: Usando códigos PHP code dentro de templates é altamente desencorajado.
+ Use custom functions ou
+ modifiers ao invés disso.
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-variables/variable-plugins-dir.xml b/docs/pt_BR/programmers/api-variables/variable-plugins-dir.xml
new file mode 100644
index 00000000..0c1c9041
--- /dev/null
+++ b/docs/pt_BR/programmers/api-variables/variable-plugins-dir.xml
@@ -0,0 +1,40 @@
+
+
+
+ $plugins_dir
+
+ Esse é o diretório onde Smarty irá procurar por plugins que são necessários.
+ O Padrão é "plugins" sob o SMARTY_DIR. Se vocêes especificar um
+ path relativo, Smarty irá primeiro procurar sob o SMARTY_DIR, então
+ relativo para o cwd (current working directory), então relativo para cada
+ entrada no seu PHP include path.
+
+
+ Notas técnicas
+
+ Para uma melhor performance, não configure seu plugins_dir para ter que usar o
+ PHP include path. Use um path absoluto, ou um path relativo para
+ SMARTY_DIR ou o cwd.
+
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-variables/variable-request-use-auto-globals.xml b/docs/pt_BR/programmers/api-variables/variable-request-use-auto-globals.xml
new file mode 100644
index 00000000..f4e18e1b
--- /dev/null
+++ b/docs/pt_BR/programmers/api-variables/variable-request-use-auto-globals.xml
@@ -0,0 +1,35 @@
+
+
+
+ $request_use_auto_globals
+
+ Especifica se a Smarty deve usar variáveis globais do php $HTTP_*_VARS[]
+ ($request_use_auto_globals=false que é o valor padrão) ou
+ $_*[] ($request_use_auto_globals=true). Isso afeta templates
+ que fazem uso do {$smarty.request.*}, {$smarty.get.*} etc. .
+ Atenção: Se você setar $request_use_auto_globals para true, variable.request.vars.order
+ não terão efeito mas valores de configurações do php
+ gpc_order são usados.
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-variables/variable-request-vars-order.xml b/docs/pt_BR/programmers/api-variables/variable-request-vars-order.xml
new file mode 100644
index 00000000..73f8171e
--- /dev/null
+++ b/docs/pt_BR/programmers/api-variables/variable-request-vars-order.xml
@@ -0,0 +1,29 @@
+
+
+
+ $request_vars_order
+
+ A ordem na qual as variáveis requeridas serão registradas, similar ao
+ variables_order no php.ini
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-variables/variable-right-delimiter.xml b/docs/pt_BR/programmers/api-variables/variable-right-delimiter.xml
new file mode 100644
index 00000000..41a4e311
--- /dev/null
+++ b/docs/pt_BR/programmers/api-variables/variable-right-delimiter.xml
@@ -0,0 +1,29 @@
+
+
+
+ $right_delimiter
+
+ Este é o delimitador direito usado para a linguagem de template.
+ O padrão é "}".
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-variables/variable-secure-dir.xml b/docs/pt_BR/programmers/api-variables/variable-secure-dir.xml
new file mode 100644
index 00000000..d4fbe5cc
--- /dev/null
+++ b/docs/pt_BR/programmers/api-variables/variable-secure-dir.xml
@@ -0,0 +1,29 @@
+
+
+
+ $secure_dir
+
+ Isso é um array de todos os diretórios locais que são considerados
+ seguros. {include} e {fetch} usam estes (diretórios) quando security está habilitado.
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-variables/variable-security-settings.xml b/docs/pt_BR/programmers/api-variables/variable-security-settings.xml
new file mode 100644
index 00000000..e07d9a16
--- /dev/null
+++ b/docs/pt_BR/programmers/api-variables/variable-security-settings.xml
@@ -0,0 +1,42 @@
+
+
+
+ $security_settings
+
+ Essas configurações são usadas para cancelar ou especificar configurações
+ de segurança quando security está habilitado. Estas possuem as seguintes configurações possíveis:
+
+
+ PHP_HANDLING - true/false. Se setado para true,
+ a configuração de $php_handling não é checada para security.
+ IF_FUNCS - Isso é um array de nomes de funções PHP permitidas
+ nos blocos IF.
+ INCLUDE_ANY - true/false. Se setado para true, algum
+ template pode ser incluído para um arquivo do sistema, apesar de toda a lista de
+ $secure_dir.
+ PHP_TAGS - true/false. Se setado para true, as tags {php}{/php}
+ são permitidas nos templates.
+ MODIFIER_FUNCS - Isso é um array de nomes de funções PHP permitidas
+ usadas como modificadores de variável.
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-variables/variable-security.xml b/docs/pt_BR/programmers/api-variables/variable-security.xml
new file mode 100644
index 00000000..7dadfed8
--- /dev/null
+++ b/docs/pt_BR/programmers/api-variables/variable-security.xml
@@ -0,0 +1,46 @@
+
+
+
+ $security
+
+ $security true/false, o padrão é false. Security é bom para situações
+ quando você tem partes inconfiáveis editando o template
+ (via ftp por exemplo) e você quer reduzir os riscos de comprometimento
+ da segurança do sistema através da linguagem de template.
+ Habilitando-o faz-se cumprir as regras da linguagem de template,
+ a menos que especificamente cancelada com $security_settings:
+
+
+ Se $php_handling está setado para SMARTY_PHP_ALLOW, isso é implicitamente
+ alterado para SMARTY_PHP_PASSTHRU
+ Funçõs PHP não são permitidas em blocos IF,
+ exceto estes especificados no $security_settings
+ templates podem ser somente incluidos no diretório
+ listado em $secure_dir array
+ Arquivos locais podem ser somente trazidos do diretório
+ listado em $secure_dir usando no array {fetch}
+ Estas tags {php}{/php} não são permitidas
+ Funções PHP não são permitidas como modificadores, exceto
+ estes especificados no $security_settings
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-variables/variable-template-dir.xml b/docs/pt_BR/programmers/api-variables/variable-template-dir.xml
new file mode 100644
index 00000000..93c1984a
--- /dev/null
+++ b/docs/pt_BR/programmers/api-variables/variable-template-dir.xml
@@ -0,0 +1,39 @@
+
+
+
+ $template_dir
+
+ Este é o nome padrão do diretório de template. Se você não fornecer
+ um tipo de recurso quando incluir arquivos, então ele irá ser encontrado aqui.
+ Por padrão isso é "./templates", significando que isso irá
+ olhar para o diretório de templates no mesmo diretório que está executando
+ o script PHP.
+
+
+ Notas Técnicas
+
+ Não é recomendado colocar este diretório sob um diretório
+ document root do seu webserver.
+
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-variables/variable-trusted-dir.xml b/docs/pt_BR/programmers/api-variables/variable-trusted-dir.xml
new file mode 100644
index 00000000..30d12d8e
--- /dev/null
+++ b/docs/pt_BR/programmers/api-variables/variable-trusted-dir.xml
@@ -0,0 +1,31 @@
+
+
+
+ $trusted_dir
+
+ $trusted_dir somente usado quando $security está habilitado. Isso é um array
+ de todos os diretórios que são considerados confiáveis. Diretórios confiáveis
+ são onde você irá deixar seus scripts php que são executados diretamente para o
+ template com {include_php}.
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-variables/variable-undefined.xml b/docs/pt_BR/programmers/api-variables/variable-undefined.xml
new file mode 100644
index 00000000..caf9b3ac
--- /dev/null
+++ b/docs/pt_BR/programmers/api-variables/variable-undefined.xml
@@ -0,0 +1,30 @@
+
+
+
+ $undefined
+
+ Isso seta o valor de $undefined para Smarty, o padrão é null.
+ Atualmente isso é somente usado para setar variáveis indefinidas em
+ $global_assign para o valor padrão.
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/api-variables/variable-use-sub-dirs.xml b/docs/pt_BR/programmers/api-variables/variable-use-sub-dirs.xml
new file mode 100644
index 00000000..2150eb47
--- /dev/null
+++ b/docs/pt_BR/programmers/api-variables/variable-use-sub-dirs.xml
@@ -0,0 +1,30 @@
+
+
+
+ $use_sub_dirs
+
+ Configure isso para false se seu ambiente de PHP não permite a criação de
+ subdiretórios pela Smarty. Subdiretórios são muito eficientes, então use-os se você
+ conseguir.
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/caching.xml b/docs/pt_BR/programmers/caching.xml
index 666d4be2..1873c1c4 100644
--- a/docs/pt_BR/programmers/caching.xml
+++ b/docs/pt_BR/programmers/caching.xml
@@ -20,359 +20,11 @@
mostrando uma página com um mapa do tempo contendo novas informações por minuto, não
faz sentido fazer cache nesta página.
-
- Configurando Caching
-
- A primeira coisa a fazer é habilitar o caching. Isso é feito pela configuração $caching = true (or 1.)
-
-
- Habilitando Caching
-
-require('Smarty.class.php');
-$smarty = new Smarty;
+&programmers.caching.caching-setting-up;
+&programmers.caching.caching-multiple-caches;
+&programmers.caching.caching-groups;
-$smarty->caching = true;
-
-$smarty->display('index.tpl');
-
-
- Com caching habilitado, a chamada para a função display('index.tpl') irá trazer
- o template como usual, mas também
- salva uma cópia disso para o arquivo de saída (uma cópia de cache) in the $cache_dir.
- Na próxima chamada de display('index.tpl'), a cópia em cache será usada
- ao invés de trazer novamente o template.
-
-
- Notas Técnicas
-
- Os arquivos no $cache_dir são nomeados com similaridade ao nome do arquivo de template.
- Embora eles terminem com a extensão ".php", eles não são realmente scripts executáveis de php.
- Não edite estes arquivos!
-
-
-
- Cada página em cache tem um período de tempo limitado determinado por $cache_lifetime. O padrão do valor é
- 3600 segundos, ou 1 hora. Após o tempo expirar, o cache é regerado.
- É possível dar tempos individuais para caches com seu próprio tempo
- de expiração pela configuração $caching = 2. Veja a documentação em $cache_lifetime para detalhes.
-
-
- Configurando cache_lifetime por cache
-
-require('Smarty.class.php');
-$smarty = new Smarty;
-
-$smarty->caching = 2; // lifetime is per cache
-
-// set the cache_lifetime for index.tpl to 5 minutes
-$smarty->cache_lifetime = 300;
-$smarty->display('index.tpl');
-
-// set the cache_lifetime for home.tpl to 1 hour
-$smarty->cache_lifetime = 3600;
-$smarty->display('home.tpl');
-
-// NOTE: the following $cache_lifetime setting will not work when $caching = 2.
-// The cache lifetime for home.tpl has already been set
-// to 1 hour, and will no longer respect the value of $cache_lifetime.
-// The home.tpl cache will still expire after 1 hour.
-$smarty->cache_lifetime = 30; // 30 seconds
-$smarty->display('home.tpl');
-
-
- Se $compile_check está habilitado,
- cada arquivo de template e arquivo de configuração que está envolvido com o arquivo em cache
- é checado por modificações. Se algum destes arquivos foi modificado desde que o último cache
- foi gerado, o cache é imediatamente regerado.
- Isso é ligeiramente uma forma de optimização de performance de overhead, deixe $compile_check setado para false.
-
-
- Habilitando $compile_check
-
-require('Smarty.class.php');
-$smarty = new Smarty;
-
-$smarty->caching = true;
-$smarty->compile_check = true;
-
-$smarty->display('index.tpl');
-
-
- Se $force_compile está habilitado,
- os arquivos de cache irão sempre ser regerados. Isso é efetivamente desativar caching.
- $force_compile é usualmente para propósitos de debug somente, um caminho mais
- eficiente de desativar caching é setar o $caching = false (ou 0.)
-
-
- A função is_cached()
- pode ser usada para testar se um template tem um cache válido ou não.
- Se você tem um template com cache que requer alguma coisa como um retorno do banco de dados,
- você pode usar isso para pular este processo.
-
-
- Usando is_cached()
-
-require('Smarty.class.php');
-$smarty = new Smarty;
-
-$smarty->caching = true;
-
-if(!$smarty->is_cached('index.tpl')) {
- // No cache available, do variable assignments here.
- $contents = get_database_contents();
- $smarty->assign($contents);
-}
-
-$smarty->display('index.tpl');
-
-
- Você pode deixar partes da sua página dinâmica com a função de template insert.
- Vamos dizer que sua página inteira pode ter cache exceto para um banner que é
- mostrado abaixo do lado direito da sua página. Usando uma função insert para o banner,
- você pode deixar esse elemento dinâmico dentro do conteúdo de cache. Veja a documentação
- em insert para
- detalhes e exemplos.
-
-
- Você pode limpar todos os arquivos de cache com a função clear_all_cache(), ou
- arquivos de cache individuais (ou grupos) com a função clear_cache().
-
-
- Limpando o cache
-
-require('Smarty.class.php');
-$smarty = new Smarty;
-
-$smarty->caching = true;
-
-// clear out all cache files
-$smarty->clear_all_cache();
-
-// clear only cache for index.tpl
-$smarty->clear_cache('index.tpl');
-
-$smarty->display('index.tpl');
-
-
-
- Multiple Caches Per Page
-
- Você pode ter múltiplos arquivos de cache para uma simples chamada de display()
- ou fetch(). Vamos dizer que uma chamada para display('index.tpl') deve ter vários
- conteúdo de saída diferentes dependendo de alguma condição, e você quer separar
- os caches para cada um. Você pode fazer isso passando um cache_id como um
- segundo parâmetro para a chamada da função.
-
-
- Passando um cache_id para display()
-
-require('Smarty.class.php');
-$smarty = new Smarty;
-
-$smarty->caching = true;
-
-$my_cache_id = $_GET['article_id'];
-
-$smarty->display('index.tpl',$my_cache_id);
-
-
- Acima, nós estamos passando a variável $my_cache_id para display() com o
- cache_id. Para cada valor único de $my_cache_id, um cache em separado irá ser
- gerado para index.tpl. Nesse exemplo, "article_id" foi passado em URL e é usado
- como o cache_id.
-
-
- Notas Técnicas
-
- Tenha muito cuidado quando passar valores do cliente (web brownser) dentro
- da Smarty (ou alguma aplicação PHP.) Embora o exemplo acima usando o article_id
- vindo de uma URL pareça fácil, isso poderia ter consequências ruins. O
- cache_id é usado para criar um diretório no sistema de arquivos, então se o usuário
- decidir passar um valor extremamente largo para article_id, ou escrever um script
- que envia article_ids randômicos em um ritmo rápido, isso poderia possivelmente causar
- problemas em nível de servidor. Tenha certeza de limpar algum dado passado antes de usar isso. Nessa instãncia, talvez você
- saiba que o article_id tem um comprimento de 10 caracteres e isso é constituído somente
- de alfa-numéricos, e deve ser um
- article_id válido no database. Verifique isso!
-
-
-
- Tenha certeza de passar o mesmo cache_id como o segundo
- parâmetro para is_cached() e
- clear_cache().
-
-
- Passando um cache_id para is_cached()
-
-require('Smarty.class.php');
-$smarty = new Smarty;
-
-$smarty->caching = true;
-
-$my_cache_id = $_GET['article_id'];
-
-if(!$smarty->is_cached('index.tpl',$my_cache_id)) {
- // No cache available, do variable assignments here.
- $contents = get_database_contents();
- $smarty->assign($contents);
-}
-
-$smarty->display('index.tpl',$my_cache_id);
-
-
- Você pode limpar todos os caches para um cache_id em particular passando
- o primeiro parâmetro null para clear_cache().
-
-
- Limpando todos os caches para um cache_id em particular
-
-require('Smarty.class.php');
-$smarty = new Smarty;
-
-$smarty->caching = true;
-
-// clear all caches with "sports" as the cache_id
-$smarty->clear_cache(null,"sports");
-
-$smarty->display('index.tpl',"sports");
-
-
- Desta maneira, você pode "agrupar" seus
- caches juntos dando-lhes o mesmo cache_id.
-
-
-
- Grupos de Cache
-
- Você pode fazer agrupamentos mais elaborados configurando grupos de cache_id. Isso é
- realizado pela separação de cada sub-grupo com uma barra vertical "|" no valor do
- cache_id. Você pode ter muitos sub-grupos com você desejar.
-
-
- Grupos de cache_id
-
-require('Smarty.class.php');
-$smarty = new Smarty;
-
-$smarty->caching = true;
-
-// clear all caches with "sports|basketball" as the first two cache_id groups
-$smarty->clear_cache(null,"sports|basketball");
-
-// clear all caches with "sports" as the first cache_id group. This would
-// include "sports|basketball", or "sports|(anything)|(anything)|(anything)|..."
-$smarty->clear_cache(null,"sports");
-
-$smarty->display('index.tpl',"sports|basketball");
-
-
- Notas Técnicas
-
- O agrupamento de cache id NÃO use o path do template como alguma parte do cache_id.
- Por exemplo, se você tem display('themes/blue/index.tpl'), você não pode limpar o cache
- para tudo que estiver sob o diretório "themes/blue". Se você quiser fazer isso, você deve
- agrupá-los no cache_id, como display('themes/blue/index.tpl','themes|blue'); Então
- você pode limpar os caches para o
- tema azul com with clear_cache(null,'themes|blue');
-
-
-
-
-
- Controlling Cacheability of Plugins' Output
-
-Desde Smarty-2.6.0 os caches de plugins pode ser declarados
-ao registrá-los. O terceiro parâmetro para register_block,
-register_compiler_function e register_function é chamado
-$cacheable e o padrão para true que é também
-o comportamento de plugins na versão da Smarty antecessores à 2.6.0
-
-
-
-Quando registrando um plugin com $cacheable=false o plugin é chamado todo o tempo na página que está sendo mostrada, sempre se a página vier do cache. A função de plugin tem um comportamento levemente como uma função insert.
-
-
-
-Em contraste para {insert} o atributo para o plugin não está em cache por padrão. Eles podem ser declarados para serem cacheados com o quarto parâmetro $cache_attrs. $cache_attrs é um array de nomes de atributos que devem ser cacheados, então a função de plugin pega o valor como isso sendo o tempo que a página foi escrita para o cache todo o tempo isso é buscado do cache.
-
-
-
- Prevenindo uma saída de plugin de ser cacheada
-
-index.php:
-
-require('Smarty.class.php');
-$smarty = new Smarty;
-$smarty->caching = true;
-
-function remaining_seconds($params, &$smarty) {
- $remain = $params['endtime'] - time();
- if ($remain >=0)
- return $remain . " second(s)";
- else
- return "done";
-}
-
-$smarty->register_function('remaining', 'remaining_seconds', false, array('endtime'));
-
-if (!$smarty->is_cached('index.tpl')) {
- // fetch $obj from db and assign...
- $smarty->assign_by_ref('obj', $obj);
-}
-
-$smarty->display('index.tpl');
-
-
-index.tpl:
-
-Tempo restante: {remain endtime=$obj->endtime}
-
-O número de segundos até que o endtime de $obj alcança alterações em cada display de página, mesmo que a página esteja em cache. Desde o atributo endtime esteja em cache o objeto somente tem que ser puxado do banco de dados quando a página está escrita para o cache mas não em requisições subsequentes da página.
-
-
-
-
-
- Prevenindo uma passagem inteira do template para o cache
-
-index.php:
-
-require('Smarty.class.php');
-$smarty = new Smarty;
-$smarty->caching = true;
-
-function smarty_block_dynamic($param, $content, &$smarty) {
- return $content;
-}
-$smarty->register_block('dynamic', 'smarty_block_dynamic', false);
-
-$smarty->display('index.tpl');
-
-
-index.tpl:
-
-Page created: {"0"|date_format:"%D %H:%M:%S"}
-
-{dynamic}
-
-Now is: {"0"|date_format:"%D %H:%M:%S"}
-
-... do other stuff ...
-
-{/dynamic}
-
-
-
-Quando recarregado a página que você irá notar que ambas as datas diferem. Uma é "dinâmica" e uma é "estática". Você pode fazer qualquer coisa entre as tags {dynamic}...{/dynamic} e ter certeza que isso não irá ficar em cache como o restante da página.
-
-
+&programmers.caching.caching-cacheable;
+
+ Controlling Cacheability of Plugins' Output
+
+Desde Smarty-2.6.0 os caches de plugins pode ser declarados
+ao registrá-los. O terceiro parâmetro para register_block,
+register_compiler_function e register_function é chamado
+$cacheable e o padrão para true que é também
+o comportamento de plugins na versão da Smarty antecessores à 2.6.0
+
+
+
+Quando registrando um plugin com $cacheable=false o plugin é chamado todo o tempo na página que está sendo mostrada, sempre se a página vier do cache. A função de plugin tem um comportamento levemente como uma função insert.
+
+
+
+Em contraste para {insert} o atributo para o plugin não está em cache por padrão. Eles podem ser declarados para serem cacheados com o quarto parâmetro $cache_attrs. $cache_attrs é um array de nomes de atributos que devem ser cacheados, então a função de plugin pega o valor como isso sendo o tempo que a página foi escrita para o cache todo o tempo isso é buscado do cache.
+
+
+
+ Prevenindo uma saída de plugin de ser cacheada
+
+index.php:
+
+require('Smarty.class.php');
+$smarty = new Smarty;
+$smarty->caching = true;
+
+function remaining_seconds($params, &$smarty) {
+ $remain = $params['endtime'] - time();
+ if ($remain >=0)
+ return $remain . " second(s)";
+ else
+ return "done";
+}
+
+$smarty->register_function('remaining', 'remaining_seconds', false, array('endtime'));
+
+if (!$smarty->is_cached('index.tpl')) {
+ // fetch $obj from db and assign...
+ $smarty->assign_by_ref('obj', $obj);
+}
+
+$smarty->display('index.tpl');
+
+
+index.tpl:
+
+Tempo restante: {remain endtime=$obj->endtime}
+
+O número de segundos até que o endtime de $obj alcança alterações em cada display de página, mesmo que a página esteja em cache. Desde o atributo endtime esteja em cache o objeto somente tem que ser puxado do banco de dados quando a página está escrita para o cache mas não em requisições subsequentes da página.
+
+
+
+
+
+ Prevenindo uma passagem inteira do template para o cache
+
+index.php:
+
+require('Smarty.class.php');
+$smarty = new Smarty;
+$smarty->caching = true;
+
+function smarty_block_dynamic($param, $content, &$smarty) {
+ return $content;
+}
+$smarty->register_block('dynamic', 'smarty_block_dynamic', false);
+
+$smarty->display('index.tpl');
+
+
+index.tpl:
+
+Page created: {"0"|date_format:"%D %H:%M:%S"}
+
+{dynamic}
+
+Now is: {"0"|date_format:"%D %H:%M:%S"}
+
+... do other stuff ...
+
+{/dynamic}
+
+
+
+Quando recarregado a página que você irá notar que ambas as datas diferem. Uma é "dinâmica" e uma é "estática". Você pode fazer qualquer coisa entre as tags {dynamic}...{/dynamic} e ter certeza que isso não irá ficar em cache como o restante da página.
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/caching/caching-groups.xml b/docs/pt_BR/programmers/caching/caching-groups.xml
new file mode 100644
index 00000000..416de2e0
--- /dev/null
+++ b/docs/pt_BR/programmers/caching/caching-groups.xml
@@ -0,0 +1,58 @@
+
+
+
+ Grupos de Cache
+
+ Você pode fazer agrupamentos mais elaborados configurando grupos de cache_id. Isso é
+ realizado pela separação de cada sub-grupo com uma barra vertical "|" no valor do
+ cache_id. Você pode ter muitos sub-grupos com você desejar.
+
+
+ Grupos de cache_id
+
+require('Smarty.class.php');
+$smarty = new Smarty;
+
+$smarty->caching = true;
+
+// clear all caches with "sports|basketball" as the first two cache_id groups
+$smarty->clear_cache(null,"sports|basketball");
+
+// clear all caches with "sports" as the first cache_id group. This would
+// include "sports|basketball", or "sports|(anything)|(anything)|(anything)|..."
+$smarty->clear_cache(null,"sports");
+
+$smarty->display('index.tpl',"sports|basketball");
+
+
+ Notas Técnicas
+
+ O agrupamento de cache id NÃO use o path do template como alguma parte do cache_id.
+ Por exemplo, se você tem display('themes/blue/index.tpl'), você não pode limpar o cache
+ para tudo que estiver sob o diretório "themes/blue". Se você quiser fazer isso, você deve
+ agrupá-los no cache_id, como display('themes/blue/index.tpl','themes|blue'); Então
+ você pode limpar os caches para o
+ tema azul com with clear_cache(null,'themes|blue');
+
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/caching/caching-multiple-caches.xml b/docs/pt_BR/programmers/caching/caching-multiple-caches.xml
new file mode 100644
index 00000000..ca2d95a1
--- /dev/null
+++ b/docs/pt_BR/programmers/caching/caching-multiple-caches.xml
@@ -0,0 +1,109 @@
+
+
+
+ Multiple Caches Per Page
+
+ Você pode ter múltiplos arquivos de cache para uma simples chamada de display()
+ ou fetch(). Vamos dizer que uma chamada para display('index.tpl') deve ter vários
+ conteúdo de saída diferentes dependendo de alguma condição, e você quer separar
+ os caches para cada um. Você pode fazer isso passando um cache_id como um
+ segundo parâmetro para a chamada da função.
+
+
+ Passando um cache_id para display()
+
+require('Smarty.class.php');
+$smarty = new Smarty;
+
+$smarty->caching = true;
+
+$my_cache_id = $_GET['article_id'];
+
+$smarty->display('index.tpl',$my_cache_id);
+
+
+ Acima, nós estamos passando a variável $my_cache_id para display() com o
+ cache_id. Para cada valor único de $my_cache_id, um cache em separado irá ser
+ gerado para index.tpl. Nesse exemplo, "article_id" foi passado em URL e é usado
+ como o cache_id.
+
+
+ Notas Técnicas
+
+ Tenha muito cuidado quando passar valores do cliente (web brownser) dentro
+ da Smarty (ou alguma aplicação PHP.) Embora o exemplo acima usando o article_id
+ vindo de uma URL pareça fácil, isso poderia ter consequências ruins. O
+ cache_id é usado para criar um diretório no sistema de arquivos, então se o usuário
+ decidir passar um valor extremamente largo para article_id, ou escrever um script
+ que envia article_ids randômicos em um ritmo rápido, isso poderia possivelmente causar
+ problemas em nível de servidor. Tenha certeza de limpar algum dado passado antes de usar isso. Nessa instãncia, talvez você
+ saiba que o article_id tem um comprimento de 10 caracteres e isso é constituído somente
+ de alfa-numéricos, e deve ser um
+ article_id válido no database. Verifique isso!
+
+
+
+ Tenha certeza de passar o mesmo cache_id como o segundo
+ parâmetro para is_cached() e
+ clear_cache().
+
+
+ Passando um cache_id para is_cached()
+
+require('Smarty.class.php');
+$smarty = new Smarty;
+
+$smarty->caching = true;
+
+$my_cache_id = $_GET['article_id'];
+
+if(!$smarty->is_cached('index.tpl',$my_cache_id)) {
+ // No cache available, do variable assignments here.
+ $contents = get_database_contents();
+ $smarty->assign($contents);
+}
+
+$smarty->display('index.tpl',$my_cache_id);
+
+
+ Você pode limpar todos os caches para um cache_id em particular passando
+ o primeiro parâmetro null para clear_cache().
+
+
+ Limpando todos os caches para um cache_id em particular
+
+require('Smarty.class.php');
+$smarty = new Smarty;
+
+$smarty->caching = true;
+
+// clear all caches with "sports" as the cache_id
+$smarty->clear_cache(null,"sports");
+
+$smarty->display('index.tpl',"sports");
+
+
+ Desta maneira, você pode "agrupar" seus
+ caches juntos dando-lhes o mesmo cache_id.
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/caching/caching-setting-up.xml b/docs/pt_BR/programmers/caching/caching-setting-up.xml
new file mode 100644
index 00000000..c885282d
--- /dev/null
+++ b/docs/pt_BR/programmers/caching/caching-setting-up.xml
@@ -0,0 +1,163 @@
+
+
+
+ Configurando Caching
+
+ A primeira coisa a fazer é habilitar o caching. Isso é feito pela configuração $caching = true (or 1.)
+
+
+ Habilitando Caching
+
+require('Smarty.class.php');
+$smarty = new Smarty;
+
+$smarty->caching = true;
+
+$smarty->display('index.tpl');
+
+
+ Com caching habilitado, a chamada para a função display('index.tpl') irá trazer
+ o template como usual, mas também
+ salva uma cópia disso para o arquivo de saída (uma cópia de cache) in the $cache_dir.
+ Na próxima chamada de display('index.tpl'), a cópia em cache será usada
+ ao invés de trazer novamente o template.
+
+
+ Notas Técnicas
+
+ Os arquivos no $cache_dir são nomeados com similaridade ao nome do arquivo de template.
+ Embora eles terminem com a extensão ".php", eles não são realmente scripts executáveis de php.
+ Não edite estes arquivos!
+
+
+
+ Cada página em cache tem um período de tempo limitado determinado por $cache_lifetime. O padrão do valor é
+ 3600 segundos, ou 1 hora. Após o tempo expirar, o cache é regerado.
+ É possível dar tempos individuais para caches com seu próprio tempo
+ de expiração pela configuração $caching = 2. Veja a documentação em $cache_lifetime para detalhes.
+
+
+ Configurando cache_lifetime por cache
+
+require('Smarty.class.php');
+$smarty = new Smarty;
+
+$smarty->caching = 2; // lifetime is per cache
+
+// set the cache_lifetime for index.tpl to 5 minutes
+$smarty->cache_lifetime = 300;
+$smarty->display('index.tpl');
+
+// set the cache_lifetime for home.tpl to 1 hour
+$smarty->cache_lifetime = 3600;
+$smarty->display('home.tpl');
+
+// NOTE: the following $cache_lifetime setting will not work when $caching = 2.
+// The cache lifetime for home.tpl has already been set
+// to 1 hour, and will no longer respect the value of $cache_lifetime.
+// The home.tpl cache will still expire after 1 hour.
+$smarty->cache_lifetime = 30; // 30 seconds
+$smarty->display('home.tpl');
+
+
+ Se $compile_check está habilitado,
+ cada arquivo de template e arquivo de configuração que está envolvido com o arquivo em cache
+ é checado por modificações. Se algum destes arquivos foi modificado desde que o último cache
+ foi gerado, o cache é imediatamente regerado.
+ Isso é ligeiramente uma forma de optimização de performance de overhead, deixe $compile_check setado para false.
+
+
+ Habilitando $compile_check
+
+require('Smarty.class.php');
+$smarty = new Smarty;
+
+$smarty->caching = true;
+$smarty->compile_check = true;
+
+$smarty->display('index.tpl');
+
+
+ Se $force_compile está habilitado,
+ os arquivos de cache irão sempre ser regerados. Isso é efetivamente desativar caching.
+ $force_compile é usualmente para propósitos de debug somente, um caminho mais
+ eficiente de desativar caching é setar o $caching = false (ou 0.)
+
+
+ A função is_cached()
+ pode ser usada para testar se um template tem um cache válido ou não.
+ Se você tem um template com cache que requer alguma coisa como um retorno do banco de dados,
+ você pode usar isso para pular este processo.
+
+
+ Usando is_cached()
+
+require('Smarty.class.php');
+$smarty = new Smarty;
+
+$smarty->caching = true;
+
+if(!$smarty->is_cached('index.tpl')) {
+ // No cache available, do variable assignments here.
+ $contents = get_database_contents();
+ $smarty->assign($contents);
+}
+
+$smarty->display('index.tpl');
+
+
+ Você pode deixar partes da sua página dinâmica com a função de template insert.
+ Vamos dizer que sua página inteira pode ter cache exceto para um banner que é
+ mostrado abaixo do lado direito da sua página. Usando uma função insert para o banner,
+ você pode deixar esse elemento dinâmico dentro do conteúdo de cache. Veja a documentação
+ em insert para
+ detalhes e exemplos.
+
+
+ Você pode limpar todos os arquivos de cache com a função clear_all_cache(), ou
+ arquivos de cache individuais (ou grupos) com a função clear_cache().
+
+
+ Limpando o cache
+
+require('Smarty.class.php');
+$smarty = new Smarty;
+
+$smarty->caching = true;
+
+// clear out all cache files
+$smarty->clear_all_cache();
+
+// clear only cache for index.tpl
+$smarty->clear_cache('index.tpl');
+
+$smarty->display('index.tpl');
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/plugins.xml b/docs/pt_BR/programmers/plugins.xml
index e070e2c1..fcdeef13 100644
--- a/docs/pt_BR/programmers/plugins.xml
+++ b/docs/pt_BR/programmers/plugins.xml
@@ -24,761 +24,27 @@
funcionalidade customizadas em plugins.
-
- Como os Plugins Funcionam
-
- Plugins são sempre lidos quando requisitados. Apenas os modificadores específicos,
- funções, recursos, etc convocados em scripts de template serão lidos. Além disso, cada plugin
- é lido apenas uma vez, mesmo se você tem várias instâncias diferentes da Smarty rodando na mesma
- requisição.
-
-
- Pre/posfiltros e filtros de saída são uma parte de um caso especial. Visto que eles não são mencionados
- nos templates, eles devem ser registrados ou lidos explicitamente via funções de API antes do template
- ser processado.
- A ordem em que multiplos filtros do mesmo
- tipo são executados dependem da ordem em que eles são registrados ou lidos.
-
-
- O diretório de plugins
- pode ser uma string contendo um caminho ou um array
- contendo multiplos caminhos. Para instalar um plugin,
- simplesmente coloque-o em um dos diretórios e a Smarty irá usá-lo automaticamente.
-
-
+&programmers.plugins.plugins-howto;
-
- Convenções de Aparência
-
- Arquivos e funções de Plugin devem seguir uma convenção de aparência muito específica
- a fim de ser localizada pela Smarty.
-
-
- Os arquivos de plugin devem ser nomeados da sequinte forma:
-
-
-
- tipo.nome.php
-
-
-
-
-
- Onde tipo é um dos seguintes tipos de plugin:
-
- function
- modifier
- block
- compiler
- prefilter
- postfilter
- outputfilter
- resource
- insert
-
-
-
- E nome seria um identificador válido (letras,
- números, e underscores apenas).
-
-
- Alguns exemplos: function.html_select_date.php,
- resource.db.php,
- modifier.spacify.php.
-
-
- As funções de plugin dentro dos arquivos do plugin devem ser nomeadas da seguinte forma:
-
-
- smarty_tipo_nome
-
-
-
-
- O significado de tipo e
- nome são os mesmos de antes.
-
-
- A Smarty mostrará mensagens de erro apropriadas se o arquivo de plugins que é necessário não é encontrado,
- ou se o arquivo ou a função de plugin
- estão nomeadas inadequadamente.
-
-
+&programmers.plugins.plugins-naming-conventions;
-
- Escrevendo Plugins
-
- Os Plugins podem ser ou lidos pela Smarty automaticamente do sistema de arquivos ou eles podem
- ser registrados no tempo de execução via uma das funções
- de API register_* . Eles podem também ser
- com o uso da função API unregister_* .
-
-
- Para os plugins que são registrados no tempo de execução, o nome da(s) função(ões) de plugin
- não têm que seguir a convenção de aparência.
-
-
- Se um plugin depende de alguma funcionalidade fornecida por um outro plugin (como é o caso com alguns
- plugins embutidos com a Smarty),
- então a forma apropriada para ler o plugin necessário é esta:
-
-
-require_once $smarty->_get_plugin_filepath('function', 'html_options');
-
- Como uma regra geral, o objeto da Smarty é sempre passado para os plugins como o último parâmetro
- (com duas exceções: modificadores não passam o objeto da Smarty em tudo e blocks passam
- &$repeat depois do objeto da Smarty
- para manter compatibilidade a antigas
- versões da Smarty).
-
-
+&programmers.plugins.plugins-writing;
- Funções de Template
-
-
- void smarty_function_name
- array $params
- object &$smarty
-
-
-
- Todos os atributos passados para as funções de template a
- partir do template estão contidas em
- $params como um array associativo. Ou acessa esses valores
- diretamente i.e $params['start'] ou usa
- extract($params) para
- importá-los para dentro da tabela símbolo.
-
-
- A saída (valor de retorno) da função será substituída no lugar da tag da função no template
- (a função fetch, por exemplo). Alternativamente, a função pode simplesmente executar
- alguma outra tarefa sem ter alguma saída
- (a função assign).
-
-
- Se a função precisa passar valores a algumas variáveis para o template ou utilizar alguma outra funcionalidade
- fornecida com a Smarty, ela pode usar
- o objeto $smarty fornecido para fazer isso.
-
-
- Veja também:
- register_function(),
- unregister_function().
-
-
-
- função de plugin com saída
-
-<?php
-/*
- * Smarty plugin
- * -------------------------------------------------------------
- * File: function.eightball.php
- * Type: function
- * Name: eightball
- * Purpose: outputs a random magic answer
- * -------------------------------------------------------------
- */
-function smarty_function_eightball($params, &$smarty)
-{
- $answers = array('Yes',
- 'No',
- 'No way',
- 'Outlook not so good',
- 'Ask again soon',
- 'Maybe in your reality');
+&programmers.plugins.plugins-functions;
- $result = array_rand($answers);
- return $answers[$result];
-}
-?>
-
-
-
- que pode ser usada no template da seguinte forma:
-
-
-Pergunta: Nós sempre teremos tempo para viajar?
-Resposta: {eightball}.
-
-
- função de plugin sem saída
-
-<?php
-/*
- * Smarty plugin
- * -------------------------------------------------------------
- * File: function.assign.php
- * Type: function
- * Name: assign
- * Purpose: assign a value to a template variable
- * -------------------------------------------------------------
- */
-function smarty_function_assign($params, &$smarty)
-{
- extract($params);
+&programmers.plugins.plugins-modifiers;
- if (empty($var)) {
- $smarty->trigger_error("assign: missing 'var' parameter");
- return;
- }
+&programmers.plugins.plugins-block-functions;
- if (!in_array('value', array_keys($params))) {
- $smarty->trigger_error("assign: missing 'value' parameter");
- return;
- }
+&programmers.plugins.plugins-compiler-functions;
- $smarty->assign($var, $value);
-}
-?>
-
-
-
+&programmers.plugins.plugins-prefilters-postfilters;
- Modifiers
-
- Modificadores são funções que são aplicadas a uma variável no template antes dela ser mostrada
- ou usada em algum outro contexto.
- Modificadores podem ser encadeados juntos.
-
-
-
- mixed smarty_modifier_name
- mixed $value
- [mixed $param1, ...]
-
-
-
- O primeiro parâmetro para o plugin midificador é o valor em que o modificador é suposto
- operar. O resto dos parâmetros podem ser opcionais,
- dependendo de qual tipo de operação é para
- ser executada.
-
-
- O modificador deve retornar o resultado de seu processamento.
-
-
- Veja também:
- register_modifier(),
- unregister_modifier().
-
-
- Plugin modificador simples
-
- Este plugin basiamente é um alias de uma
- função do PHP. Ele não tem nenhum parâmetro adicional.
-
-
-<?php
-/*
- * Smarty plugin
- * -------------------------------------------------------------
- * File: modifier.capitalize.php
- * Type: modifier
- * Name: capitalize
- * Purpose: capitalize words in the string
- * -------------------------------------------------------------
- */
-function smarty_modifier_capitalize($string)
-{
- return ucwords($string);
-}
-?>
-
-
-
- Plugin modificador mais complexo
-
-<?php
-/*
- * Smarty plugin
- * -------------------------------------------------------------
- * File: modifier.truncate.php
- * Type: modifier
- * Name: truncate
- * Purpose: Truncate a string to a certain length if necessary,
- * optionally splitting in the middle of a word, and
- * appending the $etc string.
- * -------------------------------------------------------------
- */
-function smarty_modifier_truncate($string, $length = 80, $etc = '...',
- $break_words = false)
-{
- if ($length == 0)
- return '';
+&programmers.plugins.plugins-outputfilters;
- if (strlen($string) > $length) {
- $length -= strlen($etc);
- $fragment = substr($string, 0, $length+1);
- if ($break_words)
- $fragment = substr($fragment, 0, -1);
- else
- $fragment = preg_replace('/\s+(\S+)?$/', '', $fragment);
- return $fragment.$etc;
- } else
- return $string;
-}
-?>
-
-
+&programmers.plugins.plugins-resources;
- Block Functions
-
-
- void smarty_block_name
- array $params
- mixed $content
- object &$smarty
-
-
-
- Funções de Block são funções da forma: {func} .. {/func}. Em outras palavras, ele enclausura
- um bloco de template e opera no conteúdo deste bloco. Funções de Block tem precedência sobre
- funções customizadas com mesmo nome,
- assim, você não pode ter ambas, função customizável {func} e
- função de Bloco {func} .. {/func}.
-
-
- Por definição a implementação de sua função é chamada duas vezes pela Smarty: uma vez pela tag de abertura,
- e outra pela tag de fechamento
- (veja &$repeat abaixo para como mudar isto).
-
-
- Apenas a tag de abertura da função de bloco pode ter atributos.
- Todos os atributos passados para as funções de
- template estão contidos em $params como um array associativo. Você pode ou acessar
- esses valores diretamente, i.e. $params['start']
- ou usar extract($params)
- para importá-los para dentro da tabela símbolo. Os atributos da tag de
- abertura são também acessíveis a sua função
- quando processando a tag de fechamento.
-
-
- O valor da variável $content
- depende de que se sua função é chamada pela tag de
- fechamento ou de abertura. Caso seja a de abertura, ele será
- null, se for a de fechamento
- o valor será do conteúdo do bloco de template.
- Note que o bloco de template já terá sido processado pela
- Smarty, então tudo que você receberá é saída do template, não o template original.
-
-
-
- O parâmetro &$repeat é passado por
- referência para a função de implementação
- e fornece uma possibilidade para ele controlar quantas
- vezes o bloco é mostrado. Por definição
- $repeat é true na primeira chamada da block-function
- (a tag de abertura do bloco) e false
- em todas as chamadas subsequentes à função de bloco
- (a tag de fechamento do bloco). Cada vez que a
- implementação da função retorna com o &$repeat
- sendo true, o conteúdo entre {func} .. {/func} é avaliado
- e a implementação da função é chamada novamente com
- o novo conteúdo do bloco no parâmetro $content.
-
-
-
-
- Se você tem funções de bloco aninhadas, é possível
- descobrir qual é a função de bloco pai acessando
- a variável $smarty->_tag_stack. Apenas faça um var_dump()
- nela e a estrutura estaria visível.
-
-
- See also:
- register_block(),
- unregister_block().
-
-
- função de bloco
-
-<?php
-/*
- * Smarty plugin
- * -------------------------------------------------------------
- * File: block.translate.php
- * Type: block
- * Name: translate
- * Purpose: translate a block of text
- * -------------------------------------------------------------
- */
-function smarty_block_translate($params, $content, &$smarty)
-{
- if (isset($content)) {
- $lang = $params['lang'];
- // do some intelligent translation thing here with $content
- return $translation;
- }
-}
-
-
-
- Funções Compiladoras
-
- Funções compiladoras só são chamadas durante a compilação do template.
- Elas são úteis para injeção de código PHP ou conteúdo estático time-sensitive
- dentro do template. Se há ambos, uma função
- compiladora e uma função customizável
- registrada sob o mesmo nome, a função compiladora tem precedência.
-
-
-
- mixed smarty_compiler_name
- string $tag_arg
- object &$smarty
-
-
-
- À função compiladora são passados dois parâmetros:
- a tag string de argumento da tag - basicamente, tudo a partir
- do nome da função até o delimitador de fechamento, e o objeto da Smarty. É suposto que retorna o código PHP
- para ser injetado dentro do template compilado.
-
-
- See also
- register_compiler_function(),
- unregister_compiler_function().
-
-
- função compiladora simples
-
-<?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'). "';";
-}
-?>
-
- Esta função pode ser chamada em um template da seguinte forma:
-
-
-{* esta função é executada somente no tempo de compilação *}
-{tplheader}
-
- O código PHP resultante no template compilado seria algo assim:
-
-
-<php
-echo 'index.tpl compiled at 2002-02-20 20:02';
-?>
-
-
-
-
- Prefiltros/Posfiltros
-
- Plugins Prefilter e postfilter são muito similares
- em conceito; onde eles diferem é na execução -- mais
- precisamente no tempo de suas execuções.
-
-
-
- string smarty_prefilter_name
- string $source
- object &$smarty
-
-
-
- Prefilters são usados para processar o fonte do template
- imediatamente antes da compilação. O primeiro parâmetro da
- função de prefilter é o fonte do template, possivelmente modificado por alguns outros prefilters. O Plugin
- é suposto retornar o fonte modificado. Note que este fonte não é salvo em lugar nenhum, ele só é usado para
- a compilação.
-
-
-
- string smarty_postfilter_name
- string $compiled
- object &$smarty
-
-
-
- Postfilters são usados para processar a saída compilada do template (o código PHP) imediatamente após
- a compilação ser feita e antes do template compilado ser
- salvo no sistema de arquivo. O primeiro parâmetro
- para a função postfilter é o código do template compilado,
- possivelmente modificado por outros postfilters.
- O plugin é suposto retornar a versão modificada deste código.
-
-
- Plugin prefilter
-
-<?php
-/*
- * Smarty plugin
- * -------------------------------------------------------------
- * File: prefilter.pre01.php
- * Type: prefilter
- * Name: pre01
- * Purpose: Convert html tags to be lowercase.
- * -------------------------------------------------------------
- */
- function smarty_prefilter_pre01($source, &$smarty)
- {
- return preg_replace('!<(\w+)[^>]+>!e', 'strtolower("$1")', $source);
- }
-?>
-
-
-
- Plugin postfilter
-
-<?php
-/*
- * Smarty plugin
- * -------------------------------------------------------------
- * File: postfilter.post01.php
- * Type: postfilter
- * Name: post01
- * Purpose: Output code that lists all current template vars.
- * -------------------------------------------------------------
- */
- function smarty_postfilter_post01($compiled, &$smarty)
- {
- $compiled = "<pre>\n<?php print_r(\$this->get_template_vars()); ?>\n</pre>" . $compiled;
- return $compiled;
- }
-?>
-
-
-
- Filtros de saída
-
- Filtros de saída operam na saída do template, depois que o template é lido e executado, mas
- antes a saída é mostrada.
-
-
-
- string smarty_outputfilter_name
- string $template_output
- object &$smarty
-
-
-
- O primeiro parâmetro para a função do filtro de saída é a saída do template que precisa ser processada, e
- o segundo parâmetro é a instância da Smarty invocando o plugin.
- O plugin deve fazer o precessamento e
- retornar os resultados.
-
-
- output filter plugin
-
-/*
- * Smarty plugin
- * -------------------------------------------------------------
- * File: outputfilter.protect_email.php
- * Type: outputfilter
- * Name: protect_email
- * Purpose: Converts @ sign in email addresses to %40 as
- * a simple protection against spambots
- * -------------------------------------------------------------
- */
- function smarty_outputfilter_protect_email($output, &$smarty)
- {
- return preg_replace('!(\S+)@([a-zA-Z0-9\.\-]+\.([a-zA-Z]{2,3}|[0-9]{1,3}))!',
- '$1%40$2', $output);
- }
-
-
-
-
- Recursos (Resources)
-
- Os plugins de Recursos são como uma forma genérica de fornecer códigos fontes de template
- ou componentes de script PHP para a Smarty. Alguns exemplos de recursos:
- banco de dados, LDAP, memória compartilhada, sockets, e assim por diante.
-
-
-
- Há um total de 4 funções que precisam estar registradas
- para cada tipo de recurso. Cada função receberá
- o recurso requisitado como o primeiro parâmetro e o objeto da Smarty como o último parâmetro. O resto
- dos parâmetros dependem da função.
-
-
-
-
- bool smarty_resource_name_source
- string $rsrc_name
- string &$source
- object &$smarty
-
-
- bool smarty_resource_name_timestamp
- string $rsrc_name
- int &$timestamp
- object &$smarty
-
-
- bool smarty_resource_name_secure
- string $rsrc_name
- object &$smarty
-
-
- bool smarty_resource_name_trusted
- string $rsrc_name
- object &$smarty
-
-
-
-
- A primeira função deve devolver o recurso. Seu segundo parâmetro é uma variável passada por
- referência onde o resultado seria armazenado.
- A função deve retornar true se
- ela está apta a devolver com sucesso o recurso e
- caso contrário retorna false.
-
-
-
- A segunda função deve devolver a última modificação do
- recurso requisitado (como um timestamp Unix).
- O segundo parâmetro é uma variável passada por referência onde o timestamp seria armazenado.
- A função deve retornar true
- se o timestamp poderia ser determinado com sucesso,
- e caso contrário retornaria false.
-
-
-
- A terceira função deve retornar true ou
- false, dependendo do recurso requisitado
- está seguro ou não. Esta função é usada
- apenas para recursos de template mas ainda assim seria definida.
-
-
-
- A quarta função deve retornar true
- ou false, dependendo
- do recurso requisitado ser confiável ou não.
- Esta função é usada apenas para componentes de
- script PHP requisitados pelas tags include_php ou
- insert com o atributo src.
- Entretanto, ela ainda assim mesmo seria definida para os recursos de template.
-
-
- Veja também:
- register_resource(),
- unregister_resource().
-
-
- Plugin resource (recurso)
-
-<?php
-/*
- * Smarty plugin
- * -------------------------------------------------------------
- * File: resource.db.php
- * Type: resource
- * Name: db
- * Purpose: Fetches templates from a database
- * -------------------------------------------------------------
- */
-function smarty_resource_db_source($tpl_name, &$tpl_source, &$smarty)
-{
- // do database call here to fetch your template,
- // populating $tpl_source
- $sql = new SQL;
- $sql->query("select tpl_source
- from my_table
- where tpl_name='$tpl_name'");
- if ($sql->num_rows) {
- $tpl_source = $sql->record['tpl_source'];
- return true;
- } else {
- return false;
- }
-}
-
-function smarty_resource_db_timestamp($tpl_name, &$tpl_timestamp, &$smarty)
-{
- // faz o banco de dados chamar aqui para preencher $tpl_timestamp.
- $sql = new SQL;
- $sql->query("select tpl_timestamp
- from my_table
- where tpl_name='$tpl_name'");
- if ($sql->num_rows) {
- $tpl_timestamp = $sql->record['tpl_timestamp'];
- return true;
- } else {
- return false;
- }
-}
-
-function smarty_resource_db_secure($tpl_name, &$smarty)
-{
- // assume que todos os templates são seguros
- return true;
-}
-
-function smarty_resource_db_trusted($tpl_name, &$smarty)
-{
- // não usado para templates
-}
-?>
-
-
-
- Inserts
-
- Plugins Insert são usados para implementar funções que são invocadas por tags
- insert
- no template.
-
-
-
- string smarty_insert_name
- array $params
- object &$smarty
-
-
-
- O primeiro parâmetro para a função é um array
- associativo de atributos passados para o
- insert. Ou acessa esses valores diretamente,
- i.e. $params['start'] ou usa
- extract($params) para importá-los para dentro da tabela símbolo.
-
-
- A função insert deve retornar o
- resultado que será substituído no lugar da tag
- insert no template.
-
-
- Plugin insert
-
-<?php
-/*
- * Smarty plugin
- * -------------------------------------------------------------
- * File: insert.time.php
- * Type: time
- * Name: time
- * Purpose: Inserts current date/time according to format
- * -------------------------------------------------------------
- */
-function smarty_insert_time($params, &$smarty)
-{
- if (empty($params['format'])) {
- $smarty->trigger_error("insert time: missing 'format' parameter");
- return;
- }
-
- $datetime = strftime($params['format']);
- return $datetime;
-}
-?>
-
-
+&programmers.plugins.plugins-inserts;
+ Block Functions
+
+
+ void smarty_block_name
+ array $params
+ mixed $content
+ object &$smarty
+
+
+
+ Funções de Block são funções da forma: {func} .. {/func}. Em outras palavras, ele enclausura
+ um bloco de template e opera no conteúdo deste bloco. Funções de Block tem precedência sobre
+ funções customizadas com mesmo nome,
+ assim, você não pode ter ambas, função customizável {func} e
+ função de Bloco {func} .. {/func}.
+
+
+ Por definição a implementação de sua função é chamada duas vezes pela Smarty: uma vez pela tag de abertura,
+ e outra pela tag de fechamento
+ (veja &$repeat abaixo para como mudar isto).
+
+
+ Apenas a tag de abertura da função de bloco pode ter atributos.
+ Todos os atributos passados para as funções de
+ template estão contidos em $params como um array associativo. Você pode ou acessar
+ esses valores diretamente, i.e. $params['start']
+ ou usar extract($params)
+ para importá-los para dentro da tabela símbolo. Os atributos da tag de
+ abertura são também acessíveis a sua função
+ quando processando a tag de fechamento.
+
+
+ O valor da variável $content
+ depende de que se sua função é chamada pela tag de
+ fechamento ou de abertura. Caso seja a de abertura, ele será
+ null, se for a de fechamento
+ o valor será do conteúdo do bloco de template.
+ Note que o bloco de template já terá sido processado pela
+ Smarty, então tudo que você receberá é saída do template, não o template original.
+
+
+
+ O parâmetro &$repeat é passado por
+ referência para a função de implementação
+ e fornece uma possibilidade para ele controlar quantas
+ vezes o bloco é mostrado. Por definição
+ $repeat é true na primeira chamada da block-function
+ (a tag de abertura do bloco) e false
+ em todas as chamadas subsequentes à função de bloco
+ (a tag de fechamento do bloco). Cada vez que a
+ implementação da função retorna com o &$repeat
+ sendo true, o conteúdo entre {func} .. {/func} é avaliado
+ e a implementação da função é chamada novamente com
+ o novo conteúdo do bloco no parâmetro $content.
+
+
+
+
+ Se você tem funções de bloco aninhadas, é possível
+ descobrir qual é a função de bloco pai acessando
+ a variável $smarty->_tag_stack. Apenas faça um var_dump()
+ nela e a estrutura estaria visível.
+
+
+ See also:
+ register_block(),
+ unregister_block().
+
+
+ função de bloco
+
+<?php
+/*
+ * Smarty plugin
+ * -------------------------------------------------------------
+ * File: block.translate.php
+ * Type: block
+ * Name: translate
+ * Purpose: translate a block of text
+ * -------------------------------------------------------------
+ */
+function smarty_block_translate($params, $content, &$smarty)
+{
+ if (isset($content)) {
+ $lang = $params['lang'];
+ // do some intelligent translation thing here with $content
+ return $translation;
+ }
+}
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/plugins/plugins-compiler-functions.xml b/docs/pt_BR/programmers/plugins/plugins-compiler-functions.xml
new file mode 100644
index 00000000..c68c5b82
--- /dev/null
+++ b/docs/pt_BR/programmers/plugins/plugins-compiler-functions.xml
@@ -0,0 +1,82 @@
+
+
+ Funções Compiladoras
+
+ Funções compiladoras só são chamadas durante a compilação do template.
+ Elas são úteis para injeção de código PHP ou conteúdo estático time-sensitive
+ dentro do template. Se há ambos, uma função
+ compiladora e uma função customizável
+ registrada sob o mesmo nome, a função compiladora tem precedência.
+
+
+
+ mixed smarty_compiler_name
+ string $tag_arg
+ object &$smarty
+
+
+
+ À função compiladora são passados dois parâmetros:
+ a tag string de argumento da tag - basicamente, tudo a partir
+ do nome da função até o delimitador de fechamento, e o objeto da Smarty. É suposto que retorna o código PHP
+ para ser injetado dentro do template compilado.
+
+
+ See also
+ register_compiler_function(),
+ unregister_compiler_function().
+
+
+ função compiladora simples
+
+<?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'). "';";
+}
+?>
+
+ Esta função pode ser chamada em um template da seguinte forma:
+
+
+{* esta função é executada somente no tempo de compilação *}
+{tplheader}
+
+ O código PHP resultante no template compilado seria algo assim:
+
+
+<php
+echo 'index.tpl compiled at 2002-02-20 20:02';
+?>
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/plugins/plugins-functions.xml b/docs/pt_BR/programmers/plugins/plugins-functions.xml
new file mode 100644
index 00000000..6e603056
--- /dev/null
+++ b/docs/pt_BR/programmers/plugins/plugins-functions.xml
@@ -0,0 +1,123 @@
+
+
+ Funções de Template
+
+
+ void smarty_function_name
+ array $params
+ object &$smarty
+
+
+
+ Todos os atributos passados para as funções de template a
+ partir do template estão contidas em
+ $params como um array associativo. Ou acessa esses valores
+ diretamente i.e $params['start'] ou usa
+ extract($params) para
+ importá-los para dentro da tabela símbolo.
+
+
+ A saída (valor de retorno) da função será substituída no lugar da tag da função no template
+ (a função fetch, por exemplo). Alternativamente, a função pode simplesmente executar
+ alguma outra tarefa sem ter alguma saída
+ (a função assign).
+
+
+ Se a função precisa passar valores a algumas variáveis para o template ou utilizar alguma outra funcionalidade
+ fornecida com a Smarty, ela pode usar
+ o objeto $smarty fornecido para fazer isso.
+
+
+ Veja também:
+ register_function(),
+ unregister_function().
+
+
+
+ função de plugin com saída
+
+<?php
+/*
+ * Smarty plugin
+ * -------------------------------------------------------------
+ * File: function.eightball.php
+ * Type: function
+ * Name: eightball
+ * Purpose: outputs a random magic answer
+ * -------------------------------------------------------------
+ */
+function smarty_function_eightball($params, &$smarty)
+{
+ $answers = array('Yes',
+ 'No',
+ 'No way',
+ 'Outlook not so good',
+ 'Ask again soon',
+ 'Maybe in your reality');
+
+ $result = array_rand($answers);
+ return $answers[$result];
+}
+?>
+
+
+
+ que pode ser usada no template da seguinte forma:
+
+
+Pergunta: Nós sempre teremos tempo para viajar?
+Resposta: {eightball}.
+
+
+ função de plugin sem saída
+
+<?php
+/*
+ * Smarty plugin
+ * -------------------------------------------------------------
+ * File: function.assign.php
+ * Type: function
+ * Name: assign
+ * Purpose: assign a value to a template variable
+ * -------------------------------------------------------------
+ */
+function smarty_function_assign($params, &$smarty)
+{
+ extract($params);
+
+ if (empty($var)) {
+ $smarty->trigger_error("assign: missing 'var' parameter");
+ return;
+ }
+
+ if (!in_array('value', array_keys($params))) {
+ $smarty->trigger_error("assign: missing 'value' parameter");
+ return;
+ }
+
+ $smarty->assign($var, $value);
+}
+?>
+
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/plugins/plugins-howto.xml b/docs/pt_BR/programmers/plugins/plugins-howto.xml
new file mode 100644
index 00000000..f5103872
--- /dev/null
+++ b/docs/pt_BR/programmers/plugins/plugins-howto.xml
@@ -0,0 +1,44 @@
+
+
+
+ Como os Plugins Funcionam
+
+ Plugins são sempre lidos quando requisitados. Apenas os modificadores específicos,
+ funções, recursos, etc convocados em scripts de template serão lidos. Além disso, cada plugin
+ é lido apenas uma vez, mesmo se você tem várias instâncias diferentes da Smarty rodando na mesma
+ requisição.
+
+
+ Pre/posfiltros e filtros de saída são uma parte de um caso especial. Visto que eles não são mencionados
+ nos templates, eles devem ser registrados ou lidos explicitamente via funções de API antes do template
+ ser processado.
+ A ordem em que multiplos filtros do mesmo
+ tipo são executados dependem da ordem em que eles são registrados ou lidos.
+
+
+ O diretório de plugins
+ pode ser uma string contendo um caminho ou um array
+ contendo multiplos caminhos. Para instalar um plugin,
+ simplesmente coloque-o em um dos diretórios e a Smarty irá usá-lo automaticamente.
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/plugins/plugins-inserts.xml b/docs/pt_BR/programmers/plugins/plugins-inserts.xml
new file mode 100644
index 00000000..679b4ec2
--- /dev/null
+++ b/docs/pt_BR/programmers/plugins/plugins-inserts.xml
@@ -0,0 +1,73 @@
+
+
+ Inserts
+
+ Plugins Insert são usados para implementar funções que são invocadas por tags
+ insert
+ no template.
+
+
+
+ string smarty_insert_name
+ array $params
+ object &$smarty
+
+
+
+ O primeiro parâmetro para a função é um array
+ associativo de atributos passados para o
+ insert. Ou acessa esses valores diretamente,
+ i.e. $params['start'] ou usa
+ extract($params) para importá-los para dentro da tabela símbolo.
+
+
+ A função insert deve retornar o
+ resultado que será substituído no lugar da tag
+ insert no template.
+
+
+ Plugin insert
+
+<?php
+/*
+ * Smarty plugin
+ * -------------------------------------------------------------
+ * File: insert.time.php
+ * Type: time
+ * Name: time
+ * Purpose: Inserts current date/time according to format
+ * -------------------------------------------------------------
+ */
+function smarty_insert_time($params, &$smarty)
+{
+ if (empty($params['format'])) {
+ $smarty->trigger_error("insert time: missing 'format' parameter");
+ return;
+ }
+
+ $datetime = strftime($params['format']);
+ return $datetime;
+}
+?>
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/plugins/plugins-modifiers.xml b/docs/pt_BR/programmers/plugins/plugins-modifiers.xml
new file mode 100644
index 00000000..a5b9f176
--- /dev/null
+++ b/docs/pt_BR/programmers/plugins/plugins-modifiers.xml
@@ -0,0 +1,108 @@
+
+
+ Modifiers
+
+ Modificadores são funções que são aplicadas a uma variável no template antes dela ser mostrada
+ ou usada em algum outro contexto.
+ Modificadores podem ser encadeados juntos.
+
+
+
+ mixed smarty_modifier_name
+ mixed $value
+ [mixed $param1, ...]
+
+
+
+ O primeiro parâmetro para o plugin midificador é o valor em que o modificador é suposto
+ operar. O resto dos parâmetros podem ser opcionais,
+ dependendo de qual tipo de operação é para
+ ser executada.
+
+
+ O modificador deve retornar o resultado de seu processamento.
+
+
+ Veja também:
+ register_modifier(),
+ unregister_modifier().
+
+
+ Plugin modificador simples
+
+ Este plugin basiamente é um alias de uma
+ função do PHP. Ele não tem nenhum parâmetro adicional.
+
+
+<?php
+/*
+ * Smarty plugin
+ * -------------------------------------------------------------
+ * File: modifier.capitalize.php
+ * Type: modifier
+ * Name: capitalize
+ * Purpose: capitalize words in the string
+ * -------------------------------------------------------------
+ */
+function smarty_modifier_capitalize($string)
+{
+ return ucwords($string);
+}
+?>
+
+
+
+ Plugin modificador mais complexo
+
+<?php
+/*
+ * Smarty plugin
+ * -------------------------------------------------------------
+ * File: modifier.truncate.php
+ * Type: modifier
+ * Name: truncate
+ * Purpose: Truncate a string to a certain length if necessary,
+ * optionally splitting in the middle of a word, and
+ * appending the $etc string.
+ * -------------------------------------------------------------
+ */
+function smarty_modifier_truncate($string, $length = 80, $etc = '...',
+ $break_words = false)
+{
+ if ($length == 0)
+ return '';
+
+ if (strlen($string) > $length) {
+ $length -= strlen($etc);
+ $fragment = substr($string, 0, $length+1);
+ if ($break_words)
+ $fragment = substr($fragment, 0, -1);
+ else
+ $fragment = preg_replace('/\s+(\S+)?$/', '', $fragment);
+ return $fragment.$etc;
+ } else
+ return $string;
+}
+?>
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/plugins/plugins-naming-conventions.xml b/docs/pt_BR/programmers/plugins/plugins-naming-conventions.xml
new file mode 100644
index 00000000..563e4af2
--- /dev/null
+++ b/docs/pt_BR/programmers/plugins/plugins-naming-conventions.xml
@@ -0,0 +1,79 @@
+
+
+
+ Convenções de Aparência
+
+ Arquivos e funções de Plugin devem seguir uma convenção de aparência muito específica
+ a fim de ser localizada pela Smarty.
+
+
+ Os arquivos de plugin devem ser nomeados da sequinte forma:
+
+
+
+ tipo.nome.php
+
+
+
+
+
+ Onde tipo é um dos seguintes tipos de plugin:
+
+ function
+ modifier
+ block
+ compiler
+ prefilter
+ postfilter
+ outputfilter
+ resource
+ insert
+
+
+
+ E nome seria um identificador válido (letras,
+ números, e underscores apenas).
+
+
+ Alguns exemplos: function.html_select_date.php,
+ resource.db.php,
+ modifier.spacify.php.
+
+
+ As funções de plugin dentro dos arquivos do plugin devem ser nomeadas da seguinte forma:
+
+
+ smarty_tipo_nome
+
+
+
+
+ O significado de tipo e
+ nome são os mesmos de antes.
+
+
+ A Smarty mostrará mensagens de erro apropriadas se o arquivo de plugins que é necessário não é encontrado,
+ ou se o arquivo ou a função de plugin
+ estão nomeadas inadequadamente.
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/plugins/plugins-outputfilters.xml b/docs/pt_BR/programmers/plugins/plugins-outputfilters.xml
new file mode 100644
index 00000000..04a24d93
--- /dev/null
+++ b/docs/pt_BR/programmers/plugins/plugins-outputfilters.xml
@@ -0,0 +1,61 @@
+
+
+ Filtros de saída
+
+ Filtros de saída operam na saída do template, depois que o template é lido e executado, mas
+ antes a saída é mostrada.
+
+
+
+ string smarty_outputfilter_name
+ string $template_output
+ object &$smarty
+
+
+
+ O primeiro parâmetro para a função do filtro de saída é a saída do template que precisa ser processada, e
+ o segundo parâmetro é a instância da Smarty invocando o plugin.
+ O plugin deve fazer o precessamento e
+ retornar os resultados.
+
+
+ output filter plugin
+
+/*
+ * Smarty plugin
+ * -------------------------------------------------------------
+ * File: outputfilter.protect_email.php
+ * Type: outputfilter
+ * Name: protect_email
+ * Purpose: Converts @ sign in email addresses to %40 as
+ * a simple protection against spambots
+ * -------------------------------------------------------------
+ */
+ function smarty_outputfilter_protect_email($output, &$smarty)
+ {
+ return preg_replace('!(\S+)@([a-zA-Z0-9\.\-]+\.([a-zA-Z]{2,3}|[0-9]{1,3}))!',
+ '$1%40$2', $output);
+ }
+
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/plugins/plugins-prefilters-postfilters.xml b/docs/pt_BR/programmers/plugins/plugins-prefilters-postfilters.xml
new file mode 100644
index 00000000..f35539a8
--- /dev/null
+++ b/docs/pt_BR/programmers/plugins/plugins-prefilters-postfilters.xml
@@ -0,0 +1,99 @@
+
+
+
+ Prefiltros/Posfiltros
+
+ Plugins Prefilter e postfilter são muito similares
+ em conceito; onde eles diferem é na execução -- mais
+ precisamente no tempo de suas execuções.
+
+
+
+ string smarty_prefilter_name
+ string $source
+ object &$smarty
+
+
+
+ Prefilters são usados para processar o fonte do template
+ imediatamente antes da compilação. O primeiro parâmetro da
+ função de prefilter é o fonte do template, possivelmente modificado por alguns outros prefilters. O Plugin
+ é suposto retornar o fonte modificado. Note que este fonte não é salvo em lugar nenhum, ele só é usado para
+ a compilação.
+
+
+
+ string smarty_postfilter_name
+ string $compiled
+ object &$smarty
+
+
+
+ Postfilters são usados para processar a saída compilada do template (o código PHP) imediatamente após
+ a compilação ser feita e antes do template compilado ser
+ salvo no sistema de arquivo. O primeiro parâmetro
+ para a função postfilter é o código do template compilado,
+ possivelmente modificado por outros postfilters.
+ O plugin é suposto retornar a versão modificada deste código.
+
+
+ Plugin prefilter
+
+<?php
+/*
+ * Smarty plugin
+ * -------------------------------------------------------------
+ * File: prefilter.pre01.php
+ * Type: prefilter
+ * Name: pre01
+ * Purpose: Convert html tags to be lowercase.
+ * -------------------------------------------------------------
+ */
+ function smarty_prefilter_pre01($source, &$smarty)
+ {
+ return preg_replace('!<(\w+)[^>]+>!e', 'strtolower("$1")', $source);
+ }
+?>
+
+
+
+ Plugin postfilter
+
+<?php
+/*
+ * Smarty plugin
+ * -------------------------------------------------------------
+ * File: postfilter.post01.php
+ * Type: postfilter
+ * Name: post01
+ * Purpose: Output code that lists all current template vars.
+ * -------------------------------------------------------------
+ */
+ function smarty_postfilter_post01($compiled, &$smarty)
+ {
+ $compiled = "<pre>\n<?php print_r(\$this->get_template_vars()); ?>\n</pre>" . $compiled;
+ return $compiled;
+ }
+?>
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/plugins/plugins-resources.xml b/docs/pt_BR/programmers/plugins/plugins-resources.xml
new file mode 100644
index 00000000..300d5e2e
--- /dev/null
+++ b/docs/pt_BR/programmers/plugins/plugins-resources.xml
@@ -0,0 +1,156 @@
+
+
+ Recursos (Resources)
+
+ Os plugins de Recursos são como uma forma genérica de fornecer códigos fontes de template
+ ou componentes de script PHP para a Smarty. Alguns exemplos de recursos:
+ banco de dados, LDAP, memória compartilhada, sockets, e assim por diante.
+
+
+
+ Há um total de 4 funções que precisam estar registradas
+ para cada tipo de recurso. Cada função receberá
+ o recurso requisitado como o primeiro parâmetro e o objeto da Smarty como o último parâmetro. O resto
+ dos parâmetros dependem da função.
+
+
+
+
+ bool smarty_resource_name_source
+ string $rsrc_name
+ string &$source
+ object &$smarty
+
+
+ bool smarty_resource_name_timestamp
+ string $rsrc_name
+ int &$timestamp
+ object &$smarty
+
+
+ bool smarty_resource_name_secure
+ string $rsrc_name
+ object &$smarty
+
+
+ bool smarty_resource_name_trusted
+ string $rsrc_name
+ object &$smarty
+
+
+
+
+ A primeira função deve devolver o recurso. Seu segundo parâmetro é uma variável passada por
+ referência onde o resultado seria armazenado.
+ A função deve retornar true se
+ ela está apta a devolver com sucesso o recurso e
+ caso contrário retorna false.
+
+
+
+ A segunda função deve devolver a última modificação do
+ recurso requisitado (como um timestamp Unix).
+ O segundo parâmetro é uma variável passada por referência onde o timestamp seria armazenado.
+ A função deve retornar true
+ se o timestamp poderia ser determinado com sucesso,
+ e caso contrário retornaria false.
+
+
+
+ A terceira função deve retornar true ou
+ false, dependendo do recurso requisitado
+ está seguro ou não. Esta função é usada
+ apenas para recursos de template mas ainda assim seria definida.
+
+
+
+ A quarta função deve retornar true
+ ou false, dependendo
+ do recurso requisitado ser confiável ou não.
+ Esta função é usada apenas para componentes de
+ script PHP requisitados pelas tags include_php ou
+ insert com o atributo src.
+ Entretanto, ela ainda assim mesmo seria definida para os recursos de template.
+
+
+ Veja também:
+ register_resource(),
+ unregister_resource().
+
+
+ Plugin resource (recurso)
+
+<?php
+/*
+ * Smarty plugin
+ * -------------------------------------------------------------
+ * File: resource.db.php
+ * Type: resource
+ * Name: db
+ * Purpose: Fetches templates from a database
+ * -------------------------------------------------------------
+ */
+function smarty_resource_db_source($tpl_name, &$tpl_source, &$smarty)
+{
+ // do database call here to fetch your template,
+ // populating $tpl_source
+ $sql = new SQL;
+ $sql->query("select tpl_source
+ from my_table
+ where tpl_name='$tpl_name'");
+ if ($sql->num_rows) {
+ $tpl_source = $sql->record['tpl_source'];
+ return true;
+ } else {
+ return false;
+ }
+}
+
+function smarty_resource_db_timestamp($tpl_name, &$tpl_timestamp, &$smarty)
+{
+ // faz o banco de dados chamar aqui para preencher $tpl_timestamp.
+ $sql = new SQL;
+ $sql->query("select tpl_timestamp
+ from my_table
+ where tpl_name='$tpl_name'");
+ if ($sql->num_rows) {
+ $tpl_timestamp = $sql->record['tpl_timestamp'];
+ return true;
+ } else {
+ return false;
+ }
+}
+
+function smarty_resource_db_secure($tpl_name, &$smarty)
+{
+ // assume que todos os templates são seguros
+ return true;
+}
+
+function smarty_resource_db_trusted($tpl_name, &$smarty)
+{
+ // não usado para templates
+}
+?>
+
+
+
\ No newline at end of file
diff --git a/docs/pt_BR/programmers/plugins/plugins-writing.xml b/docs/pt_BR/programmers/plugins/plugins-writing.xml
new file mode 100644
index 00000000..3759944b
--- /dev/null
+++ b/docs/pt_BR/programmers/plugins/plugins-writing.xml
@@ -0,0 +1,49 @@
+
+
+
+ Escrevendo Plugins
+
+ Os Plugins podem ser ou lidos pela Smarty automaticamente do sistema de arquivos ou eles podem
+ ser registrados no tempo de execução via uma das funções
+ de API register_* . Eles podem também ser
+ com o uso da função API unregister_* .
+
+
+ Para os plugins que são registrados no tempo de execução, o nome da(s) função(ões) de plugin
+ não têm que seguir a convenção de aparência.
+
+
+ Se um plugin depende de alguma funcionalidade fornecida por um outro plugin (como é o caso com alguns
+ plugins embutidos com a Smarty),
+ então a forma apropriada para ler o plugin necessário é esta:
+
+
+require_once $smarty->_get_plugin_filepath('function', 'html_options');
+
+ Como uma regra geral, o objeto da Smarty é sempre passado para os plugins como o último parâmetro
+ (com duas exceções: modificadores não passam o objeto da Smarty em tudo e blocks passam
+ &$repeat depois do objeto da Smarty
+ para manter compatibilidade a antigas
+ versões da Smarty).
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/advanced-features.xml b/docs/ru/programmers/advanced-features.xml
index 581961fc..28cec01a 100644
--- a/docs/ru/programmers/advanced-features.xml
+++ b/docs/ru/programmers/advanced-features.xml
@@ -2,520 +2,16 @@
Advanced Features
-
- Objects
-
- Smarty allows access to PHP objects through the templates. There are
- two ways to access them. One way is to register objects to the template,
- then use access them via syntax similar to custom functions. The other way
- is to assign objects to the templates and access them much like any other
- assigned variable. The first method has a much nicer template syntax. It
- is also more secure, as a registered object can be restricted to certain
- methods or properties. However, a registered object cannot be looped over
- or assigned in arrays of objects, etc. The method you choose will be
- determined by your needs, but use the first method whenever possible to
- keep template syntax to a minimum.
-
-
- If security is enabled, no private methods or functions can be accessed
- (begininning with "_"). If a method and property of the same name exist,
- the method will be used.
-
-
- You can restrict the methods and properties that can be accessed by
- listing them in an array as the third registration parameter.
-
-
- By default, parameters passed to objects through the templates are passed
- the same way custom functions get them. An associative array is passed
- as the first parameter, and the smarty object as the second. If you want
- the parameters passed one at a time for each argument like traditional
- object parameter passing, set the fourth registration parameter to false.
-
-
- using a registered or assigned object
-
-register_object("foobar",$myobj);
-// if we want to restrict access to certain methods or properties, list them
-$smarty->register_object("foobar",$myobj,array('meth1','meth2','prop1'));
-// if you want to use the traditional object parameter format, pass a boolean of false
-$smarty->register_object("foobar",$myobj,null,false);
+&programmers.advanced-features.advanced-features-outputfilters;
-// We can also assign objects. Assign by ref when possible.
-$smarty->assign_by_ref("myobj", $myobj);
+&programmers.advanced-features.section-template-cache-handler-func;
-$smarty->display("index.tpl");
-?>
-
-TEMPLATE:
-
-{* access our registered object *}
-{foobar->meth1 p1="foo" p2=$bar}
-
-{* you can also assign the output *}
-{foobar->meth1 p1="foo" p2=$bar assign="output"}
-the output was {$output)
-
-{* access our assigned object *}
-{$myobj->meth1("foo",$bar)}
-]]>
-
-
-
- Prefilters
-
- Template prefilters are PHP functions that your templates are ran through
- before they are compiled. This is good for preprocessing your templates
- to remove unwanted comments, keeping an eye on what people are putting
- in their templates, etc. Prefilters can be either
- registered or loaded from
- the plugins directory by using
- load_filter() function or by
- setting
- $autoload_filters variable.
- Smarty will pass the template source code as the first argument, and
- expect the function to return the resulting template source code.
-
-
- using a template prefilter
-
-register_prefilter("remove_dw_comments");
-$smarty->display("index.tpl");
-?>
-
-{* Smarty template index.tpl *}
-<!--# this line will get removed by the prefilter -->
-]]>
-
-
-
-
- Postfilters
-
- Template postfilters are PHP functions that your templates are ran through
- after they are compiled. Postfilters can be either
- registered or loaded
- from the plugins directory by using
- load_filter() function or by
- setting
- $autoload_filters
- variable. Smarty will pass the compiled template code as the first
- argument, and expect the function to return the result of the
- processing.
-
-
- using a template postfilter
-
-register_postfilter("add_header_comment");
-$smarty->display("index.tpl");
-?>
-
-{* compiled Smarty template index.tpl *}
-<!-- Created by Smarty! -->
-{* rest of template content... *}
-]]>
-
-
-
-
-
- Output Filters
-
- When the template is invoked via display() or fetch(), its output can be
- sent through one or more output filters. This differs from postfilters
- because postfilters operate on compiled templates before they are saved to
- the disk, and output filters operate on the template output when it is
- executed.
-
-
-
- Output filters can be either
- registered or loaded
- from the plugins directory by using
- load_filter() function or by
- setting
- $autoload_filters
- variable. Smarty will pass the template output as the first argument,
- and expect the function to return the result of the processing.
-
-
- using a template outputfilter
-
-register_outputfilter("protect_email");
-$smarty->display("index.tpl");
-
-// now any occurrence of an email address in the template output will have
-// a simple protection against spambots
-?>
-]]>
-
-
-
-
- Cache Handler Function
-
- As an alternative to using the default file-based caching mechanism, you
- can specify a custom cache handling function that will be used to read,
- write and clear cached files.
-
-
- Create a function in your application that Smarty will use as a
- cache handler. Set the name of it in the
- $cache_handler_func
- class variable. Smarty will now use this to handle cached data. The
- first argument is the action, which will be one of 'read', 'write' and
- 'clear'. The second parameter is the Smarty object. The third parameter
- is the cached content. Upon a write, Smarty passes the cached content
- in these parameters. Upon a 'read', Smarty expects your function to
- accept this parameter by reference and populate it with the cached
- data. Upon a 'clear', pass a dummy variable here since it is not used.
- The fourth parameter is the name of the template file (needed for
- read/write), the fifth parameter is the cache_id (optional), and the
- sixth is the compile_id (optional).
-
-
- example using MySQL as a cache source
-
-
-
-
-
-
- Resources
-
- The templates may come from a variety of sources. When you display or
- fetch a template, or when you include a template from within another
- template, you supply a resource type, followed by the appropriate path
- and template name.
-
-
- Templates from $template_dir
-
- Templates from the $template_dir do not require a template
- resource, although you can use the file: resource for consistancy.
- Just supply the path to the template you want to use relative to
- the $template_dir root directory.
-
-
- using templates from $template_dir
-
-// from PHP script
-$smarty->display("index.tpl");
-$smarty->display("admin/menu.tpl");
-$smarty->display("file:admin/menu.tpl"); // same as one above
-
-{* from within Smarty template *}
-{include file="index.tpl"}
-{include file="file:index.tpl"} {* same as one above *}
-
-
-
- Templates from any directory
-
- Templates outside of the $template_dir require the file: template
- resource type, followed by the absolute path and name of the
- template.
-
-
- using templates from any directory
-
-// from PHP script
-$smarty->display("file:/export/templates/index.tpl");
-$smarty->display("file:/path/to/my/templates/menu.tpl");
-
-{* from within Smarty template *}
-{include file="file:/usr/local/share/templates/navigation.tpl"}
-
-
-
- Windows Filepaths
-
- If you are using a Windows machine, filepaths usually include a
- drive letter (C:) at the beginning of the pathname. Be sure to use
- "file:" in the path to avoid namespace conflicts and get the
- desired results.
-
-
- using templates from windows file paths
-
-// from PHP script
-$smarty->display("file:C:/export/templates/index.tpl");
-$smarty->display("file:F:/path/to/my/templates/menu.tpl");
-
-{* from within Smarty template *}
-{include file="file:D:/usr/local/share/templates/navigation.tpl"}
-
-
-
-
-
- Templates from other sources
-
- You can retrieve templates using whatever possible source you can
- access with PHP: databases, sockets, LDAP, and so on. You do this
- by writing resource plugin functions and registering them with
- Smarty.
-
-
-
- See resource plugins
- section for more information on the functions you are supposed
- to provide.
-
-
-
-
- Note that you cannot override the built-in
- file resource, but you can provide a resource
- that fetches templates from the file system in some other way by
- registering under another resource name.
-
-
-
- using custom resources
-
-query("select tpl_source
- from my_table
- where tpl_name='$tpl_name'");
- if ($sql->num_rows) {
- $tpl_source = $sql->record['tpl_source'];
- return true;
- } else {
- return false;
- }
-}
-
-function db_get_timestamp($tpl_name, &$tpl_timestamp, &$smarty_obj)
-{
- // do database call here to populate $tpl_timestamp.
- $sql = new SQL;
- $sql->query("select tpl_timestamp
- from my_table
- where tpl_name='$tpl_name'");
- if ($sql->num_rows) {
- $tpl_timestamp = $sql->record['tpl_timestamp'];
- return true;
- } else {
- return false;
- }
-}
-
-function db_get_secure($tpl_name, &$smarty_obj)
-{
- // assume all templates are secure
- return true;
-}
-
-function db_get_trusted($tpl_name, &$smarty_obj)
-{
- // not used for templates
-}
-
-// register the resource name "db"
-$smarty->register_resource("db", array("db_get_template",
- "db_get_timestamp",
- "db_get_secure",
- "db_get_trusted"));
-
-// using resource from php script
-$smarty->display("db:index.tpl");
-
-{* using resource from within Smarty template *}
-{include file="db:/extras/navigation.tpl"}
-]]>
-
-
-
-
- Default template handler function
-
- You can specify a function that is used to retrieve template
- contents in the event the template cannot be retrieved from its
- resource. One use of this is to create templates that do not exist
- on-the-fly.
-
-
- using the default template handler function
-
-<?php
-// put this function somewhere in your application
-
-function make_template ($resource_type, $resource_name, &$template_source, &$template_timestamp, &$smarty_obj)
-{
- if( $resource_type == 'file' ) {
- if ( ! is_readable ( $resource_name )) {
- // create the template file, return contents.
- $template_source = "This is a new template.";
- $template_timestamp = time();
- $smarty_obj->_write_file($resource_name,$template_source);
- return true;
- }
- } else {
- // not a file
- return false;
- }
-}
-
-// set the default handler
-$smarty->default_template_handler_func = 'make_template';
-?>
-
-
-
+&programmers.advanced-features.template-resources;
+
+ Objects
+
+ Smarty allows access to PHP objects through the templates. There are
+ two ways to access them. One way is to register objects to the template,
+ then use access them via syntax similar to custom functions. The other way
+ is to assign objects to the templates and access them much like any other
+ assigned variable. The first method has a much nicer template syntax. It
+ is also more secure, as a registered object can be restricted to certain
+ methods or properties. However, a registered object cannot be looped over
+ or assigned in arrays of objects, etc. The method you choose will be
+ determined by your needs, but use the first method whenever possible to
+ keep template syntax to a minimum.
+
+
+ If security is enabled, no private methods or functions can be accessed
+ (begininning with "_"). If a method and property of the same name exist,
+ the method will be used.
+
+
+ You can restrict the methods and properties that can be accessed by
+ listing them in an array as the third registration parameter.
+
+
+ By default, parameters passed to objects through the templates are passed
+ the same way custom functions get them. An associative array is passed
+ as the first parameter, and the smarty object as the second. If you want
+ the parameters passed one at a time for each argument like traditional
+ object parameter passing, set the fourth registration parameter to false.
+
+
+ using a registered or assigned object
+
+register_object("foobar",$myobj);
+// if we want to restrict access to certain methods or properties, list them
+$smarty->register_object("foobar",$myobj,array('meth1','meth2','prop1'));
+// if you want to use the traditional object parameter format, pass a boolean of false
+$smarty->register_object("foobar",$myobj,null,false);
+
+// We can also assign objects. Assign by ref when possible.
+$smarty->assign_by_ref("myobj", $myobj);
+
+$smarty->display("index.tpl");
+?>
+
+TEMPLATE:
+
+{* access our registered object *}
+{foobar->meth1 p1="foo" p2=$bar}
+
+{* you can also assign the output *}
+{foobar->meth1 p1="foo" p2=$bar assign="output"}
+the output was {$output)
+
+{* access our assigned object *}
+{$myobj->meth1("foo",$bar)}
+]]>
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/advanced-features/advanced-features-outputfilters.xml b/docs/ru/programmers/advanced-features/advanced-features-outputfilters.xml
new file mode 100644
index 00000000..44508162
--- /dev/null
+++ b/docs/ru/programmers/advanced-features/advanced-features-outputfilters.xml
@@ -0,0 +1,66 @@
+
+
+
+ Output Filters
+
+ When the template is invoked via display() or fetch(), its output can be
+ sent through one or more output filters. This differs from postfilters
+ because postfilters operate on compiled templates before they are saved to
+ the disk, and output filters operate on the template output when it is
+ executed.
+
+
+
+ Output filters can be either
+ registered or loaded
+ from the plugins directory by using
+ load_filter() function or by
+ setting
+ $autoload_filters
+ variable. Smarty will pass the template output as the first argument,
+ and expect the function to return the result of the processing.
+
+
+ using a template outputfilter
+
+register_outputfilter("protect_email");
+$smarty->display("index.tpl");
+
+// now any occurrence of an email address in the template output will have
+// a simple protection against spambots
+?>
+]]>
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/advanced-features/advanced-features-postfilters.xml b/docs/ru/programmers/advanced-features/advanced-features-postfilters.xml
new file mode 100644
index 00000000..5f4a7e50
--- /dev/null
+++ b/docs/ru/programmers/advanced-features/advanced-features-postfilters.xml
@@ -0,0 +1,59 @@
+
+
+
+ Postfilters
+
+ Template postfilters are PHP functions that your templates are ran through
+ after they are compiled. Postfilters can be either
+ registered or loaded
+ from the plugins directory by using
+ load_filter() function or by
+ setting
+ $autoload_filters
+ variable. Smarty will pass the compiled template code as the first
+ argument, and expect the function to return the result of the
+ processing.
+
+
+ using a template postfilter
+
+register_postfilter("add_header_comment");
+$smarty->display("index.tpl");
+?>
+
+{* compiled Smarty template index.tpl *}
+<!-- Created by Smarty! -->
+{* rest of template content... *}
+]]>
+
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/advanced-features/advanced-features-prefilters.xml b/docs/ru/programmers/advanced-features/advanced-features-prefilters.xml
new file mode 100644
index 00000000..1cae4f04
--- /dev/null
+++ b/docs/ru/programmers/advanced-features/advanced-features-prefilters.xml
@@ -0,0 +1,58 @@
+
+
+
+ Prefilters
+
+ Template prefilters are PHP functions that your templates are ran through
+ before they are compiled. This is good for preprocessing your templates
+ to remove unwanted comments, keeping an eye on what people are putting
+ in their templates, etc. Prefilters can be either
+ registered or loaded from
+ the plugins directory by using
+ load_filter() function or by
+ setting
+ $autoload_filters variable.
+ Smarty will pass the template source code as the first argument, and
+ expect the function to return the resulting template source code.
+
+
+ using a template prefilter
+
+register_prefilter("remove_dw_comments");
+$smarty->display("index.tpl");
+?>
+
+{* Smarty template index.tpl *}
+<!--# this line will get removed by the prefilter -->
+]]>
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/advanced-features/section-template-cache-handler-func.xml b/docs/ru/programmers/advanced-features/section-template-cache-handler-func.xml
new file mode 100644
index 00000000..06f2d3fd
--- /dev/null
+++ b/docs/ru/programmers/advanced-features/section-template-cache-handler-func.xml
@@ -0,0 +1,153 @@
+
+
+
+ Cache Handler Function
+
+ As an alternative to using the default file-based caching mechanism, you
+ can specify a custom cache handling function that will be used to read,
+ write and clear cached files.
+
+
+ Create a function in your application that Smarty will use as a
+ cache handler. Set the name of it in the
+ $cache_handler_func
+ class variable. Smarty will now use this to handle cached data. The
+ first argument is the action, which will be one of 'read', 'write' and
+ 'clear'. The second parameter is the Smarty object. The third parameter
+ is the cached content. Upon a write, Smarty passes the cached content
+ in these parameters. Upon a 'read', Smarty expects your function to
+ accept this parameter by reference and populate it with the cached
+ data. Upon a 'clear', pass a dummy variable here since it is not used.
+ The fourth parameter is the name of the template file (needed for
+ read/write), the fifth parameter is the cache_id (optional), and the
+ sixth is the compile_id (optional).
+
+
+ example using MySQL as a cache source
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/advanced-features/template-resources.xml b/docs/ru/programmers/advanced-features/template-resources.xml
new file mode 100644
index 00000000..76db7f9f
--- /dev/null
+++ b/docs/ru/programmers/advanced-features/template-resources.xml
@@ -0,0 +1,213 @@
+
+
+
+ Resources
+
+ The templates may come from a variety of sources. When you display or
+ fetch a template, or when you include a template from within another
+ template, you supply a resource type, followed by the appropriate path
+ and template name.
+
+
+ Templates from $template_dir
+
+ Templates from the $template_dir do not require a template
+ resource, although you can use the file: resource for consistancy.
+ Just supply the path to the template you want to use relative to
+ the $template_dir root directory.
+
+
+ using templates from $template_dir
+
+// from PHP script
+$smarty->display("index.tpl");
+$smarty->display("admin/menu.tpl");
+$smarty->display("file:admin/menu.tpl"); // same as one above
+
+{* from within Smarty template *}
+{include file="index.tpl"}
+{include file="file:index.tpl"} {* same as one above *}
+
+
+
+ Templates from any directory
+
+ Templates outside of the $template_dir require the file: template
+ resource type, followed by the absolute path and name of the
+ template.
+
+
+ using templates from any directory
+
+// from PHP script
+$smarty->display("file:/export/templates/index.tpl");
+$smarty->display("file:/path/to/my/templates/menu.tpl");
+
+{* from within Smarty template *}
+{include file="file:/usr/local/share/templates/navigation.tpl"}
+
+
+
+ Windows Filepaths
+
+ If you are using a Windows machine, filepaths usually include a
+ drive letter (C:) at the beginning of the pathname. Be sure to use
+ "file:" in the path to avoid namespace conflicts and get the
+ desired results.
+
+
+ using templates from windows file paths
+
+// from PHP script
+$smarty->display("file:C:/export/templates/index.tpl");
+$smarty->display("file:F:/path/to/my/templates/menu.tpl");
+
+{* from within Smarty template *}
+{include file="file:D:/usr/local/share/templates/navigation.tpl"}
+
+
+
+
+
+ Templates from other sources
+
+ You can retrieve templates using whatever possible source you can
+ access with PHP: databases, sockets, LDAP, and so on. You do this
+ by writing resource plugin functions and registering them with
+ Smarty.
+
+
+
+ See resource plugins
+ section for more information on the functions you are supposed
+ to provide.
+
+
+
+
+ Note that you cannot override the built-in
+ file resource, but you can provide a resource
+ that fetches templates from the file system in some other way by
+ registering under another resource name.
+
+
+
+ using custom resources
+
+query("select tpl_source
+ from my_table
+ where tpl_name='$tpl_name'");
+ if ($sql->num_rows) {
+ $tpl_source = $sql->record['tpl_source'];
+ return true;
+ } else {
+ return false;
+ }
+}
+
+function db_get_timestamp($tpl_name, &$tpl_timestamp, &$smarty_obj)
+{
+ // do database call here to populate $tpl_timestamp.
+ $sql = new SQL;
+ $sql->query("select tpl_timestamp
+ from my_table
+ where tpl_name='$tpl_name'");
+ if ($sql->num_rows) {
+ $tpl_timestamp = $sql->record['tpl_timestamp'];
+ return true;
+ } else {
+ return false;
+ }
+}
+
+function db_get_secure($tpl_name, &$smarty_obj)
+{
+ // assume all templates are secure
+ return true;
+}
+
+function db_get_trusted($tpl_name, &$smarty_obj)
+{
+ // not used for templates
+}
+
+// register the resource name "db"
+$smarty->register_resource("db", array("db_get_template",
+ "db_get_timestamp",
+ "db_get_secure",
+ "db_get_trusted"));
+
+// using resource from php script
+$smarty->display("db:index.tpl");
+
+{* using resource from within Smarty template *}
+{include file="db:/extras/navigation.tpl"}
+]]>
+
+
+
+
+ Default template handler function
+
+ You can specify a function that is used to retrieve template
+ contents in the event the template cannot be retrieved from its
+ resource. One use of this is to create templates that do not exist
+ on-the-fly.
+
+
+ using the default template handler function
+
+<?php
+// put this function somewhere in your application
+
+function make_template ($resource_type, $resource_name, &$template_source, &$template_timestamp, &$smarty_obj)
+{
+ if( $resource_type == 'file' ) {
+ if ( ! is_readable ( $resource_name )) {
+ // create the template file, return contents.
+ $template_source = "This is a new template.";
+ $template_timestamp = time();
+ $smarty_obj->_write_file($resource_name,$template_source);
+ return true;
+ }
+ } else {
+ // not a file
+ return false;
+ }
+}
+
+// set the default handler
+$smarty->default_template_handler_func = 'make_template';
+?>
+
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-functions.xml b/docs/ru/programmers/api-functions.xml
index ab7fcf34..80ca5c5a 100644
--- a/docs/ru/programmers/api-functions.xml
+++ b/docs/ru/programmers/api-functions.xml
@@ -2,955 +2,43 @@
Methods
-
- append
-
-
- void append
- mixed var
-
-
- void append
- string varname
- mixed var
-
-
- void append
- string varname
- mixed var
- boolean merge
-
-
-
- This is used to append an element to an assigned array. If you append
- to a string value, it is converted to an array value and then
- appended to. You can explicitly pass name/value pairs, or associative
- arrays containing the name/value pairs. If you pass the optional third
- parameter of true, the value will be merged with the current array
- instead of appended.
-
-
- Technical Note
-
- The merge parameter respects array keys, so if you merge two
- numerically indexed arrays, they may overwrite each other or result in
- non-sequential keys. This is unlike the array_merge() function of PHP
- which wipes out numerical keys and renumbers them.
-
-
-
- append
-
-// passing name/value pairs
-$smarty->append("Name","Fred");
-$smarty->append("Address",$address);
+&programmers.api-functions.api-append;
+&programmers.api-functions.api-append-by-ref;
+&programmers.api-functions.api-assign;
+&programmers.api-functions.api-assign-by-ref;
+&programmers.api-functions.api-clear-all-assign;
+&programmers.api-functions.api-clear-all-cache;
+&programmers.api-functions.api-clear-assign;
+&programmers.api-functions.api-clear-cache;
+&programmers.api-functions.api-clear-compiled-tpl;
+&programmers.api-functions.api-clear-config;
+&programmers.api-functions.api-config-load;
+&programmers.api-functions.api-display;
+&programmers.api-functions.api-fetch;
+&programmers.api-functions.api-get-config-vars;
+&programmers.api-functions.api-get-registered-object;
+&programmers.api-functions.api-get-template-vars;
+&programmers.api-functions.api-is-cached;
+&programmers.api-functions.api-load-filter;
+&programmers.api-functions.api-register-block;
+&programmers.api-functions.api-register-compiler-function;
+&programmers.api-functions.api-register-function;
+&programmers.api-functions.api-register-modifier;
+&programmers.api-functions.api-register-object;
+&programmers.api-functions.api-register-outputfilter;
+&programmers.api-functions.api-register-postfilter;
+&programmers.api-functions.api-register-prefilter;
+&programmers.api-functions.api-register-resource;
+&programmers.api-functions.api-trigger-error;
-// passing an associative array
-$smarty->append(array("city" => "Lincoln","state" => "Nebraska"));
-
-
-
- append_by_ref
-
-
- void append_by_ref
- string varname
- mixed var
-
-
- void append_by_ref
- string varname
- mixed var
- boolean merge
-
-
-
- This is used to append values to the templates by reference.
- If you append a variable by reference then change its
- value, the appended value sees the change as well. For objects,
- append_by_ref() also avoids an in-memory copy of the appended object.
- See the PHP manual on variable referencing for an in-depth
- explanation. If you pass the optional third parameter of true,
- the value will be merged with the current array instead of appended.
-
-
- Technical Note
-
- The merge parameter respects array keys, so if you merge two
- numerically indexed arrays, they may overwrite each other or result in
- non-sequential keys. This is unlike the array_merge() function of PHP
- which wipes out numerical keys and renumbers them.
-
-
-
- append_by_ref
-
-// appending name/value pairs
-$smarty->append_by_ref("Name",$myname);
-$smarty->append_by_ref("Address",$address);
-
-
-
- assign
-
-
- void assign
- mixed var
-
-
- void assign
- string varname
- mixed var
-
-
-
- This is used to assign values to the templates. You can
- explicitly pass name/value pairs, or associative arrays
- containing the name/value pairs.
-
-
- assign
-
-// passing name/value pairs
-$smarty->assign("Name","Fred");
-$smarty->assign("Address",$address);
-
-// passing an associative array
-$smarty->assign(array("city" => "Lincoln","state" => "Nebraska"));
-
-
-
- assign_by_ref
-
-
- void assign_by_ref
- string varname
- mixed var
-
-
-
- This is used to assign values to the templates by reference instead of
- making a copy. See the PHP manual on variable referencing for an explanation.
-
-
- Technical Note
-
- This is used to assign values to the templates by reference.
- If you assign a variable by reference then change its
- value, the assigned value sees the change as well. For objects,
- assign_by_ref() also avoids an in-memory copy of the assigned object.
- See the PHP manual on variable referencing for an in-depth
- explanation.
-
-
-
- assign_by_ref
-
-// passing name/value pairs
-$smarty->assign_by_ref("Name",$myname);
-$smarty->assign_by_ref("Address",$address);
-
-
-
- clear_all_assign
-
-
- void clear_all_assign
-
-
-
-
- This clears the values of all assigned variables.
-
-
-clear_all_assign
-
-// clear all assigned variables
-$smarty->clear_all_assign();
-
-
-
- clear_all_cache
-
-
- void clear_all_cache
- int expire time
-
-
-
- This clears the entire template cache. As an optional
- parameter, you can supply a minimum age in seconds the cache
- files must be before they will get cleared.
-
-
-clear_all_cache
-
-// clear the entire cache
-$smarty->clear_all_cache();
-
-
-
- clear_assign
-
-
- void clear_assign
- string var
-
-
-
- This clears the value of an assigned variable. This
- can be a single value, or an array of values.
-
-
-clear_assign
-
-// clear a single variable
-$smarty->clear_assign("Name");
-
-// clear multiple variables
-$smarty->clear_assign(array("Name","Address","Zip"));
-
-
-
- clear_cache
-
- voidclear_cache
- stringtemplate
- stringcache id
- stringcompile id
- intexpire time
-
-
- This clears the cache for a specific template. If you have
- multiple caches for this template, you can clear a specific
- cache by supplying the cache id as the second parameter. You
- can also pass a compile id as a third parameter. You can "group"
- templates together so they can be removed as a group. See the
- caching section for more
- information. As an optional fourth parameter, you can supply a
- minimum age in seconds the cache file must be before it will
- get cleared.
-
-
-clear_cache
-
-// clear the cache for a template
-$smarty->clear_cache("index.tpl");
-
-// clear the cache for a particular cache id in an multiple-cache template
-$smarty->clear_cache("index.tpl","CACHEID");
-
-
-
- clear_compiled_tpl
-
-
- void clear_compiled_tpl
- string tpl_file
-
-
-
- This clears the compiled version of the specified template
- resource, or all compiled template files if one is not specified.
- This function is for advanced use only, not normally needed.
-
-
-clear_compiled_tpl
-
-// clear a specific template resource
-$smarty->clear_compiled_tpl("index.tpl");
-
-// clear entire compile directory
-$smarty->clear_compiled_tpl();
-
-
-
- clear_config
-
- voidclear_config
- stringvar
-
-
- This clears all assigned config variables. If a variable name is
- supplied, only that variable is cleared.
-
-
-clear_config
-
-// clear all assigned config variables.
-$smarty->clear_config();
-
-// clear one variable
-$smarty->clear_config('foobar');
-
-
-
- config_load
-
- voidconfig_load
- stringfile
- stringsection
-
-
- This loads config file data and assigns it to the template. This
- works identical to the template config_load
- function.
-
-
- Technical Note
-
- As of Smarty 2.4.0, assigned template variables are kept across
- invocations of fetch() and display(). Config vars loaded from
- config_load() are always global scope. Config files are also
- compiled for faster execution, and respect the force_compile and compile_check settings.
-
-
-
-config_load
-
-// load config variables and assign them
-$smarty->config_load('my.conf');
-
-// load a section
-$smarty->config_load('my.conf','foobar');
-
-
-
- display
-
- voiddisplay
- stringtemplate
- stringcache_id
- stringcompile_id
-
-
- This displays the template. Supply a valid template resource
- type and path. As an optional second parameter, you can pass a
- cache id. See the caching
- section for more information.
-
-
- As an optional third parameter, you can pass a compile id. This
- is in the event that you want to compile different versions of
- the same template, such as having separate templates compiled
- for different languages. Another use for compile_id is when you
- use more than one $template_dir but only one $compile_dir. Set
- a separate compile_id for each $template_dir, otherwise
- templates of the same name will overwrite each other. You can
- also set the $compile_id variable once
- instead of passing this to each call to display().
-
-
-display
-
-include("Smarty.class.php");
-$smarty = new Smarty;
-$smarty->caching = true;
-
-// only do db calls if cache doesn't exist
-if(!$smarty->is_cached("index.tpl"))
-{
-
- // dummy up some data
- $address = "245 N 50th";
- $db_data = array(
- "City" => "Lincoln",
- "State" => "Nebraska",
- "Zip" = > "68502"
- );
-
- $smarty->assign("Name","Fred");
- $smarty->assign("Address",$address);
- $smarty->assign($db_data);
-
-}
-
-// display the output
-$smarty->display("index.tpl");
-
-
- Use the syntax for template resources to
- display files outside of the $template_dir directory.
-
-
-function display template resource examples
-
-// absolute filepath
-$smarty->display("/usr/local/include/templates/header.tpl");
-
-// absolute filepath (same thing)
-$smarty->display("file:/usr/local/include/templates/header.tpl");
-
-// windows absolute filepath (MUST use "file:" prefix)
-$smarty->display("file:C:/www/pub/templates/header.tpl");
-
-// include from template resource named "db"
-$smarty->display("db:header.tpl");
-
-
-
-
- fetch
-
- stringfetch
- stringtemplate
- stringcache_id
- stringcompile_id
-
-
- This returns the template output instead of displaying it.
- Supply a valid template resource
- type and path. As an optional second parameter, you can pass a
- cache id. See the caching
- section for more information.
-
-
- As an optional third parameter, you can pass a compile id. This
- is in the event that you want to compile different versions of
- the same template, such as having separate templates compiled
- for different languages. Another use for compile_id is when you
- use more than one $template_dir but only one $compile_dir. Set
- a separate compile_id for each $template_dir, otherwise
- templates of the same name will overwrite each other. You can
- also set the $compile_id variable once
- instead of passing this to each call to fetch().
-
-
-fetch
-
-include("Smarty.class.php");
-$smarty = new Smarty;
-
-$smarty->caching = true;
-
-// only do db calls if cache doesn't exist
-if(!$smarty->is_cached("index.tpl"))
-{
-
- // dummy up some data
- $address = "245 N 50th";
- $db_data = array(
- "City" => "Lincoln",
- "State" => "Nebraska",
- "Zip" = > "68502"
- );
-
- $smarty->assign("Name","Fred");
- $smarty->assign("Address",$address);
- $smarty->assign($db_data);
-
-}
-
-// capture the output
-$output = $smarty->fetch("index.tpl");
-
-// do something with $output here
-
-echo $output;
-
-
-
- get_config_vars
-
- arrayget_config_vars
- stringvarname
-
-
- This returns the given loaded config variable value. If no parameter
- is given, an array of all loaded config variables is returned.
-
-
-get_config_vars
-
-// get loaded config template var 'foo'
-$foo = $smarty->get_config_vars('foo');
-
-// get all loaded config template vars
-$config_vars = $smarty->get_config_vars();
-
-// take a look at them
-print_r($config_vars);
-
-
-
- get_registered_object
-
-
- array get_registered_object
- string object_name
-
-
-
- This returns a reference to a registered object. This is useful
- from within a custom function when you need direct access to a
- registered object.
-
-
-get_registered_object
-
-function smarty_block_foo($params, &$smarty) {
- if (isset[$params['object']]) {
- // get reference to registered object
- $obj_ref =& $smarty->&get_registered_object($params['object']);
- // use $obj_ref is now a reference to the object
- }
-}
-
-
-
- get_template_vars
-
- arrayget_template_vars
- stringvarname
-
-
- This returns the given assigned variable value. If no parameter
- is given, an array of all assigned variables is returned.
-
-
-get_template_vars
-
-// get assigned template var 'foo'
-$foo = $smarty->get_template_vars('foo');
-
-// get all assigned template vars
-$tpl_vars = $smarty->get_template_vars();
-
-// take a look at them
-print_r($tpl_vars);
-
-
-
- is_cached
-
-
- void is_cached
- string template
- [string cache_id]
-
-
-
- This returns true if there is a valid cache for this template.
- This only works if caching is set to true.
-
-
-is_cached
-
-$smarty->caching = true;
-
-if(!$smarty->is_cached("index.tpl")) {
- // do database calls, assign vars here
-}
-
-$smarty->display("index.tpl");
-
-
- You can also pass a cache id as an optional second parameter
- in case you want multiple caches for the given template.
-
-
-is_cached with multiple-cache template
-
-$smarty->caching = true;
-
-if(!$smarty->is_cached("index.tpl","FrontPage")) {
- // do database calls, assign vars here
-}
-
-$smarty->display("index.tpl","FrontPage");
-
-
-
- load_filter
-
-
- void load_filter
- string type
- string name
-
-
-
- This function can be used to load a filter plugin. The first
- argument specifies the type of the filter to load and can be one
- of the following: 'pre', 'post', or 'output'. The second argument
- specifies the name of the filter plugin, for example, 'trim'.
-
-
-loading filter plugins
-
-$smarty->load_filter('pre', 'trim'); // load prefilter named 'trim'
-$smarty->load_filter('pre', 'datefooter'); // load another prefilter named 'datefooter'
-$smarty->load_filter('output', 'compress'); // load output filter named 'compress'
-
-
-
- register_block
-
-
- void register_block
- string name
- string impl
-
-
-
- Use this to dynamically register block functions plugins.
- Pass in the block function name, followed by the PHP
- function name that implements it.
-
-
-register_block
-
-register_block("translate", "do_translation");
-
-function do_translation ($params, $content, &$smarty) {
- if ($content) {
- $lang = $params['lang'];
- // do some translation with $content
- echo $translation;
- }
-}
-?>
-
-{* template *}
-{translate lang="br"}
- Hello, world!
-{/translate}
-]]>
-
-
-
-
- register_compiler_function
-
-
- void register_compiler_function
- string name
- string impl
-
-
-
- Use this to dynamically register a compiler function plugin.
- Pass in the compiler function name, followed by the PHP
- function that implements it.
-
-
-
- register_function
-
-
- void register_function
- string name
- string impl
-
-
-
- Use this to dynamically register template function plugins.
- Pass in the template function name, followed by the PHP
- function name that implements it.
-
-
-register_function
-
-$smarty->register_function("date_now", "print_current_date");
-
-function print_current_date ($params) {
- extract($params);
- if(empty($format))
- $format="%b %e, %Y";
- echo strftime($format,time());
-}
-
-// now you can use this in Smarty to print the current date: {date_now}
-// or, {date_now format="%Y/%m/%d"} to format it.
-
-
-
- register_modifier
-
-
- void register_modifier
- string name
- string impl
-
-
-
- Use this to dynamically register modifier plugin. Pass in the
- template modifier name, followed by the PHP function that it
- implements it.
-
-
-register_modifier
-
-// let's map PHP's stripslashes function to a Smarty modifier.
-
-$smarty->register_modifier("sslash","stripslashes");
-
-// now you can use {$var|sslash} to strip slashes from variables
-
-
-
- register_object
-
-
- void register_object
- string object_name
- object $object
- array allowed methods/properties
- boolean format
-
-
-
- This is to register an object for use in the templates. See the
- object section
- of the manual for examples.
-
-
-
- register_outputfilter
-
-
- void register_outputfilter
- string function_name
-
-
-
- Use this to dynamically register outputfilters to operate on
- a template's output before it is displayed. See
- template output
- filters
- for more information on how to set up an output filter function.
-
-
-
- register_postfilter
-
-
- void register_postfilter
- string function_name
-
-
-
- Use this to dynamically register postfilters to run templates
- through after they are compiled. See template postfilters for
- more information on how to setup a postfiltering function.
-
-
-
- register_prefilter
-
-
- void register_prefilter
- string function_name
-
-
-
- Use this to dynamically register prefilters to run templates
- through before they are compiled. See template prefilters for
- more information on how to setup a prefiltering function.
-
-
-
- register_resource
-
-
- void register_resource
- string name
- array resource_funcs
-
-
-
- Use this to dynamically register a resource plugin with Smarty.
- Pass in the name of the resource and the array of PHP functions
- implementing it. See
- template resources
- for more information on how to setup a function for fetching
- templates.
-
-
-register_resource
-
-$smarty->register_resource("db", array("db_get_template",
- "db_get_timestamp",
- "db_get_secure",
- "db_get_trusted"));
-
-
-
- trigger_error
-
-
- void trigger_error
- string error_msg
- [int level]
-
-
-
- This function can be used to output an error message using Smarty.
- level parameter can be one of the values
- used for trigger_error() PHP function, i.e. E_USER_NOTICE,
- E_USER_WARNING, etc. By default it's E_USER_WARNING.
-
-
-
-
- template_exists
-
-
- bool template_exists
- string template
-
-
-
- This function checks whether the specified template exists. It can
- accept either a path to the template on the filesystem or a
- resource string specifying the template.
-
-
-
- unregister_block
-
-
- void unregister_block
- string name
-
-
-
- Use this to dynamically unregister block function plugin.
- Pass in the block function name.
-
-
-
- unregister_compiler_function
-
-
- void unregister_compiler_function
- string name
-
-
-
- Use this to dynamically unregister a compiler function. Pass in
- the name of the compiler function.
-
-
-
- unregister_function
-
-
- void unregister_function
- string name
-
-
-
- Use this to dynamically unregister template function plugin.
- Pass in the template function name.
-
-
-unregister_function
-
-// we don't want template designers to have access to system files
-
-$smarty->unregister_function("fetch");
-
-
-
- unregister_modifier
-
-
- void unregister_modifier
- string name
-
-
-
- Use this to dynamically unregister modifier plugin. Pass in the
- template modifier name.
-
-
-unregister_modifier
-
-// we don't want template designers to strip tags from elements
-
-$smarty->unregister_modifier("strip_tags");
-
-
-
- unregister_object
-
-
- void unregister_object
- string object_name
-
-
-
- Use this to unregister an object.
-
-
-
- unregister_outputfilter
-
-
- void unregister_outputfilter
- string function_name
-
-
-
- Use this to dynamically unregister an output filter.
-
-
-
- unregister_postfilter
-
-
- void unregister_postfilter
- string function_name
-
-
-
- Use this to dynamically unregister a postfilter.
-
-
-
- unregister_prefilter
-
-
- void unregister_prefilter
- string function_name
-
-
-
- Use this to dynamically unregister a prefilter.
-
-
-
- unregister_resource
-
-
- void unregister_resource
- string name
-
-
-
- Use this to dynamically unregister a resource plugin. Pass in the
- name of the resource.
-
-
-unregister_resource
-
-$smarty->unregister_resource("db");
-
-
+&programmers.api-functions.api-template-exists;
+&programmers.api-functions.api-unregister-block;
+&programmers.api-functions.api-unregister-compiler-function;
+&programmers.api-functions.api-unregister-function;
+&programmers.api-functions.api-unregister-modifier;
+&programmers.api-functions.api-unregister-object;
+&programmers.api-functions.api-unregister-outputfilter;
+&programmers.api-functions.api-unregister-postfilter;
+&programmers.api-functions.api-unregister-prefilter;
+&programmers.api-functions.api-unregister-resource;
diff --git a/docs/ru/programmers/api-functions/api-append-by-ref.xml b/docs/ru/programmers/api-functions/api-append-by-ref.xml
new file mode 100644
index 00000000..ef266dee
--- /dev/null
+++ b/docs/ru/programmers/api-functions/api-append-by-ref.xml
@@ -0,0 +1,63 @@
+
+
+
+ append_by_ref
+
+
+ void append_by_ref
+ string varname
+ mixed var
+
+
+ void append_by_ref
+ string varname
+ mixed var
+ boolean merge
+
+
+
+ This is used to append values to the templates by reference.
+ If you append a variable by reference then change its
+ value, the appended value sees the change as well. For objects,
+ append_by_ref() also avoids an in-memory copy of the appended object.
+ See the PHP manual on variable referencing for an in-depth
+ explanation. If you pass the optional third parameter of true,
+ the value will be merged with the current array instead of appended.
+
+
+ Technical Note
+
+ The merge parameter respects array keys, so if you merge two
+ numerically indexed arrays, they may overwrite each other or result in
+ non-sequential keys. This is unlike the array_merge() function of PHP
+ which wipes out numerical keys and renumbers them.
+
+
+
+ append_by_ref
+
+// appending name/value pairs
+$smarty->append_by_ref("Name",$myname);
+$smarty->append_by_ref("Address",$address);
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-functions/api-append.xml b/docs/ru/programmers/api-functions/api-append.xml
new file mode 100644
index 00000000..953cb5da
--- /dev/null
+++ b/docs/ru/programmers/api-functions/api-append.xml
@@ -0,0 +1,69 @@
+
+
+
+ append
+
+
+ void append
+ mixed var
+
+
+ void append
+ string varname
+ mixed var
+
+
+ void append
+ string varname
+ mixed var
+ boolean merge
+
+
+
+ This is used to append an element to an assigned array. If you append
+ to a string value, it is converted to an array value and then
+ appended to. You can explicitly pass name/value pairs, or associative
+ arrays containing the name/value pairs. If you pass the optional third
+ parameter of true, the value will be merged with the current array
+ instead of appended.
+
+
+ Technical Note
+
+ The merge parameter respects array keys, so if you merge two
+ numerically indexed arrays, they may overwrite each other or result in
+ non-sequential keys. This is unlike the array_merge() function of PHP
+ which wipes out numerical keys and renumbers them.
+
+
+
+ append
+
+// passing name/value pairs
+$smarty->append("Name","Fred");
+$smarty->append("Address",$address);
+
+// passing an associative array
+$smarty->append(array("city" => "Lincoln","state" => "Nebraska"));
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-functions/api-assign-by-ref.xml b/docs/ru/programmers/api-functions/api-assign-by-ref.xml
new file mode 100644
index 00000000..8519671d
--- /dev/null
+++ b/docs/ru/programmers/api-functions/api-assign-by-ref.xml
@@ -0,0 +1,54 @@
+
+
+
+ assign_by_ref
+
+
+ void assign_by_ref
+ string varname
+ mixed var
+
+
+
+ This is used to assign values to the templates by reference instead of
+ making a copy. See the PHP manual on variable referencing for an explanation.
+
+
+ Technical Note
+
+ This is used to assign values to the templates by reference.
+ If you assign a variable by reference then change its
+ value, the assigned value sees the change as well. For objects,
+ assign_by_ref() also avoids an in-memory copy of the assigned object.
+ See the PHP manual on variable referencing for an in-depth
+ explanation.
+
+
+
+ assign_by_ref
+
+// passing name/value pairs
+$smarty->assign_by_ref("Name",$myname);
+$smarty->assign_by_ref("Address",$address);
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-functions/api-assign.xml b/docs/ru/programmers/api-functions/api-assign.xml
new file mode 100644
index 00000000..89974511
--- /dev/null
+++ b/docs/ru/programmers/api-functions/api-assign.xml
@@ -0,0 +1,51 @@
+
+
+
+ assign
+
+
+ void assign
+ mixed var
+
+
+ void assign
+ string varname
+ mixed var
+
+
+
+ This is used to assign values to the templates. You can
+ explicitly pass name/value pairs, or associative arrays
+ containing the name/value pairs.
+
+
+ assign
+
+// passing name/value pairs
+$smarty->assign("Name","Fred");
+$smarty->assign("Address",$address);
+
+// passing an associative array
+$smarty->assign(array("city" => "Lincoln","state" => "Nebraska"));
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-functions/api-clear-all-assign.xml b/docs/ru/programmers/api-functions/api-clear-all-assign.xml
new file mode 100644
index 00000000..593adb3d
--- /dev/null
+++ b/docs/ru/programmers/api-functions/api-clear-all-assign.xml
@@ -0,0 +1,40 @@
+
+
+
+ clear_all_assign
+
+
+ void clear_all_assign
+
+
+
+
+ This clears the values of all assigned variables.
+
+
+clear_all_assign
+
+// clear all assigned variables
+$smarty->clear_all_assign();
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-functions/api-clear-all-cache.xml b/docs/ru/programmers/api-functions/api-clear-all-cache.xml
new file mode 100644
index 00000000..f1750d7a
--- /dev/null
+++ b/docs/ru/programmers/api-functions/api-clear-all-cache.xml
@@ -0,0 +1,42 @@
+
+
+
+ clear_all_cache
+
+
+ void clear_all_cache
+ int expire time
+
+
+
+ This clears the entire template cache. As an optional
+ parameter, you can supply a minimum age in seconds the cache
+ files must be before they will get cleared.
+
+
+clear_all_cache
+
+// clear the entire cache
+$smarty->clear_all_cache();
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-functions/api-clear-assign.xml b/docs/ru/programmers/api-functions/api-clear-assign.xml
new file mode 100644
index 00000000..b9a94c57
--- /dev/null
+++ b/docs/ru/programmers/api-functions/api-clear-assign.xml
@@ -0,0 +1,44 @@
+
+
+
+ clear_assign
+
+
+ void clear_assign
+ string var
+
+
+
+ This clears the value of an assigned variable. This
+ can be a single value, or an array of values.
+
+
+clear_assign
+
+// clear a single variable
+$smarty->clear_assign("Name");
+
+// clear multiple variables
+$smarty->clear_assign(array("Name","Address","Zip"));
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-functions/api-clear-cache.xml b/docs/ru/programmers/api-functions/api-clear-cache.xml
new file mode 100644
index 00000000..1afb37a7
--- /dev/null
+++ b/docs/ru/programmers/api-functions/api-clear-cache.xml
@@ -0,0 +1,52 @@
+
+
+
+ clear_cache
+
+ voidclear_cache
+ stringtemplate
+ stringcache id
+ stringcompile id
+ intexpire time
+
+
+ This clears the cache for a specific template. If you have
+ multiple caches for this template, you can clear a specific
+ cache by supplying the cache id as the second parameter. You
+ can also pass a compile id as a third parameter. You can "group"
+ templates together so they can be removed as a group. See the
+ caching section for more
+ information. As an optional fourth parameter, you can supply a
+ minimum age in seconds the cache file must be before it will
+ get cleared.
+
+
+clear_cache
+
+// clear the cache for a template
+$smarty->clear_cache("index.tpl");
+
+// clear the cache for a particular cache id in an multiple-cache template
+$smarty->clear_cache("index.tpl","CACHEID");
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-functions/api-clear-compiled-tpl.xml b/docs/ru/programmers/api-functions/api-clear-compiled-tpl.xml
new file mode 100644
index 00000000..77e6ea7a
--- /dev/null
+++ b/docs/ru/programmers/api-functions/api-clear-compiled-tpl.xml
@@ -0,0 +1,45 @@
+
+
+
+ clear_compiled_tpl
+
+
+ void clear_compiled_tpl
+ string tpl_file
+
+
+
+ This clears the compiled version of the specified template
+ resource, or all compiled template files if one is not specified.
+ This function is for advanced use only, not normally needed.
+
+
+clear_compiled_tpl
+
+// clear a specific template resource
+$smarty->clear_compiled_tpl("index.tpl");
+
+// clear entire compile directory
+$smarty->clear_compiled_tpl();
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-functions/api-clear-config.xml b/docs/ru/programmers/api-functions/api-clear-config.xml
new file mode 100644
index 00000000..3c1a8b8c
--- /dev/null
+++ b/docs/ru/programmers/api-functions/api-clear-config.xml
@@ -0,0 +1,42 @@
+
+
+
+ clear_config
+
+ voidclear_config
+ stringvar
+
+
+ This clears all assigned config variables. If a variable name is
+ supplied, only that variable is cleared.
+
+
+clear_config
+
+// clear all assigned config variables.
+$smarty->clear_config();
+
+// clear one variable
+$smarty->clear_config('foobar');
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-functions/api-config-load.xml b/docs/ru/programmers/api-functions/api-config-load.xml
new file mode 100644
index 00000000..cce6d5c2
--- /dev/null
+++ b/docs/ru/programmers/api-functions/api-config-load.xml
@@ -0,0 +1,56 @@
+
+
+
+ config_load
+
+ voidconfig_load
+ stringfile
+ stringsection
+
+
+ This loads config file data and assigns it to the template. This
+ works identical to the template config_load
+ function.
+
+
+ Technical Note
+
+ As of Smarty 2.4.0, assigned template variables are kept across
+ invocations of fetch() and display(). Config vars loaded from
+ config_load() are always global scope. Config files are also
+ compiled for faster execution, and respect the force_compile and compile_check settings.
+
+
+
+config_load
+
+// load config variables and assign them
+$smarty->config_load('my.conf');
+
+// load a section
+$smarty->config_load('my.conf','foobar');
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-functions/api-display.xml b/docs/ru/programmers/api-functions/api-display.xml
new file mode 100644
index 00000000..0ea10688
--- /dev/null
+++ b/docs/ru/programmers/api-functions/api-display.xml
@@ -0,0 +1,99 @@
+
+
+
+ display
+
+ voiddisplay
+ stringtemplate
+ stringcache_id
+ stringcompile_id
+
+
+ This displays the template. Supply a valid template resource
+ type and path. As an optional second parameter, you can pass a
+ cache id. See the caching
+ section for more information.
+
+
+ As an optional third parameter, you can pass a compile id. This
+ is in the event that you want to compile different versions of
+ the same template, such as having separate templates compiled
+ for different languages. Another use for compile_id is when you
+ use more than one $template_dir but only one $compile_dir. Set
+ a separate compile_id for each $template_dir, otherwise
+ templates of the same name will overwrite each other. You can
+ also set the $compile_id variable once
+ instead of passing this to each call to display().
+
+
+display
+
+include("Smarty.class.php");
+$smarty = new Smarty;
+$smarty->caching = true;
+
+// only do db calls if cache doesn't exist
+if(!$smarty->is_cached("index.tpl"))
+{
+
+ // dummy up some data
+ $address = "245 N 50th";
+ $db_data = array(
+ "City" => "Lincoln",
+ "State" => "Nebraska",
+ "Zip" = > "68502"
+ );
+
+ $smarty->assign("Name","Fred");
+ $smarty->assign("Address",$address);
+ $smarty->assign($db_data);
+
+}
+
+// display the output
+$smarty->display("index.tpl");
+
+
+ Use the syntax for template resources to
+ display files outside of the $template_dir directory.
+
+
+function display template resource examples
+
+// absolute filepath
+$smarty->display("/usr/local/include/templates/header.tpl");
+
+// absolute filepath (same thing)
+$smarty->display("file:/usr/local/include/templates/header.tpl");
+
+// windows absolute filepath (MUST use "file:" prefix)
+$smarty->display("file:C:/www/pub/templates/header.tpl");
+
+// include from template resource named "db"
+$smarty->display("db:header.tpl");
+
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-functions/api-fetch.xml b/docs/ru/programmers/api-functions/api-fetch.xml
new file mode 100644
index 00000000..927db6ca
--- /dev/null
+++ b/docs/ru/programmers/api-functions/api-fetch.xml
@@ -0,0 +1,84 @@
+
+
+
+ fetch
+
+ stringfetch
+ stringtemplate
+ stringcache_id
+ stringcompile_id
+
+
+ This returns the template output instead of displaying it.
+ Supply a valid template resource
+ type and path. As an optional second parameter, you can pass a
+ cache id. See the caching
+ section for more information.
+
+
+ As an optional third parameter, you can pass a compile id. This
+ is in the event that you want to compile different versions of
+ the same template, such as having separate templates compiled
+ for different languages. Another use for compile_id is when you
+ use more than one $template_dir but only one $compile_dir. Set
+ a separate compile_id for each $template_dir, otherwise
+ templates of the same name will overwrite each other. You can
+ also set the $compile_id variable once
+ instead of passing this to each call to fetch().
+
+
+fetch
+
+include("Smarty.class.php");
+$smarty = new Smarty;
+
+$smarty->caching = true;
+
+// only do db calls if cache doesn't exist
+if(!$smarty->is_cached("index.tpl"))
+{
+
+ // dummy up some data
+ $address = "245 N 50th";
+ $db_data = array(
+ "City" => "Lincoln",
+ "State" => "Nebraska",
+ "Zip" = > "68502"
+ );
+
+ $smarty->assign("Name","Fred");
+ $smarty->assign("Address",$address);
+ $smarty->assign($db_data);
+
+}
+
+// capture the output
+$output = $smarty->fetch("index.tpl");
+
+// do something with $output here
+
+echo $output;
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-functions/api-get-config-vars.xml b/docs/ru/programmers/api-functions/api-get-config-vars.xml
new file mode 100644
index 00000000..0c9e0fe1
--- /dev/null
+++ b/docs/ru/programmers/api-functions/api-get-config-vars.xml
@@ -0,0 +1,45 @@
+
+
+
+ get_config_vars
+
+ arrayget_config_vars
+ stringvarname
+
+
+ This returns the given loaded config variable value. If no parameter
+ is given, an array of all loaded config variables is returned.
+
+
+get_config_vars
+
+// get loaded config template var 'foo'
+$foo = $smarty->get_config_vars('foo');
+
+// get all loaded config template vars
+$config_vars = $smarty->get_config_vars();
+
+// take a look at them
+print_r($config_vars);
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-functions/api-get-registered-object.xml b/docs/ru/programmers/api-functions/api-get-registered-object.xml
new file mode 100644
index 00000000..4e668928
--- /dev/null
+++ b/docs/ru/programmers/api-functions/api-get-registered-object.xml
@@ -0,0 +1,47 @@
+
+
+
+ get_registered_object
+
+
+ array get_registered_object
+ string object_name
+
+
+
+ This returns a reference to a registered object. This is useful
+ from within a custom function when you need direct access to a
+ registered object.
+
+
+get_registered_object
+
+function smarty_block_foo($params, &$smarty) {
+ if (isset[$params['object']]) {
+ // get reference to registered object
+ $obj_ref =& $smarty->&get_registered_object($params['object']);
+ // use $obj_ref is now a reference to the object
+ }
+}
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-functions/api-get-template-vars.xml b/docs/ru/programmers/api-functions/api-get-template-vars.xml
new file mode 100644
index 00000000..14191ae8
--- /dev/null
+++ b/docs/ru/programmers/api-functions/api-get-template-vars.xml
@@ -0,0 +1,45 @@
+
+
+
+ get_template_vars
+
+ arrayget_template_vars
+ stringvarname
+
+
+ This returns the given assigned variable value. If no parameter
+ is given, an array of all assigned variables is returned.
+
+
+get_template_vars
+
+// get assigned template var 'foo'
+$foo = $smarty->get_template_vars('foo');
+
+// get all assigned template vars
+$tpl_vars = $smarty->get_template_vars();
+
+// take a look at them
+print_r($tpl_vars);
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-functions/api-is-cached.xml b/docs/ru/programmers/api-functions/api-is-cached.xml
new file mode 100644
index 00000000..036cc2f3
--- /dev/null
+++ b/docs/ru/programmers/api-functions/api-is-cached.xml
@@ -0,0 +1,63 @@
+
+
+
+ is_cached
+
+
+ void is_cached
+ string template
+ [string cache_id]
+
+
+
+ This returns true if there is a valid cache for this template.
+ This only works if caching is set to true.
+
+
+is_cached
+
+$smarty->caching = true;
+
+if(!$smarty->is_cached("index.tpl")) {
+ // do database calls, assign vars here
+}
+
+$smarty->display("index.tpl");
+
+
+ You can also pass a cache id as an optional second parameter
+ in case you want multiple caches for the given template.
+
+
+is_cached with multiple-cache template
+
+$smarty->caching = true;
+
+if(!$smarty->is_cached("index.tpl","FrontPage")) {
+ // do database calls, assign vars here
+}
+
+$smarty->display("index.tpl","FrontPage");
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-functions/api-load-filter.xml b/docs/ru/programmers/api-functions/api-load-filter.xml
new file mode 100644
index 00000000..b9288b91
--- /dev/null
+++ b/docs/ru/programmers/api-functions/api-load-filter.xml
@@ -0,0 +1,45 @@
+
+
+
+ load_filter
+
+
+ void load_filter
+ string type
+ string name
+
+
+
+ This function can be used to load a filter plugin. The first
+ argument specifies the type of the filter to load and can be one
+ of the following: 'pre', 'post', or 'output'. The second argument
+ specifies the name of the filter plugin, for example, 'trim'.
+
+
+loading filter plugins
+
+$smarty->load_filter('pre', 'trim'); // load prefilter named 'trim'
+$smarty->load_filter('pre', 'datefooter'); // load another prefilter named 'datefooter'
+$smarty->load_filter('output', 'compress'); // load output filter named 'compress'
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-functions/api-register-block.xml b/docs/ru/programmers/api-functions/api-register-block.xml
new file mode 100644
index 00000000..794ccc19
--- /dev/null
+++ b/docs/ru/programmers/api-functions/api-register-block.xml
@@ -0,0 +1,62 @@
+
+
+
+ register_block
+
+
+ void register_block
+ string name
+ string impl
+
+
+
+ Use this to dynamically register block functions plugins.
+ Pass in the block function name, followed by the PHP
+ function name that implements it.
+
+
+register_block
+
+register_block("translate", "do_translation");
+
+function do_translation ($params, $content, &$smarty) {
+ if ($content) {
+ $lang = $params['lang'];
+ // do some translation with $content
+ echo $translation;
+ }
+}
+?>
+
+{* template *}
+{translate lang="br"}
+ Hello, world!
+{/translate}
+]]>
+
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-functions/api-register-compiler-function.xml b/docs/ru/programmers/api-functions/api-register-compiler-function.xml
new file mode 100644
index 00000000..cd69ddaf
--- /dev/null
+++ b/docs/ru/programmers/api-functions/api-register-compiler-function.xml
@@ -0,0 +1,37 @@
+
+
+
+ register_compiler_function
+
+
+ void register_compiler_function
+ string name
+ string impl
+
+
+
+ Use this to dynamically register a compiler function plugin.
+ Pass in the compiler function name, followed by the PHP
+ function that implements it.
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-functions/api-register-function.xml b/docs/ru/programmers/api-functions/api-register-function.xml
new file mode 100644
index 00000000..0dc5bf19
--- /dev/null
+++ b/docs/ru/programmers/api-functions/api-register-function.xml
@@ -0,0 +1,52 @@
+
+
+
+ register_function
+
+
+ void register_function
+ string name
+ string impl
+
+
+
+ Use this to dynamically register template function plugins.
+ Pass in the template function name, followed by the PHP
+ function name that implements it.
+
+
+register_function
+
+$smarty->register_function("date_now", "print_current_date");
+
+function print_current_date ($params) {
+ extract($params);
+ if(empty($format))
+ $format="%b %e, %Y";
+ echo strftime($format,time());
+}
+
+// now you can use this in Smarty to print the current date: {date_now}
+// or, {date_now format="%Y/%m/%d"} to format it.
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-functions/api-register-modifier.xml b/docs/ru/programmers/api-functions/api-register-modifier.xml
new file mode 100644
index 00000000..879f6870
--- /dev/null
+++ b/docs/ru/programmers/api-functions/api-register-modifier.xml
@@ -0,0 +1,46 @@
+
+
+
+ register_modifier
+
+
+ void register_modifier
+ string name
+ string impl
+
+
+
+ Use this to dynamically register modifier plugin. Pass in the
+ template modifier name, followed by the PHP function that it
+ implements it.
+
+
+register_modifier
+
+// let's map PHP's stripslashes function to a Smarty modifier.
+
+$smarty->register_modifier("sslash","stripslashes");
+
+// now you can use {$var|sslash} to strip slashes from variables
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-functions/api-register-object.xml b/docs/ru/programmers/api-functions/api-register-object.xml
new file mode 100644
index 00000000..df8e6333
--- /dev/null
+++ b/docs/ru/programmers/api-functions/api-register-object.xml
@@ -0,0 +1,39 @@
+
+
+
+ register_object
+
+
+ void register_object
+ string object_name
+ object $object
+ array allowed methods/properties
+ boolean format
+
+
+
+ This is to register an object for use in the templates. See the
+ object section
+ of the manual for examples.
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-functions/api-register-outputfilter.xml b/docs/ru/programmers/api-functions/api-register-outputfilter.xml
new file mode 100644
index 00000000..a4a8cc7a
--- /dev/null
+++ b/docs/ru/programmers/api-functions/api-register-outputfilter.xml
@@ -0,0 +1,38 @@
+
+
+
+ register_outputfilter
+
+
+ void register_outputfilter
+ string function_name
+
+
+
+ Use this to dynamically register outputfilters to operate on
+ a template's output before it is displayed. See
+ template output
+ filters
+ for more information on how to set up an output filter function.
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-functions/api-register-postfilter.xml b/docs/ru/programmers/api-functions/api-register-postfilter.xml
new file mode 100644
index 00000000..c5702d3b
--- /dev/null
+++ b/docs/ru/programmers/api-functions/api-register-postfilter.xml
@@ -0,0 +1,37 @@
+
+
+
+ register_postfilter
+
+
+ void register_postfilter
+ string function_name
+
+
+
+ Use this to dynamically register postfilters to run templates
+ through after they are compiled. See template postfilters for
+ more information on how to setup a postfiltering function.
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-functions/api-register-prefilter.xml b/docs/ru/programmers/api-functions/api-register-prefilter.xml
new file mode 100644
index 00000000..d6f1d249
--- /dev/null
+++ b/docs/ru/programmers/api-functions/api-register-prefilter.xml
@@ -0,0 +1,37 @@
+
+
+
+ register_prefilter
+
+
+ void register_prefilter
+ string function_name
+
+
+
+ Use this to dynamically register prefilters to run templates
+ through before they are compiled. See template prefilters for
+ more information on how to setup a prefiltering function.
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-functions/api-register-resource.xml b/docs/ru/programmers/api-functions/api-register-resource.xml
new file mode 100644
index 00000000..6cde9f82
--- /dev/null
+++ b/docs/ru/programmers/api-functions/api-register-resource.xml
@@ -0,0 +1,48 @@
+
+
+
+ register_resource
+
+
+ void register_resource
+ string name
+ array resource_funcs
+
+
+
+ Use this to dynamically register a resource plugin with Smarty.
+ Pass in the name of the resource and the array of PHP functions
+ implementing it. See
+ template resources
+ for more information on how to setup a function for fetching
+ templates.
+
+
+register_resource
+
+$smarty->register_resource("db", array("db_get_template",
+ "db_get_timestamp",
+ "db_get_secure",
+ "db_get_trusted"));
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-functions/api-template-exists.xml b/docs/ru/programmers/api-functions/api-template-exists.xml
new file mode 100644
index 00000000..1e9e32e4
--- /dev/null
+++ b/docs/ru/programmers/api-functions/api-template-exists.xml
@@ -0,0 +1,36 @@
+
+
+
+ template_exists
+
+
+ bool template_exists
+ string template
+
+
+
+ This function checks whether the specified template exists. It can
+ accept either a path to the template on the filesystem or a
+ resource string specifying the template.
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-functions/api-trigger-error.xml b/docs/ru/programmers/api-functions/api-trigger-error.xml
new file mode 100644
index 00000000..7e779e00
--- /dev/null
+++ b/docs/ru/programmers/api-functions/api-trigger-error.xml
@@ -0,0 +1,38 @@
+
+
+
+ trigger_error
+
+
+ void trigger_error
+ string error_msg
+ [int level]
+
+
+
+ This function can be used to output an error message using Smarty.
+ level parameter can be one of the values
+ used for trigger_error() PHP function, i.e. E_USER_NOTICE,
+ E_USER_WARNING, etc. By default it's E_USER_WARNING.
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-functions/api-unregister-block.xml b/docs/ru/programmers/api-functions/api-unregister-block.xml
new file mode 100644
index 00000000..ea7be58e
--- /dev/null
+++ b/docs/ru/programmers/api-functions/api-unregister-block.xml
@@ -0,0 +1,35 @@
+
+
+
+ unregister_block
+
+
+ void unregister_block
+ string name
+
+
+
+ Use this to dynamically unregister block function plugin.
+ Pass in the block function name.
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-functions/api-unregister-compiler-function.xml b/docs/ru/programmers/api-functions/api-unregister-compiler-function.xml
new file mode 100644
index 00000000..1b21c409
--- /dev/null
+++ b/docs/ru/programmers/api-functions/api-unregister-compiler-function.xml
@@ -0,0 +1,35 @@
+
+
+
+ unregister_compiler_function
+
+
+ void unregister_compiler_function
+ string name
+
+
+
+ Use this to dynamically unregister a compiler function. Pass in
+ the name of the compiler function.
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-functions/api-unregister-function.xml b/docs/ru/programmers/api-functions/api-unregister-function.xml
new file mode 100644
index 00000000..85db1e86
--- /dev/null
+++ b/docs/ru/programmers/api-functions/api-unregister-function.xml
@@ -0,0 +1,42 @@
+
+
+
+ unregister_function
+
+
+ void unregister_function
+ string name
+
+
+
+ Use this to dynamically unregister template function plugin.
+ Pass in the template function name.
+
+
+unregister_function
+
+// we don't want template designers to have access to system files
+
+$smarty->unregister_function("fetch");
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-functions/api-unregister-modifier.xml b/docs/ru/programmers/api-functions/api-unregister-modifier.xml
new file mode 100644
index 00000000..09243e1c
--- /dev/null
+++ b/docs/ru/programmers/api-functions/api-unregister-modifier.xml
@@ -0,0 +1,42 @@
+
+
+
+ unregister_modifier
+
+
+ void unregister_modifier
+ string name
+
+
+
+ Use this to dynamically unregister modifier plugin. Pass in the
+ template modifier name.
+
+
+unregister_modifier
+
+// we don't want template designers to strip tags from elements
+
+$smarty->unregister_modifier("strip_tags");
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-functions/api-unregister-object.xml b/docs/ru/programmers/api-functions/api-unregister-object.xml
new file mode 100644
index 00000000..d9007b0f
--- /dev/null
+++ b/docs/ru/programmers/api-functions/api-unregister-object.xml
@@ -0,0 +1,34 @@
+
+
+
+ unregister_object
+
+
+ void unregister_object
+ string object_name
+
+
+
+ Use this to unregister an object.
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-functions/api-unregister-outputfilter.xml b/docs/ru/programmers/api-functions/api-unregister-outputfilter.xml
new file mode 100644
index 00000000..c3438f7d
--- /dev/null
+++ b/docs/ru/programmers/api-functions/api-unregister-outputfilter.xml
@@ -0,0 +1,34 @@
+
+
+
+ unregister_outputfilter
+
+
+ void unregister_outputfilter
+ string function_name
+
+
+
+ Use this to dynamically unregister an output filter.
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-functions/api-unregister-postfilter.xml b/docs/ru/programmers/api-functions/api-unregister-postfilter.xml
new file mode 100644
index 00000000..cca256d1
--- /dev/null
+++ b/docs/ru/programmers/api-functions/api-unregister-postfilter.xml
@@ -0,0 +1,34 @@
+
+
+
+ unregister_postfilter
+
+
+ void unregister_postfilter
+ string function_name
+
+
+
+ Use this to dynamically unregister a postfilter.
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-functions/api-unregister-prefilter.xml b/docs/ru/programmers/api-functions/api-unregister-prefilter.xml
new file mode 100644
index 00000000..60be265a
--- /dev/null
+++ b/docs/ru/programmers/api-functions/api-unregister-prefilter.xml
@@ -0,0 +1,34 @@
+
+
+
+ unregister_prefilter
+
+
+ void unregister_prefilter
+ string function_name
+
+
+
+ Use this to dynamically unregister a prefilter.
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-functions/api-unregister-resource.xml b/docs/ru/programmers/api-functions/api-unregister-resource.xml
new file mode 100644
index 00000000..6c776f49
--- /dev/null
+++ b/docs/ru/programmers/api-functions/api-unregister-resource.xml
@@ -0,0 +1,40 @@
+
+
+
+ unregister_resource
+
+
+ void unregister_resource
+ string name
+
+
+
+ Use this to dynamically unregister a resource plugin. Pass in the
+ name of the resource.
+
+
+unregister_resource
+
+$smarty->unregister_resource("db");
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-variables.xml b/docs/ru/programmers/api-variables.xml
index eb71c43a..12a6af6f 100644
--- a/docs/ru/programmers/api-variables.xml
+++ b/docs/ru/programmers/api-variables.xml
@@ -3,460 +3,40 @@
Variables
-
- $template_dir
-
- This is the name of the default template directory. If you do
- not supply a resource type when including files, they will be
- found here. By default this is "./templates", meaning that it
- will look for the templates directory in the same directory as
- the executing php script.
-
-
- Technical Note
-
- It is not recommended to put this directory under
- the web server document root.
-
-
-
-
- $compile_dir
-
- This is the name of the directory where compiled templates are
- located. By default this is "./templates_c", meaning that it
- will look for the compile directory in the same directory as
- the executing php script.
-
-
- Technical Note
-
- This setting must be either a relative or
- absolute path. include_path is not used for writing files.
-
-
-
- Technical Note
-
- It is not recommended to put this directory under
- the web server document root.
-
-
-
-
- $config_dir
-
- This is the directory used to store config files used in the
- templates. Default is "./configs", meaning that it will look
- for the configs directory in the same directory as the
- executing php script.
-
-
- Technical Note
-
- It is not recommended to put this directory under
- the web server document root.
-
-
-
-
- $plugins_dir
-
- This is the directories where Smarty will look for the plugins that it
- needs. Default is "plugins" under the SMARTY_DIR. If you supply a
- relative path, Smarty will first look under the SMARTY_DIR, then
- relative to the cwd (current working directory), then relative to each
- entry in your PHP include path.
-
-
- Technical Note
-
- For best performance, do not setup your plugins_dir to have to use the
- PHP include path. Use an absolute pathname, or a path relative to
- SMARTY_DIR or the cwd.
-
-
-
-
- $debugging
-
- This enables the debugging console.
- The console is a javascript window that informs you of the
- included templates and assigned variables for the current
- template page.
-
-
-
- $debug_tpl
-
- This is the name of the template file used for the debugging console. By
- default, it is named debug.tpl and is located in the SMARTY_DIR.
-
-
-
- $debugging_ctrl
-
- This allows alternate ways to enable debugging. NONE means no
- alternate methods are allowed. URL means when the keyword
- SMARTY_DEBUG is found in the QUERY_STRING, debugging is enabled
- for that invocation of the script. If $debugging is true, this
- value is ignored.
-
-
-
- $global_assign
-
- This is a list of variables that are always implicitly assigned
- to the template engine. This is handy for making global
- variables or server variables available to all templates
- without having to manually assign them. Each element in the
- $global_assign should be either a name of the global variable,
- or a key/value pair, where the key is the name of the global
- array and the value is the array of variables to be assigned
- from that global array. $SCRIPT_NAME is globally assigned by
- default from $HTTP_SERVER_VARS.
-
-
- Technical Note
-
- Server variables can be accessed through the
- $smarty variable, such as {$smarty.server.SCRIPT_NAME}. See the
- section on the
- $smarty variable.
-
-
-
-
- $undefined
-
- This sets the value of $undefined for Smarty, default is null.
- Currently this is only used to set undefined variables in
- $global_assign to a default value.
-
-
-
- $autoload_filters
-
- If there are some filters that you wish to load on every template
- invocation, you can specify them using this variable and Smarty will
- automatically load them for you. The variable is an associative array
- where keys are filter types and values are arrays of the filter
- names. For example:
-
-
-$smarty->autoload_filters = array('pre' => array('trim', 'stamp'),
- 'output' => array('convert'));
-
-
-
-
-
- $compile_check
-
- Upon each invocation of the PHP application, Smarty tests to see if the
- current template has changed (different time stamp) since the last time
- it was compiled. If it has changed, it recompiles that template. If the
- template has not been compiled, it will compile regardless of this
- setting. By default this variable is set to true. Once an application is
- put into production (templates won't be changing), the compile_check
- step is no longer needed. Be sure to set $compile_check to "false" for
- maximal performance. Note that if you change this to "false" and a
- template file is changed, you will *not* see the change since the
- template will not get recompiled. If caching is enabled and
- compile_check is enabled, then the cache files will get regenerated if
- an involved template file or config file was updated. See $force_compile or clear_compiled_tpl.
-
-
-
- $force_compile
-
- This forces Smarty to (re)compile templates on every
- invocation. This setting overrides $compile_check. By default
- this is disabled. This is handy for development and debugging.
- It should never be used in a production environment. If caching
- is enabled, the cache file(s) will be regenerated every time.
-
-
-
- $caching
-
- This tells Smarty whether or not to cache the output of the templates.
- By default this is set to 0, or disabled. If your templates generate
- redundant redundant content, it is advisable to turn on caching. This
- will result in significant performance gains. You can also have multiple
- caches for the same template. A value of 1 or 2 enables caching. 1 tells
- Smarty to use the current $cache_lifetime variable to determine if the
- cache has expired. A value of 2 tells Smarty to use the cache_lifetime
- value at the time the cache was generated. This way you can set the
- cache_lifetime just before fetching the template to have granular
- control over when that particular cache expires. See also is_cached.
-
-
- If $compile_check is enabled, the cached content will be regenerated if
- any of the templates or config files that are part of this cache are
- changed. If $force_compile is enabled, the cached content will always be
- regenerated.
-
-
-
- $cache_dir
-
- This is the name of the directory where template caches are
- stored. By default this is "./cache", meaning that it will look
- for the cache directory in the same directory as the executing
- php script. You can also use your own custom cache handler
- function to control cache files, which will ignore this
- setting.
-
-
- Technical Note
-
- This setting must be either a relative or
- absolute path. include_path is not used for writing files.
-
-
-
- Technical Note
-
- It is not recommended to put this directory under
- the web server document root.
-
-
-
-
- $cache_lifetime
-
- This is the length of time in seconds that a template cache is valid.
- Once this time has expired, the cache will be regenerated. $caching must
- be set to "true" for $cache_lifetime to have any purpose. A value of -1
- will force the cache to never expire. A value of 0 will cause the cache
- to always regenerate (good for testing only, to disable caching a more
- efficient method is to set $caching = false.)
-
-
- If $force_compile is
- enabled, the cache files will be regenerated every time, effectively
- disabling caching. You can clear all the cache files with the clear_all_cache() function, or
- individual cache files (or groups) with the clear_cache() function.
-
-
- Technical Note
-
- If you want to give certain templates their own cache lifetime, you could
- do this by setting $caching = 2,
- then set $cache_lifetime to a unique value just before calling display()
- or fetch().
-
-
-
-
- $cache_handler_func
-
- You can supply a custom function to handle cache files instead
- of using the built-in method using the $cache_dir. See the
- custom cache handler function section for details.
-
-
-
- $cache_modified_check
-
- If set to true, Smarty will respect the If-Modified-Since
- header sent from the client. If the cached file timestamp has
- not changed since the last visit, then a "304 Not Modified"
- header will be sent instead of the content. This works only on
- cached content without insert tags.
-
-
-
- $config_overwrite
-
- If set to true, variables read in from config files will overwrite each
- other. Otherwise, the variables will be pushed onto an array. This is
- helpful if you want to store arrays of data in config files, just list
- each element multiple times. true by default.
-
-
-
- $config_booleanize
-
- If set to true, config file values of on/true/yes and off/false/no get
- converted to boolean values automatically. This way you can use the
- values in the template like so: {if #foobar#} ... {/if}. If foobar was
- on, true or yes, the {if} statement will execute. true by default.
-
-
-
- $config_read_hidden
-
- If set to true, hidden sections (section names beginning with a period)
- in config files can be read from templates. Typically you would leave
- this false, that way you can store sensitive data in the config files
- such as database parameters and not worry about the template loading
- them. false by default.
-
-
-
- $config_fix_newlines
-
- If set to true, mac and dos newlines (\r and \r\n) in config files are
- converted to \n when they are parsed. true by default.
-
-
-
- $default_template_handler_func
-
- This function is called when a template cannot be obtained from
- its resource.
-
-
-
- $php_handling
-
- This tells Smarty how to handle PHP code embedded in the
- templates. There are four possible settings, default being
- SMARTY_PHP_PASSTHRU. Note that this does NOT affect php code
- within {php}{/php}
- tags in the template.
-
-
- SMARTY_PHP_PASSTHRU - Smarty echos tags as-is.
- SMARTY_PHP_QUOTE - Smarty quotes the tags as
- html entities.
- SMARTY_PHP_REMOVE - Smarty removes the tags from
- the templates.
- SMARTY_PHP_ALLOW - Smarty will execute the tags
- as PHP code.
-
-
- NOTE: Embedding PHP code into templates is highly discouraged.
- Use custom functions or
- modifiers instead.
-
-
-
- $security
-
- $security true/false, default is false. Security is good for
- situations when you have untrusted parties editing the templates
- (via ftp for example) and you want to reduce the risk of system
- security compromises through the template language. Turning on
- security enforces the following rules to the template language,
- unless specifially overridden with $security_settings:
-
-
- If $php_handling is set to SMARTY_PHP_ALLOW, this is
- implicitly changed to SMARTY_PHP_PASSTHRU
- PHP functions are not allowed in IF statements,
- except those specified in the $security_settings
- templates can only be included from directories
- listed in the $secure_dir array
- local files can only be fetched from directories
- listed in the $secure_dir array using {fetch}
- {php}{/php} tags are not allowed
- PHP functions are not allowed as modifiers, except
- those specified in the $security_settings
-
-
-
- $secure_dir
-
- This is an array of all local directories that are considered
- secure. {include} and {fetch} use this when security is enabled.
-
-
-
- $security_settings
-
- These are used to override or specify the security settings when
- security is enabled. These are the possible settings:
-
-
- PHP_HANDLING - true/false. If set to true, the
- $php_handling setting is not checked for security.
- IF_FUNCS - This is an array of the names of permitted
- PHP functions in IF statements.
- INCLUDE_ANY - true/false. If set to true, any
- template can be included from the file system, regardless of the
- $secure_dir list.
- PHP_TAGS - true/false. If set to true, {php}{/php}
- tags are permitted in the templates.
- MODIFIER_FUNCS - This is an array of the names of permitted
- PHP functions used as variable modifiers.
-
-
-
- $trusted_dir
-
- $trusted_dir is only for use when $security is enabled. This is an array
- of all directories that are considered trusted. Trusted directories are
- where you keep php scripts that are executed directly from the templates
- with {include_php}.
-
-
-
- $left_delimiter
-
- This is the left delimiter used by the template language.
- Default is "{".
-
-
-
- $right_delimiter
-
- This is the right delimiter used by the template language.
- Default is "}".
-
-
-
- $compiler_class
-
- Specifies the name of the compiler class that Smarty will use
- to compile the templates. The default is 'Smarty_Compiler'. For
- advanced users only.
-
-
-
- $request_vars_order
-
- The order in which request variables are registered, similar to
- variables_order in php.ini
-
-
-
- $compile_id
-
- Persistant compile identifier. As an alternative to passing the same
- compile_id to each and every function call, you can set this compile_id
- and it will be used implicitly thereafter.
-
-
-
- $use_sub_dirs
-
- Set this to false if your PHP environment does not allow the creation of
- sub directories by Smarty. Sub directories are more efficient, so use them
- if you can.
-
-
-
- $default_modifiers
-
- This is an array of modifiers to implicitly apply to every variable in a
- template. For example, to HTML-escape every variable by default, use
- array('escape:"htmlall"'); To make a variable exempt from default
- modifiers, pass the special "smarty" modifier with a parameter value of
- "nodefaults" modifier to it, such as
- {$var|smarty:nodefaults}.
-
-
+&programmers.api-variables.variable-template-dir;
+&programmers.api-variables.variable-compile-dir;
+&programmers.api-variables.variable-config-dir;
+&programmers.api-variables.variable-plugins-dir;
+&programmers.api-variables.variable-debugging;
+&programmers.api-variables.variable-debug-tpl;
+&programmers.api-variables.variable-debugging-ctrl;
+&programmers.api-variables.variable-global-assign;
+&programmers.api-variables.variable-undefined;
+&programmers.api-variables.variable-autoload-filters;
+&programmers.api-variables.variable-compile-check;
+&programmers.api-variables.variable-force-compile;
+&programmers.api-variables.variable-caching;
+&programmers.api-variables.variable-cache-dir;
+&programmers.api-variables.variable-cache-lifetime;
+&programmers.api-variables.variable-cache-handler-func;
+&programmers.api-variables.variable-cache-modified-check;
+&programmers.api-variables.variable-config-overwrite;
+&programmers.api-variables.variable-config-booleanize;
+&programmers.api-variables.variable-config-read-hidden;
+&programmers.api-variables.variable-config-fix-newlines;
+&programmers.api-variables.variable-default-template-handler-func;
+&programmers.api-variables.variable-php-handling;
+&programmers.api-variables.variable-security;
+&programmers.api-variables.variable-secure-dir;
+&programmers.api-variables.variable-security-settings;
+&programmers.api-variables.variable-trusted-dir;
+&programmers.api-variables.variable-left-delimiter;
+&programmers.api-variables.variable-right-delimiter;
+&programmers.api-variables.variable-compiler-class;
+&programmers.api-variables.variable-request-vars-order;
+&programmers.api-variables.variable-compile-id;
+&programmers.api-variables.variable-use-sub-dirs;
+&programmers.api-variables.variable-default-modifiers;
+
+ $autoload_filters
+
+ If there are some filters that you wish to load on every template
+ invocation, you can specify them using this variable and Smarty will
+ automatically load them for you. The variable is an associative array
+ where keys are filter types and values are arrays of the filter
+ names. For example:
+
+
+$smarty->autoload_filters = array('pre' => array('trim', 'stamp'),
+ 'output' => array('convert'));
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-variables/variable-cache-dir.xml b/docs/ru/programmers/api-variables/variable-cache-dir.xml
new file mode 100644
index 00000000..8796cf39
--- /dev/null
+++ b/docs/ru/programmers/api-variables/variable-cache-dir.xml
@@ -0,0 +1,47 @@
+
+
+
+ $cache_dir
+
+ This is the name of the directory where template caches are
+ stored. By default this is "./cache", meaning that it will look
+ for the cache directory in the same directory as the executing
+ php script. You can also use your own custom cache handler
+ function to control cache files, which will ignore this
+ setting.
+
+
+ Technical Note
+
+ This setting must be either a relative or
+ absolute path. include_path is not used for writing files.
+
+
+
+ Technical Note
+
+ It is not recommended to put this directory under
+ the web server document root.
+
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-variables/variable-cache-handler-func.xml b/docs/ru/programmers/api-variables/variable-cache-handler-func.xml
new file mode 100644
index 00000000..0cc80146
--- /dev/null
+++ b/docs/ru/programmers/api-variables/variable-cache-handler-func.xml
@@ -0,0 +1,30 @@
+
+
+
+ $cache_handler_func
+
+ You can supply a custom function to handle cache files instead
+ of using the built-in method using the $cache_dir. See the
+ custom cache handler function section for details.
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-variables/variable-cache-lifetime.xml b/docs/ru/programmers/api-variables/variable-cache-lifetime.xml
new file mode 100644
index 00000000..489921a3
--- /dev/null
+++ b/docs/ru/programmers/api-variables/variable-cache-lifetime.xml
@@ -0,0 +1,51 @@
+
+
+
+ $cache_lifetime
+
+ This is the length of time in seconds that a template cache is valid.
+ Once this time has expired, the cache will be regenerated. $caching must
+ be set to "true" for $cache_lifetime to have any purpose. A value of -1
+ will force the cache to never expire. A value of 0 will cause the cache
+ to always regenerate (good for testing only, to disable caching a more
+ efficient method is to set $caching = false.)
+
+
+ If $force_compile is
+ enabled, the cache files will be regenerated every time, effectively
+ disabling caching. You can clear all the cache files with the clear_all_cache() function, or
+ individual cache files (or groups) with the clear_cache() function.
+
+
+ Technical Note
+
+ If you want to give certain templates their own cache lifetime, you could
+ do this by setting $caching = 2,
+ then set $cache_lifetime to a unique value just before calling display()
+ or fetch().
+
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-variables/variable-cache-modified-check.xml b/docs/ru/programmers/api-variables/variable-cache-modified-check.xml
new file mode 100644
index 00000000..dd6687f1
--- /dev/null
+++ b/docs/ru/programmers/api-variables/variable-cache-modified-check.xml
@@ -0,0 +1,32 @@
+
+
+
+ $cache_modified_check
+
+ If set to true, Smarty will respect the If-Modified-Since
+ header sent from the client. If the cached file timestamp has
+ not changed since the last visit, then a "304 Not Modified"
+ header will be sent instead of the content. This works only on
+ cached content without insert tags.
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-variables/variable-caching.xml b/docs/ru/programmers/api-variables/variable-caching.xml
new file mode 100644
index 00000000..0fb75fa2
--- /dev/null
+++ b/docs/ru/programmers/api-variables/variable-caching.xml
@@ -0,0 +1,44 @@
+
+
+
+ $caching
+
+ This tells Smarty whether or not to cache the output of the templates.
+ By default this is set to 0, or disabled. If your templates generate
+ redundant redundant content, it is advisable to turn on caching. This
+ will result in significant performance gains. You can also have multiple
+ caches for the same template. A value of 1 or 2 enables caching. 1 tells
+ Smarty to use the current $cache_lifetime variable to determine if the
+ cache has expired. A value of 2 tells Smarty to use the cache_lifetime
+ value at the time the cache was generated. This way you can set the
+ cache_lifetime just before fetching the template to have granular
+ control over when that particular cache expires. See also is_cached.
+
+
+ If $compile_check is enabled, the cached content will be regenerated if
+ any of the templates or config files that are part of this cache are
+ changed. If $force_compile is enabled, the cached content will always be
+ regenerated.
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-variables/variable-compile-check.xml b/docs/ru/programmers/api-variables/variable-compile-check.xml
new file mode 100644
index 00000000..23efbe78
--- /dev/null
+++ b/docs/ru/programmers/api-variables/variable-compile-check.xml
@@ -0,0 +1,41 @@
+
+
+
+ $compile_check
+
+ Upon each invocation of the PHP application, Smarty tests to see if the
+ current template has changed (different time stamp) since the last time
+ it was compiled. If it has changed, it recompiles that template. If the
+ template has not been compiled, it will compile regardless of this
+ setting. By default this variable is set to true. Once an application is
+ put into production (templates won't be changing), the compile_check
+ step is no longer needed. Be sure to set $compile_check to "false" for
+ maximal performance. Note that if you change this to "false" and a
+ template file is changed, you will *not* see the change since the
+ template will not get recompiled. If caching is enabled and
+ compile_check is enabled, then the cache files will get regenerated if
+ an involved template file or config file was updated. See $force_compile or clear_compiled_tpl.
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-variables/variable-compile-dir.xml b/docs/ru/programmers/api-variables/variable-compile-dir.xml
new file mode 100644
index 00000000..8503cc7e
--- /dev/null
+++ b/docs/ru/programmers/api-variables/variable-compile-dir.xml
@@ -0,0 +1,45 @@
+
+
+
+ $compile_dir
+
+ This is the name of the directory where compiled templates are
+ located. By default this is "./templates_c", meaning that it
+ will look for the compile directory in the same directory as
+ the executing php script.
+
+
+ Technical Note
+
+ This setting must be either a relative or
+ absolute path. include_path is not used for writing files.
+
+
+
+ Technical Note
+
+ It is not recommended to put this directory under
+ the web server document root.
+
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-variables/variable-compile-id.xml b/docs/ru/programmers/api-variables/variable-compile-id.xml
new file mode 100644
index 00000000..3b0b12ae
--- /dev/null
+++ b/docs/ru/programmers/api-variables/variable-compile-id.xml
@@ -0,0 +1,30 @@
+
+
+
+ $compile_id
+
+ Persistant compile identifier. As an alternative to passing the same
+ compile_id to each and every function call, you can set this compile_id
+ and it will be used implicitly thereafter.
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-variables/variable-compiler-class.xml b/docs/ru/programmers/api-variables/variable-compiler-class.xml
new file mode 100644
index 00000000..076822b4
--- /dev/null
+++ b/docs/ru/programmers/api-variables/variable-compiler-class.xml
@@ -0,0 +1,30 @@
+
+
+
+ $compiler_class
+
+ Specifies the name of the compiler class that Smarty will use
+ to compile the templates. The default is 'Smarty_Compiler'. For
+ advanced users only.
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-variables/variable-config-booleanize.xml b/docs/ru/programmers/api-variables/variable-config-booleanize.xml
new file mode 100644
index 00000000..966719f4
--- /dev/null
+++ b/docs/ru/programmers/api-variables/variable-config-booleanize.xml
@@ -0,0 +1,31 @@
+
+
+
+ $config_booleanize
+
+ If set to true, config file values of on/true/yes and off/false/no get
+ converted to boolean values automatically. This way you can use the
+ values in the template like so: {if #foobar#} ... {/if}. If foobar was
+ on, true or yes, the {if} statement will execute. true by default.
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-variables/variable-config-dir.xml b/docs/ru/programmers/api-variables/variable-config-dir.xml
new file mode 100644
index 00000000..6c382925
--- /dev/null
+++ b/docs/ru/programmers/api-variables/variable-config-dir.xml
@@ -0,0 +1,38 @@
+
+
+
+ $config_dir
+
+ This is the directory used to store config files used in the
+ templates. Default is "./configs", meaning that it will look
+ for the configs directory in the same directory as the
+ executing php script.
+
+
+ Technical Note
+
+ It is not recommended to put this directory under
+ the web server document root.
+
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-variables/variable-config-fix-newlines.xml b/docs/ru/programmers/api-variables/variable-config-fix-newlines.xml
new file mode 100644
index 00000000..fd889472
--- /dev/null
+++ b/docs/ru/programmers/api-variables/variable-config-fix-newlines.xml
@@ -0,0 +1,29 @@
+
+
+
+ $config_fix_newlines
+
+ If set to true, mac and dos newlines (\r and \r\n) in config files are
+ converted to \n when they are parsed. true by default.
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-variables/variable-config-overwrite.xml b/docs/ru/programmers/api-variables/variable-config-overwrite.xml
new file mode 100644
index 00000000..882fcf8d
--- /dev/null
+++ b/docs/ru/programmers/api-variables/variable-config-overwrite.xml
@@ -0,0 +1,31 @@
+
+
+
+ $config_overwrite
+
+ If set to true, variables read in from config files will overwrite each
+ other. Otherwise, the variables will be pushed onto an array. This is
+ helpful if you want to store arrays of data in config files, just list
+ each element multiple times. true by default.
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-variables/variable-config-read-hidden.xml b/docs/ru/programmers/api-variables/variable-config-read-hidden.xml
new file mode 100644
index 00000000..cb42e91e
--- /dev/null
+++ b/docs/ru/programmers/api-variables/variable-config-read-hidden.xml
@@ -0,0 +1,32 @@
+
+
+
+ $config_read_hidden
+
+ If set to true, hidden sections (section names beginning with a period)
+ in config files can be read from templates. Typically you would leave
+ this false, that way you can store sensitive data in the config files
+ such as database parameters and not worry about the template loading
+ them. false by default.
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-variables/variable-debug-tpl.xml b/docs/ru/programmers/api-variables/variable-debug-tpl.xml
new file mode 100644
index 00000000..53a67266
--- /dev/null
+++ b/docs/ru/programmers/api-variables/variable-debug-tpl.xml
@@ -0,0 +1,30 @@
+
+
+
+ $debug_tpl
+
+ This is the name of the template file used for the debugging console. By
+ default, it is named debug.tpl and is located in the SMARTY_DIR.
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-variables/variable-debugging-ctrl.xml b/docs/ru/programmers/api-variables/variable-debugging-ctrl.xml
new file mode 100644
index 00000000..2bb08022
--- /dev/null
+++ b/docs/ru/programmers/api-variables/variable-debugging-ctrl.xml
@@ -0,0 +1,32 @@
+
+
+
+ $debugging_ctrl
+
+ This allows alternate ways to enable debugging. NONE means no
+ alternate methods are allowed. URL means when the keyword
+ SMARTY_DEBUG is found in the QUERY_STRING, debugging is enabled
+ for that invocation of the script. If $debugging is true, this
+ value is ignored.
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-variables/variable-debugging.xml b/docs/ru/programmers/api-variables/variable-debugging.xml
new file mode 100644
index 00000000..0da2573c
--- /dev/null
+++ b/docs/ru/programmers/api-variables/variable-debugging.xml
@@ -0,0 +1,32 @@
+
+
+
+ $debugging
+
+ This enables the debugging console.
+ The console is a javascript window that informs you of the
+ included templates and assigned variables for the current
+ template page.
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-variables/variable-default-modifiers.xml b/docs/ru/programmers/api-variables/variable-default-modifiers.xml
new file mode 100644
index 00000000..c068cd02
--- /dev/null
+++ b/docs/ru/programmers/api-variables/variable-default-modifiers.xml
@@ -0,0 +1,33 @@
+
+
+
+ $default_modifiers
+
+ This is an array of modifiers to implicitly apply to every variable in a
+ template. For example, to HTML-escape every variable by default, use
+ array('escape:"htmlall"'); To make a variable exempt from default
+ modifiers, pass the special "smarty" modifier with a parameter value of
+ "nodefaults" modifier to it, such as
+ {$var|smarty:nodefaults}.
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-variables/variable-default-template-handler-func.xml b/docs/ru/programmers/api-variables/variable-default-template-handler-func.xml
new file mode 100644
index 00000000..d508ac6b
--- /dev/null
+++ b/docs/ru/programmers/api-variables/variable-default-template-handler-func.xml
@@ -0,0 +1,29 @@
+
+
+
+ $default_template_handler_func
+
+ This function is called when a template cannot be obtained from
+ its resource.
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-variables/variable-force-compile.xml b/docs/ru/programmers/api-variables/variable-force-compile.xml
new file mode 100644
index 00000000..51df1dd9
--- /dev/null
+++ b/docs/ru/programmers/api-variables/variable-force-compile.xml
@@ -0,0 +1,32 @@
+
+
+
+ $force_compile
+
+ This forces Smarty to (re)compile templates on every
+ invocation. This setting overrides $compile_check. By default
+ this is disabled. This is handy for development and debugging.
+ It should never be used in a production environment. If caching
+ is enabled, the cache file(s) will be regenerated every time.
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-variables/variable-global-assign.xml b/docs/ru/programmers/api-variables/variable-global-assign.xml
new file mode 100644
index 00000000..9d96def8
--- /dev/null
+++ b/docs/ru/programmers/api-variables/variable-global-assign.xml
@@ -0,0 +1,45 @@
+
+
+
+ $global_assign
+
+ This is a list of variables that are always implicitly assigned
+ to the template engine. This is handy for making global
+ variables or server variables available to all templates
+ without having to manually assign them. Each element in the
+ $global_assign should be either a name of the global variable,
+ or a key/value pair, where the key is the name of the global
+ array and the value is the array of variables to be assigned
+ from that global array. $SCRIPT_NAME is globally assigned by
+ default from $HTTP_SERVER_VARS.
+
+
+ Technical Note
+
+ Server variables can be accessed through the
+ $smarty variable, such as {$smarty.server.SCRIPT_NAME}. See the
+ section on the
+ $smarty variable.
+
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-variables/variable-left-delimiter.xml b/docs/ru/programmers/api-variables/variable-left-delimiter.xml
new file mode 100644
index 00000000..3e2399ba
--- /dev/null
+++ b/docs/ru/programmers/api-variables/variable-left-delimiter.xml
@@ -0,0 +1,29 @@
+
+
+
+ $left_delimiter
+
+ This is the left delimiter used by the template language.
+ Default is "{".
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-variables/variable-php-handling.xml b/docs/ru/programmers/api-variables/variable-php-handling.xml
new file mode 100644
index 00000000..df11594d
--- /dev/null
+++ b/docs/ru/programmers/api-variables/variable-php-handling.xml
@@ -0,0 +1,46 @@
+
+
+
+ $php_handling
+
+ This tells Smarty how to handle PHP code embedded in the
+ templates. There are four possible settings, default being
+ SMARTY_PHP_PASSTHRU. Note that this does NOT affect php code
+ within {php}{/php}
+ tags in the template.
+
+
+ SMARTY_PHP_PASSTHRU - Smarty echos tags as-is.
+ SMARTY_PHP_QUOTE - Smarty quotes the tags as
+ html entities.
+ SMARTY_PHP_REMOVE - Smarty removes the tags from
+ the templates.
+ SMARTY_PHP_ALLOW - Smarty will execute the tags
+ as PHP code.
+
+
+ NOTE: Embedding PHP code into templates is highly discouraged.
+ Use custom functions or
+ modifiers instead.
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-variables/variable-plugins-dir.xml b/docs/ru/programmers/api-variables/variable-plugins-dir.xml
new file mode 100644
index 00000000..36f4d98f
--- /dev/null
+++ b/docs/ru/programmers/api-variables/variable-plugins-dir.xml
@@ -0,0 +1,40 @@
+
+
+
+ $plugins_dir
+
+ This is the directories where Smarty will look for the plugins that it
+ needs. Default is "plugins" under the SMARTY_DIR. If you supply a
+ relative path, Smarty will first look under the SMARTY_DIR, then
+ relative to the cwd (current working directory), then relative to each
+ entry in your PHP include path.
+
+
+ Technical Note
+
+ For best performance, do not setup your plugins_dir to have to use the
+ PHP include path. Use an absolute pathname, or a path relative to
+ SMARTY_DIR or the cwd.
+
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-variables/variable-request-vars-order.xml b/docs/ru/programmers/api-variables/variable-request-vars-order.xml
new file mode 100644
index 00000000..ca671cd0
--- /dev/null
+++ b/docs/ru/programmers/api-variables/variable-request-vars-order.xml
@@ -0,0 +1,29 @@
+
+
+
+ $request_vars_order
+
+ The order in which request variables are registered, similar to
+ variables_order in php.ini
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-variables/variable-right-delimiter.xml b/docs/ru/programmers/api-variables/variable-right-delimiter.xml
new file mode 100644
index 00000000..95316641
--- /dev/null
+++ b/docs/ru/programmers/api-variables/variable-right-delimiter.xml
@@ -0,0 +1,29 @@
+
+
+
+ $right_delimiter
+
+ This is the right delimiter used by the template language.
+ Default is "}".
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-variables/variable-secure-dir.xml b/docs/ru/programmers/api-variables/variable-secure-dir.xml
new file mode 100644
index 00000000..2f3b1f80
--- /dev/null
+++ b/docs/ru/programmers/api-variables/variable-secure-dir.xml
@@ -0,0 +1,29 @@
+
+
+
+ $secure_dir
+
+ This is an array of all local directories that are considered
+ secure. {include} and {fetch} use this when security is enabled.
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-variables/variable-security-settings.xml b/docs/ru/programmers/api-variables/variable-security-settings.xml
new file mode 100644
index 00000000..6d19a807
--- /dev/null
+++ b/docs/ru/programmers/api-variables/variable-security-settings.xml
@@ -0,0 +1,42 @@
+
+
+
+ $security_settings
+
+ These are used to override or specify the security settings when
+ security is enabled. These are the possible settings:
+
+
+ PHP_HANDLING - true/false. If set to true, the
+ $php_handling setting is not checked for security.
+ IF_FUNCS - This is an array of the names of permitted
+ PHP functions in IF statements.
+ INCLUDE_ANY - true/false. If set to true, any
+ template can be included from the file system, regardless of the
+ $secure_dir list.
+ PHP_TAGS - true/false. If set to true, {php}{/php}
+ tags are permitted in the templates.
+ MODIFIER_FUNCS - This is an array of the names of permitted
+ PHP functions used as variable modifiers.
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-variables/variable-security.xml b/docs/ru/programmers/api-variables/variable-security.xml
new file mode 100644
index 00000000..66e56847
--- /dev/null
+++ b/docs/ru/programmers/api-variables/variable-security.xml
@@ -0,0 +1,46 @@
+
+
+
+ $security
+
+ $security true/false, default is false. Security is good for
+ situations when you have untrusted parties editing the templates
+ (via ftp for example) and you want to reduce the risk of system
+ security compromises through the template language. Turning on
+ security enforces the following rules to the template language,
+ unless specifially overridden with $security_settings:
+
+
+ If $php_handling is set to SMARTY_PHP_ALLOW, this is
+ implicitly changed to SMARTY_PHP_PASSTHRU
+ PHP functions are not allowed in IF statements,
+ except those specified in the $security_settings
+ templates can only be included from directories
+ listed in the $secure_dir array
+ local files can only be fetched from directories
+ listed in the $secure_dir array using {fetch}
+ {php}{/php} tags are not allowed
+ PHP functions are not allowed as modifiers, except
+ those specified in the $security_settings
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-variables/variable-template-dir.xml b/docs/ru/programmers/api-variables/variable-template-dir.xml
new file mode 100644
index 00000000..e159baf3
--- /dev/null
+++ b/docs/ru/programmers/api-variables/variable-template-dir.xml
@@ -0,0 +1,39 @@
+
+
+
+ $template_dir
+
+ This is the name of the default template directory. If you do
+ not supply a resource type when including files, they will be
+ found here. By default this is "./templates", meaning that it
+ will look for the templates directory in the same directory as
+ the executing php script.
+
+
+ Technical Note
+
+ It is not recommended to put this directory under
+ the web server document root.
+
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-variables/variable-trusted-dir.xml b/docs/ru/programmers/api-variables/variable-trusted-dir.xml
new file mode 100644
index 00000000..6c042cd7
--- /dev/null
+++ b/docs/ru/programmers/api-variables/variable-trusted-dir.xml
@@ -0,0 +1,31 @@
+
+
+
+ $trusted_dir
+
+ $trusted_dir is only for use when $security is enabled. This is an array
+ of all directories that are considered trusted. Trusted directories are
+ where you keep php scripts that are executed directly from the templates
+ with {include_php}.
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-variables/variable-undefined.xml b/docs/ru/programmers/api-variables/variable-undefined.xml
new file mode 100644
index 00000000..e607f498
--- /dev/null
+++ b/docs/ru/programmers/api-variables/variable-undefined.xml
@@ -0,0 +1,30 @@
+
+
+
+ $undefined
+
+ This sets the value of $undefined for Smarty, default is null.
+ Currently this is only used to set undefined variables in
+ $global_assign to a default value.
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/api-variables/variable-use-sub-dirs.xml b/docs/ru/programmers/api-variables/variable-use-sub-dirs.xml
new file mode 100644
index 00000000..f9d75c95
--- /dev/null
+++ b/docs/ru/programmers/api-variables/variable-use-sub-dirs.xml
@@ -0,0 +1,30 @@
+
+
+
+ $use_sub_dirs
+
+ Set this to false if your PHP environment does not allow the creation of
+ sub directories by Smarty. Sub directories are more efficient, so use them
+ if you can.
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/caching.xml b/docs/ru/programmers/caching.xml
index 26fc2f87..e7ab670e 100644
--- a/docs/ru/programmers/caching.xml
+++ b/docs/ru/programmers/caching.xml
@@ -20,270 +20,9 @@
displaying a page with a weather map containing new information by the
minute, it would not make sense to cache this page.
-
- Setting Up Caching
-
- The first thing to do is enable caching. This is done by setting $caching = true (or 1.)
-
-
- enabling caching
-
-require('Smarty.class.php');
-$smarty = new Smarty;
-
-$smarty->caching = true;
-
-$smarty->display('index.tpl');
-
-
- With caching enabled, the function call to display('index.tpl') will render
- the template as usual, but also saves a copy of its output to a file (a
- cached copy) in the $cache_dir.
- Upon the next call to display('index.tpl'), the cached copy will be used
- instead of rendering the template again.
-
-
- Technical Note
-
- The files in the $cache_dir are named similar to the template name.
- Although they end in the ".php" extention, they are not really executable
- php scripts. Do not edit these files!
-
-
-
- Each cached page has a limited lifetime determined by $cache_lifetime. The default value
- is 3600 seconds, or 1 hour. After that time expires, the cache is
- regenerated. It is possible to give individual caches their own expiration
- time by setting $caching = 2. See the documentation on $cache_lifetime for details.
-
-
- setting cache_lifetime per cache
-
-require('Smarty.class.php');
-$smarty = new Smarty;
-
-$smarty->caching = 2; // lifetime is per cache
-
-// set the cache_lifetime for index.tpl to 5 minutes
-$smarty->cache_lifetime = 300;
-$smarty->display('index.tpl');
-
-// set the cache_lifetime for home.tpl to 1 hour
-$smarty->cache_lifetime = 3600;
-$smarty->display('home.tpl');
-
-// NOTE: the following $cache_lifetime setting will not work when $caching = 2.
-// The cache lifetime for home.tpl has already been set
-// to 1 hour, and will no longer respect the value of $cache_lifetime.
-// The home.tpl cache will still expire after 1 hour.
-$smarty->cache_lifetime = 30; // 30 seconds
-$smarty->display('home.tpl');
-
-
- If $compile_check is enabled,
- every template file and config file that is involved with the cache file is
- checked for modification. If any of the files have been modified since the
- cache was generated, the cache is immediately regenerated. This is a slight
- overhead so for optimum performance, leave $compile_check set to false.
-
-
- enabling $compile_check
-
-require('Smarty.class.php');
-$smarty = new Smarty;
-
-$smarty->caching = true;
-$smarty->compile_check = true;
-
-$smarty->display('index.tpl');
-
-
- If $force_compile is enabled,
- the cache files will always be regenerated. This effectively turns off
- caching. $force_compile is usually for debugging purposes only, a more
- efficient way of disabling caching is to set $caching = false (or 0.)
-
-
- The is_cached() function
- can be used to test if a template has a valid cache or not. If you have a
- cached template that requires something like a database fetch, you can use
- this to skip that process.
-
-
- using is_cached()
-
-require('Smarty.class.php');
-$smarty = new Smarty;
-
-$smarty->caching = true;
-
-if(!$smarty->is_cached('index.tpl')) {
- // No cache available, do variable assignments here.
- $contents = get_database_contents();
- $smarty->assign($contents);
-}
-
-$smarty->display('index.tpl');
-
-
- You can keep parts of a page dynamic with the insert template function. Let's
- say the whole page can be cached except for a banner that is displayed down
- the right side of the page. By using an insert function for the banner, you
- can keep this element dynamic within the cached content. See the
- documentation on insert for
- details and examples.
-
-
- You can clear all the cache files with the clear_all_cache() function, or
- individual cache files (or groups) with the clear_cache() function.
-
-
- clearing the cache
-
-require('Smarty.class.php');
-$smarty = new Smarty;
-
-$smarty->caching = true;
-
-// clear out all cache files
-$smarty->clear_all_cache();
-
-// clear only cache for index.tpl
-$smarty->clear_cache('index.tpl');
-
-$smarty->display('index.tpl');
-
-
-
- Multiple Caches Per Page
-
- You can have multiple cache files for a single call to display() or
- fetch(). Let's say that a call to display('index.tpl') may have several
- different output contents depending on some condition, and you want
- separate caches for each one. You can do this by passing a cache_id as the
- second parameter to the function call.
-
-
- passing a cache_id to display()
-
-require('Smarty.class.php');
-$smarty = new Smarty;
-
-$smarty->caching = true;
-
-$my_cache_id = $_GET['article_id'];
-
-$smarty->display('index.tpl',$my_cache_id);
-
-
- Above, we are passing the variable $my_cache_id to display() as the
- cache_id. For each unique value of $my_cache_id, a separate cache will be
- generated for index.tpl. In this example, "article_id" was passed in the
- URL and is used as the cache_id.
-
-
- Technical Note
-
- Be very cautious when passing values from a client (web browser) into
- Smarty (or any PHP application.) Although the above example of using the
- article_id from the URL looks handy, it could have bad consequences. The
- cache_id is used to create a directory on the file system, so if the user
- decided to pass an extremely large value for article_id, or write a script
- that sends random article_ids at a rapid pace, this could possibly cause
- problems at the server level. Be sure to sanitize any data passed in before
- using it. In this instance, maybe you know the article_id has a length of
- 10 characters and is made up of alpha-numerics only, and must be a valid
- article_id in the database. Check for this!
-
-
-
- Be sure to pass the same cache_id as the
- second parameter to is_cached() and
- clear_cache().
-
-
- passing a cache_id to is_cached()
-
-require('Smarty.class.php');
-$smarty = new Smarty;
-
-$smarty->caching = true;
-
-$my_cache_id = $_GET['article_id'];
-
-if(!$smarty->is_cached('index.tpl',$my_cache_id)) {
- // No cache available, do variable assignments here.
- $contents = get_database_contents();
- $smarty->assign($contents);
-}
-
-$smarty->display('index.tpl',$my_cache_id);
-
-
- You can clear all caches for a particular cache_id by passing null as the
- first parameter to clear_cache().
-
-
- clearing all caches for a particular cache_id
-
-require('Smarty.class.php');
-$smarty = new Smarty;
-
-$smarty->caching = true;
-
-// clear all caches with "sports" as the cache_id
-$smarty->clear_cache(null,"sports");
-
-$smarty->display('index.tpl',"sports");
-
-
- In this manner, you can "group" your caches together by giving them the
- same cache_id.
-
-
-
- Cache Groups
-
- You can do more elaborate grouping by setting up cache_id groups. This is
- accomplished by separating each sub-group with a vertical bar "|" in the
- cache_id value. You can have as many sub-groups as you like.
-
-
- cache_id groups
-
-require('Smarty.class.php');
-$smarty = new Smarty;
-
-$smarty->caching = true;
-
-// clear all caches with "sports|basketball" as the first two cache_id groups
-$smarty->clear_cache(null,"sports|basketball");
-
-// clear all caches with "sports" as the first cache_id group. This would
-// include "sports|basketball", or "sports|(anything)|(anything)|(anything)|..."
-$smarty->clear_cache(null,"sports");
-
-$smarty->display('index.tpl',"sports|basketball");
-
-
- Technical Note
-
- The cache grouping does NOT use the path to the template as any part of the
- cache_id. For example, if you have display('themes/blue/index.tpl'), you
- cannot clear the cache for everything under the "themes/blue" directory. If
- you want to do that, you must group them in the cache_id, such as
- display('themes/blue/index.tpl','themes|blue'); Then you can clear the
- caches for the blue theme with clear_cache(null,'themes|blue');
-
-
-
+&programmers.caching.caching-setting-up;
+&programmers.caching.caching-multiple-caches;
+&programmers.caching.caching-groups;
+
+ Cache Groups
+
+ You can do more elaborate grouping by setting up cache_id groups. This is
+ accomplished by separating each sub-group with a vertical bar "|" in the
+ cache_id value. You can have as many sub-groups as you like.
+
+
+ cache_id groups
+
+require('Smarty.class.php');
+$smarty = new Smarty;
+
+$smarty->caching = true;
+
+// clear all caches with "sports|basketball" as the first two cache_id groups
+$smarty->clear_cache(null,"sports|basketball");
+
+// clear all caches with "sports" as the first cache_id group. This would
+// include "sports|basketball", or "sports|(anything)|(anything)|(anything)|..."
+$smarty->clear_cache(null,"sports");
+
+$smarty->display('index.tpl',"sports|basketball");
+
+
+ Technical Note
+
+ The cache grouping does NOT use the path to the template as any part of the
+ cache_id. For example, if you have display('themes/blue/index.tpl'), you
+ cannot clear the cache for everything under the "themes/blue" directory. If
+ you want to do that, you must group them in the cache_id, such as
+ display('themes/blue/index.tpl','themes|blue'); Then you can clear the
+ caches for the blue theme with clear_cache(null,'themes|blue');
+
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/caching/caching-multiple-caches.xml b/docs/ru/programmers/caching/caching-multiple-caches.xml
new file mode 100644
index 00000000..9535604e
--- /dev/null
+++ b/docs/ru/programmers/caching/caching-multiple-caches.xml
@@ -0,0 +1,109 @@
+
+
+
+ Multiple Caches Per Page
+
+ You can have multiple cache files for a single call to display() or
+ fetch(). Let's say that a call to display('index.tpl') may have several
+ different output contents depending on some condition, and you want
+ separate caches for each one. You can do this by passing a cache_id as the
+ second parameter to the function call.
+
+
+ passing a cache_id to display()
+
+require('Smarty.class.php');
+$smarty = new Smarty;
+
+$smarty->caching = true;
+
+$my_cache_id = $_GET['article_id'];
+
+$smarty->display('index.tpl',$my_cache_id);
+
+
+ Above, we are passing the variable $my_cache_id to display() as the
+ cache_id. For each unique value of $my_cache_id, a separate cache will be
+ generated for index.tpl. In this example, "article_id" was passed in the
+ URL and is used as the cache_id.
+
+
+ Technical Note
+
+ Be very cautious when passing values from a client (web browser) into
+ Smarty (or any PHP application.) Although the above example of using the
+ article_id from the URL looks handy, it could have bad consequences. The
+ cache_id is used to create a directory on the file system, so if the user
+ decided to pass an extremely large value for article_id, or write a script
+ that sends random article_ids at a rapid pace, this could possibly cause
+ problems at the server level. Be sure to sanitize any data passed in before
+ using it. In this instance, maybe you know the article_id has a length of
+ 10 characters and is made up of alpha-numerics only, and must be a valid
+ article_id in the database. Check for this!
+
+
+
+ Be sure to pass the same cache_id as the
+ second parameter to is_cached() and
+ clear_cache().
+
+
+ passing a cache_id to is_cached()
+
+require('Smarty.class.php');
+$smarty = new Smarty;
+
+$smarty->caching = true;
+
+$my_cache_id = $_GET['article_id'];
+
+if(!$smarty->is_cached('index.tpl',$my_cache_id)) {
+ // No cache available, do variable assignments here.
+ $contents = get_database_contents();
+ $smarty->assign($contents);
+}
+
+$smarty->display('index.tpl',$my_cache_id);
+
+
+ You can clear all caches for a particular cache_id by passing null as the
+ first parameter to clear_cache().
+
+
+ clearing all caches for a particular cache_id
+
+require('Smarty.class.php');
+$smarty = new Smarty;
+
+$smarty->caching = true;
+
+// clear all caches with "sports" as the cache_id
+$smarty->clear_cache(null,"sports");
+
+$smarty->display('index.tpl',"sports");
+
+
+ In this manner, you can "group" your caches together by giving them the
+ same cache_id.
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/caching/caching-setting-up.xml b/docs/ru/programmers/caching/caching-setting-up.xml
new file mode 100644
index 00000000..c63c8a11
--- /dev/null
+++ b/docs/ru/programmers/caching/caching-setting-up.xml
@@ -0,0 +1,163 @@
+
+
+
+ Setting Up Caching
+
+ The first thing to do is enable caching. This is done by setting $caching = true (or 1.)
+
+
+ enabling caching
+
+require('Smarty.class.php');
+$smarty = new Smarty;
+
+$smarty->caching = true;
+
+$smarty->display('index.tpl');
+
+
+ With caching enabled, the function call to display('index.tpl') will render
+ the template as usual, but also saves a copy of its output to a file (a
+ cached copy) in the $cache_dir.
+ Upon the next call to display('index.tpl'), the cached copy will be used
+ instead of rendering the template again.
+
+
+ Technical Note
+
+ The files in the $cache_dir are named similar to the template name.
+ Although they end in the ".php" extention, they are not really executable
+ php scripts. Do not edit these files!
+
+
+
+ Each cached page has a limited lifetime determined by $cache_lifetime. The default value
+ is 3600 seconds, or 1 hour. After that time expires, the cache is
+ regenerated. It is possible to give individual caches their own expiration
+ time by setting $caching = 2. See the documentation on $cache_lifetime for details.
+
+
+ setting cache_lifetime per cache
+
+require('Smarty.class.php');
+$smarty = new Smarty;
+
+$smarty->caching = 2; // lifetime is per cache
+
+// set the cache_lifetime for index.tpl to 5 minutes
+$smarty->cache_lifetime = 300;
+$smarty->display('index.tpl');
+
+// set the cache_lifetime for home.tpl to 1 hour
+$smarty->cache_lifetime = 3600;
+$smarty->display('home.tpl');
+
+// NOTE: the following $cache_lifetime setting will not work when $caching = 2.
+// The cache lifetime for home.tpl has already been set
+// to 1 hour, and will no longer respect the value of $cache_lifetime.
+// The home.tpl cache will still expire after 1 hour.
+$smarty->cache_lifetime = 30; // 30 seconds
+$smarty->display('home.tpl');
+
+
+ If $compile_check is enabled,
+ every template file and config file that is involved with the cache file is
+ checked for modification. If any of the files have been modified since the
+ cache was generated, the cache is immediately regenerated. This is a slight
+ overhead so for optimum performance, leave $compile_check set to false.
+
+
+ enabling $compile_check
+
+require('Smarty.class.php');
+$smarty = new Smarty;
+
+$smarty->caching = true;
+$smarty->compile_check = true;
+
+$smarty->display('index.tpl');
+
+
+ If $force_compile is enabled,
+ the cache files will always be regenerated. This effectively turns off
+ caching. $force_compile is usually for debugging purposes only, a more
+ efficient way of disabling caching is to set $caching = false (or 0.)
+
+
+ The is_cached() function
+ can be used to test if a template has a valid cache or not. If you have a
+ cached template that requires something like a database fetch, you can use
+ this to skip that process.
+
+
+ using is_cached()
+
+require('Smarty.class.php');
+$smarty = new Smarty;
+
+$smarty->caching = true;
+
+if(!$smarty->is_cached('index.tpl')) {
+ // No cache available, do variable assignments here.
+ $contents = get_database_contents();
+ $smarty->assign($contents);
+}
+
+$smarty->display('index.tpl');
+
+
+ You can keep parts of a page dynamic with the insert template function. Let's
+ say the whole page can be cached except for a banner that is displayed down
+ the right side of the page. By using an insert function for the banner, you
+ can keep this element dynamic within the cached content. See the
+ documentation on insert for
+ details and examples.
+
+
+ You can clear all the cache files with the clear_all_cache() function, or
+ individual cache files (or groups) with the clear_cache() function.
+
+
+ clearing the cache
+
+require('Smarty.class.php');
+$smarty = new Smarty;
+
+$smarty->caching = true;
+
+// clear out all cache files
+$smarty->clear_all_cache();
+
+// clear only cache for index.tpl
+$smarty->clear_cache('index.tpl');
+
+$smarty->display('index.tpl');
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/plugins.xml b/docs/ru/programmers/plugins.xml
index eef28246..e07ded34 100644
--- a/docs/ru/programmers/plugins.xml
+++ b/docs/ru/programmers/plugins.xml
@@ -44,731 +44,26 @@
install a plugin, simply place it in the directory and Smarty will use
it automatically.
-
-
- Naming Conventions
-
- Plugin files and functions must follow a very specific naming
- convention in order to be located by Smarty.
-
-
- The plugin files must be named as follows:
-
-
-
- type.name.php
-
-
-
-
-
- Where type is one of these plugin types:
-
- function
- modifier
- block
- compiler
- prefilter
- postfilter
- outputfilter
- resource
- insert
-
-
-
- And name should be a valid identifier (letters,
- numbers, and underscores only).
-
-
- Some examples: function.html_select_date.php,
- resource.db.php,
- modifier.spacify.php.
-
-
- The plugin functions inside the plugin files must be named as follows:
-
-
- smarty_type_name
-
-
-
-
- The meanings of type and name are
- the same as before.
-
-
- Smarty will output appropriate error messages if the plugin file it
- needs is not found, or if the file or the plugin function are named
- improperly.
-
-
+&programmers.plugins.plugins-naming-conventions;
-
- Writing Plugins
-
- Plugins can be either loaded by Smarty automatically from the
- filesystem or they can be registered at runtime via one of the
- register_* API functions. They can also be unregistered by using
- unregister_* API functions.
-
-
- For the plugins that are registered at runtime, the name of the plugin
- function(s) does not have to follow the naming convention.
-
-
- If a plugin depends on some functionality provided by another plugin
- (as is the case with some plugins bundled with Smarty), then the proper
- way to load the needed plugin is this:
-
-
-require_once SMARTY_DIR . 'plugins/function.html_options.php';
-
- As a general rule, Smarty object is always passed to the plugins as the last
- parameter (except for modifiers).
-
-
+&programmers.plugins.plugins-writing;
- Template Functions
-
-
- void smarty_function_name
- array $params
- object &$smarty
-
-
-
- All attributes passed to template functions from the template are
- contained in the $params as an associative
- array. Either access those values directly, e.g.
- $params['start'] or use
- extract($params) to import them into the symbol
- table.
-
-
- The output (return value) of the function will be substituted in place of the
- function tag in the template (fetch function, for
- example). Alternatively, the function can simply perform some other
- task without any output (assign function).
-
-
- If the function needs to assign some variables to the template or use
- some other Smarty-provided functionality, it can use the supplied
- $smarty object to do so.
-
-
- See also:
- register_function(),
- unregister_function().
-
-
-
- function plugin with output
-
-<?php
-/*
- * Smarty plugin
- * -------------------------------------------------------------
- * File: function.eightball.php
- * Type: function
- * Name: eightball
- * Purpose: outputs a random magic answer
- * -------------------------------------------------------------
- */
-function smarty_function_eightball($params, &$smarty)
-{
- $answers = array('Yes',
- 'No',
- 'No way',
- 'Outlook not so good',
- 'Ask again soon',
- 'Maybe in your reality');
+&programmers.plugins.plugins-functions;
- $result = array_rand($answers);
- return $answers[$result];
-}
-?>
-
-
-
- which can be used in the template as:
-
-
-Question: Will we ever have time travel?
-Answer: {eightball}.
-
-
- function plugin without output
-
-<?php
-/*
- * Smarty plugin
- * -------------------------------------------------------------
- * File: function.assign.php
- * Type: function
- * Name: assign
- * Purpose: assign a value to a template variable
- * -------------------------------------------------------------
- */
-function smarty_function_assign($params, &$smarty)
-{
- extract($params);
+&programmers.plugins.plugins-modifiers;
- if (empty($var)) {
- $smarty->trigger_error("assign: missing 'var' parameter");
- return;
- }
+&programmers.plugins.plugins-block-functions;
- if (!in_array('value', array_keys($params))) {
- $smarty->trigger_error("assign: missing 'value' parameter");
- return;
- }
+&programmers.plugins.plugins-compiler-functions;
- $smarty->assign($var, $value);
-}
-?>
-
-
-
+&programmers.plugins.plugins-prefilters-postfilters;
- Modifiers
-
- Modifiers are little functions that are applied to a variable in the
- template before it is displayed or used in some other context.
- Modifiers can be chained together.
-
-
-
- mixed smarty_modifier_name
- mixed $value
- [mixed $param1, ...]
-
-
-
- The first parameter to the modifier plugin is the value on which
- the modifier is supposed to operate. The rest of the parameters can be
- optional, depending on what kind of operation is supposed to be
- performed.
-
-
- The modifier has to return the result of its processing.
-
-
- See also
- register_modifier(),
- unregister_modifier().
-
-
- simple modifier plugin
-
- This plugin basically aliases one of the built-in PHP functions. It
- does not have any additional parameters.
-
-
-<?php
-/*
- * Smarty plugin
- * -------------------------------------------------------------
- * File: modifier.capitalize.php
- * Type: modifier
- * Name: capitalize
- * Purpose: capitalize words in the string
- * -------------------------------------------------------------
- */
-function smarty_modifier_capitalize($string)
-{
- return ucwords($string);
-}
-?>
-
-
-
- more complex modifier plugin
-
-<?php
-/*
- * Smarty plugin
- * -------------------------------------------------------------
- * File: modifier.truncate.php
- * Type: modifier
- * Name: truncate
- * Purpose: Truncate a string to a certain length if necessary,
- * optionally splitting in the middle of a word, and
- * appending the $etc string.
- * -------------------------------------------------------------
- */
-function smarty_modifier_truncate($string, $length = 80, $etc = '...',
- $break_words = false)
-{
- if ($length == 0)
- return '';
+&programmers.plugins.plugins-outputfilters;
- if (strlen($string) > $length) {
- $length -= strlen($etc);
- $fragment = substr($string, 0, $length+1);
- if ($break_words)
- $fragment = substr($fragment, 0, -1);
- else
- $fragment = preg_replace('/\s+(\S+)?$/', '', $fragment);
- return $fragment.$etc;
- } else
- return $string;
-}
-?>
-
-
+&programmers.plugins.plugins-resources;
- Block Functions
-
-
- void smarty_block_name
- array $params
- mixed $content
- object &$smarty
-
-
-
- Block functions are functions of the form: {func} .. {/func}. In other
- words, they enclose a template block and operate on the contents of
- this block. Block functions take precedence over custom functions of
- the same name, that is, you cannot have both custom function {func} and
- block function {func} .. {/func}.
-
-
- Your function implementation is called twice by Smarty:
- once for the opening tag, and once for the closing tag.
-
-
- Only the opening tag of the block function may have attributes. All
- attributes passed to template functions from the template are contained
- in the $params as an associative array. You can
- either access those values directly, e.g.
- $params['start'] or use
- extract($params) to import them into the symbol
- table. The opening tag attributes are also accessible to your function
- when processing the closing tag.
-
-
- The value of $content variable depends on
- whether your function is called for the opening or closing tag. In case
- of the opening tag, it will be null, and in case of
- the closing tag it will be the contents of the template block.
- Note that the template block will have already been processed by
- Smarty, so all you will receive is the template output, not the
- template source.
-
-
- If you have nested block functions, it's possible to find out what the
- parent block function is by accessing
- $smarty->_tag_stack variable. Just do a var_dump()
- on it and the structure should be apparent.
-
-
- See also:
- register_block(),
- unregister_block().
-
-
- block function
-
-<?php
-/*
- * Smarty plugin
- * -------------------------------------------------------------
- * File: block.translate.php
- * Type: block
- * Name: translate
- * Purpose: translate a block of text
- * -------------------------------------------------------------
- */
-function smarty_block_translate($params, $content, &$smarty)
-{
- if ($content) {
- $lang = $params['lang'];
- // do some intelligent translation thing here with $content
- echo $translation;
- }
-}
-
-
-
- Compiler Functions
-
- Compiler functions are called only during compilation of the template.
- They are useful for injecting PHP code or time-sensitive static
- content into the template. If there is both a compiler function and a
- custom function registered under the same name, the compiler function
- has precedence.
-
-
-
- mixed smarty_compiler_name
- string $tag_arg
- object &$smarty
-
-
-
- The compiler function is passed two parameters: the tag argument
- string - basically, everything from the function name until the ending
- delimiter, and the Smarty object. It's supposed to return the PHP code
- to be injected into the compiled template.
-
-
- See also
- register_compiler_function(),
- unregister_compiler_function().
-
-
- simple compiler function
-
-
-
- This function can be called from the template as:
-
-
-{* this function gets executed at compile time only *}
-{tplheader}
-
- The resulting PHP code in the compiled template would be something like this:
-
-
-<php
-echo 'index.tpl compiled at 2002-02-20 20:02';
-?>
-
-
-
-
- Prefilters/Postfilters
-
- Prefilter and postfilter plugins are very similar in concept; where
- they differ is in the execution -- more precisely the time of their
- execution.
-
-
-
- string smarty_prefilter_name
- string $source
- object &$smarty
-
-
-
- Prefilters are used to process the source of the template immediately
- before compilation. The first parameter to the prefilter function is
- the template source, possibly modified by some other prefilters. The
- plugin is supposed to return the modified source. Note that this
- source is not saved anywhere, it is only used for compilation.
-
-
-
- string smarty_postfilter_name
- string $compiled
- object &$smarty
-
-
-
- Postfilters are used to process the compiled output of the template
- (the PHP code) immediately after the compilation is done but before the
- compiled template is saved to the filesystem. The first parameter to
- the postfilter function is the compiled template code, possibly
- modified by other postfilters. The plugin is supposed to return the
- modified version of this code.
-
-
- prefilter plugin
-
-
-
-
-
-
- postfilter plugin
-
-
-
-
-
-
- Output Filters
-
- Output filter plugins operate on a template's output, after the
- template is loaded and executed, but before the output is displayed.
-
-
-
- string smarty_outputfilter_name
- string $template_output
- object &$smarty
-
-
-
- The first parameter to the output filter function is the template
- output that needs to be processed, and the second parameter is the
- instance of Smarty invoking the plugin. The plugin is supposed to do
- the processing and return the results.
-
-
- output filter plugin
-
-
-]]>
-
-
-
-
- Resources
-
- Resource plugins are meant as a generic way of providing template
- sources or PHP script components to Smarty. Some examples of resources:
- databases, LDAP, shared memory, sockets, and so on.
-
-
-
- There are a total of 4 functions that need to be registered for each
- type of resource. Every function will receive the requested resource as
- the first parameter and the Smarty object as the last parameter. The
- rest of parameters depend on the function.
-
-
-
-
- bool smarty_resource_name_source
- string $rsrc_name
- string &$source
- object &$smarty
-
-
- bool smarty_resource_name_timestamp
- string $rsrc_name
- int &$timestamp
- object &$smarty
-
-
- bool smarty_resource_name_secure
- string $rsrc_name
- object &$smarty
-
-
- bool smarty_resource_name_trusted
- string $rsrc_name
- object &$smarty
-
-
-
-
- The first function is supposed to retrieve the resource. Its second
- parameter is a variable passed by reference where the result should be
- stored. The function is supposed to return true if
- it was able to successfully retrieve the resource and
- false otherwise.
-
-
-
- The second function is supposed to retrieve the last modification time
- of the requested resource (as a UNIX timestamp). The second parameter
- is a variable passed by reference where the timestamp should be stored.
- The function is supposed to return true if the
- timestamp could be succesfully determined, and false
- otherwise.
-
-
-
- The third function is supposed to return true or
- false, depending on whether the requested resource
- is secure or not. This function is used only for template resources but
- should still be defined.
-
-
-
- The fourth function is supposed to return true or
- false, depending on whether the requested resource
- is trusted or not. This function is used for only for PHP script
- components requested by include_php tag or
- insert tag with src
- attribute. However, it should still be defined even for template
- resources.
-
-
- See also
- register_resource(),
- unregister_resource().
-
-
- resource plugin
-
-<?php
-/*
- * Smarty plugin
- * -------------------------------------------------------------
- * File: resource.db.php
- * Type: resource
- * Name: db
- * Purpose: Fetches templates from a database
- * -------------------------------------------------------------
- */
-function smarty_resource_db_source($tpl_name, &$tpl_source, &$smarty)
-{
- // do database call here to fetch your template,
- // populating $tpl_source
- $sql = new SQL;
- $sql->query("select tpl_source
- from my_table
- where tpl_name='$tpl_name'");
- if ($sql->num_rows) {
- $tpl_source = $sql->record['tpl_source'];
- return true;
- } else {
- return false;
- }
-}
-
-function smarty_resource_db_timestamp($tpl_name, &$tpl_timestamp, &$smarty)
-{
- // do database call here to populate $tpl_timestamp.
- $sql = new SQL;
- $sql->query("select tpl_timestamp
- from my_table
- where tpl_name='$tpl_name'");
- if ($sql->num_rows) {
- $tpl_timestamp = $sql->record['tpl_timestamp'];
- return true;
- } else {
- return false;
- }
-}
-
-function smarty_resource_db_secure($tpl_name, &$smarty)
-{
- // assume all templates are secure
- return true;
-}
-
-function smarty_resource_db_trusted($tpl_name, &$smarty)
-{
- // not used for templates
-}
-?>
-
-
-
- Inserts
-
- Insert plugins are used to implement functions that are invoked by
- insert
- tags in the template.
-
-
-
- string smarty_insert_name
- array $params
- object &$smarty
-
-
-
- The first parameter to the function is an associative array of
- attributes passed to the insert. Either access those values directly,
- e.g. $params['start'] or use
- extract($params) to import them into the symbol
- table.
-
-
- The insert function is supposed to return the result which will be
- substituted in place of the insert tag in the
- template.
-
-
- insert plugin
-
-<?php
-/*
- * Smarty plugin
- * -------------------------------------------------------------
- * File: insert.time.php
- * Type: time
- * Name: time
- * Purpose: Inserts current date/time according to format
- * -------------------------------------------------------------
- */
-function smarty_insert_time($params, &$smarty)
-{
- if (empty($params['format'])) {
- $smarty->trigger_error("insert time: missing 'format' parameter");
- return;
- }
-
- $datetime = strftime($params['format']);
- return $datetime;
-}
-?>
-
-
+&programmers.plugins.plugins-inserts;
+ Block Functions
+
+
+ void smarty_block_name
+ array $params
+ mixed $content
+ object &$smarty
+
+
+
+ Block functions are functions of the form: {func} .. {/func}. In other
+ words, they enclose a template block and operate on the contents of
+ this block. Block functions take precedence over custom functions of
+ the same name, that is, you cannot have both custom function {func} and
+ block function {func} .. {/func}.
+
+
+ Your function implementation is called twice by Smarty:
+ once for the opening tag, and once for the closing tag.
+
+
+ Only the opening tag of the block function may have attributes. All
+ attributes passed to template functions from the template are contained
+ in the $params as an associative array. You can
+ either access those values directly, e.g.
+ $params['start'] or use
+ extract($params) to import them into the symbol
+ table. The opening tag attributes are also accessible to your function
+ when processing the closing tag.
+
+
+ The value of $content variable depends on
+ whether your function is called for the opening or closing tag. In case
+ of the opening tag, it will be null, and in case of
+ the closing tag it will be the contents of the template block.
+ Note that the template block will have already been processed by
+ Smarty, so all you will receive is the template output, not the
+ template source.
+
+
+ If you have nested block functions, it's possible to find out what the
+ parent block function is by accessing
+ $smarty->_tag_stack variable. Just do a var_dump()
+ on it and the structure should be apparent.
+
+
+ See also:
+ register_block(),
+ unregister_block().
+
+
+ block function
+
+<?php
+/*
+ * Smarty plugin
+ * -------------------------------------------------------------
+ * File: block.translate.php
+ * Type: block
+ * Name: translate
+ * Purpose: translate a block of text
+ * -------------------------------------------------------------
+ */
+function smarty_block_translate($params, $content, &$smarty)
+{
+ if ($content) {
+ $lang = $params['lang'];
+ // do some intelligent translation thing here with $content
+ echo $translation;
+ }
+}
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/plugins/plugins-compiler-functions.xml b/docs/ru/programmers/plugins/plugins-compiler-functions.xml
new file mode 100644
index 00000000..62c95feb
--- /dev/null
+++ b/docs/ru/programmers/plugins/plugins-compiler-functions.xml
@@ -0,0 +1,84 @@
+
+
+ Compiler Functions
+
+ Compiler functions are called only during compilation of the template.
+ They are useful for injecting PHP code or time-sensitive static
+ content into the template. If there is both a compiler function and a
+ custom function registered under the same name, the compiler function
+ has precedence.
+
+
+
+ mixed smarty_compiler_name
+ string $tag_arg
+ object &$smarty
+
+
+
+ The compiler function is passed two parameters: the tag argument
+ string - basically, everything from the function name until the ending
+ delimiter, and the Smarty object. It's supposed to return the PHP code
+ to be injected into the compiled template.
+
+
+ See also
+ register_compiler_function(),
+ unregister_compiler_function().
+
+
+ simple compiler function
+
+
+
+ This function can be called from the template as:
+
+
+{* this function gets executed at compile time only *}
+{tplheader}
+
+ The resulting PHP code in the compiled template would be something like this:
+
+
+<php
+echo 'index.tpl compiled at 2002-02-20 20:02';
+?>
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/plugins/plugins-functions.xml b/docs/ru/programmers/plugins/plugins-functions.xml
new file mode 100644
index 00000000..e9741499
--- /dev/null
+++ b/docs/ru/programmers/plugins/plugins-functions.xml
@@ -0,0 +1,123 @@
+
+
+ Template Functions
+
+
+ void smarty_function_name
+ array $params
+ object &$smarty
+
+
+
+ All attributes passed to template functions from the template are
+ contained in the $params as an associative
+ array. Either access those values directly, e.g.
+ $params['start'] or use
+ extract($params) to import them into the symbol
+ table.
+
+
+ The output (return value) of the function will be substituted in place of the
+ function tag in the template (fetch function, for
+ example). Alternatively, the function can simply perform some other
+ task without any output (assign function).
+
+
+ If the function needs to assign some variables to the template or use
+ some other Smarty-provided functionality, it can use the supplied
+ $smarty object to do so.
+
+
+ See also:
+ register_function(),
+ unregister_function().
+
+
+
+ function plugin with output
+
+<?php
+/*
+ * Smarty plugin
+ * -------------------------------------------------------------
+ * File: function.eightball.php
+ * Type: function
+ * Name: eightball
+ * Purpose: outputs a random magic answer
+ * -------------------------------------------------------------
+ */
+function smarty_function_eightball($params, &$smarty)
+{
+ $answers = array('Yes',
+ 'No',
+ 'No way',
+ 'Outlook not so good',
+ 'Ask again soon',
+ 'Maybe in your reality');
+
+ $result = array_rand($answers);
+ return $answers[$result];
+}
+?>
+
+
+
+ which can be used in the template as:
+
+
+Question: Will we ever have time travel?
+Answer: {eightball}.
+
+
+ function plugin without output
+
+<?php
+/*
+ * Smarty plugin
+ * -------------------------------------------------------------
+ * File: function.assign.php
+ * Type: function
+ * Name: assign
+ * Purpose: assign a value to a template variable
+ * -------------------------------------------------------------
+ */
+function smarty_function_assign($params, &$smarty)
+{
+ extract($params);
+
+ if (empty($var)) {
+ $smarty->trigger_error("assign: missing 'var' parameter");
+ return;
+ }
+
+ if (!in_array('value', array_keys($params))) {
+ $smarty->trigger_error("assign: missing 'value' parameter");
+ return;
+ }
+
+ $smarty->assign($var, $value);
+}
+?>
+
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/plugins/plugins-inserts.xml b/docs/ru/programmers/plugins/plugins-inserts.xml
new file mode 100644
index 00000000..4bd9d9a4
--- /dev/null
+++ b/docs/ru/programmers/plugins/plugins-inserts.xml
@@ -0,0 +1,73 @@
+
+
+ Inserts
+
+ Insert plugins are used to implement functions that are invoked by
+ insert
+ tags in the template.
+
+
+
+ string smarty_insert_name
+ array $params
+ object &$smarty
+
+
+
+ The first parameter to the function is an associative array of
+ attributes passed to the insert. Either access those values directly,
+ e.g. $params['start'] or use
+ extract($params) to import them into the symbol
+ table.
+
+
+ The insert function is supposed to return the result which will be
+ substituted in place of the insert tag in the
+ template.
+
+
+ insert plugin
+
+<?php
+/*
+ * Smarty plugin
+ * -------------------------------------------------------------
+ * File: insert.time.php
+ * Type: time
+ * Name: time
+ * Purpose: Inserts current date/time according to format
+ * -------------------------------------------------------------
+ */
+function smarty_insert_time($params, &$smarty)
+{
+ if (empty($params['format'])) {
+ $smarty->trigger_error("insert time: missing 'format' parameter");
+ return;
+ }
+
+ $datetime = strftime($params['format']);
+ return $datetime;
+}
+?>
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/plugins/plugins-modifiers.xml b/docs/ru/programmers/plugins/plugins-modifiers.xml
new file mode 100644
index 00000000..9064f7cc
--- /dev/null
+++ b/docs/ru/programmers/plugins/plugins-modifiers.xml
@@ -0,0 +1,108 @@
+
+
+ Modifiers
+
+ Modifiers are little functions that are applied to a variable in the
+ template before it is displayed or used in some other context.
+ Modifiers can be chained together.
+
+
+
+ mixed smarty_modifier_name
+ mixed $value
+ [mixed $param1, ...]
+
+
+
+ The first parameter to the modifier plugin is the value on which
+ the modifier is supposed to operate. The rest of the parameters can be
+ optional, depending on what kind of operation is supposed to be
+ performed.
+
+
+ The modifier has to return the result of its processing.
+
+
+ See also
+ register_modifier(),
+ unregister_modifier().
+
+
+ simple modifier plugin
+
+ This plugin basically aliases one of the built-in PHP functions. It
+ does not have any additional parameters.
+
+
+<?php
+/*
+ * Smarty plugin
+ * -------------------------------------------------------------
+ * File: modifier.capitalize.php
+ * Type: modifier
+ * Name: capitalize
+ * Purpose: capitalize words in the string
+ * -------------------------------------------------------------
+ */
+function smarty_modifier_capitalize($string)
+{
+ return ucwords($string);
+}
+?>
+
+
+
+ more complex modifier plugin
+
+<?php
+/*
+ * Smarty plugin
+ * -------------------------------------------------------------
+ * File: modifier.truncate.php
+ * Type: modifier
+ * Name: truncate
+ * Purpose: Truncate a string to a certain length if necessary,
+ * optionally splitting in the middle of a word, and
+ * appending the $etc string.
+ * -------------------------------------------------------------
+ */
+function smarty_modifier_truncate($string, $length = 80, $etc = '...',
+ $break_words = false)
+{
+ if ($length == 0)
+ return '';
+
+ if (strlen($string) > $length) {
+ $length -= strlen($etc);
+ $fragment = substr($string, 0, $length+1);
+ if ($break_words)
+ $fragment = substr($fragment, 0, -1);
+ else
+ $fragment = preg_replace('/\s+(\S+)?$/', '', $fragment);
+ return $fragment.$etc;
+ } else
+ return $string;
+}
+?>
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/plugins/plugins-naming-conventions.xml b/docs/ru/programmers/plugins/plugins-naming-conventions.xml
new file mode 100644
index 00000000..b7676736
--- /dev/null
+++ b/docs/ru/programmers/plugins/plugins-naming-conventions.xml
@@ -0,0 +1,79 @@
+
+
+
+ Naming Conventions
+
+ Plugin files and functions must follow a very specific naming
+ convention in order to be located by Smarty.
+
+
+ The plugin files must be named as follows:
+
+
+
+ type.name.php
+
+
+
+
+
+ Where type is one of these plugin types:
+
+ function
+ modifier
+ block
+ compiler
+ prefilter
+ postfilter
+ outputfilter
+ resource
+ insert
+
+
+
+ And name should be a valid identifier (letters,
+ numbers, and underscores only).
+
+
+ Some examples: function.html_select_date.php,
+ resource.db.php,
+ modifier.spacify.php.
+
+
+ The plugin functions inside the plugin files must be named as follows:
+
+
+ smarty_type_name
+
+
+
+
+ The meanings of type and name are
+ the same as before.
+
+
+ Smarty will output appropriate error messages if the plugin file it
+ needs is not found, or if the file or the plugin function are named
+ improperly.
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/plugins/plugins-outputfilters.xml b/docs/ru/programmers/plugins/plugins-outputfilters.xml
new file mode 100644
index 00000000..8b1cfdf6
--- /dev/null
+++ b/docs/ru/programmers/plugins/plugins-outputfilters.xml
@@ -0,0 +1,65 @@
+
+
+ Output Filters
+
+ Output filter plugins operate on a template's output, after the
+ template is loaded and executed, but before the output is displayed.
+
+
+
+ string smarty_outputfilter_name
+ string $template_output
+ object &$smarty
+
+
+
+ The first parameter to the output filter function is the template
+ output that needs to be processed, and the second parameter is the
+ instance of Smarty invoking the plugin. The plugin is supposed to do
+ the processing and return the results.
+
+
+ output filter plugin
+
+
+]]>
+
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/plugins/plugins-prefilters-postfilters.xml b/docs/ru/programmers/plugins/plugins-prefilters-postfilters.xml
new file mode 100644
index 00000000..b0aca2b2
--- /dev/null
+++ b/docs/ru/programmers/plugins/plugins-prefilters-postfilters.xml
@@ -0,0 +1,105 @@
+
+
+
+ Prefilters/Postfilters
+
+ Prefilter and postfilter plugins are very similar in concept; where
+ they differ is in the execution -- more precisely the time of their
+ execution.
+
+
+
+ string smarty_prefilter_name
+ string $source
+ object &$smarty
+
+
+
+ Prefilters are used to process the source of the template immediately
+ before compilation. The first parameter to the prefilter function is
+ the template source, possibly modified by some other prefilters. The
+ plugin is supposed to return the modified source. Note that this
+ source is not saved anywhere, it is only used for compilation.
+
+
+
+ string smarty_postfilter_name
+ string $compiled
+ object &$smarty
+
+
+
+ Postfilters are used to process the compiled output of the template
+ (the PHP code) immediately after the compilation is done but before the
+ compiled template is saved to the filesystem. The first parameter to
+ the postfilter function is the compiled template code, possibly
+ modified by other postfilters. The plugin is supposed to return the
+ modified version of this code.
+
+
+ prefilter plugin
+
+
+
+
+
+
+ postfilter plugin
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/plugins/plugins-resources.xml b/docs/ru/programmers/plugins/plugins-resources.xml
new file mode 100644
index 00000000..cffbd72f
--- /dev/null
+++ b/docs/ru/programmers/plugins/plugins-resources.xml
@@ -0,0 +1,156 @@
+
+
+ Resources
+
+ Resource plugins are meant as a generic way of providing template
+ sources or PHP script components to Smarty. Some examples of resources:
+ databases, LDAP, shared memory, sockets, and so on.
+
+
+
+ There are a total of 4 functions that need to be registered for each
+ type of resource. Every function will receive the requested resource as
+ the first parameter and the Smarty object as the last parameter. The
+ rest of parameters depend on the function.
+
+
+
+
+ bool smarty_resource_name_source
+ string $rsrc_name
+ string &$source
+ object &$smarty
+
+
+ bool smarty_resource_name_timestamp
+ string $rsrc_name
+ int &$timestamp
+ object &$smarty
+
+
+ bool smarty_resource_name_secure
+ string $rsrc_name
+ object &$smarty
+
+
+ bool smarty_resource_name_trusted
+ string $rsrc_name
+ object &$smarty
+
+
+
+
+ The first function is supposed to retrieve the resource. Its second
+ parameter is a variable passed by reference where the result should be
+ stored. The function is supposed to return true if
+ it was able to successfully retrieve the resource and
+ false otherwise.
+
+
+
+ The second function is supposed to retrieve the last modification time
+ of the requested resource (as a UNIX timestamp). The second parameter
+ is a variable passed by reference where the timestamp should be stored.
+ The function is supposed to return true if the
+ timestamp could be succesfully determined, and false
+ otherwise.
+
+
+
+ The third function is supposed to return true or
+ false, depending on whether the requested resource
+ is secure or not. This function is used only for template resources but
+ should still be defined.
+
+
+
+ The fourth function is supposed to return true or
+ false, depending on whether the requested resource
+ is trusted or not. This function is used for only for PHP script
+ components requested by include_php tag or
+ insert tag with src
+ attribute. However, it should still be defined even for template
+ resources.
+
+
+ See also
+ register_resource(),
+ unregister_resource().
+
+
+ resource plugin
+
+<?php
+/*
+ * Smarty plugin
+ * -------------------------------------------------------------
+ * File: resource.db.php
+ * Type: resource
+ * Name: db
+ * Purpose: Fetches templates from a database
+ * -------------------------------------------------------------
+ */
+function smarty_resource_db_source($tpl_name, &$tpl_source, &$smarty)
+{
+ // do database call here to fetch your template,
+ // populating $tpl_source
+ $sql = new SQL;
+ $sql->query("select tpl_source
+ from my_table
+ where tpl_name='$tpl_name'");
+ if ($sql->num_rows) {
+ $tpl_source = $sql->record['tpl_source'];
+ return true;
+ } else {
+ return false;
+ }
+}
+
+function smarty_resource_db_timestamp($tpl_name, &$tpl_timestamp, &$smarty)
+{
+ // do database call here to populate $tpl_timestamp.
+ $sql = new SQL;
+ $sql->query("select tpl_timestamp
+ from my_table
+ where tpl_name='$tpl_name'");
+ if ($sql->num_rows) {
+ $tpl_timestamp = $sql->record['tpl_timestamp'];
+ return true;
+ } else {
+ return false;
+ }
+}
+
+function smarty_resource_db_secure($tpl_name, &$smarty)
+{
+ // assume all templates are secure
+ return true;
+}
+
+function smarty_resource_db_trusted($tpl_name, &$smarty)
+{
+ // not used for templates
+}
+?>
+
+
+
\ No newline at end of file
diff --git a/docs/ru/programmers/plugins/plugins-writing.xml b/docs/ru/programmers/plugins/plugins-writing.xml
new file mode 100644
index 00000000..773e5111
--- /dev/null
+++ b/docs/ru/programmers/plugins/plugins-writing.xml
@@ -0,0 +1,46 @@
+
+
+
+ Writing Plugins
+
+ Plugins can be either loaded by Smarty automatically from the
+ filesystem or they can be registered at runtime via one of the
+ register_* API functions. They can also be unregistered by using
+ unregister_* API functions.
+
+
+ For the plugins that are registered at runtime, the name of the plugin
+ function(s) does not have to follow the naming convention.
+
+
+ If a plugin depends on some functionality provided by another plugin
+ (as is the case with some plugins bundled with Smarty), then the proper
+ way to load the needed plugin is this:
+
+
+require_once SMARTY_DIR . 'plugins/function.html_options.php';
+
+ As a general rule, Smarty object is always passed to the plugins as the last
+ parameter (except for modifiers).
+
+
+
\ No newline at end of file