By: Ruud
Date: 2006-03-31
Time: 09:09
|
Object calls with argument via template
I *really* needed TBS to be able to pass an argument for an object call.
Here's what I did. In method function meth_Locator_Replace.
On line 870 where it says:
$x = call_user_func(array(&$Value,$x)); |
I replaced it with:
// rmh: added to allow object call with param
if (isset($Loc->SubLst[$SubId +1]) ) {
$x = call_user_func_array(array(&$Value, $x), $Loc->SubLst[$SubId +1]);
$SubId++;
} else {
$x = call_user_func(array(&$Value,$x));
}
// rmh: end mod
|
This allows me to call an object method without a param the standard way like var.object ... while I can also call an object method as var.object.parameter
|
By: Skrol29
Date: 2006-03-31
Time: 16:54
|
Re: Object calls with argument via template
This is intersting.
I'm thinking about of adding such a feature but propbaly not for 3.0 yet.
Users will also need 2,3,4... arguments
|
By: Ruud
Date: 2006-03-31
Time: 19:36
|
Re: Object calls with argument via template
More arguments would be better but it would make the hack less clean: I keep in mind I might have to put it in a newer version.
I haven't had the need yet to call methods with multiple arguments from inside a template yet. My calls are mainly config related. But when I have to do so I don't mind exploding on _ to get multiple parameters.
...
Hm, haven't tried yet if TBS would have a problem with the format but otherwise parse_str could be helpful too.
Happy you like it. You've done excellent work and are soley responsible for finally getting me on the template bandwagon. Every other comparable was simply too much like copying PHP itself.
|
|
Posting in progress.
Please wait...
|