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

From: Date: Fri, 28 Jan 2005 17:40:51 +0000
Subject: Re: Re: Structures_DataGrid_Renderer - doesnt' allow custom renderers outside of PEAR directory tree
References: 1 2  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-17242@lists.php.net to get a copy of this message
On Fri, 28 Jan 2005 12:14:43 -0500, Andrew Nagy <asnagy@webitecture.org> wrote: > 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? > I would suggest doing a class_exists before the include. This way the user could require their own file without providing a path. Of course, it would restrict the naming of the class, but I wouldn't see this is a bad thing. Additionally, to the OP, it's prefectly reasonable to put your own file in the PEAR directories. I've been doing this with DB drivers and HTML_QuickForm elements for a while. -- Justin Patrin

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