[prev in list] [next in list] [prev in thread] [next in thread]
List: smarty-dev
Subject: Re: [SMARTY-DEV] arrays in config files
From: messju mohr <messju () lammfellpuschen ! de>
Date: 2004-03-05 13:00:34
Message-ID: 20040305130033.GA5403 () pharao ! serveftp ! org
[Download RAW message or body]
> 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.
> [...]
--
Smarty Development Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic