Re: Default tag handler

From: Date: Sat, 22 Sep 2001 14:26:14 +0000
Subject: Re: Default tag handler
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-1524@lists.php.net to get a copy of this message
Anders Janson wrote: > > Monte Ohrt wrote: > >>When would you want to use a template function that doesn't exist? > > Well, I can not give any example of that :) > But sometimes my templates are edited online. The preview looks really > ugly if template tags are misspelled! A default handler could catch > what went wrong, and bring up the editor page again. Or refuse to > save the edited version into the database/file system. Or... > Today, the application does not really know if the compiler failed. > I'm not sure how you would handle this at compile time. Bringing up the edit page with a default error handler sounds a bit messy. > >>I think that you would WANT an error. > > Monte, nobody wants errors ;) > Seriously, what I would find useful is a way to DETECT the error. > And handle it gracefully. It already does :-) The compiler triggers a PHP error, telling you _exactly_ what the error was, and where it can be found. Now the beauty of Smarty using the PHP error handler is that you can write a custom PHP error handling function in your application. You don't like to see them dumped out on the screen where the error is happening? Write a function that does something else with it. Smarty doesn't need to know how you are handling these. > > >> If you don't, this could get quite confusing to debug. For example, > if your default function silently returned nothing and you accidenatally > misspelled a function name, you could be pulling your hair out trying > to figure out what is wrong. cache on/off? recompile not happening? > > I think anybody who would try to use such a feature knows what to do. > > /Anders > > --- > You are currently subscribed to smarty as: monte@ispi.net > To unsubscribe send a blank email to $subst('Email.Unsub') > Visit Smarty's homepage at ÈMï5™´B”ùQ™²à– > http://www.phpinsider.com/php/code/Smarty/ -- Monte Ohrt <monte@ispi.net> http://www.ispi.net/

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