Re: [SMARTY-DEV] Re: [SMARTY] Smarty Config Error
| From: | Monte Ohrt | Date: | Sat, 22 Feb 2003 20:27:37 +0000 |
| Subject: | Re: [SMARTY-DEV] Re: [SMARTY] Smarty Config Error | ||
| References: | 1 2 | Groups: | php.smarty.dev php.smarty.general |
| Request: | Send a blank email to php-smarty-dev+get-826@lists.php.net to get a copy of this message | ||
this patch is duplicating the same code...
I'll get this fixed better.
Actually I'm thinking of making config vars available via
$smarty.config.var, then you can use that in quotes for sure.
Monte
On Sat, 2003-02-22 at 13:39, Paul Lockaby wrote:
> Paul Lockaby wrote:
> > Hi,
> >
> > This will fail:
> >
> > {config_load file="config/#p_DefaultLanguage#.lang"}
> >
> > However, this does not:
> >
> > {config_load file="config/$p_DefaultLanguage.lang"}
> >
> > Can we get it so that they both work?
> >
>
> Hi,
>
> I solved this problem and I would like to submit the following change
> for inclusion into Smarty. I made this change using the most recent CVS
> version of Smarty_Compiler.class.php (version 1.180). All there is to it
> is this.
>
> In the function _expand_quoted_text, I added the following elseif:
>
> } elseif
>
> (preg_match_all('%(?<!\\\\)\#(?:smarty(?:\.\w+)+|\w+(?:'.$this->_var_bracket_regexp.')*)\#%',$var_expr,$match))
>
> {
> // config variables
> rsort($match[0]);
> reset($match[0]);
> foreach($match[0] as $var) {
> $var_expr =
>
> str_replace($var,'".'.$this->_parse_conf_var($var).'."',$var_expr);
> }
> return preg_replace('!\.""|""\.!', '', $var_expr);
>
>
> I have attached a file called "patch.txt" that shows the entire file. I
> would make a normal "patch" file, but I really don't know how. So there
> ya go. I hope this fixes a problem that's been plaguing me since I've
> started using Smarty.
>
> ~Paul
>
> ______________________________________________________________________
>
> function _expand_quoted_text($var_expr)
> {
> if(preg_match_all('%(?<!\\\\)\$(?:smarty(?:\.\w+)+|\w+(?:' .
> $this->_var_bracket_regexp . ')*)%', $var_expr, $match)) {
> // regular variables
> rsort($match[0]);
> reset($match[0]);
> foreach($match[0] as $var) {
> $var_expr = str_replace ($var, '".' . $this->_parse_var($var) .
> '."', $var_expr);
> }
> return preg_replace('!\.""|""\.!', '', $var_expr);
> } elseif (preg_match_all('%(?<!\\\\)\#(?:smarty(?:\.\w+)+|\w+(?:' .
> $this->_var_bracket_regexp . ')*)\#%', $var_expr, $match)) {
> // config variables
> rsort($match[0]);
> reset($match[0]);
> foreach($match[0] as $var) {
> $var_expr = str_replace ($var, '".' . $this->_parse_conf_var($var) .
> '."', $var_expr);
> }
> return preg_replace('!\.""|""\.!', '', $var_expr);
> } else {
> return $var_expr;
> }
> }
>
>
> ______________________________________________________________________
>
> --
> Smarty Development Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--
Monte Ohrt <monte@ispi.net>