List Info

Thread: Re: html_options




Re: html_options
user name
2007-02-26 10:12:20
--- Danilo Buerger <daniloblizzz.org> wrote:
> messju mohr schrieb:
> > On Mon, Feb 26, 2007 at 02:53:20PM +0100, Danilo
Buerger wrote:
> >>> It's the responsobility of the editor who
inserts the 
> >>> into the template to declare it as
multiple or not.
> >>>
> >>> the fact if an option list is single or
multiple is most times rather
> >>> static, but the list of actually selected
values is highly dynamic.
> >>>
> >> I can understand your point about the multiple
part although i dont 
> >> agree. However i dont see why you are going
against dropping the 
> >> array_map('strval'....) (which is unneccessary
anyway) to make the 
> >> plugin work better.
> > 
> > the strval() is necessary to distinguish between
"" and 0, like here:
> > 
> > $smarty->assign('options', array('' =>
'Please Choose',
> >                                  0 => 0,
> >                                  1 => 1,
> >                                  2 => 2));
> > 
> > $smarty->assign('selected', 0);
> > 
> > ...
> > 
> > {html_options name=foo options=$options
selected=$selected}
> > 
> > 
> 
> Ok this is a problem still to figure out however now
this works 
> incorrectly as well:
> 
> $smarty->assign('options', array('' => 'Please
Choose',
>                                   0 => 0,
>                                   1 => 1,
>                                   2 => 2));
> 
> $smarty->assign('selected', false);
> 
> false should match the array key 0 but matches the
empty string.

Personally, I think the point is moot. Whether or not you
can generally use
true/false as array keys, AFAIK, one can never get the PHP
values true or false
back from a form post. In that light, one has no business
specifying them when
they really mean to specify 0 or 1, not?

boots


 
____________________________________________________________
________________________
Get your own web address.  
Have a HUGE year through Yahoo! Small Business.
ht
tp://smallbusiness.yahoo.com/domains/?p=BESTDEAL

-- 
Smarty Development Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php


Re: html_options
user name
2007-02-26 10:39:26
Danilo Buerger wrote:
>
>>
>> Personally, I think the point is moot. Whether or
not you can 
>> generally use
>> true/false as array keys, AFAIK, one can never get
the PHP values 
>> true or false
>> back from a form post. In that light, one has no
business specifying 
>> them when
>> they really mean to specify 0 or 1, not?
>>
>> boots
>>
>
> Well it could be for semantic reasons that someone
wants to have 
> something like this:
>
> $smarty->assign('options', array(true => 'Yes',
false => 'No'));
> $smarty->assign('select_yes_by_default', false);
>

If it can be addressed with no BC breakage, it doesn't
bother me. 
Otherwise, I don't think that is important of a concern. We
are 
splitting hairs here, these are boolean values getting
passed to 
 option values, an HTML-specific function
which won't 
preserve variable types anyways, as boots mentioned.

-- 
Smarty Development Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php


Re: html_options
user name
2007-02-26 10:22:56
> 
> Personally, I think the point is moot. Whether or not
you can generally use
> true/false as array keys, AFAIK, one can never get the
PHP values true or false
> back from a form post. In that light, one has no
business specifying them when
> they really mean to specify 0 or 1, not?
> 
> boots
> 

Well it could be for semantic reasons that someone wants to
have 
something like this:

$smarty->assign('options', array(true => 'Yes', false
=> 'No'));
$smarty->assign('select_yes_by_default', false);

-- 
Smarty Development Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php


[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )