Re: [SMARTY-DEV] arrays in config files

From: Date: Fri, 05 Mar 2004 13:00:34 +0000
Subject: Re: [SMARTY-DEV] arrays in config files
References: 1  Groups: php.smarty.dev 
Request: Send a blank email to php-smarty-dev+get-2193@lists.php.net to get a copy of this message
> As promised, I worked onto the Config_File class, and here is attached the > _set_config_var function, that is full backward compatible (tested). The > function is nearly complete, it support : > > _var5 > var[0] > var.foo > var.foo[3].bar > var.foo.bar[2] nice. > now, I have to add the support of : > > var[$Const] > > Where $Const is a numerical value that should be reached at > $smarty.const.Const. I didn't explored this yet, but I don't know if the > Config_File class access to $smarty.const. Config-Files are for static content. IMO It's plain bad and wrong to add this to Config_File.class.php. If you need CONST-magic inside your Config-Files, write a resource that does this replacement and read your config-files through it. > One more things, now changes must be made on Smarty_Compiler class, and I > thougt about one thing, when overwrite is off and then that _set_config_var > create a sub-array, how are the config var accessed in template currently ? > (#overwritted[0]# ???) Then I guess that the Smarty_Compiler class have a > partial config vars array support ? (I must say that didn't really get how > the whole thing works, but trust me I got how the _set_config_var works, > you'll see on my function ;) AFAIK, the only way to access these is {$smarty.config.overwritted[0]}. And I think this should also be the first thing to do if you want to enable config-vars-arrays in the template: Just remove the $_max_index = 3; limitation in the "config" case of Smarty_Compiler::_compile_smarty_ref() That's much simpler and less prone to errors than extending the #...#-syntax. > [...]

« previous php.smarty.dev (#2193) next »