Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Relax (controlled) Error Handling

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Feature Requests
View previous topic :: View next topic  

Need more control on Error Handling?
yes
0%
 0%  [ 0 ]
no
0%
 0%  [ 0 ]
what error handling?
100%
 100%  [ 3 ]
Total Votes : 3

Author Message
olympic
Smarty n00b


Joined: 29 Nov 2005
Posts: 1

PostPosted: Tue Nov 29, 2005 2:42 pm    Post subject: Relax (controlled) Error Handling Reply with quote

There were allready some request pointing in the same direction.

I would like to have the "feature" to ignore errors, and pass "unknown" tags to the result - that is i want :

A) controll when and how error messages are generated (without subclassing the Compiler).
B) control substitution of unknown tags.

I basically have the need to process a template twice (e.g.)

Code:
$smarty1=new Smarty();
$smarty1->assign...
$pass1=$smarty1->fetch(...)

$smarty2= new Smarty()
$pass2=$smarty2->fetch($result_from_pass1)



Note: I can only assign a subset of "vars" at pass1, the unknown vars should be processed by a second smarty object (that doesn't work right now).

(I can't assign these vars in pass1, because the second pass is done by posting the result to a webservice which is using smarty.)


So what I would need is a settings that allows to ignore errors(if possible) and an option that controlls how to ignore errors, that is, pass the error to the result or fix/ignore it.

Simple example again:
Input:
Code:
<html>{$var1}{$var2}</html>


Code:
$foo=new Smarty();
$foo->assign('var1','bar');
$res=$foo->fetch('** FILE**');


The result is
Code:
<html>bar</html>

but i need either an error like:

var2 not found
OR a passthrough so the result would be:
Code:
<html>bar{$var2}</html>


I think a fast and clean solution would be to allow to set a callback for errors, unknown element with default behaviour set like now (error, ignore)

Note: I only showed examples for simple variables, but my request is also for complex tags.

For your interest:

We do create a personalization of documents, which requires to
generate a "default template" at step1 and fill in the personal/individual text at a second run.
The second run will process the result from pass1 1xx.xxx times and has to be done on a complete different server, so
we do not even know which tags/vars are allowed/available on server2.
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Feature Requests All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP