Interesting. It has nothing to do with your getPostions() method. If
you're running the latest release, the error is in
View::_loadHelpers(). It seems that the 2nd param is a string rather
than an array. I know a Helper may have other helpers, and your syntax
there looks fine. Might be a bug.
Try editing View.php temporarily:
function &_loadHelpers(&$loaded, $helpers, $parent = null) {
debug($helpers);
On Tue, Mar 24, 2009 at 10:19 AM, Tony Thomas <[email protected]> wrote:
>
> 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
-~----------~----~----~----~------~----~------~--~---