the method getNbResults() already returns the number of results, so
you do not need to do a count on it.

if ($this->pager->getNbResults() == 0 && $this->pager-
>getCurrentPage() <> 1)

should do it :)

On 30 Dez., 14:40, dziobacz <[email protected]> wrote:
> Alexandru sry but Your solution doesn't work :/
>
> On 30 Gru, 10:43, Alexandru-Emil Lupu <[email protected]> wrote:
>
> > You could do something else:
>
> > $this->pager->init();
> > if (count($this->pager->getNbResults()) == 0 &&
> > $this->pager->getCurrentPage() <> 1)
> > {
> > // force the redirect to the first page
>
> > }
>
> > I have used " <>1 ", because that would cover all the cases of invalid page
> > numbers (including -1 page )
>
> > Alecs
>
> > On Wed, Dec 30, 2009 at 7:52 AM, dziobacz <[email protected]> wrote:
> > > Could somebody add to Symfony Pager code:
>
> > > if($request->hasParameter('page') && ((int)$request->getParameter
> > > ('page') > $this->pager->getLastPage() ||
> > >        (int)$request->getParameter('page') < $this->pager->getFirstPage())
> > > )
> > > $this->forward404();
>
> > > because now if for example somebody change url and write number of
> > > page > number of all pages he will see only pager ?
>
> > > --
>
> > > You received this message because you are subscribed to the Google Groups
> > > "symfony developers" group.
> > > To post to this group, send email to [email protected].
> > > To unsubscribe from this group, send email to
> > > [email protected]<symfony-devs%[email protected]>
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/symfony-devs?hl=en.
>
> > --
> > Have a nice day!
> > Alecs
>
> > As programmers create bigger & better idiot proof programs, so the universe
> > creates bigger & better idiots!
> > I am on web:  http://www.alecslupu.ro/
> > I am on twitter:http://twitter.com/alecslupu
> > I am on linkedIn:http://www.linkedin.com/in/alecslupu
> > Tel: (+4)0748.543.798
>
>

--

You received this message because you are subscribed to the Google Groups 
"symfony developers" 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/symfony-devs?hl=en.


Reply via email to