RE: [PEAR] DataGrid

From: Date: Mon, 25 Sep 2006 00:10:19 +0000
Subject: RE: [PEAR] DataGrid
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-25231@lists.php.net to get a copy of this message
> > I am, however, running into a stumbling block. One of my columns is a > > text field that contains/allows CRLFs, which I need to preserve. > > Before, when I queried the data manually, I was just able to pass that > > column on to nl2br() prior to display and all was good. > That is, of course, only preserving the format for HTML output. > Preserving newlines would be actually leaving newlines as they are, which > the XML renderer is almost certainly doing. Your XML reader, however is > likely removing extra whitespace. No, the whitespace is still there. And the CRLFs are still there because if I wrap the comments in <pre>, they are showing as expected. > > However, I don't see a way to pass the value of a column to a user > > defined function prior to the datagrid renderer using it. > Really? Did you look? One of the parameters to the Structures_DataGrid_Column > class is a user-defined formatter function. > See addColumn(). Yes, I did look and yes, I did see addColumn. And I looked at the code for DataGrid_Column. But when I tried it, it didn't work for me. > the datagrid renderer (any of them, actually, not just the XML > renderer) gets the value of the field, it 'prepares' it in some manner > and turns any potential entity character into it's html entity representation. > So my "<br/>"s are turned into "&lt;br/&gt;". This is definately correct behavior for HTML and XML renderers. You don't want to allow HTML injection (XSS attacks). If it is happening for other renderers (such as text or XLS) then this is a bug. > It seems as if there is no way for > me to, effectively, no way for me to perform any formatting (such as > nl2br(), or any thing else that might involve entity characters). Is > that the case? No, see above. >> be preserved. But by using <pre>, any paragraph sized block would >> force the text off the right side of the page and cause the browser to >> create a horizontal scrollbar. Less than ideal presentation. > There should be a way to do a replace in XSL. In fact, a simple Google > query for "XSL replace newlines" shows the answer in the first result. I did a search for this, too, and found the same pages you did I'm sure. But this is another thing I couldn't get working (most likely due to the fact that I'm still learning XSL). I figured I could get all my problems solved if I could just get the CRLFs turned into actual BRs in the rendered XML somehow. thnx, Chris

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