Part of your problem is that you're trying to sanitize output in your
controller. That is more appropriately done in the view, where you
have already sorted out the array and are working with single elements
at a time (presumably inside of a loop). This will also be helpful in
the future when you suddenly find yourself needing to export the data
to CVS or an oddball proprietary file format that doesn't require the
peculiarity that is &. You also reduce the risk of double-
escaping, a common problem in data-driven web sites.

On Jun 20, 11:11 am, Drew <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I am new to cake and this is definately turning into a much larger
> learning curve then what I would have liked!! :) I can already see a
> lot of potential out of it though.
>
> Currently the add/edit controllers have built in functionality (with
> the helpers) to clean the data displayed in the html boxes. Data
> passed in and out of these fields are automatically html encode'ed IE
> " => &quote; ' => &apot; => < => &lt; etc etc
>
> However, on any other action (view, index, ControllerName) we must
> manually add to these. On the index() call, I have used find() to get
> the data from the database; however, is there a way to automatically
> encode all results returned?
>
> class TemplateColorsController extends AppController
> {
>         var $name = 'TemplateColors';
>
>         function index()
>         {
>                 $this->set('templateColors', $this->TemplateColor->findAll());
>         }
>
> }
>
> I tried playing with the sanize class, however it seems that it does
> not support the data retrieved from an array. What do I need to do to
> automatically escape this data?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to