On Nov 29, 2007 7:22 PM, Tommy Baggett <[EMAIL PROTECTED]> wrote:

> Here's the exact code I tried:
>
> class Walker_NavBar extends Walker {
> ...
>
>        function walk($elements, $to_depth) {
>                $args = func_get_args();
>
> ...
>
>                // call base class implementation
>                return call_user_func_array(array(parent,'walk'),$args);
>        }
> ...


wow; i was just looking at the wordpress source;  not the prettiest code ive
ever seen..
anyway; in what context do you intend to use the subclass?  why dont you
just create a
proxy instead?
eg. (php4)

class WalkerProxy {
    var $walkerInstance = null;

    /**
     * constructor
     *   accept an existing walker instance or create one from scratch
     */
    function WalkerProxy($existingWalker=null) {
        if(!is_null($existingWalker) && is_a($existingWalker, 'Walker') {
            $this->walkerInstance = $existingWalker;
        } else {
            $this->walkerInstance = new Walker();
        }
    }

    /**
     * walk
     *    do custom WalkerProxy stuff then invoke the underlying Walker's
walk() method
     */
    function walk($elements, $to_depth) {
         //// do something custom here
        return $this->walkerInstance($elements, $to_depth);
    }

   /// .....
}

-nathan

Reply via email to