Re: [SMARTY-DEV] Error reporting info in compiled templates

From: Date: Wed, 01 Sep 2004 13:06:37 +0000
Subject: Re: [SMARTY-DEV] Error reporting info in compiled templates
References: 1 2 3 4 5 6 7  Groups: php.smarty.dev 
Request: Send a blank email to php-smarty-dev+get-2541@lists.php.net to get a copy of this message
Monte I already explained the basics. I'd have to provide the code to clear things up completely but I'm trying to find out if the concept is worth spending the time on code. I'll try to explain though in a couple of words one variant of the code that could make this thing happen. Suppose the Smarty object defines two more variables in its class: $running_template_stack and $running_plugin. The two are arrays. The template stack is used at the beginning and at the end of every compiled template. At the beginning you push the template name onto the stack and at the end you pop it out. The PHP code for this is generated by the compiler upon compilation. The running plugin is used for generating the code of custom tags (at first at least). You'd put a chunk of code similar to this one: echo '$this->running_plugin = array('.$this->_current_line_no.', '.$tag_command.');'; in the compiler function for custom tags. The code gets tacked on to every call for custom plugins. With this feature in place, one can create custom plugins that do application specific things, and provided they need to report an error to the designer that uses them, they can tell him exactly the template, plugin call and line number where the error occurred in his templates. With medium-to-highly complex templates, believe me it's more than useful. Only the code is clearer than this I think so if it's still not clear enough, I guess I'll have to code something up for my next message but I hope to get some proof of interest before getting on to it. Daniel "Monte Ohrt" <monte@ispi.net> wrote in message news:41347CC9.2080900@ispi.net... > Maybe you can provide a more explicit example of what you are proposing. > If it warrants practical usefulness and does not affect run-time > performance, then it is a possibility. > > Daniel BODEA wrote: > > >>What I'd like to know is if the Smarty development coordinators are > >>interested by this feature or not so that I can start preparing a diff but > >>the preparation takes time and I can't currently afford to work on things > >>that won't be taken into consideration. > >> > >> > > > >Anyone ? > > > > > >

« previous php.smarty.dev (#2541) next »