|
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 |
mankyd Smarty Regular
Joined: 04 May 2006 Posts: 92 Location: Boston MA
|
Posted: Thu Apr 10, 2008 5:36 pm Post subject: Extending Smarty and the Smarty_Compiler |
|
|
I've been working with an extended version of the Smarty class for a few days now and had to write a prefilter plugin recently. I've just discovered, however, that the Smarty_Compiler class does not have access to the public variables that I put into my extended Smarty class.
This is because the Smarty_Compiler extends Smarty directly and when Smarty instantiates a compiler, it transfers some of its public variables, but not all of its public variables - those that I created in my extended class get left behind!
I am working on a solution for this, but it would be really nice if there was some sort of mechanism for classes that extend the Smarty to pass member variables into the Smarty compiler as well.
Thanks! |
|
Back to top |
|
xho Smarty n00b
Joined: 22 Jul 2008 Posts: 1
|
Posted: Tue Jul 22, 2008 10:57 am Post subject: Quite similar req |
|
|
Hi almost agree with previous, as a solution i only find out i could access the variables $compiler_file and $compiler_class inside smarty_class.
I didn't try, but what I actually need is quite simple, and change the whole compiler file seems too much: i should actually copy the original and substitute the few things i would like to be different in a particular project.
I suggest at least to give public access to some comiler stuff, like the regular expressions used in compiler to isolate smarty code.
I would like at least to have public access to this content
Code: |
preg_match_all("~{$ldq}\s*(.*?)\s*{$rdq}~s", $source_content, $_match);
|
and following:
Code: |
$text_blocks = preg_split("~{$ldq}.*?{$rdq}~s", $source_content);
|
in order to change the first parameeter in preg funcions.
So anybody could change the way the file is parsed and have further customization on delimiters' behaviour.
Bye. |
|
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
|