Re: [SMARTY] debug console - mad idea
| From: | Monte Ohrt | Date: | Thu, 20 Mar 2003 15:42:32 +0000 |
| Subject: | Re: [SMARTY] debug console - mad idea | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-8776@lists.php.net to get a copy of this message | ||
On Thu, 2003-03-20 at 09:07, Monte Ohrt wrote:
> I think this kind of info is out of scope for Smarty. It is a template
> engine, not a develpment environment. The debug console lets you know
> values assigned to templates and the execution times of them. Although
> Smarty has mechanisms to access the PHP super globals directly, they
> really aren't considered to be part of the engine. In all correctness,
> you should assign values you plan to use in the templates.
>
> Try putting this in your Smarty class extention:
>
> My_Smarty extends Smarty {
> function My_Smarty() {
> Smarty::Smarty();
> $this->assign('_POST', $_POST);
> $this->assign('_GET', $_GET);
> $this->assign('_SERVER', $_SERVER);
> }
> }
A correction on this, Smarty's assign() will make new copies. Try this:
My_Smarty extends Smarty {
function My_Smarty() {
Smarty::Smarty();
$this->assign_by_ref('_POST', $_POST);
$this->assign_by_ref('_GET', $_GET);
$this->assign_by_ref('_SERVER', $_SERVER);
}
}
>
> (note: AFAIK, PHP 4 will create internal references and increment ref
> counters for these arrays, not make copies)
>
> Now your vars will show up in the debug console.
>
> Monte
>
> On Thu, 2003-03-20 at 05:30, Pete Morganic wrote:
> > During programming I leave debug window on ..
> >
> > So here's the dream.
> >
> > Have a set of tabs at the top (just like phpmyadmin) for switching
> > between different debug data. This could be accomplished using layers
> > maybe ;-)
> >
> > The tabs are:
> > Smarty | $_GET vars | $_POST vars | $_SERVER vars | etc..
> >
> > Gonna try an start coding but me not a Javascript expert (yet)
> >
> > nicec day everyone - the sun is shining in wales ..
> >
> > pete
> >
> --
> Monte Ohrt <monte@ispi.net>
--
Monte Ohrt <monte@ispi.net>