On 10 May 2001, David N. Welton wrote:
> Maybe VARSLISTS could contain some useful information, like the length
> of the list. Actually, if we were to do that, all variables could
> have one, and you would just check if it's > 1. I kind of like that,
> as > 1 is easier that [ info exists blahblah ], which gets tiring if
> you use it a lot.
You still need to use it a lot since you can't count on any variable being
set - that's what's good about PHP. I wrote a small proc ('g::v') which is
called with argument and default value. But I don't recommend putting such
a solution in the core - maybe a proc to check for number of arguments
with such name.
btw AOLserver uses ns_queryget or ns_set+ns_getform which is more
uncomfortable to use.
I vote for using $::request::VARS w/o lists (like it's in my 0.10.0) and
providing functions for getting stuff. ie getarg returns $VARS(arg) while
getargl always returns a list. Or maybe switch to functions and use VARS
only when called 'hgetform' or something. If someone sent me 2000 args, I
don't always have to use them all... Could improve speed a bit -
definitely for me since I use a 'wrapper' to do so at the moment - catch
{set defval $VARS($name)}; return $defval ;-)
I think David should also consider a function to return
QUERY_STRING in a name-value list (suitable for array set) - like
script.dtcl?a=b&c=d&e=f -> {a b c d e f}. That way it could be used to
fetch any data w/o involving sublists... Simple
'foreach {n v} [hargs] { hputs "$n=$v<BR>\n" }' would do.
ps. I also vote for alias 'p' to 'hputs' in the core - to use <?p $var ?>
(a bit similar to AOL's <%=$var%> :-). I use it for 2 weeks
(proc p {args} {eval hputs $args} ;-) and it's great help. Also, since
stuff outside <? ?> is parsed to hputs "string", it could be put directly
in that hputs statement. And it would be wonderful is it could be shorted
to <?p$var?> - a bit obfuscated perhaps, but I like small code ;-).
--
Wojtek Kocjan
[EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]