Re: Structures_DataGrid_Renderer - doesnt' allow custom renderers outside of PEAR directory tree

From: Date: Fri, 28 Jan 2005 17:14:43 +0000
Subject: Re: Structures_DataGrid_Renderer - doesnt' allow custom renderers outside of PEAR directory tree
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-17238@lists.php.net to get a copy of this message
Ian P. Christian wrote:
The following member function of Structures_DataGrid_Renderer resticts you from generating your own Renderer class and using it. function setRenderer($renderer)
    {
        $class = 'Structures_DataGrid_Renderer_' . $renderer;
        $file = 'Structures/DataGrid/Renderer/' . $renderer . '.php';
        if (@include_once($file)) {
            $this->renderer = new $class($this);
        } else {
            return new PEAR_Error('Invalid renderer');
        }
        return true;
    }
Perhaps I'm missing something, but it should be possible to write your own renderer and apply it to a datagrid? I'm trying to make it so that the first line in the table is a form used to filter, and without putting my render file in the PEAR directory (or setting the include path and creating a matching structure) I cannot do so.
At this current point, the 2 solutions you mentioned would have to be done (place in the pear directory or create a similar directory in the include path). I guess the best solution for this is to add an optional parameter to the setRenderer method that allows you to change the path. Does this seem reasonable? Andrew

« previous php.pear.general (#17238) next »