Guys... I have to be missing something obvious here:

        function index()
        {
                     uses('sanitize');
                     $sanitize = new Sanitize();
                     $find = $this->TemplateColor->findAll();
                     foreach ($find AS $key => $color)
                     {
                         $find[$key]['TemplateColor']['name'] =
$sanitize->html($color['TemplateColor']['name']);
                         $find[$key]['TemplateColor']['description'] =
$sanitize->html($color['TemplateColor']['description']);
                     }
                $this->set('templateColors', $find);
        }

This is what I came up with, and is obviously rather redundant. Isn't
there some way to auto-filter output from the database? Kinda figured
it would be standard functionality from a framework... What am I
missing?

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