Re: pagination problem, please help

2012-11-18 Thread Chris
thank you Ivan,... I have tried that by the book,... and probably missed 
something on its way in a first place,...
 well,... this is what I got now, and it's working, 

  function category($id = null)
  {

if($this->is_user())
{
  $this->set('user_obj', $user = 
$this->User->findById($this->user['id']));
}
  $filter = $this->params['pass'];
  $this->set('url_options', $filter);

  $category = $id;

  $cat_id = array_search($category, 
Configure::read('Blog.blog_category'));

  $this->set('category', $category);

$this->paginate = array('Blog' => array('conditions' => 
array('Blog.categories' => $cat_id), 'limit' => 12, 'recursive' => 1));

$blogs = $this->paginate('Blog');

  $this->set('blogs', $blogs);
  }



On Sunday, November 18, 2012 1:52:17 PM UTC-8, ivnrmc wrote:
>
> i think this is your answer:
>
> function category($id = null){
>
> if($this->is_user()) { 
>  $this->set('user_obj', $user = 
> $this->User->findById($this->user['id']));
> }
> 
> $category = $id;
> $cat_id = array_search($category, 
> Configure::read('Blog.blog_category'));
> 
> $this->paginate = array('Blog' => array('conditions' => 
> array('Blog.categories' => $cat_id), 'limit' => 12, 'recursive' => -1));
> $blogs = $this->paginate('Blog');
>
> $this->set(compact('blogs', 'category'));
> }
>
>
> On Sun, Nov 18, 2012 at 9:05 PM, Chris >wrote:
>
>> hi guys,... I have a problem with pagination in a controller,... can 
>> someone help me please,... 
>> I'm getting an error: SQL Error: 1054: Unknown column 'limit' in 'where 
>> clause' 
>>
>> how can I do this,...? 
>>
>>   function category($id = null)
>>   {
>> if($this->is_user())
>> {
>>   $this->set('user_obj', $user = 
>> $this->User->findById($this->user['id']));
>> }
>>
>>   $category = $id;
>>
>>   $cat_id = array_search($category, 
>> Configure::read('Blog.blog_category'));
>>
>>   $this->set('category', $category);
>>
>>   $blogs = $this->Blog->find('all', array('conditions' => 
>> array('Blog.categories' => $cat_id)));
>>
>>   $this->set('blogs', $blogs, $this->paginate('Blog', array('limit' 
>> => 12) ));
>>
>> thanks in advance, 
>> chris 
>>
>>  -- 
>> Like Us on FaceBook https://www.facebook.com/CakePHP
>> Find us on Twitter http://twitter.com/CakePHP
>>  
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "CakePHP" group.
>> To post to this group, send email to cake...@googlegroups.com
>> .
>> To unsubscribe from this group, send email to 
>> cake-php+u...@googlegroups.com .
>> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>>  
>>  
>>
>
>
>
> -- 
> *Ivan Rimac***
> mail: ivn...@gmail.com 
> *tel: +385 95 555 99 66*
> *http://ivanrimac.com*
>
>  

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: pagination problem, please help

2012-11-18 Thread Ivan Rimac
i think this is your answer:

function category($id = null){

if($this->is_user()) {
 $this->set('user_obj', $user =
$this->User->findById($this->user['id']));
}

$category = $id;
$cat_id = array_search($category,
Configure::read('Blog.blog_category'));

$this->paginate = array('Blog' => array('conditions' =>
array('Blog.categories' => $cat_id), 'limit' => 12, 'recursive' => -1));
$blogs = $this->paginate('Blog');

$this->set(compact('blogs', 'category'));
}


On Sun, Nov 18, 2012 at 9:05 PM, Chris  wrote:

> hi guys,... I have a problem with pagination in a controller,... can
> someone help me please,...
> I'm getting an error: SQL Error: 1054: Unknown column 'limit' in 'where
> clause'
>
> how can I do this,...?
>
>   function category($id = null)
>   {
> if($this->is_user())
> {
>   $this->set('user_obj', $user =
> $this->User->findById($this->user['id']));
> }
>
>   $category = $id;
>
>   $cat_id = array_search($category,
> Configure::read('Blog.blog_category'));
>
>   $this->set('category', $category);
>
>   $blogs = $this->Blog->find('all', array('conditions' =>
> array('Blog.categories' => $cat_id)));
>
>   $this->set('blogs', $blogs, $this->paginate('Blog', array('limit' =>
> 12) ));
>
> thanks in advance,
> chris
>
>  --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com.
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>
>
>



-- 
*Ivan Rimac***
mail: ivn...@gmail.com
*tel: +385 95 555 99 66*
*http://ivanrimac.com*

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: Pagination Problem

2011-09-17 Thread WebbedIT
If this is a simple pagination problem then I am confused what it has
to do with the JsHelper?

As the error is from a helper is has to be realted to something in
your view/layout (unless your calling views in your controller).

Have you checked the error stack to see what line in your code is
creating the error?

HTH, Paul
@phpMagpie

On Sep 16, 6:44 pm, Caio Landau  wrote:
> I'm trying to do simple pagination with cake and getting the following
> error: "Warning (4096): Object of class JsHelper could not be
> converted to string [CORE/cake/libs/view/helpers/html.php, line 444]"
>
> Here is my code:
>
> //controllers/orders_controller.php
> class OrdersController extends AppController {
>
>     var $components = array("Security");
>     var $helpers = array("Html", "Form", "Session", "Number",
> "Paginator");
>     var $uses = array('Product', 'Order');
>     var $paginate = array('limit' => 10,'order' => array('Order.date'
> => 'asc'),'recursive' => 2);
>
>     function view($id = null) {
>         if ($id == NULL) {
>             $this->set("orders", $this->paginate("Order"));
>             $this->set("js", array("jquery-1.6.2.min",
> "viewOrders")); //Set a JS variable to be put on the head
>         } else {
>             $orders[0] = $this->Order->getOrder($id);
>             $this->set("orders", $orders);
>         }
>     }
>
> }
>
> The only place I'm calling the paginate function is here in the
> controller. Not calling anything (yet) on the view/model. If I comment
> the $this->set("orders", $this->paginate("Order")); line the error
> stops. Any idea?

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Pagination Problem

2011-06-30 Thread CrotchFrog
Thanks for answering Johan :)

I tracked the problem down to passing form data via "GET" through an
iframe. I located where the problem was occurring, but I couldn't
figure out why. I tried a few different approaches to no avail. In any
case I resorted to using "POST" and Cache and the app once again works
flawlessly :)

- ED

On Jun 30, 10:31 am, Johan  wrote:
> Could it be that this second page is coming through an ajax request?
> This type of error usually pops up when you try to use the PaginationHelper
> but no pagination has been done on the controller.
>
> Cheers,
> - Johan
>
>
>
>
>
>
>
> On Wed, Jun 29, 2011 at 9:12 PM, Ed Propsner  wrote:
> > I've been poking around with this for a bit and have yet to find out what's
> > going wrong. I'm passing a paginated result set to a view and everything
> > renders fine until I try to access the next page of results.
>
> > Example:
>
> > // CONTROLLER //
>
> > $this->paginate = array(
> > 'contain' => array(
> >    'OnlineUser',
> >    'Seeking',
> >    'UserProfile' => array('conditions' => array('UserProfile.order' =>
> > 1)),
> >    'Score' ,
> >    'Photo' => array('conditions' => array('Photo.profile' => 1),
> >  'limit' => 1,
> > 'fields' => 'name'
> >    )
> >    ),
> > 'conditions' => array(
> >       'Seeking.orientation' => $orientation,
> >       'User.gender' => $gender,
> >       'User.age BETWEEN ? AND ?' => array($minAge, $maxAge),
> >       'User.country' => $country,
> >       'User.region' => $region,
> >       'NOT' => array(
> >       ' User.id' => array(2, $this->Auth->User('id'))),
> >       'AND' => array($seekingOption)
> >       ),
> > 'limit' => 5,
> >  'order' => 'last_login DESC'
> > );
>
> >                 $user = $this->paginate('User');
> > $this->set(compact('user''));
>
> > // VIEW //
>
> > 
> > Paginator->prev('<< ' . __('previous', true), array(),
> > null, array('class'=>'disabled'));?>
> >  Paginator->numbers();?> |
> > Paginator->next(__('next', true) . ' >>', array(), null,
> > array('class' => 'disabled'));?>
> > 
>
> > I debugged $this->Paginator and everything seems to be in place just as I
> > would expect and the first 5 results of the set render just fine in the view
> > also as expected. Nothing seems out of place with the Pagination in the
> > initial view ... the links generated by $this->Paginator->numbers() and
> > $this->Paginator->next() are correct and clicking them loads the appropriate
> > controller/action ... ie. /controller/action/page:2. This is the point where
> > it starts throwing errors. The view is complaining about "undefined
> > variable", "invalid argument supplied for foreach()", "undefined property
> > View::Paginator" ... pretty much everything you would expect if no data were
> > being passed to the view. I'll also add that the pagination works just as it
> > should everywhere else throughout the app with no issues.
>
> > --
> > Our newest site for the community: CakePHP Video Tutorials
> >http://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
> > others with their CakePHP related questions.
>
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Pagination Problem

2011-06-30 Thread Johan
Could it be that this second page is coming through an ajax request?
This type of error usually pops up when you try to use the PaginationHelper
but no pagination has been done on the controller.

Cheers,
- Johan

On Wed, Jun 29, 2011 at 9:12 PM, Ed Propsner  wrote:

> I've been poking around with this for a bit and have yet to find out what's
> going wrong. I'm passing a paginated result set to a view and everything
> renders fine until I try to access the next page of results.
>
> Example:
>
> // CONTROLLER //
>
> $this->paginate = array(
> 'contain' => array(
>'OnlineUser',
>'Seeking',
>'UserProfile' => array('conditions' => array('UserProfile.order' =>
> 1)),
>'Score' ,
>'Photo' => array('conditions' => array('Photo.profile' => 1),
>  'limit' => 1,
> 'fields' => 'name'
>)
>),
> 'conditions' => array(
>   'Seeking.orientation' => $orientation,
>   'User.gender' => $gender,
>   'User.age BETWEEN ? AND ?' => array($minAge, $maxAge),
>   'User.country' => $country,
>   'User.region' => $region,
>   'NOT' => array(
>   ' User.id' => array(2, $this->Auth->User('id'))),
>   'AND' => array($seekingOption)
>   ),
> 'limit' => 5,
>  'order' => 'last_login DESC'
> );
>
> $user = $this->paginate('User');
> $this->set(compact('user''));
>
> // VIEW //
>
> 
> Paginator->prev('<< ' . __('previous', true), array(),
> null, array('class'=>'disabled'));?>
>  Paginator->numbers();?> |
> Paginator->next(__('next', true) . ' >>', array(), null,
> array('class' => 'disabled'));?>
> 
>
>
> I debugged $this->Paginator and everything seems to be in place just as I
> would expect and the first 5 results of the set render just fine in the view
> also as expected. Nothing seems out of place with the Pagination in the
> initial view ... the links generated by $this->Paginator->numbers() and
> $this->Paginator->next() are correct and clicking them loads the appropriate
> controller/action ... ie. /controller/action/page:2. This is the point where
> it starts throwing errors. The view is complaining about "undefined
> variable", "invalid argument supplied for foreach()", "undefined property
> View::Paginator" ... pretty much everything you would expect if no data were
> being passed to the view. I'll also add that the pagination works just as it
> should everywhere else throughout the app with no issues.
>
> --
> 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+unsubscr...@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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Pagination Problem in Custom Query

2011-02-06 Thread Name256
Hey,

Try the containable behaviour. It is designed specifically to filter
out related results ("Feeds" in your case).

On Feb 7, 3:48 am, Joseph Buarao  wrote:
> Hello Guys,
>
> Thanks for your help Guys, I have fixed the limit statement but still
> in problem, I think I found the problem not in my query it is in my
> data structure, I was trying to paginate the data in one category,
> here's my data structure
> Array
> (
>     [0] => Array
>         (
>             [Category] => Array
>                 (
>                     [id] => 1
>                     [name] =>
>                     [slug] => asian-food
>                 )
>
>             [Feed] => Array
>                 (
>                     [0] => Array
>                         (
>                             [id] => 1
>                             [url] =>http://steamykitchen.com/blog/feed
>                             [title] =>
>                             [popularity] => 7
>                             [error] => 0
>                             [ParseItem] => Array
>                                 (
>                                     [0] => Array
>                                         (
>                                             [id] => 796
>                                             [feed_id] => 1
>                                             [datetime] => 2011-01-28
> 11:12:42
>                                             [permalink] 
> =>http://feedproxy.google.com/~r/SteamyKitchen/~3/Jh82Omii8DQ/13565-chi...
>                                             [title] => Smoky Sweet
> Spicy Chipotle Cinnamon Wings
>                                             [excerpt] =>
>                                         )
>
>                                     [1] => Array
>                                         (
>                                             [id] => 121
>                                             [feed_id] => 1
>                                             [datetime] => 2011-01-28
> 11:12:42
>                                             [permalink] 
> =>http://feedproxy.google.com/~r/SteamyKitchen/~3/Jh82Omii8DQ/13565-chi...
>                                             [title] => Smoky Sweet
> Spicy Chipotle Cinnamon Wings
>                                             [excerpt] =>
>                                         )
>
>                                 )
>
>                         )
>
>                     [1] => Array
>                         (
>                             [id] => 3
>                             [url] 
> =>http://stickyrice.typepad.com/my_weblog/atom.xml
>                             [title] =>
>                             [popularity] => 8
>                             [error] => 0
>                             [ParseItem] => Array
>                                 (
>                                     [0] => Array
>                                         (
>                                             [id] => 127
>                                             [feed_id] => 3
>                                             [datetime] => 2011-01-19
> 04:58:22
>                                             [permalink] 
> =>http://stickyrice.typepad.com/my_weblog/2011/01/deck-of-the-fisherman...
>                                             [title] => Deck of the
> Fisherman
>                                             [excerpt] => Whenever I
> come
>                                         )
>                         )
>
>    as you can see here. there is only one category and inside of it
> there's a lot of feeds, that's why the paginate helper on cakephp did
> come out because it start counting, referring to limit in category not
> in the feeds, can you suggest to me guys how can I fix this. I want
> the limit statement working on the feeds not in category, because
> obviously it only has one category, so I want to limit the feeds
> result inside of that particular category and have a pagination..
> Thank you in advance again guys for you help..
>
> Joseph Buarao
> Web Developer
> Azure Web Design
>
> On Feb 6, 4:15 am, Jeremy Burns | Class Outfit
>
>
>
>
>
>
>
>  wrote:
> > It's 'limit' not 'limits'. Not sure if that's the only problem, but it's a 
> > starter.
>
> > Jeremy Burns
> > Class Outfit
>
> > jeremybu...@classoutfit.comhttp://www.classoutfit.com
>
> > On 5 Feb 2011, at 07:48, Joseph Buarao wrote:
>
> > > Hi Fellow Programmer,
>
> > > I getting problem with my code, I don't know what's the reason why the
> > > sql limit statement is not working on my paginate query. below are my
> > > codes feel free to suggest, I really Appreciated it.. Thank you in
> > > advance for your support GUYS...
>
> > > $this->paginate = array('conditions' =>  array('Category.slug'=>
> > > $category),
> > > 'limits' => 10);
>
> > > $feeds_data = $this->paginate('Category');
>
> > > By the way, I used hasAndBelongsToMany relationship..
>
> > > Thanks..
>
> > > Joseph Buarao
> > > Web Developer
> > 

Re: Pagination Problem in Custom Query

2011-02-06 Thread Joseph Buarao
Hello Guys,

Thanks for your help Guys, I have fixed the limit statement but still
in problem, I think I found the problem not in my query it is in my
data structure, I was trying to paginate the data in one category,
here's my data structure
Array
(
[0] => Array
(
[Category] => Array
(
[id] => 1
[name] =>
[slug] => asian-food
)

[Feed] => Array
(
[0] => Array
(
[id] => 1
[url] => http://steamykitchen.com/blog/feed
[title] =>
[popularity] => 7
[error] => 0
[ParseItem] => Array
(
[0] => Array
(
[id] => 796
[feed_id] => 1
[datetime] => 2011-01-28
11:12:42
[permalink] =>
http://feedproxy.google.com/~r/SteamyKitchen/~3/Jh82Omii8DQ/13565-chipotle-cinnamon-wings-recipe.html
[title] => Smoky Sweet
Spicy Chipotle Cinnamon Wings
[excerpt] =>
)

[1] => Array
(
[id] => 121
[feed_id] => 1
[datetime] => 2011-01-28
11:12:42
[permalink] =>
http://feedproxy.google.com/~r/SteamyKitchen/~3/Jh82Omii8DQ/13565-chipotle-cinnamon-wings-recipe.html
[title] => Smoky Sweet
Spicy Chipotle Cinnamon Wings
[excerpt] =>
)



)

)

[1] => Array
(
[id] => 3
[url] => 
http://stickyrice.typepad.com/my_weblog/atom.xml
[title] =>
[popularity] => 8
[error] => 0
[ParseItem] => Array
(
[0] => Array
(
[id] => 127
[feed_id] => 3
[datetime] => 2011-01-19
04:58:22
[permalink] =>
http://stickyrice.typepad.com/my_weblog/2011/01/deck-of-the-fisherman.html
[title] => Deck of the
Fisherman
[excerpt] => Whenever I
come
)
)

   as you can see here. there is only one category and inside of it
there's a lot of feeds, that's why the paginate helper on cakephp did
come out because it start counting, referring to limit in category not
in the feeds, can you suggest to me guys how can I fix this. I want
the limit statement working on the feeds not in category, because
obviously it only has one category, so I want to limit the feeds
result inside of that particular category and have a pagination..
Thank you in advance again guys for you help..


Joseph Buarao
Web Developer
Azure Web Design

On Feb 6, 4:15 am, Jeremy Burns | Class Outfit
 wrote:
> It's 'limit' not 'limits'. Not sure if that's the only problem, but it's a 
> starter.
>
> Jeremy Burns
> Class Outfit
>
> jeremybu...@classoutfit.comhttp://www.classoutfit.com
>
> On 5 Feb 2011, at 07:48, Joseph Buarao wrote:
>
>
>
>
>
>
>
> > Hi Fellow Programmer,
>
> > I getting problem with my code, I don't know what's the reason why the
> > sql limit statement is not working on my paginate query. below are my
> > codes feel free to suggest, I really Appreciated it.. Thank you in
> > advance for your support GUYS...
>
> > $this->paginate = array('conditions' =>  array('Category.slug'=>
> > $category),
> > 'limits' => 10);
>
> > $feeds_data = $this->paginate('Category');
>
> > By the way, I used hasAndBelongsToMany relationship..
>
> > Thanks..
>
> > Joseph Buarao
> > Web Developer
> > Azure Web Design.com
>
> > --
> > Our newest site for the community: CakePHP Video 
> > Tutorialshttp://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help 
> > others with their CakePHP related questions.
>
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@go

Re: Pagination Problem in Custom Query

2011-02-05 Thread Jeremy Burns | Class Outfit
It's 'limit' not 'limits'. Not sure if that's the only problem, but it's a 
starter.

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 5 Feb 2011, at 07:48, Joseph Buarao wrote:

> Hi Fellow Programmer,
> 
> I getting problem with my code, I don't know what's the reason why the
> sql limit statement is not working on my paginate query. below are my
> codes feel free to suggest, I really Appreciated it.. Thank you in
> advance for your support GUYS...
> 
> $this->paginate = array('conditions' =>  array('Category.slug'=>
> $category),
> 'limits' => 10);
> 
> $feeds_data = $this->paginate('Category');
> 
> By the way, I used hasAndBelongsToMany relationship..
> 
> Thanks..
> 
> 
> Joseph Buarao
> Web Developer
> Azure Web Design.com
> 
> -- 
> 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+unsubscr...@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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Pagination Problem in Custom Query

2011-02-05 Thread ibejohn818
Limit needs to be singular

"limit"

:-)

On Feb 4, 11:48 pm, Joseph Buarao  wrote:
> Hi Fellow Programmer,
>
> I getting problem with my code, I don't know what's the reason why the
> sql limit statement is not working on my paginate query. below are my
> codes feel free to suggest, I really Appreciated it.. Thank you in
> advance for your support GUYS...
>
> $this->paginate = array('conditions' =>  array('Category.slug'=>
> $category),
> 'limits' => 10);
>
> $feeds_data = $this->paginate('Category');
>
> By the way, I used hasAndBelongsToMany relationship..
>
> Thanks..
>
> Joseph Buarao
> Web Developer
> Azure Web Design.com

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Pagination Problem

2010-08-12 Thread arif hossen
Thank you very much

On Thu, Aug 12, 2010 at 11:32 AM, Andras Kende  wrote:

> Try something like:
>
> $this->paginate = array(
> 'conditions' => array(Project.id => $ProjectIdArray),
> 'limit' => 20
> );
>
> $projects = $this->paginate('Project');
>
> // debugging in controller ;-)
> // print_r($projects);
>
> $this->set(compact('projects'));
>
> then add the paginator links in the view (
> http://book.cakephp.org/view/1233/Pagination-in-Views)
>
> Andras Kende
> http://www.kende.com
>
> On Aug 12, 2010, at 12:24 AM, arif hossen wrote:
>
> Dear All,
>
> I need pagination below query :
>
> $projectTable = $this->Project->findAllById($ProjectIdArray);
>
> Please give me suggestion..
>
> --
> Regards,
> Mohammad Arif Hossen
> Software Enginner at
> Epsilon Consulting and Development Services(ECDS)
> www.ecds-tech.com
> www.arifhossen.wordpress.com
> Cell: +88 01714355911
>
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php?hl=en
>
>
>  Check out the new CakePHP Questions site http://cakeqs.org and help
> others with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>



-- 
Regards,
Mohammad Arif Hossen
Software Enginner at
Epsilon Consulting and Development Services(ECDS)
www.ecds-tech.com
www.arifhossen.wordpress.com
Cell: +88 01714355911

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Pagination Problem

2010-08-11 Thread Andras Kende
Try something like:

$this->paginate = array(
'conditions' => array(Project.id => $ProjectIdArray),
'limit' => 20
);

$projects = $this->paginate('Project');

// debugging in controller ;-)
// print_r($projects);

$this->set(compact('projects'));

then add the paginator links in the view 
(http://book.cakephp.org/view/1233/Pagination-in-Views)

Andras Kende
http://www.kende.com

On Aug 12, 2010, at 12:24 AM, arif hossen wrote:

> Dear All,
> 
> I need pagination below query : 
> 
> $projectTable = $this->Project->findAllById($ProjectIdArray);
> 
> Please give me suggestion..
> 
> -- 
> Regards,
> Mohammad Arif Hossen
> Software Enginner at
> Epsilon Consulting and Development Services(ECDS)
> www.ecds-tech.com
> www.arifhossen.wordpress.com
> Cell: +88 01714355911 
> 
> 
> Check out the new CakePHP Questions site http://cakeqs.org and help others 
> with their CakePHP related questions.
>  
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
> http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Pagination problem

2009-07-20 Thread Isaac Raja
Hi bino,

In your views , add this line

$paginator->options(array('url' => $this->passedArgs));


Thanks
Isaac

On Sat, Jul 18, 2009 at 11:06 PM, bino dev  wrote:

> Hi Friends,
>
> Iam very new in cake php.
> I need a help on the pagination . Actually iam trying to make a search with
> the company and phone number. Iam pasting the code below. When i search with
> a company with 'A' iam getting the result which have the compnay name which
> starts with A. When i go to the next page the all results are showing (
> because query is changing due to compnay values is null). How can i solve it
> .
>
> -
> my controller code
> if
> ($this->data['post']['comp'] !='') {
> $datass .=" and posts.body like '%". $this->data['post']['comp']."%'";
> }
> if($this->data['post']['phone'] !='') {
> $datass .=" and posts.active like '". $this->data['post']['phone']."'";
> }
> $criteria='post.active =1';
> list($order,$limit,$page) = $this->Pagination->init($criteria);
> $sql = array('conditions' => array($datass),
> 'recursive' => 1 ,
> 'fields' => array('posts.*'),
> 'order' => array( 'posts.id DESC'),
> 'limit' => $limit,
> 'page' => $page
> );
> $tasks = $this->posts->find('all',$sql );
> $this->set('results', $tasks);
> --
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Pagination problem in search functionality

2009-04-11 Thread AD7six



On Apr 10, 2:03 pm, kaushik  wrote:
> I have a search form for Blog with pagination. The form is like below.
>
>  id="BlogSearchForm" method="post" action="/blogs/search">
> 
> 
> 
>  id="keywords" />
>  id="category" />
>  value="Search" />
> 
>
> I want to set so that the url after hitting search button, it should
> come with all the params. I mean it should: "http://
> videon.smallbizmavericks.com/blogs/search/keywords:test1/
> category:test2", so that in pagination I can use the in pagination
> link like below:
>
> $paginator->options(array('url' => $this->passedArgs));
>
> If it is not possible, how to pass this arguments to paginator for
> first time?

it's simpler to just handle the post rather than p about with js to do
it.

function index () {
 if ($this->data) {
 return $this->redirect($this->data['Blog']);
}
$this->set('posts', $this->paginate($this->params['named']));
}

styley.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: [professionel] Re: Pagination Problem

2006-12-13 Thread Bernard Grosperrin

Dateve,

I am working on the same thing, but am certainly more of a beginner than 
you are.
What is this Pagination object?

Is this the component from ad7six on cakeforge?
I guess I am dumb enough I need a step by step (typing slowly, so that I 
can follow) explanation.

Thanks for this post, it helps a lot, actually!

Bernard
> Thanks for your help! With your assistance I solved the problem.
>
> For those of you that might encounter the same Cake Pagination Problem,
> this is how I fixed it:
>
> My Controller:
> ---
>   /**
>* Index Action.
>*/
>   public function index($criteria = NULL) {
>
> $this->pageTitle = 'Throbbin Hood :: Porno for the masses since
> 1853';
>
> // If we JUST clicked the search button
> if(isset($this->data['form']['search'])) {
>
>   // Let's clean our search
>   uses('sanitize');
>   $toiletDuck = new Sanitize();
>   $cleanDuck = $toiletDuck->sql($this->data['form']['search']);
>
>   // Redirect to ourself with the new with new parameters
>   $this->redirect('passwords/index/'.$cleanDuck);
> }
>
> // If we were redirected from ourself with new parameters
> if($criteria) {
>   $search_value = $criteria;
>   $criteria = array('Password.url' => "LIKE %{$search_value}%");
> }
>
> // Initialize the pagination object, get results from the database,
> and set it for the view
> list($order, $limit, $page) = $this->Pagination->init($criteria);
> $passwords = $this->Password->findAll($criteria, NULL, $order,
> $limit, $page);
> $this->set('passwords', $passwords);
>
> // Tell it what page to view.
> $this->render('index');
>   }  
> --
>
> Thanks again.
>
>
> >
>
>   


--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Cake PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Pagination Problem

2006-12-09 Thread AD7six

Hi Steve,

That is a logic problem which simply goes away if you use PRG (Post
Redirect Get). See http://www.noswad.me.uk/Pagination/PRG/ for an
example and code you can download.

If you don't want to use PRG you will need for the links to 'pull' the
form data with each link - that requires ajax to work and there's an
example of that on my site too.

I think it's about time I edited that wiki page to point at the
bakery

HTH,

AD7six
Please note:
The manual/bakery is a good place to start any quest for info.
The cake search (at the time of writing) erroneously reports less/no
results for the google group.
The wiki may contain incorrect info - read at your own risk (it's
mainly user submitted) :) You may get your answer quicker by asking on
the IRC Channel (you can access it with just a browser
here:http://irc.cakephp.org).

Dateve wrote:
> I am new to cake and I have a question regarding the pagination found
> here http://wiki.cakephp.org/tutorials:pagination .
>
> I have read and read, and unfortunately, I can not solve my "Search
> value disappearing in the pagination element" problem. I simply create
> a form, submit it, and the page displays properly, but once I try to go
> to another page, the search_value was lost. (thus showing a normal
> database query with no special where clause). I am thinking it has
> something to do with passing an extra parameter? Is this the case? The
> first time the controller receives the Post variable, but how do I keep
> that search_value for subsequent pages?
>
> Here are the pieces of code.
>
> Controller Index function:
> $this->pageTitle = 'Throbbin Hood :: Porno for the masses since
> 1853';
>
> // If we came from the index
> if(isset($this->data['form']['search'])) {
>   $search_value = $this->data['form']['search'];
>   $criteria['Password']['url'] = "LIKE %{$search_value}%";
> }
> debug('11'.$criteria.'11');
> list($order, $limit, $page) = $this->Pagination->init($criteria);
> $passwords = $this->Password->findAll($criteria, NULL, $order,
> $limit, $page);
> $this->set('passwords', $passwords);
> $this->render('index');
>
> Index View:
> formTag('/passwords'); ?>
>   input('form/search'); ?>
>   submit('Search');?>
> 
> renderElement('search'); ?>
>
> Search Element View:
> 
>$pagination->setPaging($paging);
>   $th = array (
> $pagination->sortBy('url', 'Website'),
> $pagination->sortBy('username','Username'),
> $pagination->sortBy('password', 'Password'),
> $pagination->sortBy('dateFound','Date Found'),
>   );
>
>   echo $html->tableHeaders($th);
>   foreach ($passwords as $password) {
> $tr = array (
>   $html->link($password['Password']['url'],
> $password['Password']['url'], array('target'=> '_blank')),
>   $password['Password']['userName'],
>   $password['Password']['password'],
>   $password['Password']['dateFound'],
> );
> echo $html->tableCells($tr, array('style'=>'background:#E2E2E2'),
> array('style'=>'background:transparent'));
>   }
> ?>
> 
> renderElement('pagination', $paging); ?>
>
> Pagination View Element:
> 
>  if($pagination->setPaging($paging)):
>   $prev = $pagination->prevPage('Previous',false);
>   $prev = $prev ? $prev : $leftArrow;
>   $next = $pagination->nextPage('Next',false);
>   $next = $next ? $next : $rightArrow;
>   $pages = $pagination->pageNumbers("  ");
>   echo $prev." ".$pages." ".$next;
> endif;
> ?>
> 
>
> I have attempted to search from the same page rather than have two
> seperate pages (instead of index and search, I have combined them and
> used only index).
> 
> I appreciate any help I get. Thanks
> Steve.


--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Cake PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---