var $paginate = array(
'limit' => 5,
'order' => array(
'id' => 'asc'
)
);
$this->set('items', $this->paginate('Item')
}
how can this works ?? :D "var" inside method ? :)
--
-- --
Lep pozdrav, Tilen Majerle
2011/12/28 J. <contact.mysparetime@gmail.com>
Found it. Seems my paginators were deprecated.
I used this :
<?php echo $this->Paginator->numbers(); ?>
Moreover, the VAR had to be declared before the functions.
On 28 déc, 12:29, "J." <contact.mysparet...@gmail.com> wrote:
> Here is my controller :
>
> <?php
> class ItemsController extends AppController {
> public $name = 'Items';
> public $helpers = array('Html', 'Form', 'Paginator');
>
> public function index() {
> var $paginate = array(
> 'limit' => 5,
> 'order' => array(
> 'id' => 'asc'
> )
> );
> $this->set('items', $this->paginate('Item')
> }
>
> and I have this in my view :
>
> <?php echo $paginator->prev(); ?>
> <?php echo $paginator->numbers(); ?>
> <?php echo $paginator->next(); ?>
>
> And I get this error message :
>
> Parse error: syntax error, unexpected T_VAR in /Applications/MAMP/
> htdocs/sparetime/app/Controller/ItemsController.php on line 7
>
> I don't understand, can someone help me ? Thanks a lot.
>
> On 26 déc, 17:49, Tilen Majerle <tilen.maje...@gmail.com> wrote:
>
>
>
>
>
>
>
> > or for 2.0 this:http://book.cakephp.org/2.0/en/core-libraries/components/pagination.html
> > --
> > Lep pozdrav, Tilen Majerlehttp://majerle.eu
>
> > 2011/12/26 euromark <dereurom...@googlemail.com>
>
> > > you are probably looking for
> > >http://book.cakephp.org/view/1231/Pagination
>
> > > On 26 Dez., 17:40, "J." <contact.mysparet...@gmail.com> wrote:
> > > > People here are of great help, so I figured out I may ask here.
>
> > > > I have an Item controller (An Item is a post on my website) with this
> > > > function :
>
> > > > public function index() {
> > > > $this->set('items', $this->Item->find('all', array('limit' =>
> > > > 5 )));
> > > > }
>
> > > > When in view, I echo it out this like this :
>
> > > > <?php foreach ($items as $item): ?>
>
> > > > Before I put out the limit of 5 elements, all my site items (lots)
> > > > were displayed. Now it only displays 5. But how can I say that it only
> > > > displays 5 then a link to page 2 with posts 6 -> 10 then page 3
> > > > etc... ?
>
> > > > Thanks a lot. Cakephp is a very usefull tool but for someone new to
> > > > php and coding it can be hard to know where to search.
>
> > > --
> > > Our newest site for the community: CakePHP Video Tutorials
> > >http://tv.cakephp.org
> > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp
> > > others with their CakePHP related questions.
>
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscribe@googlegroups.com For more options, visit this group
> > > athttp://groups.google.com/group/cake-php
--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
No comments:
Post a Comment