Re: [SMARTY] config variable type
| From: | Monte Ohrt | Date: | Mon, 29 Jul 2002 15:32:43 +0000 |
| Subject: | Re: [SMARTY] config variable type | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-5500@lists.php.net to get a copy of this message | ||
By default, the Config_File class booleanizes these values, so "yes,true,on" and "no,false,off" get converted to true or false (1 or 0).
This way you can do things like:
{if #calendarEnabled#}
...
{/if}
and you could have any one of these in your config file:
calendarEnabled = yes
calendarEnabled = on
calendarEnabled = true
calendarEnabled = "yes"
calendarEnabled = "on"
calendarEnabled = "true"
calendarEnabled = no
calendarEnabled = off
calendarEnabled = false
calendarEnabled = "no"
calendarEnabled = "off"
calendarEnabled = "false"
and they will all work like you would intend them to.
There is currently no provision in Smarty to get around this, since it is unlikely you would want to use this as a string. To get around it, you can edit the Config_File.class.php file and set booleanize = false, but realize this will happen across the board.
I can make this a configurable element of Smarty, but the need hasn't arisen (until now :-), we'll get that on the TODO.
Monte
tvdv@dds.nl wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Does anybody know how to force string type for config file variables? When I set value_no = "No" in a config file, Smarty returns an empty string for {#value_no#} - -- Thijs van der Vossen / www.vandervossen.net / +31(0)624204845 Internet development, design, training and consultancy -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE9RUdWEGwEFq4QOQIRAg4KAJ9PV78OiQoMksZW9c03PROw2S5nEACffziW q6og0h1MQbSoMqAAMuXL3NE= =s7/u -----END PGP SIGNATURE------- Monte Ohrt <monte@ispi.net> Director of Technology, ispi Inc.