Re: [SMARTY-DEV] Re: [SMARTY] Smarty Config Error

From: Date: Sat, 22 Feb 2003 20:57:08 +0000
Subject: Re: [SMARTY-DEV] Re: [SMARTY] Smarty Config Error
References: 1 2 3  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-8128@lists.php.net to get a copy of this message
Monte Ohrt wrote:
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
You mean like adding a case into the _compile_smart_ref? A case like this, perhaps?
            case 'config':
                array_shift($indexes);
                $name = substr($indexes[0], 1);
                $compiled_ref = "\$this->_config[0]['vars']";
                if ($name = substr($indexes[0], 1))
                    $compiled_ref .= "['$name']";
                break;
Would that suffice? Or would that not work in the grand scheme of things. While I can see the obvious benefits from using $smarty.config.var scheme, I see some drawbacks. Here is an example. I have the config variable defaultLang set to "en" and I can access it using #defaultLang#. I use it to load my language file en.lang. When I put it in quotes, it looks like this: {config_load file="languages/$smarty.config.defaultLang.lang"} That bombs. So I try this: {config_load file="languages/".$smarty.config.defaultLang.".lang"} That bombs. I guess I could work around it by changing my config file to specifically state "en.lang" instead of just "en" but there goes some functionality. Oh well, I'm open your suggestions. ~Paul

« previous php.smarty.general (#8128) next »