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

How to find unresolved variables?

 
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 -> General
View previous topic :: View next topic  
Author Message
gumshot
Smarty n00b


Joined: 13 Feb 2014
Posts: 2

PostPosted: Tue Apr 01, 2014 2:40 pm    Post subject: How to find unresolved variables? Reply with quote

Hello,

i'm using several Smarty-Templates and have always the same problem: How to find out unresolved variabled. Sometimes they are simple mistyped, but sometimes they have no value. Now i use a syntax like
Code:
{$myvar|default:"**UNSET**"}

to mark unresolved and after applying the template i grep for **UNSET**.

Is there a smarter, integrated way to do this?
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Tue Apr 01, 2014 5:14 pm    Post subject: Reply with quote

You can set to $smarty->error_reporting = E_ALL;
You will then get an E_NOTICE error for all undefined variables.

See http://www.smarty.net/docs/en/variable.error.reporting.tpl
Back to top
View user's profile Send private message
gumshot
Smarty n00b


Joined: 13 Feb 2014
Posts: 2

PostPosted: Wed Apr 23, 2014 10:05 am    Post subject: Reply with quote

I'm sorry but this does not help in any way. Error reporting is done to STDERR by default and thus will be written to a logfile in a webserver-context.

Shure, i could try to redirect this, but it will not only contain errors from smarty, but the whole webserer also Sad

So, what i am looking for is a way to ask smarty if there where any compile-errors, and it should return with an array or such.
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 -> General 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