What is Smarty?
Why use it?
Use Cases and Work Flow
Syntax Comparison
Template Inheritance
Best Practices
Crash Course
You may use the Smarty logo according to the trademark notice.
For sponsorship, advertising, news or other inquiries, contact us at:
register_resource
void register_resource(string name,
array resource_funcs);
Usatelo per registrare dinamicamente un plugin risorsa per Smarty. Passate il nome della risorsa e l'array delle funzioni PHP che la implementano. Consultate risorse per i template per maggiori informazioni su come impostare una funzione per caricare i template.
Il nome di una risorsa deve avere un minimo di due caratteri di lunghezza. Nomi di risorsa di un solo carattere verranno ignorati ed usati come parte del percorso del file; ad es. $smarty->display('c:/path/to/index.tpl');
L'array di funzioni php resource_funcs
deve avere 4 o 5 elementi. Con 4 elementi, questi saranno le
funzioni callback per le rispettive funzioni "source", "timestamp",
"secure" e "trusted" della risorsa. Con 5 elementi, il primo
deve essere il riferimento all'oggetto oppure il nome della
classe relativi all'oggetto o alla classe che implementano
la risorsa, mentre i 4 elementi successivi saranno i nomi
dei metodi che implementano "source", "timestamp",
"secure" e "trusted".
Example 13.24. register_resource
<?php $smarty->register_resource("db", array("db_get_template", "db_get_timestamp", "db_get_secure", "db_get_trusted")); ?>