New Simple plugin

From: Date: Wed, 06 Nov 2002 16:10:55 +0000
Subject: New Simple plugin
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-6335@lists.php.net to get a copy of this message
My first simple but useful plugin: <?php /* * Smarty plugin * -------------------------------------------------------------
* Type:     function
* Name:     assign_array
* Purpose: assign an associative array to a template variable * ------------------------------------------------------------- */ function smarty_function_assign_array($params, &$smarty) { extract($params); if (empty($var)) {
       $smarty->trigger_error("assign_array: missing 'var' parameter");
       return;
} if (!in_array('value', array_keys($params))) {
       $smarty->trigger_error("assign_array: missing 'value' parameter");
       return;
} @eval("\$value = array($value);"); $smarty->assign($var, $value); } ?> Usage example: {assign_array var="foo" value=" 'key' => 'value' "} {$foo.key} Any comments? What email should be used to send patches, plugins, etc...? May be sending to the list like that is a bad idea? :-? -- Manuel Polo Tolón Dpto. I+D Servicios de Telefonía Avanzada Juan De la Cierva #23 50014 Zaragoza Tlf. +034 902 11 12 21 ___________________________________________________________________________ _ _ / La información incluida en el presente correo electrónico es CONFIDENCIAL, | siendo para el uso exclusivo del destinatario arriba mencionado. Si usted | lee este mensaje y no es el destinatario señalado, el empleado o el agente | responsable de entregar el mensaje al destinatario, o ha recibido esta | comunicación por error, le informamos que está totalmente prohibida | cualquier divulgación, distribución o reproducción de esta comunicación, y | le rogamos que nos lo notifique, nos devuelva el mensaje original a la | dirección arriba mencionada y borre el mensaje. | Gracias. \___________________________________________________________________________ _ _

« previous php.smarty.general (#6335) next »