I want to build some options for use across several views, so a custom
HTML helper seems like the best option. However, I'm running into
problems. Here's the helper:
class PositionHelper extends AppHelper {
var $helpers = array('Html');
function getPositions() {
$yaxes = array('A','B','C','D','E','F','G','H','I');
$xaxes = array
('001','002','003','004','005','006','007','008','009');
$options = array();
foreach($yaxes as $y){
foreach($xaxes as $x) {
$options = array_pad($options,1, $y . ',' . $x);
}
}
return $this->output($form->input('position', array('options' =>
$options)));
}
}
This is an attempt to build a select list of options. Right now I get
this error when I try to use it:
Fatal error: [] operator not supported for strings in /path/cake/libs/
view/view.php on line 702
As you can see, I just want to build a list of options that can be
used in more than one view and not coded into each one. Am I just
approaching this the wrong way?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---