I am using CakePHP to create a simple blog for myself. I want to have a rating system attached to each post.
I have loaded the ratings which look like this:
Controller
$this->set('ratings', $this->Ratings->find('all'));
I want to generate radio buttons on the view with the ratings. The ratings have the fields value and label. I could use a foreach and loop around the ratings but I am wondering if the radio button helper in the form class can take a model object and generate the radio buttons?
I hope you understand what I mean.
You can pass an options attribute to the form helper.
<?=$this->Form->input('rating', array('type' => 'radio', 'options' => range(1, 10)))?>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With