As Farray pointed out, you have used the set() method incorrectly. The correct syntax is as follows:
EDIT: I misread Farrays post and indeed you have used set() correctly as it can take an associative array as it's first command. It might be worth changing the variable type to something other that $data and making use of the set method as follows:
<?php
$myarray = array(
'color' => 'pink',
'type' => 'sugar',
'base_price' => 23.95
);
//make $color, $type, and $base_price
//available to the view:
$this->set('myarray', $myarray);
?>
Alternatively you can use a shorthand method and make use of the compact() method:
<?php
$this->set(compact('myarray'));
?>
Inside your view, if you run pr($myarray); you should see your array neatly formatted in a recursive manner. If you do NOT see it then either:
- There is an error in your view file that is being caught before your pr() command
- You have PHP short tags off in your php.ini config file
- There is a deeper underlying issue in your controller
Regards,
Simon