Yeah man!
The same error here.
It's ocurrs when I try to sort fields of another model.
Like:
$paginator->sort('Field Description', 'field', array('model' => 'MyModel'))
=/
On Wed, Apr 16, 2008 at 8:02 PM, Grainne <[EMAIL PROTECTED]> wrote:
>
> I am having the exact same problem. I hope someone can help us.
>
> - Grainne
>
> On Apr 7, 9:19 pm, "Juan Luis Baptiste" <[EMAIL PROTECTED]>
> wrote:
> > Hi,
> >
> > I'm trying to make a view element and reuse it in various views. The
> > element uses the pagination helper, the problem is that the element
> > can't see the paginator helper object:
> >
> > : Undefined variable: paginator [APP/views/elements/servers.ctp, line 7]
> >
> > If I add the helper to the "uses" variable of the controller which
> > calls the action that includes the element on its view, then the
> > helper is found but I get these errors:
> >
> > Warning (2): array_merge() [function.array-merge]: Argument #1 is not
> > an array [CORE/cake/libs/view/helpers/paginator.php, line 139]
> >
> > The code of my element is something like the the following:
> >
> > $servers = $this->requestAction('servers/index/');
> > ?>
> > <table cellpadding="0" cellspacing="0">
> > <tr>
> > <th><?= $paginator->sort('Server Name', 'name');?></th>
> > <th><?= $paginator->sort('IP Address',
> 'ip_address');?></th>
> > </tr>
> > <?php foreach ($servers as $server): ?>
> > <tr>
> > <td><?= $server['Server']['name']; ?></td>
> > <td><?= $server['Server']['ip_address']; ?></td>
> > </tr>
> > <?php endforeach; ?>
> > </table>
> > <?php $paginate = $paginator->prev('<< Previous ', null,
> null);?>
> > <?php $paginate .= $paginator->next(' Next >>', null, null);?>
> > <?php $paginate .= '<br/>'.$paginator->counter(); ?>
> > <?=$html->div(null,$paginate, array('align' => 'center')); ?>
> >
> > on the view that includes it:
> >
> > echo $this->renderElement('servers');
> >
> > and the controller action:
> >
> > function index($id = null) {
> > $servers = $this->paginate('Server');
> > $this->set(compact('servers'));
> > if(isset($this->params['requested'])) {
> > return $servers;
> > }
> >
> > }
> >
> > So how is the propper way to use the pagination helper on a view element
> ?
> >
> > Thanks.
> > --
> > Juan Luis Baptiste
> >
>
--
Renan Gonçalves - Software Engineer
Cell Phone: +55 11 8633 6018
MSN: [EMAIL PROTECTED]
São Paulo - SP/Brazil
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" 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
-~----------~----~----~----~------~----~------~--~---