Re: [SMARTY] Re: functions, modifier explaining themselves

From: Date: Thu, 27 Jun 2002 07:58:24 +0000
Subject: Re: [SMARTY] Re: functions, modifier explaining themselves
References: 1 2  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-5059@lists.php.net to get a copy of this message
Daniel BODEA wrote:
designers from all your clients (the many, the better). It'd be pretty interesting to be able to say: "Go check out the official Smarty docs, then upload your first template consisting of something like {help} or {info} (just like phpinfo) to see the full listing of functions and modifiers provided by our product/platform."
Yes, indeed. All we need to implement this functionality is a new API function get_plugin_list(). From that point on it's an easy job to implement {smartyinfo} yourself. I doubt it should to into core engine, it should be implemented on the "userspace" level. Remember the selfexplaining functions and modifiers I requested? What I did to get them is this roughly: in global_plugins.php: // remember this file gets included from within a smarty method $GLOBALS['smarty_mods'] = array( 'custom_mod' => array(
      'name'     => 'custom_mod',
      'params'  => array(
              array(
                  'name' => 'param1',
                  'type'   => 'string',
                  'desc'   => '....'
               )
       ),
       'desc'      => '....'
)[ , ...] ); function smarty_check_mod_args($args, $mod) { .... $syntax = $GLOBALS['smarty_mods'][$mod]; if no ok
     smarty_dump_mod_syntax ($syntax);
  }
function smarty_dump_mod_syntax($syntax) { ... } function smarty_mod_number() { if (!smary_check_mod_args(func_get_args(), 'custom_mod')) return; } It's not a hard job at all to created something similar for functions and to write a function that dumps the content for $GLOBALS['smarty_mods'], $GLOBALS['smarty_func'] etc. This way I can dump a list of all custom modifiers/functions that are available in the source. But as I tend to have more than one function per file and it's not granted that I register all the functions/modifiersc contained in that file, I'd like to have a get_plugin_list() function. It would be perfect it it gave me a list like this: smarty plugin name => array( "php_func" => php function name, "source" => include file") [, ...] Ulf

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