|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
Jerc Smarty Rookie
Joined: 26 Jan 2010 Posts: 30 Location: Slovenia / Ljubljana
|
Posted: Wed Oct 22, 2014 7:26 am Post subject: {strip}, |strip as configuration |
|
|
All our templates starts and ends with {strip}{/strip} tag. When I have to debug something I have remove {strip}{/strip} and |strip tags from the template. It takes a lot of time to find whats wrong with the html/js code.
I suggest to add new configuration:
$smarty->setStrip(int stripLevel);
stripLevel:
0: default value - don't change any template
1: auto strip all variables with |strip modifier
2: auto strip templates - no need to add in the template {strip}{/strip} tags
3: auto strip templates and variables - no need to add in template {strip}{/strip} and use modifier strip on all variables
4: debug mode - skip all {strip}{/strip} and |strip tags
Is it possible to add something like this? |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
|
Back to top |
|
Jerc Smarty Rookie
Joined: 26 Jan 2010 Posts: 30 Location: Slovenia / Ljubljana
|
Posted: Thu Oct 23, 2014 1:02 pm Post subject: |
|
|
It works.
I only had to fix few JS lines (replace { } with {ldelim}{rdelim}).
This is my function:
Code: | function smarty_prefilter_stripFilter($source, $template)
{
// copied from smarty_internal_templateparser.php :: yy_r13()
return preg_replace('![\t ]*[\r\n]+[\t ]*!', '', $source);
}
// autoload
$smarty->autoload_filters = array('pre' => array('stripFilter'));
|
|
|
Back to top |
|
|
|
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
|