Re: [Template] Design issues

From: Date: Fri, 11 Jun 2004 18:34:47 +0000
Subject: Re: [Template] Design issues
References: 1 2 3 4  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-30514@lists.php.net to get a copy of this message
On Jun 11, 2004, at 1:26 PM, Alan Knowles wrote:
Paul M Jones wrote:
Also, as long as we're building new code, these things might be nice: * use PEAR_ErrorStack instead of PEAR_Error * Using an array of some sort for error and debug message texts so they can be run through i18n by end-users
I know using PEAR_Error, that would all be done in the Template_Error Class.. - I'm not sure how PEAR_ErrorStack handles that part..
Talk to Greg when he comes back, it can throw PEAR_Error objects too. Also has Log hooks. Very nice.
* Debug-message codes in the define() area
?? - example??
E.g., define('TEMPLATE_DEBUG_USING_RAW_COMPILER', 99); and define a class property (or global) array element called $debug_msgs or something. $this->debug_msgs[TEMPLATE_DEBUG_USING_RAW_COMPILER] = "Using raw compiler."; You call debug with the code, not the message: $this->debug(TEMPLATE_DEBUG_USING_RAW_COMPILER); and the debug() method then takes the debug code and an additional information string, a la: function debug($code, $info = '') { echo $this->debug_msgs[$code]; if (! empty($info)) { echo " ($info)"; } } End users can do i18n on the debug messages by editing the value for the proper debug key. Same thing could be true for error messaging. Or you could define globals using gettext on the message string. Something like that. :-) -- Paul M. Jones Savant: the simple alternative to Smarty for PHP. http://phpsavant.com/ DB_Table: build RDBMS tables and XHTML forms in one PHP class. http://wiki.ciaweb.net/yawiki/index.php?area=DB_Table Yawiki: a collaborative online documentation system. http://wiki.ciaweb.net/yawiki/index.php?area=Yawiki Yawp: a single-file foundation for PHP applications. http://phpyawp.com/

« previous php.pear.dev (#30514) next »