Re: Error reporting info in compiled templates
"Daniel BODEA" <[email protected]>
| Newsgroups | gmane.comp.php.smarty.devel |
|---|---|
| Message-ID | <[email protected]> |
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" <[email protected]> wrote in message
news:[email protected]...
> 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 ?
> >
> >
> >
--
Smarty Development Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php