Thanks for the great advice! That did the trick and made me realize an even simpler solution to my needs in the process.

I needed to iterate the pages in reverse to store the page ID of the last <li> element of each <ul> element before allowing the walker class to do its work. This allowed me to assign a CSS class to the stored elements in the Walker class's start_el function.

Both you guys have a great weekend and thanks for the help.

On Nov 29, 2007, at 6:56 PM, Nathan Nobbe wrote:

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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to