Re: pagination with join and array in cakephp

2015-02-23 Thread ajt


>   I still cant get this to work with paginate but i can with find all 
> , so there has to be a way
>
 

>$options['recursive'] =-1;
>  
>

  I still cant get this to work with paginate but i can with find all , 
> so there has to be a way
>
 
   $options['recursive'] =-1;
 

> 
>

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: pagination on cakephp 1.3

2014-05-19 Thread tuan kim
thank you very muck !

Vào 13:06:57 UTC+7 Thứ sáu, ngày 16 tháng năm năm 2014, Reuben đã viết:
>
> You should be able to access the current page from the Controller at
>
> $this->params['paging'][$modelAlias]['page'], after you've called 
> $this->paginate.
>
> You can then set the title for the page with 
> $this->set('title_for_layout', 'design website page ' 
> . $this->params['paging'][$modelAlias]['page']); in the controller. (
> http://book.cakephp.org/1.3/en/The-Manual/Developing-with-CakePHP/Views.html#layouts
> )
>
> And then make sure you set the title in your layout
>
> 
>
> Regards
> Reuben Helms
>
> On Wednesday, 14 May 2014 14:15:59 UTC+10, tuan kim wrote:
>>
>> hi ,
>> Thanks for you support always,
>> I have a problem with Pagination,
>> When I use CakePHP Pagination I get the default url like this:
>>
>> localhos/posts/index/
>>
>> and the title of  website is " design website "
>> when I click to page number 4, the title is still "design website "
>> But I want the title when I click to page number 4  is "design website 
>> page 4"
>> So, please help me to solve this problem
>>
>>

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: pagination on cakephp 1.3

2014-05-15 Thread Reuben
You should be able to access the current page from the Controller at

$this->params['paging'][$modelAlias]['page'], after you've called 
$this->paginate.

You can then set the title for the page with $this->set('title_for_layout', 
'design website page ' . $this->params['paging'][$modelAlias]['page']); in 
the controller. 
(http://book.cakephp.org/1.3/en/The-Manual/Developing-with-CakePHP/Views.html#layouts)

And then make sure you set the title in your layout



Regards
Reuben Helms

On Wednesday, 14 May 2014 14:15:59 UTC+10, tuan kim wrote:
>
> hi ,
> Thanks for you support always,
> I have a problem with Pagination,
> When I use CakePHP Pagination I get the default url like this:
>
> localhos/posts/index/
>
> and the title of  website is " design website "
> when I click to page number 4, the title is still "design website "
> But I want the title when I click to page number 4  is "design website 
> page 4"
> So, please help me to solve this problem
>
>

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: Pagination Sort, Resetting Data

2014-02-27 Thread tfirvin

你是用 Paginator->sort() 產生的連結(我知道這裡你把它變成checkbox了),再點擊它的時候,已經不是 post request;
但取而代之是傳入 querystring 或是 named parameters,這時候你的 searchByBrowser 
應該要在接收到這些與sort有關的參數時,
最後要再指定給 $this->request->data,這樣 view 在被 rendering 的時候就會把 request data 的值填回你的 
Form 表單。



Eric Chan  於 2014/2/27 下午12:14 寫道:

> Hello,
> 
> I just starting baking with CakePHP and I'm slowly grasping the basics.
> 
> So far I've created a view to display all the data in table format from a 
> table in the database with pagination.
> There is a column in the table that contains browser information (Firefox, 
> Chrome, Safari...etc).
> So on the view I made some checkboxes using Form->checkbox, with each check 
> box representing a browser. 
> When the the submit button is pressed, the POST request is sent to the 
> searchByBrowser function in the controller and 
> the view is updated with the appropiate data.
> 
> Now I am adding sort() functionality using Paginator->sort() and it sorts by 
> the specified column just fine.  
> 
> However, when I use the searchByBrower function to get the appropiate view 
> and then try and sort the displayed data, it resets everything
> to showing all the full dataset and the checkbox is no longer checked.
> 
> Is there a way to get everything to work the way it should with just CakePHP?
> 
> Thanks.
> 
> 
> 
> 
> 1 - Full data set view
> 
> 
> 
> 
> 
> 2 - Just Firefox data
> 
> 
> 
> 3 - Sorted on http_method, full dataset again (instead of just firefox data)
> 
> 
> 
> 
> 
> 
> 
> -- 
> 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 unsubscribe from this group and stop receiving emails from it, send an 
> email to cake-php+unsubscr...@googlegroups.com.
> To post to this group, send email to cake-php@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Pagination option url question

2013-11-14 Thread Salines
Question one: Can I overwrite the controller and action with my slugged_url 
value?
To have something like http://domain.com/my_slugged_url/page:2?

Yes, in your router put something like:

Router::connect('/:slug/*', array('admin'=>false,'controller' => 'posts', 
'action' => 'index'),array('pass'=>array('slug','page'),'page' =>'[0-9]+'));


-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.


RE: Pagination Help

2013-10-25 Thread Advantage+
On the model it's self. 
The is a field for the listings / Listings table for "featured" bool.

Pagination $params has "featured" => $featured so if the listings/featured
is passed then it would only paginate featured listings.


-Original Message-
From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf
Of Anja Liebermann
Sent: Friday, October 25, 2013 8:23 AM
To: cake-php@googlegroups.com
Subject: Re: Pagination Help

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi Dave,

is this condition on your first model or on a related model?


Anja


Am 16.10.2013 17:59, schrieb Advantage+:
> Now this used to work, but now it does not.. Not sure what happened.
> 
>  
> 
> I have standard pagination but offer the ability to paginate listings 
> based on "featured".
> 
>  
> 
> Paginator->options(array('url'=>
> array($this->params['pass'])));?>
> 
>  
> 
> So if "featured" was passed it would then only display featured 
> listings and paginate correct.
> 
>  
> 
> Now it just defaults back to standard (non-featured) listings. Initial 
> page of featured is fine but all the pagination links do not continue 
> to carry the listings/featured/page:xxx it goes to listings/page:xxx
> 
>  
> 
> Any insight would be great.
> 
>  
> 
> Version 2.3.8
> 
>  
> 
> Thanks,
> 
> Dave
> 

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAlJqTXQACgkQbOdiIJzHNKEKDQCeJmOXfPY4Y9zDs0/ogZjS5ljw
3u4An07PTuWLz1E8/iI+KluKzo1fsMU1
=Gw4r
-END PGP SIGNATURE-

--
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 unsubscribe from this group and stop receiving emails from it, send an
email to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Pagination Help

2013-10-25 Thread Anja Liebermann
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi Dave,

is this condition on your first model or on a related model?


Anja


Am 16.10.2013 17:59, schrieb Advantage+:
> Now this used to work, but now it does not.. Not sure what happened.
> 
>  
> 
> I have standard pagination but offer the ability to paginate listings based
> on "featured".
> 
>  
> 
> Paginator->options(array('url'=>
> array($this->params['pass'])));?>
> 
>  
> 
> So if "featured" was passed it would then only display featured listings and
> paginate correct.
> 
>  
> 
> Now it just defaults back to standard (non-featured) listings. Initial page
> of featured is fine but all the pagination links do not continue to carry
> the listings/featured/page:xxx it goes to listings/page:xxx
> 
>  
> 
> Any insight would be great.
> 
>  
> 
> Version 2.3.8
> 
>  
> 
> Thanks,
> 
> Dave
> 

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAlJqTXQACgkQbOdiIJzHNKEKDQCeJmOXfPY4Y9zDs0/ogZjS5ljw
3u4An07PTuWLz1E8/iI+KluKzo1fsMU1
=Gw4r
-END PGP SIGNATURE-

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Pagination with i18n field condition (pagination + translation behavior error)

2013-09-10 Thread aka
Sorry, a little typo in my example:

$conditions = array('OR' => array( 'I18n__title.content LIKE' => 
'%'.$searchKey.'%'));

should be 

$conditions = array('OR' => array( I18n__titleTranslation LIKE' => 
'%'.$searchKey.'%'));


That doesn't change the outcome though.. 


On Tuesday, September 10, 2013 12:30:53 PM UTC+2, aka wrote:
>
> Why is this no working (throws a column not found) :
>
> $conditions = array('OR' => array( 'I18n__title.content LIKE' => 
> '%'.$searchKey.'%'));
>
> $this->paginate = array(
> 'conditions' => $conditions
> );
>
> $results = $this->paginate();
>
> *Error: * SQLSTATE[42S22]: Column not found: 1054 Unknown column 
> 'I18n__title.content' in 'where clause'
>
> While a normal find works fine: 
> $this->MyModel->find('all',  array('conditions' => $conditions));
>
>
>
>

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Pagination

2013-05-09 Thread albertus putra tan
this documentation not help:
http://book.cakephp.org/2.0/en/core-libraries/helpers/paginator.html#PaginatorHelper

u can play with before, after, and tag for options parameters



--
View this message in context: 
http://cakephp.1045679.n5.nabble.com/Pagination-tp5714793p5714855.html
Sent from the CakePHP mailing list archive at Nabble.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 unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Pagination

2013-05-09 Thread Kento Furui
in your .ctp file

echo $this->Paginator->prev(' << ' . __('prev'), array(), null, array('class' 
=> 'prev disabled'));echo $this->Paginator->numbers();echo 
$this->Paginator->next(' >> ' . __('next'), array(), null, array('class' => 
'next disabled'));

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Pagination

2013-05-08 Thread Julien Itard
Any ideas ? :'(

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Pagination in Detail page like gmail

2013-01-18 Thread Luciano Bargmann
I think your biggest issue is to make paginator helper generate links to 
your details pages, correct?

I dont think you can do it with regular paginator, so in your place, I 
would extend it, create a custom query to return the paginator data and 
count and then create the links pointing to your controller/action/detail_id

Keep us posted of your progress ;)

Luciano

On Thursday, January 17, 2013 5:53:39 AM UTC-2, Ricko Marshal wrote:
>
> Hi,
> I have implemented cakephp 2 pagination to display a list.
> It is working fine.
> Now when I select (click) a item in the list it will display the item 
> detail page.
> It will fetch the item detail by item id (i.e find : first in cake way).
> It is almost similar as gmail inbox and view message detail page.
> Now what I want is to display page information in detail page too.
>
>> e.g [* Showing 5 of 34 << |  >>*]
>>
> Here 34 is the total number of records returned by the paginator.
> 5 is the record number.
>
> How to implement this in cakephp2.
> any help or valuable suggestion will be highly appreciated.
>
>
>
>
>

-- 
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 of another Model

2013-01-05 Thread Michael Gaiser
I will try that out later tonight.. Thanks a lot for the quick reply.

~Michael

On Sat, Jan 5, 2013 at 1:44 PM, lowpass  wrote:

>
> ),

-- 
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 of another Model

2013-01-05 Thread lowpass
public $uses = array('Event', 'Feeding');
public $paginate = array(
'Event' => array(
// ...
),
'Feeding' => array(
// ...
)
);

$this->paginate('Feeding');

On Sat, Jan 5, 2013 at 12:13 PM, Michael Gaiser  wrote:
> So I trying to build an index page for my 'Event' controller, but this
> controller has been setup a little differently than my other ones. All of
> the events share the same "Event" model, except for the feeding events which
> for many reasons, have their own "Feeding" model. Both tables have a
> "Location" associated with them so for the most part I was able to gain
> access to this "Feeding" model by using "$this->Event->Location->Feeding".
> This has worked for the most part, but now that I am trying to make a
> paginate call from the Events index function, I am unsure how to set which
> model to use as it seems to default to the "Event" model. Anyone know how to
> have it list an index of the Feeding Model from the Events Index function?
> Thanks
>
> ~Michael
>
> --
> 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.
>
>

-- 
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

2012-11-20 Thread Paul Willis
Yes my posts have many categories, probably categories would be called Tags in 
a regular blog setup.

Anyway I followed your advice and moved my code to my CategoriesController and 
following the answer to a similar question here 
http://stackoverflow.com/questions/4627120/cakephp-1-3-paginating-habtm-related-data
 I specified my joins and everything is now working (the link is for 1.3 but it 
worked fine on 2.2)

Thanks again for the help

Cheers

PW


On 20 Nov 2012, at 05:38, Andras Kende  wrote:

> Paul,
> 
> Sorry the code I gave earlier is not valid, my mistake...
> 
> this is better for that specific:
> 
> $posts = $this->paginate('Category');
> OR
> $posts = $this->paginate($this->Post->Category);
> 
> But now you mentioning HABTM which is something different….
> 
> So the reason for HABMT is that a single post can belong to multiple 
> categories ? 
> 
> Andras
> 
> On Nov 19, 2012, at 3:45 PM, Paul Willis  wrote:
> 
>> And when I say I can't get it to work it is because using the code from 
>> Andras gives the error...
>> 
>> Error: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an 
>> error in your SQL syntax; check the manual that corresponds to your MySQL 
>> server version for the right syntax to use near 'paginate' at line 1
>> SQL Query: paginate
>> 
>> 
>> On 19 Nov 2012, at 23:41, Paul Willis  wrote:
>> 
>>> Thanks for the replies but I can't seem to get any solution to work I 
>>> wonder if it is because I stupidly missed a vital detail...
>>> 
>>> My posts and categories are a HABTM relationship so I have no category_id 
>>> in the posts table.
>>> 
>>> I have a posts table, a categories table and a categories_posts table
>>> 
>>> PW
>>> 
>>> On 19 Nov 2012, at 22:22, lowpass  wrote:
>>> 
 If your controller already declares a $paginate var it would be better
 to add the conditions to it rather than redeclare the entire array.
 Also, you can use the Post.category_id in the conditions.
 
 $this->paginate['conditions'] = array('Post.category_id' => $id);
 
 On Mon, Nov 19, 2012 at 4:15 PM, Andras Kende  wrote:
> 
> something like this should work:
> 
>   public function category($id = null) {
>   $this->paginate = array(
>   'conditions' => array(
>   'Category.id' => $id
>   )
>   );
>   $posts = $this->Post->Category->paginate('Category');
>   //print_r($posts);  // to test here ...
>   $this->set(compact('posts'));
>   }
> 
> But since you paginating categories it may be better to do this from the 
> categories controller..
> 
> Andras Kende
> http:///www.kende.com
> 
> On Nov 19, 2012, at 12:57 PM, Paul Willis  wrote:
> 
>> In my PostsController.php I have a function to find all the posts from a 
>> category…
>> 
>> public function category($id = null) {
>> $this->set('posts', $this->Post->Category->find('first', 
>> array(
>> 'conditions' => array(
>> 'Category.id' => $id
>> )
>> )));
>> }
>> 
>> 
>> This works fine and all my posts for the particular category are 
>> returned.
>> 
>> However I obviously get every post in that category and so now I would 
>> like to use paginate but I'm not sure how to add it to the above 
>> function.
>> 
>> PW
>> 
>> --
>> 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.
>> 
>> 
> 
> --
> 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.
> 
> 
 
 -- 
 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...@googlegrou

Re: Pagination

2012-11-19 Thread Andras Kende
Paul,

Sorry the code I gave earlier is not valid, my mistake...

this is better for that specific:

$posts = $this->paginate('Category');
OR
$posts = $this->paginate($this->Post->Category);

But now you mentioning HABTM which is something different….

So the reason for HABMT is that a single post can belong to multiple categories 
? 

Andras

On Nov 19, 2012, at 3:45 PM, Paul Willis  wrote:

> And when I say I can't get it to work it is because using the code from 
> Andras gives the error...
> 
> Error: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an 
> error in your SQL syntax; check the manual that corresponds to your MySQL 
> server version for the right syntax to use near 'paginate' at line 1
> SQL Query: paginate
> 
> 
> On 19 Nov 2012, at 23:41, Paul Willis  wrote:
> 
>> Thanks for the replies but I can't seem to get any solution to work I wonder 
>> if it is because I stupidly missed a vital detail...
>> 
>> My posts and categories are a HABTM relationship so I have no category_id in 
>> the posts table.
>> 
>> I have a posts table, a categories table and a categories_posts table
>> 
>> PW
>> 
>> On 19 Nov 2012, at 22:22, lowpass  wrote:
>> 
>>> If your controller already declares a $paginate var it would be better
>>> to add the conditions to it rather than redeclare the entire array.
>>> Also, you can use the Post.category_id in the conditions.
>>> 
>>> $this->paginate['conditions'] = array('Post.category_id' => $id);
>>> 
>>> On Mon, Nov 19, 2012 at 4:15 PM, Andras Kende  wrote:
 
 something like this should work:
 
   public function category($id = null) {
   $this->paginate = array(
   'conditions' => array(
   'Category.id' => $id
   )
   );
   $posts = $this->Post->Category->paginate('Category');
   //print_r($posts);  // to test here ...
   $this->set(compact('posts'));
   }
 
 But since you paginating categories it may be better to do this from the 
 categories controller..
 
 Andras Kende
 http:///www.kende.com
 
 On Nov 19, 2012, at 12:57 PM, Paul Willis  wrote:
 
> In my PostsController.php I have a function to find all the posts from a 
> category…
> 
> public function category($id = null) {
> $this->set('posts', $this->Post->Category->find('first', 
> array(
> 'conditions' => array(
> 'Category.id' => $id
> )
> )));
> }
> 
> 
> This works fine and all my posts for the particular category are returned.
> 
> However I obviously get every post in that category and so now I would 
> like to use paginate but I'm not sure how to add it to the above function.
> 
> PW
> 
> --
> 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.
> 
> 
 
 --
 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.
 
 
>>> 
>>> -- 
>>> 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.
>>> 
>>> 
>> 
>> -- 
>> 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.
>> 
>> 
> 
> 
> -- 
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>  

Re: Pagination

2012-11-19 Thread Paul Willis
And when I say I can't get it to work it is because using the code from Andras 
gives the error...

Error: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an 
error in your SQL syntax; check the manual that corresponds to your MySQL 
server version for the right syntax to use near 'paginate' at line 1
SQL Query: paginate


On 19 Nov 2012, at 23:41, Paul Willis  wrote:

> Thanks for the replies but I can't seem to get any solution to work I wonder 
> if it is because I stupidly missed a vital detail...
> 
> My posts and categories are a HABTM relationship so I have no category_id in 
> the posts table.
> 
> I have a posts table, a categories table and a categories_posts table
> 
> PW
> 
> On 19 Nov 2012, at 22:22, lowpass  wrote:
> 
>> If your controller already declares a $paginate var it would be better
>> to add the conditions to it rather than redeclare the entire array.
>> Also, you can use the Post.category_id in the conditions.
>> 
>> $this->paginate['conditions'] = array('Post.category_id' => $id);
>> 
>> On Mon, Nov 19, 2012 at 4:15 PM, Andras Kende  wrote:
>>> 
>>> something like this should work:
>>> 
>>>   public function category($id = null) {
>>>   $this->paginate = array(
>>>   'conditions' => array(
>>>   'Category.id' => $id
>>>   )
>>>   );
>>>   $posts = $this->Post->Category->paginate('Category');
>>>   //print_r($posts);  // to test here ...
>>>   $this->set(compact('posts'));
>>>   }
>>> 
>>> But since you paginating categories it may be better to do this from the 
>>> categories controller..
>>> 
>>> Andras Kende
>>> http:///www.kende.com
>>> 
>>> On Nov 19, 2012, at 12:57 PM, Paul Willis  wrote:
>>> 
 In my PostsController.php I have a function to find all the posts from a 
 category…
 
 public function category($id = null) {
 $this->set('posts', $this->Post->Category->find('first', array(
 'conditions' => array(
 'Category.id' => $id
 )
 )));
 }
 
 
 This works fine and all my posts for the particular category are returned.
 
 However I obviously get every post in that category and so now I would 
 like to use paginate but I'm not sure how to add it to the above function.
 
 PW
 
 --
 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.
 
 
>>> 
>>> --
>>> 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.
>>> 
>>> 
>> 
>> -- 
>> 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.
>> 
>> 
> 
> -- 
> 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.
> 
> 

-- 
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

2012-11-19 Thread Paul Willis
Thanks for the replies but I can't seem to get any solution to work I wonder if 
it is because I stupidly missed a vital detail...

My posts and categories are a HABTM relationship so I have no category_id in 
the posts table.

I have a posts table, a categories table and a categories_posts table

PW

On 19 Nov 2012, at 22:22, lowpass  wrote:

> If your controller already declares a $paginate var it would be better
> to add the conditions to it rather than redeclare the entire array.
> Also, you can use the Post.category_id in the conditions.
> 
> $this->paginate['conditions'] = array('Post.category_id' => $id);
> 
> On Mon, Nov 19, 2012 at 4:15 PM, Andras Kende  wrote:
>> 
>> something like this should work:
>> 
>>public function category($id = null) {
>>$this->paginate = array(
>>'conditions' => array(
>>'Category.id' => $id
>>)
>>);
>>$posts = $this->Post->Category->paginate('Category');
>>//print_r($posts);  // to test here ...
>>$this->set(compact('posts'));
>>}
>> 
>> But since you paginating categories it may be better to do this from the 
>> categories controller..
>> 
>> Andras Kende
>> http:///www.kende.com
>> 
>> On Nov 19, 2012, at 12:57 PM, Paul Willis  wrote:
>> 
>>> In my PostsController.php I have a function to find all the posts from a 
>>> category…
>>> 
>>>  public function category($id = null) {
>>>  $this->set('posts', $this->Post->Category->find('first', array(
>>>  'conditions' => array(
>>>  'Category.id' => $id
>>>  )
>>>  )));
>>>  }
>>> 
>>> 
>>> This works fine and all my posts for the particular category are returned.
>>> 
>>> However I obviously get every post in that category and so now I would like 
>>> to use paginate but I'm not sure how to add it to the above function.
>>> 
>>> PW
>>> 
>>> --
>>> 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.
>>> 
>>> 
>> 
>> --
>> 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.
>> 
>> 
> 
> -- 
> 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.
> 
> 

-- 
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

2012-11-19 Thread lowpass
If your controller already declares a $paginate var it would be better
to add the conditions to it rather than redeclare the entire array.
Also, you can use the Post.category_id in the conditions.

$this->paginate['conditions'] = array('Post.category_id' => $id);

On Mon, Nov 19, 2012 at 4:15 PM, Andras Kende  wrote:
>
> something like this should work:
>
> public function category($id = null) {
> $this->paginate = array(
> 'conditions' => array(
> 'Category.id' => $id
> )
> );
> $posts = $this->Post->Category->paginate('Category');
> //print_r($posts);  // to test here ...
> $this->set(compact('posts'));
> }
>
> But since you paginating categories it may be better to do this from the 
> categories controller..
>
> Andras Kende
> http:///www.kende.com
>
> On Nov 19, 2012, at 12:57 PM, Paul Willis  wrote:
>
>> In my PostsController.php I have a function to find all the posts from a 
>> category…
>>
>>   public function category($id = null) {
>>   $this->set('posts', $this->Post->Category->find('first', array(
>>   'conditions' => array(
>>   'Category.id' => $id
>>   )
>>   )));
>>   }
>>
>>
>> This works fine and all my posts for the particular category are returned.
>>
>> However I obviously get every post in that category and so now I would like 
>> to use paginate but I'm not sure how to add it to the above function.
>>
>> PW
>>
>> --
>> 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.
>>
>>
>
> --
> 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.
>
>

-- 
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

2012-11-19 Thread Jonathan Sundquist
What you are looking for is the following.

$this->set('posts', $this->paginate(array('Post', "Post.category_id =
$categoryId"));


On Mon, Nov 19, 2012 at 3:32 PM, Paul Willis  wrote:

> I'm not paging categories I'm trying to page posts that belong to a
> particular category
>
> PW
>
>
> On 19 Nov 2012, at 21:15, Andras Kende  wrote:
>
> >
> > something like this should work:
> >
> >   public function category($id = null) {
> >   $this->paginate = array(
> >   'conditions' => array(
> >   'Category.id' => $id
> >   )
> >   );
> >   $posts = $this->Post->Category->paginate('Category');
> >   //print_r($posts);  // to test here ...
> >   $this->set(compact('posts'));
> >   }
> >
> > But since you paginating categories it may be better to do this from the
> categories controller..
> >
> > Andras Kende
> > http:///www.kende.com
> >
> > On Nov 19, 2012, at 12:57 PM, Paul Willis  wrote:
> >
> >> In my PostsController.php I have a function to find all the posts from
> a category…
> >>
> >>  public function category($id = null) {
> >>  $this->set('posts', $this->Post->Category->find('first',
> array(
> >>  'conditions' => array(
> >>  'Category.id' => $id
> >>  )
> >>  )));
> >>  }
> >>
> >>
> >> This works fine and all my posts for the particular category are
> returned.
> >>
> >> However I obviously get every post in that category and so now I would
> like to use paginate but I'm not sure how to add it to the above function.
> >>
> >> PW
> >>
> >> --
> >> 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.
> >>
> >>
> >
> > --
> > 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.
> >
> >
>
> --
> 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.
>
>
>

-- 
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

2012-11-19 Thread Paul Willis
I'm not paging categories I'm trying to page posts that belong to a particular 
category

PW


On 19 Nov 2012, at 21:15, Andras Kende  wrote:

> 
> something like this should work:
> 
>   public function category($id = null) {
>   $this->paginate = array(
>   'conditions' => array(
>   'Category.id' => $id
>   )
>   );
>   $posts = $this->Post->Category->paginate('Category');
>   //print_r($posts);  // to test here ...
>   $this->set(compact('posts'));
>   }
> 
> But since you paginating categories it may be better to do this from the 
> categories controller..
> 
> Andras Kende
> http:///www.kende.com
> 
> On Nov 19, 2012, at 12:57 PM, Paul Willis  wrote:
> 
>> In my PostsController.php I have a function to find all the posts from a 
>> category…
>> 
>>  public function category($id = null) {
>>  $this->set('posts', $this->Post->Category->find('first', array(
>>  'conditions' => array(
>>  'Category.id' => $id
>>  )
>>  )));
>>  }
>> 
>> 
>> This works fine and all my posts for the particular category are returned.
>> 
>> However I obviously get every post in that category and so now I would like 
>> to use paginate but I'm not sure how to add it to the above function.
>> 
>> PW
>> 
>> -- 
>> 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.
>> 
>> 
> 
> -- 
> 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.
> 
> 

-- 
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

2012-11-19 Thread Andras Kende

something like this should work:

public function category($id = null) {
$this->paginate = array(
'conditions' => array(
'Category.id' => $id
)
);
$posts = $this->Post->Category->paginate('Category');
//print_r($posts);  // to test here ...
$this->set(compact('posts'));
}

But since you paginating categories it may be better to do this from the 
categories controller..

Andras Kende
http:///www.kende.com

On Nov 19, 2012, at 12:57 PM, Paul Willis  wrote:

> In my PostsController.php I have a function to find all the posts from a 
> category…
> 
>   public function category($id = null) {
>   $this->set('posts', $this->Post->Category->find('first', array(
>   'conditions' => array(
>   'Category.id' => $id
>   )
>   )));
>   }
> 
> 
> This works fine and all my posts for the particular category are returned.
> 
> However I obviously get every post in that category and so now I would like 
> to use paginate but I'm not sure how to add it to the above function.
> 
> PW
> 
> -- 
> 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.
> 
> 

-- 
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 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 Limit Default Global AppController CakePHP 2.x

2012-10-02 Thread TonyCharlotteCakePHP
Thanks. Exactly what I was looking for.

On Thursday, September 20, 2012 5:26:58 PM UTC-4, cricket wrote:
>
> If you define a $paginate var in AppController, it's going to be 
> overwritten in your other controllers. What you could do instead is 
> put it in AppController::beforeFilter() like so: 
>
> $this->paginate['limit'] = 15; 
>
> Just remember to have parent::beforeFilter() in your other 
> controllers' beforeFilter callbacks. 
>
> On Tue, Sep 18, 2012 at 5:38 PM, TonyCharlotteCakePHP 
> > wrote: 
> > Well it seems like cakephp's default limit for pagination is 20. For 
> > instance, if limit is not set for pagination, then cakephp will display 
> 20 
> > records when using pagination. I can set the limit for each individual 
> > controller with: 
> > 
> > public $paginate = array( 
> > 'limit' => 15 
> > ); 
> > 
> > but I'm wanting to set this globally for all controllers/actions. I 
> figured 
> > I could set limit to 15 within the AppController (using the same code 
> above) 
> > but I still get 20 records for pagination within my other 
> controllers/action 
> > where limit has not been set. 
> > 
> > On Thursday, September 13, 2012 4:42:53 PM UTC-4, TonyCharlotteCakePHP 
> > wrote: 
> >> 
> >> Is it possible to set or change the limit of pagination globally for 
> all 
> >> controllers? 
> >> 
> >> I've tried adding the below to the AppController: 
> >> 
> >> public $paginate = array( 
> >> 'limit' => 15 
> >> ); 
> >> 
> >> Thanks 
> > 
> > -- 
> > Like Us on FacekBook 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. 
> > 
> > 
>

-- 
Like Us on FacekBook 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 Limit Default Global AppController CakePHP 2.x

2012-09-21 Thread AD7six


On Friday, 21 September 2012 13:01:56 UTC+2, Nikhil Agrawal wrote:
>
> Hi
> Directly you can change inside the pagination helper, it has been defined 
>  as 20 over there.
>

1) no it isn't
2) don't edit your Cake folder

AD

-- 
Like Us on FacekBook 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 Limit Default Global AppController CakePHP 2.x

2012-09-20 Thread lowpass
If you define a $paginate var in AppController, it's going to be
overwritten in your other controllers. What you could do instead is
put it in AppController::beforeFilter() like so:

$this->paginate['limit'] = 15;

Just remember to have parent::beforeFilter() in your other
controllers' beforeFilter callbacks.

On Tue, Sep 18, 2012 at 5:38 PM, TonyCharlotteCakePHP
 wrote:
> Well it seems like cakephp's default limit for pagination is 20. For
> instance, if limit is not set for pagination, then cakephp will display 20
> records when using pagination. I can set the limit for each individual
> controller with:
>
> public $paginate = array(
> 'limit' => 15
> );
>
> but I'm wanting to set this globally for all controllers/actions. I figured
> I could set limit to 15 within the AppController (using the same code above)
> but I still get 20 records for pagination within my other controllers/action
> where limit has not been set.
>
> On Thursday, September 13, 2012 4:42:53 PM UTC-4, TonyCharlotteCakePHP
> wrote:
>>
>> Is it possible to set or change the limit of pagination globally for all
>> controllers?
>>
>> I've tried adding the below to the AppController:
>>
>> public $paginate = array(
>> 'limit' => 15
>> );
>>
>> Thanks
>
> --
> Like Us on FacekBook 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.
>
>

-- 
Like Us on FacekBook 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 Limit Default Global AppController CakePHP 2.x

2012-09-18 Thread TonyCharlotteCakePHP
Well it seems like cakephp's default limit for pagination is 20. For 
instance, if limit is not set for pagination, then cakephp will display 20 
records when using pagination. I can set the limit for each individual 
controller with:

public $paginate = array(
'limit' => 15
);

but I'm wanting to set this globally for all controllers/actions. I figured 
I could set limit to 15 within the AppController (using the same code 
above) but I still get 20 records for pagination within my other 
controllers/action where limit has not been set.

On Thursday, September 13, 2012 4:42:53 PM UTC-4, TonyCharlotteCakePHP 
wrote:
>
> Is it possible to set or change the limit of pagination globally for all 
> controllers?
>
> I've tried adding the below to the AppController:
>
> public $paginate = array(
> 'limit' => 15
> );
>
> Thanks
>

-- 
Like Us on FacekBook 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 Limit Default Global AppController CakePHP 2.x

2012-09-13 Thread Tilen Majerle
and ? it's not working ?
--
Lep pozdrav, Tilen Majerle
http://majerle.eu



2012/9/13 TonyCharlotteCakePHP 

> Is it possible to set or change the limit of pagination globally for all
> controllers?
>
> I've tried adding the below to the AppController:
>
> public $paginate = array(
> 'limit' => 15
> );
>
> Thanks
>
> --
> 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-US.
>
>
>

-- 
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-US.




Re: pagination with lat lng

2012-08-03 Thread euromark
I think you can already use virtualFields for cake1.3
http://book.cakephp.org/1.3/view/1608/Virtual-fields 
then it will work


Am Freitag, 3. August 2012 09:28:56 UTC+2 schrieb lorenzoshake:
>
> $sql_for_distance is the classic function to calculate distance with 
> latlng  

-- 
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 with lat lng

2012-08-03 Thread lorenzoshake
$sql_for_distance is the classic function to calculate distance with latlng 
 

-- 
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 not work after change to Nginx

2012-07-24 Thread Phang Mulianto
hello..

anybody can help me..

On Tue, Jul 24, 2012 at 5:13 PM, Phang Mulianto  wrote:

> Hi all,
>
> i have an apps build using cakephp1.1 .
>
> i use the pagination component which come with 1.1
>
> The app run using lighttpd, and its ok.
>
> now i switch to nginx , and the pagination breaks, also the sorting
> facilites.
>
> the error is, the link not point to my webroot adress, example:
>
> http://www.mywebsite.com/product/page/2   <=== using lighttpd
>
> product/page/2   <=== using nginx
>
> so the url is not there, and the application point to no server...  it
> should ok if the link is /product/page/2  , but the link generate for the
> page is product/page/2
>
> any one know how to handle this , coz i need to use nginx.
>
> thanks in advanced
>
> Mulianto
>
>

-- 
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 with HABTM?

2012-06-25 Thread JonStark
Yes, I do it this way in my app:

$this->loadModel('Post');
$this->paginate = array('Post' => array('conditions' => //conditions ), 
'limit' => '8', 'order' => array('Post.created' => 'desc')));
$data = $this->paginate('Post');
$this->set('posts', $data);


Hope it helped

Le lundi 25 juin 2012 03:14:32 UTC+2, 42startups a écrit :
>
> Ah ok, so how would I paginate and limit results to 10?...
>
> $this->loadModel('Tag', $id);
> $tag = $this->Tag->read();
>
> On Monday, June 25, 2012 6:11:55 AM UTC+10, JonStark wrote:
>>
>> I find it easier to use LoadModel to display and sort posts from HABTM...
>>
>> Le dimanche 24 juin 2012 10:40:04 UTC+2, 42startups a écrit :
>>>
>>> Wow, CakePHP really hasn't got this problem sorted.
>>>
>>> After hours of searching I came across the solution below (which may or 
>>> may not be outdated), but I'm having issues applying paginatior 'limit' => 
>>> 10 or other ordering.
>>>
>>> Any ideas what I'm missing?
>>>
>>> My model:
>>>
>>> public $hasAndBelongsToMany = array(
>>> 'Post' => array(
>>> 'className'  => 'Post',
>>> 'joinTable'  => 'tags_posts',
>>> 'foreignKey' => 'tag_id',
>>> 'associationForeignKey'  => 'post_id',  
>>> 'order'  => array('Post.created DESC'),
>>> 'unique' => true
>>> )
>>> );
>>>
>>> In my controller in view()
>>>
>>> public function view($id) {
>>> $this->Tag->bindModel(array('hasOne' => array('TagsPost')), false); 
>>> $this->set('tag', $this->paginate('Tag', array('TagsPost.tag_id' => 
>>> $id))); 
>>> }
>>>
>>> In my view I then had to change:
>>>
>>> foreach ($tag['Post'] as $post)
>>>
>>> to
>>>
>>> foreach ($tag[0]['Post'] as $post)
>>>
>>>

-- 
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 with HABTM?

2012-06-25 Thread 42startups
Yep, doesn't seem to work as it returns all the posts.


On Monday, June 25, 2012 3:21:15 PM UTC+10, Борислав Събев wrote:
>
> Have you tried configuring the paginator in your Controller with a limit 
> of 10:
>
> public $paginate = array(
> 'limit' => 10,
> 'order' => array(
> 'Post.title' => 'asc'
> )
> );
>
>
>
> On Monday, 25 June 2012 04:14:32 UTC+3, 42startups wrote:
>>
>> Ah ok, so how would I paginate and limit results to 10?...
>>
>> $this->loadModel('Tag', $id);
>> $tag = $this->Tag->read();
>>
>> On Monday, June 25, 2012 6:11:55 AM UTC+10, JonStark wrote:
>>>
>>> I find it easier to use LoadModel to display and sort posts from HABTM...
>>>
>>> Le dimanche 24 juin 2012 10:40:04 UTC+2, 42startups a écrit :

 Wow, CakePHP really hasn't got this problem sorted.

 After hours of searching I came across the solution below (which may or 
 may not be outdated), but I'm having issues applying paginatior 'limit' => 
 10 or other ordering.

 Any ideas what I'm missing?

 My model:

 public $hasAndBelongsToMany = array(
 'Post' => array(
 'className'  => 'Post',
 'joinTable'  => 'tags_posts',
 'foreignKey' => 'tag_id',
 'associationForeignKey'  => 'post_id',  
 'order'  => array('Post.created DESC'),
 'unique' => true
 )
 );

 In my controller in view()

 public function view($id) {
 $this->Tag->bindModel(array('hasOne' => array('TagsPost')), false);
  
 $this->set('tag', $this->paginate('Tag', array('TagsPost.tag_id' => 
 $id))); 
 }

 In my view I then had to change:

 foreach ($tag['Post'] as $post)

 to

 foreach ($tag[0]['Post'] as $post)



-- 
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 with HABTM?

2012-06-24 Thread Борислав Събев
Have you tried configuring the paginator in your Controller with a limit of 
10:

public $paginate = array(
'limit' => 10,
'order' => array(
'Post.title' => 'asc'
)
);



On Monday, 25 June 2012 04:14:32 UTC+3, 42startups wrote:
>
> Ah ok, so how would I paginate and limit results to 10?...
>
> $this->loadModel('Tag', $id);
> $tag = $this->Tag->read();
>
> On Monday, June 25, 2012 6:11:55 AM UTC+10, JonStark wrote:
>>
>> I find it easier to use LoadModel to display and sort posts from HABTM...
>>
>> Le dimanche 24 juin 2012 10:40:04 UTC+2, 42startups a écrit :
>>>
>>> Wow, CakePHP really hasn't got this problem sorted.
>>>
>>> After hours of searching I came across the solution below (which may or 
>>> may not be outdated), but I'm having issues applying paginatior 'limit' => 
>>> 10 or other ordering.
>>>
>>> Any ideas what I'm missing?
>>>
>>> My model:
>>>
>>> public $hasAndBelongsToMany = array(
>>> 'Post' => array(
>>> 'className'  => 'Post',
>>> 'joinTable'  => 'tags_posts',
>>> 'foreignKey' => 'tag_id',
>>> 'associationForeignKey'  => 'post_id',  
>>> 'order'  => array('Post.created DESC'),
>>> 'unique' => true
>>> )
>>> );
>>>
>>> In my controller in view()
>>>
>>> public function view($id) {
>>> $this->Tag->bindModel(array('hasOne' => array('TagsPost')), false); 
>>> $this->set('tag', $this->paginate('Tag', array('TagsPost.tag_id' => 
>>> $id))); 
>>> }
>>>
>>> In my view I then had to change:
>>>
>>> foreach ($tag['Post'] as $post)
>>>
>>> to
>>>
>>> foreach ($tag[0]['Post'] as $post)
>>>
>>>

-- 
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 with HABTM?

2012-06-24 Thread 42startups
Ah ok, so how would I paginate and limit results to 10?...

$this->loadModel('Tag', $id);
$tag = $this->Tag->read();

On Monday, June 25, 2012 6:11:55 AM UTC+10, JonStark wrote:
>
> I find it easier to use LoadModel to display and sort posts from HABTM...
>
> Le dimanche 24 juin 2012 10:40:04 UTC+2, 42startups a écrit :
>>
>> Wow, CakePHP really hasn't got this problem sorted.
>>
>> After hours of searching I came across the solution below (which may or 
>> may not be outdated), but I'm having issues applying paginatior 'limit' => 
>> 10 or other ordering.
>>
>> Any ideas what I'm missing?
>>
>> My model:
>>
>> public $hasAndBelongsToMany = array(
>> 'Post' => array(
>> 'className'  => 'Post',
>> 'joinTable'  => 'tags_posts',
>> 'foreignKey' => 'tag_id',
>> 'associationForeignKey'  => 'post_id',  
>> 'order'  => array('Post.created DESC'),
>> 'unique' => true
>> )
>> );
>>
>> In my controller in view()
>>
>> public function view($id) {
>> $this->Tag->bindModel(array('hasOne' => array('TagsPost')), false); 
>> $this->set('tag', $this->paginate('Tag', array('TagsPost.tag_id' => 
>> $id))); 
>> }
>>
>> In my view I then had to change:
>>
>> foreach ($tag['Post'] as $post)
>>
>> to
>>
>> foreach ($tag[0]['Post'] as $post)
>>
>>

-- 
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 with HABTM?

2012-06-24 Thread JonStark
I find it easier to use LoadModel to display and sort posts from HABTM...

Le dimanche 24 juin 2012 10:40:04 UTC+2, 42startups a écrit :
>
> Wow, CakePHP really hasn't got this problem sorted.
>
> After hours of searching I came across the solution below (which may or 
> may not be outdated), but I'm having issues applying paginatior 'limit' => 
> 10 or other ordering.
>
> Any ideas what I'm missing?
>
> My model:
>
> public $hasAndBelongsToMany = array(
> 'Post' => array(
> 'className'  => 'Post',
> 'joinTable'  => 'tags_posts',
> 'foreignKey' => 'tag_id',
> 'associationForeignKey'  => 'post_id',  
> 'order'  => array('Post.created DESC'),
> 'unique' => true
> )
> );
>
> In my controller in view()
>
> public function view($id) {
> $this->Tag->bindModel(array('hasOne' => array('TagsPost')), false); 
> $this->set('tag', $this->paginate('Tag', array('TagsPost.tag_id' => 
> $id))); 
> }
>
> In my view I then had to change:
>
> foreach ($tag['Post'] as $post)
>
> to
>
> foreach ($tag[0]['Post'] as $post)
>
>

-- 
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

2012-04-27 Thread jeremyharris
Why didn't you use the $belongsTo array I gave you? Your belongsTo has 
changed the aliases from MainCity to main_city, so paginating by MainCity 
will not work.

Rename the aliases to be CamelCased and try again. Also, debug the results 
of $this->paginate() to make sure it includes the MainCity and any other 
data you are trying to sort by.

-jeremy

On Friday, April 27, 2012 4:45:16 PM UTC-7, Hill180 wrote:
>
> Here is the real example I am trying.
>
> The webpage has a list of work order that are open.
>
>
> Paginator->sort('Work Order ID','WorkOrder.id') ?> 
> //works
> Paginator->sort('Customer','Customer.name') ?> 
> //works
> Paginator->sort('City','MainCity.name') ?> //no 
> worky
>
> Customer Model:
>
> var $belongsTo = array(
>'main_city' => array(
> 'className' => 'City',
> 'foreignKey' => 'main_city_id',
> 'conditions' => '',
> 'fields' => '',
> 'order' => ''
> ),
> 'billing_city' => array(
> 'className' => 'City',
> 'foreignKey' => 'billing_city_id',
> 'conditions' => '',
> 'fields' => '',
> 'order' => ''
> ),...
>
>   var $hasMany = array(
> 'WorkOrder' => array(
> 'className' => 'WorkOrder',
> 'foreignKey' => 'customer_id',
> 'dependent' => false,
> ),
>
>
> Work Order Model
>
> var $belongsTo = array(
> 'Customer' => array(
> 'className' => 'Customer',
> 'foreignKey' => 'customer_id',
> 'conditions' => '',
> 'fields' => '',
> 'order' => ''
> ),
>   
> City Model
>
>   var $hasMany = array(
> 'MainCity' => array(
> 'className'=>'Customer',
> 'foreignKey'=> 'main_city_id',
> 'dependent'=>true,
> ),
>   'BillingCity' => array(
> 'className'=>'Customer',
> 'foreignKey'=> 'billing_city_id',
> 'dependent'=>true,
> ));
> 
>

-- 
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

2012-04-27 Thread hill180
Here is the real example I am trying.

The webpage has a list of work order that are open.


Paginator->sort('Work Order ID','WorkOrder.id') ?>
//works
Paginator->sort('Customer','Customer.name') ?>
//works
Paginator->sort('City','MainCity.name') ?> //no
worky

Customer Model:

var $belongsTo = array(
   'main_city' => array(
'className' => 'City',
'foreignKey' => 'main_city_id',
'conditions' => '',
'fields' => '',
'order' => ''
),
'billing_city' => array(
'className' => 'City',
'foreignKey' => 'billing_city_id',
'conditions' => '',
'fields' => '',
'order' => ''
),...

  var $hasMany = array(
'WorkOrder' => array(
'className' => 'WorkOrder',
'foreignKey' => 'customer_id',
'dependent' => false,
),


Work Order Model

var $belongsTo = array(
'Customer' => array(
'className' => 'Customer',
'foreignKey' => 'customer_id',
'conditions' => '',
'fields' => '',
'order' => ''
),

City Model

  var $hasMany = array(
'MainCity' => array(
'className'=>'Customer',
'foreignKey'=> 'main_city_id',
'dependent'=>true,
),
  'BillingCity' => array(
'className'=>'Customer',
'foreignKey'=> 'billing_city_id',
'dependent'=>true,
));

-- 
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

2012-04-26 Thread jeremyharris
So the book belongsTo will look something like this:

var $belongsTo = array(
  'BillingCity' => array(
'className' => 'City',
'foreignKey' => 'billing_city_id'
  ), 
  'MainCity' => array(
'className' => 'City',
'foreignKey' => 'main_city_id'
  ), 
  'Author'
);

Then your pagination needs to contain both cities (or just the one you are 
sorting by):

$this->paginate = array(
  'contain' => array('BillingCity', 'MainCity', 'Author');
);
$this->paginate('Book');

And lastly, your pagination link:

$this->Paginator->sort('Where Written', 'BillingCity.name'); // or MainCity

On Thursday, April 26, 2012 5:23:30 PM UTC-7, Hill180 wrote:
>
> You know my example was a different then my actual code (I know I should 
> have just used it)
>
> I have two cities per book.
>
> IE
>
> main_city_id (where it was written)
> billing_city_id (where the author wants to get paid)
>
> How do I distinguish them?  I can't use City.name
>
> Thanks.
>
> On Thu, Apr 26, 2012 at 3:13 PM, jeremyharris wrote:
>
>> If it's hasMany then I think your relationship should be:
>>
>> var $hasMany = array(
>> 'Book' => array(
>> 'className' => 'Book',
>> 'foreignKey' => 'city_id', // books table has city_id
>>
>> 'conditions' => '',
>> 'fields' => '',
>> 'order' => ''
>> ));
>>
>> In that case, Book belongsTo City
>>
>> class Book extends AppModel {
>>   var $belongsTo = array('City', 'Author');
>> }
>>
>> Then you can paginate like the example I had above since it will LEFT 
>> join the city models for all the books, as long as you contain the city 
>> model:
>>
>> // in books controller
>> $this->paginate = array(
>>   'contain' => array('City', 'Author');
>> );
>> $this->paginate('Book'); // paginate from the book model to be able to 
>> sort by Book, Author or City
>>
>>
>> On Thursday, April 26, 2012 3:06:34 PM UTC-7, Hill180 wrote:
>>>
>>> City hasMany books, books only have one author.
>>>
>>> City.name didn't work
>>>
>>> var $hasMany = array(
>>> 'Book' => array(
>>> 'className' => 'Book',
>>> 'foreignKey' => 'book_id',
>>> 'conditions' => '',
>>> 'fields' => '',
>>> 'order' => ''
>>> ));
>>>
>>> On Thu, Apr 26, 2012 at 7:46 AM, jeremyharris wrote:
>>>
 Is City a hasOne or belongsTo relationship? If so, and your find code 
 is using contain or recursive to include those in the results, you can do 
 this:

 $this->Paginator->sort('Where Written', 'City.name');

 Check your data and SQL queries to see if it's joined that way.


 On Wednesday, April 25, 2012 4:29:26 PM UTC-7, Hill180 wrote:
>
> Trying to use the paginator in the view
>
> I have an Author who is has a Book and where the "book" was written (
> book_id.name, city_id.name) 
> Author sort works, title sort work, but not the sort for city_id. I 
> can sort by the id, but obviously this won't work because 
> the id has nothing to do with the name of the city.
>
>
>
> Paginator->sort('**Author**', 'name'); ?> 
>  Paginator->sort('Book', 'title.name'); ?> 
>  Paginator->sort('Where Written', 
> 'title.city_id'); ?> (sorts, but the names are not sorted because
> it is using the id)
>
> need something like this
> Paginator->sort('Where Written', '
> title.city_id.name'); ?> //does not work.
>
> Is there a way to get this to work, or is it a customer pagination?
>
> thanks..  
> j
>
  -- 
 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.comFor
  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
>>
>
>

-- 
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

2012-04-26 Thread hill180
You know my example was a different then my actual code (I know I should
have just used it)

I have two cities per book.

IE

main_city_id (where it was written)
billing_city_id (where the author wants to get paid)

How do I distinguish them?  I can't use City.name

Thanks.

On Thu, Apr 26, 2012 at 3:13 PM, jeremyharris  wrote:

> If it's hasMany then I think your relationship should be:
>
> var $hasMany = array(
> 'Book' => array(
> 'className' => 'Book',
> 'foreignKey' => 'city_id', // books table has city_id
>
> 'conditions' => '',
> 'fields' => '',
> 'order' => ''
> ));
>
> In that case, Book belongsTo City
>
> class Book extends AppModel {
>   var $belongsTo = array('City', 'Author');
> }
>
> Then you can paginate like the example I had above since it will LEFT join
> the city models for all the books, as long as you contain the city model:
>
> // in books controller
> $this->paginate = array(
>   'contain' => array('City', 'Author');
> );
> $this->paginate('Book'); // paginate from the book model to be able to
> sort by Book, Author or City
>
>
> On Thursday, April 26, 2012 3:06:34 PM UTC-7, Hill180 wrote:
>>
>> City hasMany books, books only have one author.
>>
>> City.name didn't work
>>
>> var $hasMany = array(
>> 'Book' => array(
>> 'className' => 'Book',
>> 'foreignKey' => 'book_id',
>> 'conditions' => '',
>> 'fields' => '',
>> 'order' => ''
>> ));
>>
>> On Thu, Apr 26, 2012 at 7:46 AM, jeremyharris wrote:
>>
>>> Is City a hasOne or belongsTo relationship? If so, and your find code is
>>> using contain or recursive to include those in the results, you can do this:
>>>
>>> $this->Paginator->sort('Where Written', 'City.name');
>>>
>>> Check your data and SQL queries to see if it's joined that way.
>>>
>>>
>>> On Wednesday, April 25, 2012 4:29:26 PM UTC-7, Hill180 wrote:

 Trying to use the paginator in the view

 I have an Author who is has a Book and where the "book" was written (
 book_id.name, city_id.name)
 Author sort works, title sort work, but not the sort for city_id. I can
 sort by the id, but obviously this won't work because
 the id has nothing to do with the name of the city.



 Paginator->sort('**Author**', 'name'); ?>
  Paginator->sort('Book', 'title.name'); ?>
  Paginator->sort('Where Written', 'title.city_id');
 ?> (sorts, but the names are not sorted because
 it is using the id)

 need something like this
 Paginator->sort('Where Written', '
 title.city_id.name'); ?> //does not work.

 Is there a way to get this to work, or is it a customer pagination?

 thanks..
 j

>>>  --
>>> 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.comFor
>>>  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
>

-- 
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

2012-04-26 Thread jeremyharris
If it's hasMany then I think your relationship should be:

var $hasMany = array(
'Book' => array(
'className' => 'Book',
'foreignKey' => 'city_id', // books table has city_id
'conditions' => '',
'fields' => '',
'order' => ''
));

In that case, Book belongsTo City

class Book extends AppModel {
  var $belongsTo = array('City', 'Author');
}

Then you can paginate like the example I had above since it will LEFT join 
the city models for all the books, as long as you contain the city model:

// in books controller
$this->paginate = array(
  'contain' => array('City', 'Author');
);
$this->paginate('Book'); // paginate from the book model to be able to sort 
by Book, Author or City

On Thursday, April 26, 2012 3:06:34 PM UTC-7, Hill180 wrote:
>
> City hasMany books, books only have one author.
>
> City.name didn't work
>
> var $hasMany = array(
> 'Book' => array(
> 'className' => 'Book',
> 'foreignKey' => 'book_id',
> 'conditions' => '',
> 'fields' => '',
> 'order' => ''
> ));
>
> On Thu, Apr 26, 2012 at 7:46 AM, jeremyharris wrote:
>
>> Is City a hasOne or belongsTo relationship? If so, and your find code is 
>> using contain or recursive to include those in the results, you can do this:
>>
>> $this->Paginator->sort('Where Written', 'City.name');
>>
>> Check your data and SQL queries to see if it's joined that way.
>>
>>
>> On Wednesday, April 25, 2012 4:29:26 PM UTC-7, Hill180 wrote:
>>>
>>> Trying to use the paginator in the view
>>>
>>> I have an Author who is has a Book and where the "book" was written (
>>> book_id.name, city_id.name) 
>>> Author sort works, title sort work, but not the sort for city_id. I can 
>>> sort by the id, but obviously this won't work because 
>>> the id has nothing to do with the name of the city.
>>>
>>>
>>>
>>> Paginator->sort('**Author', 'name'); ?> 
>>>  Paginator->sort('Book', 'title.name'); ?> 
>>>  Paginator->sort('Where Written', 'title.city_id'); 
>>> ?> (sorts, but the names are not sorted because
>>> it is using the id)
>>>
>>> need something like this
>>> Paginator->sort('Where Written', '
>>> title.city_id.name'); ?> //does not work.
>>>
>>> Is there a way to get this to work, or is it a customer pagination?
>>>
>>> thanks..  
>>> j
>>>
>>  -- 
>> 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

2012-04-26 Thread hill180
City hasMany books, books only have one author.

City.name didn't work

var $hasMany = array(
'Book' => array(
'className' => 'Book',
'foreignKey' => 'book_id',
'conditions' => '',
'fields' => '',
'order' => ''
));

On Thu, Apr 26, 2012 at 7:46 AM, jeremyharris  wrote:

> Is City a hasOne or belongsTo relationship? If so, and your find code is
> using contain or recursive to include those in the results, you can do this:
>
> $this->Paginator->sort('Where Written', 'City.name');
>
> Check your data and SQL queries to see if it's joined that way.
>
>
> On Wednesday, April 25, 2012 4:29:26 PM UTC-7, Hill180 wrote:
>>
>> Trying to use the paginator in the view
>>
>> I have an Author who is has a Book and where the "book" was written (
>> book_id.name, city_id.name)
>> Author sort works, title sort work, but not the sort for city_id. I can
>> sort by the id, but obviously this won't work because
>> the id has nothing to do with the name of the city.
>>
>>
>>
>> Paginator->sort('**Author', 'name'); ?>
>>  Paginator->sort('Book', 'title.name'); ?>
>>  Paginator->sort('Where Written', 'title.city_id');
>> ?> (sorts, but the names are not sorted because
>> it is using the id)
>>
>> need something like this
>> Paginator->sort('Where Written', '
>> title.city_id.name'); ?> //does not work.
>>
>> Is there a way to get this to work, or is it a customer pagination?
>>
>> thanks..
>> j
>>
>  --
> 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

2012-04-26 Thread jeremyharris
Is City a hasOne or belongsTo relationship? If so, and your find code is 
using contain or recursive to include those in the results, you can do this:

$this->Paginator->sort('Where Written', 'City.name');

Check your data and SQL queries to see if it's joined that way.

On Wednesday, April 25, 2012 4:29:26 PM UTC-7, Hill180 wrote:
>
> Trying to use the paginator in the view
>
> I have an Author who is has a Book and where the "book" was written (
> book_id.name, city_id.name) 
> Author sort works, title sort work, but not the sort for city_id. I can 
> sort by the id, but obviously this won't work because 
> the id has nothing to do with the name of the city.
>
>
>
> Paginator->sort('Author', 'name'); ?> 
>  Paginator->sort('Book', 'title.name'); ?> 
>  Paginator->sort('Where Written', 'title.city_id'); 
> ?> (sorts, but the names are not sorted because
> it is using the id)
>
> need something like this
> Paginator->sort('Where Written', 'title.city_id.name
> '); ?> //does not work.
>
> Is there a way to get this to work, or is it a customer pagination?
>
> thanks..  
> j
>

-- 
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

2012-04-25 Thread hill180
1.3

On Wed, Apr 25, 2012 at 5:38 PM, euromark wrote:

> what version are you using?
> because in 2.x it should be the other way around:
>
> sort($key, $title)
>
> please always mention your cake version
>
>
>
> Am Donnerstag, 26. April 2012 01:29:26 UTC+2 schrieb Hill180:
>
>> Trying to use the paginator in the view
>>
>> I have an Author who is has a Book and where the "book" was written (
>> book_id.name, city_id.name)
>> Author sort works, title sort work, but not the sort for city_id. I can
>> sort by the id, but obviously this won't work because
>> the id has nothing to do with the name of the city.
>>
>>
>>
>> Paginator->sort('**Author', 'name'); ?>
>>  Paginator->sort('Book', 'title.name'); ?>
>>  Paginator->sort('Where Written', 'title.city_id');
>> ?> (sorts, but the names are not sorted because
>> it is using the id)
>>
>> need something like this
>> Paginator->sort('Where Written', '
>> title.city_id.name'); ?> //does not work.
>>
>> Is there a way to get this to work, or is it a customer pagination?
>>
>> thanks..
>> j
>>
>  --
> 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

2012-04-25 Thread euromark
what version are you using?
because in 2.x it should be the other way around:

sort($key, $title)

please always mention your cake version



Am Donnerstag, 26. April 2012 01:29:26 UTC+2 schrieb Hill180:
>
> Trying to use the paginator in the view
>
> I have an Author who is has a Book and where the "book" was written (
> book_id.name, city_id.name) 
> Author sort works, title sort work, but not the sort for city_id. I can 
> sort by the id, but obviously this won't work because 
> the id has nothing to do with the name of the city.
>
>
>
> Paginator->sort('Author', 'name'); ?> 
>  Paginator->sort('Book', 'title.name'); ?> 
>  Paginator->sort('Where Written', 'title.city_id'); 
> ?> (sorts, but the names are not sorted because
> it is using the id)
>
> need something like this
> Paginator->sort('Where Written', 'title.city_id.name
> '); ?> //does not work.
>
> Is there a way to get this to work, or is it a customer pagination?
>
> thanks..  
> j
>

-- 
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 + querying associated models

2012-03-18 Thread David Cole
Look up bindModel for #2. Should be what your looking for.

On Saturday, March 17, 2012 9:45:17 PM UTC-5, succ...@tiscali.it wrote:
>
> Hi bakers! 
>
> I have 2 questions for you: 
>
> 1)Is it possibile to use afterFind with pagination? 
>
>
> 2) I have this association: Cities hasMany Users. 
> How can i do a query to have the list of the city with the number of 
> people who lives in it? 
> sounds like to add after a findAll 
>
>
> foreach ($city) 
> { 
> $city['population']=$this->users->find('count', array('condition' => 
> array('cities_id' => $city['id']))); 
> } 
>
> Is there a cakeway?! 
> thank you so much!

-- 
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 and canonical tag

2011-10-25 Thread euromark
interesting

i thought I need
/index/ as well as all
/index/page:1...x/

and I dont need
/index/page:2/sort:name/direction:desc/ etc

so what should been used is an url cleaned of all params except "page"
to pass on to the canonical tag

example:
/index/some:named/ => canonical link to: /index/
/index/page:1/sort:name/direction:desc/ => canonical link to: /index/
/index/page:2/sort:name/direction:desc/ => canonical link to: /index/
page:2/
/index/sort:name/direction:desc/page:3/ => canonical link to: /index/
page:3/
etc

but I can see your argument to link everything back to the index as
long as all links are followed and all /view/ID links are correctly
indexed. and it would make it way easier than my approach.
thx.


On 25 Okt., 10:11, AD7six  wrote:
> On Oct 24, 5:39 pm, euromark  wrote:
>
>
>
>
>
>
>
>
>
> > this site states pretty clearly on how to use 
> > canonicalhttp://www.johnfdoherty.com/do-bing-and-google-treat-relcanonical-dif...
>
> > "
> > When should I definitely NOT use the canonical tag?
> > A few times exist when you should not use the canonical tag, and
> > instead use a different tactic:
>
> > On paginated results (use rel=prev or rel=next instead
> > When the page is no longer necessary. Use a 301 redirect to a relevant
> > page instead.
> > "
>
> > Currently we use "canonical"=>url without any named params.
> > But this seems to be the quick and dirty hack.
>
> > The problem is that "page" is mixed in with "sort" etc
> > For "sort" we should use canonical.
> > There can be quite a few combinations of the above params...
>
> > How do you handle this?
> > Extract the page and display the canonical link in combination with
> > this single param if available?
>
> > I think it is pretty important to get this right because otherwise
> > everything after page 1 does not get indexed.
>
> I would say the absolute most important thing to keep in mind when
> thinking about SEO is: is this page (not the things it links to)
> important to search engines; if it's a choice do I want this page
> showing up in search results instead of ? In context that
> means is the list itself important or, if appropriate, the individual
> item pages?
>
> You are not going to prevent links on your paginated lists from being
> followed and indexed by putting a canonical meta tag pointing at page
> 1 of your list pages. If you are paginating /foos/index and each item
> has a link to /foos/view/, you really want search engines to index
> the individual foos (probably), not the list which is just a means to
> find them. This is where using a canonical on the list pages to point
> at page 1 makes sense -especially if the listing is constantly
> changing; It is a simple tactic to prevent search engines indexing
> pages that are SEO-irrelevant, whilst not preventing them from finding
> all the individual items, and ensuring that any links that point to
> page >1 still give SEO-value to your site.
>
> If there is no /foos/view/ then the information you've found
> regarding - rel=prev and rel=next and don't use canonical - is a lot
> more relevant, but personally I canonical => page 1, the list pages as
> they are no where near as important as the things they link to, and do
> not consider it a dirty hack to do so.
>
> AD

-- 
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 and canonical tag

2011-10-25 Thread AD7six


On Oct 24, 5:39 pm, euromark  wrote:
> this site states pretty clearly on how to use 
> canonicalhttp://www.johnfdoherty.com/do-bing-and-google-treat-relcanonical-dif...
>
> "
> When should I definitely NOT use the canonical tag?
> A few times exist when you should not use the canonical tag, and
> instead use a different tactic:
>
> On paginated results (use rel=prev or rel=next instead
> When the page is no longer necessary. Use a 301 redirect to a relevant
> page instead.
> "
>
> Currently we use "canonical"=>url without any named params.
> But this seems to be the quick and dirty hack.
>
> The problem is that "page" is mixed in with "sort" etc
> For "sort" we should use canonical.
> There can be quite a few combinations of the above params...
>
> How do you handle this?
> Extract the page and display the canonical link in combination with
> this single param if available?
>
> I think it is pretty important to get this right because otherwise
> everything after page 1 does not get indexed.

I would say the absolute most important thing to keep in mind when
thinking about SEO is: is this page (not the things it links to)
important to search engines; if it's a choice do I want this page
showing up in search results instead of ? In context that
means is the list itself important or, if appropriate, the individual
item pages?

You are not going to prevent links on your paginated lists from being
followed and indexed by putting a canonical meta tag pointing at page
1 of your list pages. If you are paginating /foos/index and each item
has a link to /foos/view/, you really want search engines to index
the individual foos (probably), not the list which is just a means to
find them. This is where using a canonical on the list pages to point
at page 1 makes sense -especially if the listing is constantly
changing; It is a simple tactic to prevent search engines indexing
pages that are SEO-irrelevant, whilst not preventing them from finding
all the individual items, and ensuring that any links that point to
page >1 still give SEO-value to your site.

If there is no /foos/view/ then the information you've found
regarding - rel=prev and rel=next and don't use canonical - is a lot
more relevant, but personally I canonical => page 1, the list pages as
they are no where near as important as the things they link to, and do
not consider it a dirty hack to do so.

AD

-- 
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 generatetreelist results

2011-10-19 Thread Constantin.FF
the issue became a bit more complicated. Here is what I need as a
result.
I have the Post Model which behave as a Tree, and also every post has
a parent or for the first level the parent is 0. Also every post has a
sort number which helps for them to be sorted.
I wold like to display paginated results but the order to be as
follows:
First to be the post with lower sort number followed by it's children
(again sorted by their sort number), next grandchildren again sorted
and so on...
Next to be the second post with its children and so on 

I'm looking for the most appropriate way to do this. If I get the
generatetreelist the results are not ordered the way I need but just
ordered by ID and also not paginated. And if I try to display the
posts results , I can sort them only by one criteria and I need them
sorted by parent_id and sort number while keeping them groped by
parent_id.

Please if someone can give an idea how to solve this. Thanks

-- 
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 sorting question

2011-10-11 Thread heohni
Great!! Thanks!!

-- 
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 and delete an item in a paginated list with jquery

2011-09-29 Thread euromark
you can update the complete content of the content div
this way everything is current then again


On 29 Sep., 12:23, heohni 
wrote:
> Hi,
>
> I have a paginated list and want to remove single items out of it with
> jquery.
> Is there any way I can update the pagination info for the paginator as
> the pagination needs to count one item less and needs to change the
> counting and paging accordingly?
>
> Thanks!

-- 
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 sorting question

2011-09-25 Thread WebbedIT
I have never manually specified ASC and DESC links, I have always used
paginations default $this->Paginator->sort() links as shown in the
book which automagically works out if the link should sort ASC or
DESC:
http://book.cakephp.org/view/1233/Pagination-in-Views

I guess that by specifying both links at the same time it will of
course be forced to show both links.  If you want it to check if the
current sort value for that column is ASC or DESC and then display the
opposite link then you will need to add some PHP logic in there to do
that.

This related post by teknoid may get you started:
http://nuts-and-bolts-of-cakephp.com/2008/07/28/displaying-sort-direction-in-paginated-data/

HTH, Paul

On Sep 23, 8:11 am, heohni 
wrote:
> Hi,
>
> I have these in my table header
>
> Paginator->link($html->image('dpdown.jpg'),array('sort' => 
> 'OBJ_PREIS', 'direction' =>
>
> 'DESC'), $options = array('escape' => false)); ?>
>
>          $this->Paginator->link($html->image('dpdownup.jpg'),array('sort' => 
> 'OBJ_PREIS', 'direction' =>
>
> 'ASC'), $options = array('escape' => false)); ?>
>
> 2 little arrows which indicate the sorting for a price asc and desc.
>
> but in my source it show alway BOTH links like
>
> 
> 
> 
> 
> 
> 
>
> I have by default the sortng for OBJ_PREIS ASC within my find()
> statement.
> What I do wrong to get the wrong links displayed?
>
> Please help!

-- 
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-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 and JQuery: Passing parameters with JQuery to controller

2011-09-03 Thread Tomfox Wiranata
i made it work! i used a variable checking what div whas clicked and a
dummy model.thanks for all your help :)

On 31 Aug., 10:04, Tomfox Wiranata  wrote:
> hi paul,
>
> yes, with the links href i am already passing the page number
>
> controller/action/page:x
>
> to my actions isAjax() function. but i need an additional parameter,
> so my controller knows what element to render within the isAjax():
> if ($this->RequestHandler->isAjax())
> {
>
> when user clicks on div "pagination_follow"
>                 $this->render('/elements/users/following');
>                 return;
>
> when user clicks on div "pagination_created"
>                 $this->render('/elements/users/created');
>                 return;
>                 }
>
> i just cant get jquery to pass that additional variable
>
> On Aug 31, 9:56 am, WebbedIT  wrote:
>
>
>
>
>
>
>
> > The parameter(s) should already be in the link's href attribute, if
> > not you're not using pagination to display your column sort and paging
> > links?
>
> > Have you read this (not done so myself, but should give you some
> > pointers):http://bakery.cakephp.org/articles/daphonz/2008/05/03/easy-ajax-pagin...
>
> > HTH, Paul
>
> > On Aug 30, 8:59 am, Tomfox Wiranata  wrote:
>
> > > thx, again ;)
>
> > > stupid question. with ajax request you mean doing so within jquery,
> > > correct? how would i do it here?
>
> > > $('#pagination_created a').live('click', function() {
> > >                     var url = $(this).attr("href");   !<<
> > > I'm having a feeling that i need to add the parameter to this line
> > >                     $('#following_popup').load(url);
> > >                     return false;
> > >                 });
>
> > > thanks a lot :)
>
> > > On Aug 30, 9:28 am, WebbedIT  wrote:
>
> > > > There is nothing special about achieving this as CakePHP takes the
> > > > passed or named variables the same way as any other time.  Simply send
> > > > an ajax request to:
>
> > > > /controller/action/variableValue
>
> > > > or
>
> > > > /controller/action/variableName:variableValue
>
> > > > If you're still struggling to access the variable in your action add
> > > > echo debug($this->params); to see where the variable ends up.
>
> > > > HTH, Paul.
>
> > > > On Aug 29, 3:41 pm, Tomfox Wiranata  wrote:
>
> > > > > hi huoxito,
>
> > > > > thx for your post. no i didnt get there cause my way worked too.
> > > > > if you/someone know/knows how to pass a variable with jquery to the
> > > > > isAjax() i'd rather stay with my solution, otherwise i might give it a
> > > > > try..
>
> > > > > On Aug 29, 2:22 pm, huoxito  wrote:
>
> > > > > > Have u tried to do it use cake built in ajax pagination?
>
> > > > > >http://book.cakephp.org/view/1600/Ajax-Pagination-Hidequotedtext -
>
> > > > - Show quoted text -- Hide quoted text -
>
> > - Show quoted text -

-- 
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 and JQuery: Passing parameters with JQuery to controller

2011-08-31 Thread Tomfox Wiranata
hi paul,

yes, with the links href i am already passing the page number

controller/action/page:x

to my actions isAjax() function. but i need an additional parameter,
so my controller knows what element to render within the isAjax():
if ($this->RequestHandler->isAjax())
{


when user clicks on div "pagination_follow"
$this->render('/elements/users/following');
return;


when user clicks on div "pagination_created"
$this->render('/elements/users/created');
return;
}



i just cant get jquery to pass that additional variable





On Aug 31, 9:56 am, WebbedIT  wrote:
> The parameter(s) should already be in the link's href attribute, if
> not you're not using pagination to display your column sort and paging
> links?
>
> Have you read this (not done so myself, but should give you some
> pointers):http://bakery.cakephp.org/articles/daphonz/2008/05/03/easy-ajax-pagin...
>
> HTH, Paul
>
> On Aug 30, 8:59 am, Tomfox Wiranata  wrote:
>
>
>
> > thx, again ;)
>
> > stupid question. with ajax request you mean doing so within jquery,
> > correct? how would i do it here?
>
> > $('#pagination_created a').live('click', function() {
> >                     var url = $(this).attr("href");   !<<
> > I'm having a feeling that i need to add the parameter to this line
> >                     $('#following_popup').load(url);
> >                     return false;
> >                 });
>
> > thanks a lot :)
>
> > On Aug 30, 9:28 am, WebbedIT  wrote:
>
> > > There is nothing special about achieving this as CakePHP takes the
> > > passed or named variables the same way as any other time.  Simply send
> > > an ajax request to:
>
> > > /controller/action/variableValue
>
> > > or
>
> > > /controller/action/variableName:variableValue
>
> > > If you're still struggling to access the variable in your action add
> > > echo debug($this->params); to see where the variable ends up.
>
> > > HTH, Paul.
>
> > > On Aug 29, 3:41 pm, Tomfox Wiranata  wrote:
>
> > > > hi huoxito,
>
> > > > thx for your post. no i didnt get there cause my way worked too.
> > > > if you/someone know/knows how to pass a variable with jquery to the
> > > > isAjax() i'd rather stay with my solution, otherwise i might give it a
> > > > try..
>
> > > > On Aug 29, 2:22 pm, huoxito  wrote:
>
> > > > > Have u tried to do it use cake built in ajax pagination?
>
> > > > >http://book.cakephp.org/view/1600/Ajax-Pagination-Hidequoted text -
>
> > > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -

-- 
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 and JQuery: Passing parameters with JQuery to controller

2011-08-31 Thread WebbedIT
The parameter(s) should already be in the link's href attribute, if
not you're not using pagination to display your column sort and paging
links?

Have you read this (not done so myself, but should give you some
pointers):
http://bakery.cakephp.org/articles/daphonz/2008/05/03/easy-ajax-pagination-using-jquery

HTH, Paul

On Aug 30, 8:59 am, Tomfox Wiranata  wrote:
> thx, again ;)
>
> stupid question. with ajax request you mean doing so within jquery,
> correct? how would i do it here?
>
> $('#pagination_created a').live('click', function() {
>                     var url = $(this).attr("href");   !<<
> I'm having a feeling that i need to add the parameter to this line
>                     $('#following_popup').load(url);
>                     return false;
>                 });
>
> thanks a lot :)
>
> On Aug 30, 9:28 am, WebbedIT  wrote:
>
>
>
>
>
>
>
> > There is nothing special about achieving this as CakePHP takes the
> > passed or named variables the same way as any other time.  Simply send
> > an ajax request to:
>
> > /controller/action/variableValue
>
> > or
>
> > /controller/action/variableName:variableValue
>
> > If you're still struggling to access the variable in your action add
> > echo debug($this->params); to see where the variable ends up.
>
> > HTH, Paul.
>
> > On Aug 29, 3:41 pm, Tomfox Wiranata  wrote:
>
> > > hi huoxito,
>
> > > thx for your post. no i didnt get there cause my way worked too.
> > > if you/someone know/knows how to pass a variable with jquery to the
> > > isAjax() i'd rather stay with my solution, otherwise i might give it a
> > > try..
>
> > > On Aug 29, 2:22 pm, huoxito  wrote:
>
> > > > Have u tried to do it use cake built in ajax pagination?
>
> > > >http://book.cakephp.org/view/1600/Ajax-Pagination-Hide quoted text -
>
> > - Show quoted text -

-- 
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 and JQuery: Passing parameters with JQuery to controller

2011-08-30 Thread Tomfox Wiranata
thx, again ;)

stupid question. with ajax request you mean doing so within jquery,
correct? how would i do it here?

$('#pagination_created a').live('click', function() {
var url = $(this).attr("href");   !<<
I'm having a feeling that i need to add the parameter to this line
$('#following_popup').load(url);
return false;
});



thanks a lot :)


On Aug 30, 9:28 am, WebbedIT  wrote:
> There is nothing special about achieving this as CakePHP takes the
> passed or named variables the same way as any other time.  Simply send
> an ajax request to:
>
> /controller/action/variableValue
>
> or
>
> /controller/action/variableName:variableValue
>
> If you're still struggling to access the variable in your action add
> echo debug($this->params); to see where the variable ends up.
>
> HTH, Paul.
>
> On Aug 29, 3:41 pm, Tomfox Wiranata  wrote:
>
>
>
> > hi huoxito,
>
> > thx for your post. no i didnt get there cause my way worked too.
> > if you/someone know/knows how to pass a variable with jquery to the
> > isAjax() i'd rather stay with my solution, otherwise i might give it a
> > try..
>
> > On Aug 29, 2:22 pm, huoxito  wrote:
>
> > > Have u tried to do it use cake built in ajax pagination?
>
> > >http://book.cakephp.org/view/1600/Ajax-Pagination- Hide quoted text -
>
> - Show quoted text -

-- 
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 and JQuery: Passing parameters with JQuery to controller

2011-08-30 Thread WebbedIT
There is nothing special about achieving this as CakePHP takes the
passed or named variables the same way as any other time.  Simply send
an ajax request to:

/controller/action/variableValue

or

/controller/action/variableName:variableValue

If you're still struggling to access the variable in your action add
echo debug($this->params); to see where the variable ends up.

HTH, Paul.

On Aug 29, 3:41 pm, Tomfox Wiranata  wrote:
> hi huoxito,
>
> thx for your post. no i didnt get there cause my way worked too.
> if you/someone know/knows how to pass a variable with jquery to the
> isAjax() i'd rather stay with my solution, otherwise i might give it a
> try..
>
> On Aug 29, 2:22 pm, huoxito  wrote:
>
>
>
>
>
>
>
> > Have u tried to do it use cake built in ajax pagination?
>
> >http://book.cakephp.org/view/1600/Ajax-Pagination

-- 
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 and JQuery: Passing parameters with JQuery to controller

2011-08-29 Thread Tomfox Wiranata
hi huoxito,

thx for your post. no i didnt get there cause my way worked too.
if you/someone know/knows how to pass a variable with jquery to the
isAjax() i'd rather stay with my solution, otherwise i might give it a
try..



On Aug 29, 2:22 pm, huoxito  wrote:
> Have u tried to do it use cake built in ajax pagination?
>
> http://book.cakephp.org/view/1600/Ajax-Pagination

-- 
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 and JQuery: Passing parameters with JQuery to controller

2011-08-29 Thread huoxito
Have u tried to do it use cake built in ajax pagination?

http://book.cakephp.org/view/1600/Ajax-Pagination

-- 
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 trouble with umlauts & named parameters

2011-08-18 Thread WebbedIT
Yeah, happens often :)

On Aug 17, 3:13 pm, Anja Liebermann 
wrote:
> I saw that AFTER it hit the mailing list. it was not intended to hijack
> someones thread.
>
> Am 17.08.2011 11:38, schrieb WebbedIT:
>
>
>
>
>
>
>
> > Anja,
>
> > You have posted your query into someone elses thread.  I suggest you
> > start your own thread if you want people to find it and offer help.
>
> > HTH, Paul.
>
> > On Aug 15, 4:05 pm, Anja Liebermann
> > wrote:
> >> Hello,
>
> >> I have inherited a big application based on cake 1.2. The search works
> >> via named parameters in the URL because the search form is  placed in
> >> the layout header *ouch* and works for more than one model.
>
> >> So the search parameter is passed 
> >> likehttp://www.mynicedomain.de/gruppen/suche:Kln
>
> >> this is passed through a huge routes.php file:
>
> >>     // Group Overview (with searchword)
> >>     Router::connect(
> >>       '/gruppen/suche::search',
> >>       array(
> >>         'controller' =>  'groups',
> >>         'action' =>  'index'
> >>       ),
> >>       array(
> >>         'search' =>  '[^/?&:]+'
> >>       )
> >>     );
>
> >> Since it is a German page with all those nasty umlauts I already
> >> intervene via JavaScript in the search form and encode "K ln" to
> >> "K%C3%B6ln" which I successfully catch in the controller via
>
> >>                  $suche = explode(':',$_SERVER['REQUEST_URI']);
> >>                  if(isset($suche[1])&&  isset($this->params['search'])){
> >>                          $suchbegriffe = explode(':',$suche[1]);
> >>                          $suchbegriff = explode('/',$suchbegriffe[0]);
> >>                          $search = urldecode($suchbegriff[0]);
> >>                  }
> >> So now "K%C3%B6ln" is back to "K ln". and my search works just fine
> >> until I get more than one page of results. And woe is me!
>
> >> What I try now is
> >> in the controller:
> >> $urlsearch = urlencode(trim($search));
> >>                  $urloption =                    array(
> >>                                  'controller' =>  'groups',
> >>                                  'action' =>  $this->action,
> >>                                  'suche:'.$urlsearch,
> >>                          );
> >>                  $paginator_params = array(
> >>                          'pass' =>  $urloption,
> >>                  );
> >> and in the view (in an element):
>
> >> $paginator->options(array(
> >>     'url' =>
> >> $paginator->params['paging'][$model]['options']['url']['pass']));
>
> >> latter containing my array:
> >> url array(
> >>       controller =>  groups
> >>       action =>  index
> >>       0 =>  suche:K%C3%B6ln
> >> )
>
> >> But the url of the paging numbers still results in
> >> /gruppen/suche:K ln/seite:2
> >> K ln again with " " causing my paging to break.
>
> >> Where have I missed to pass on my encoded parameters?
>
> >> Thanks for any advice
>
> >> Anja
>
> >>   anja_liebermann.vcf
> >> <  1KViewDownload

-- 
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 trouble with umlauts & named parameters

2011-08-17 Thread Anja Liebermann
I saw that AFTER it hit the mailing list. it was not intended to hijack 
someones thread.


Am 17.08.2011 11:38, schrieb WebbedIT:

Anja,

You have posted your query into someone elses thread.  I suggest you
start your own thread if you want people to find it and offer help.

HTH, Paul.

On Aug 15, 4:05 pm, Anja Liebermann
wrote:

Hello,

I have inherited a big application based on cake 1.2. The search works
via named parameters in the URL because the search form is  placed in
the layout header *ouch* and works for more than one model.

So the search parameter is passed 
likehttp://www.mynicedomain.de/gruppen/suche:K�ln

this is passed through a huge routes.php file:

// Group Overview (with searchword)
Router::connect(
  '/gruppen/suche::search',
  array(
'controller' =>  'groups',
'action' =>  'index'
  ),
  array(
'search' =>  '[^/?&:]+'
  )
);

Since it is a German page with all those nasty umlauts I already
intervene via JavaScript in the search form and encode "K�ln" to
"K%C3%B6ln" which I successfully catch in the controller via

 $suche = explode(':',$_SERVER['REQUEST_URI']);
 if(isset($suche[1])&&  isset($this->params['search'])){
 $suchbegriffe = explode(':',$suche[1]);
 $suchbegriff = explode('/',$suchbegriffe[0]);
 $search = urldecode($suchbegriff[0]);
 }
So now "K%C3%B6ln" is back to "K�ln". and my search works just fine
until I get more than one page of results. And woe is me!

What I try now is
in the controller:
$urlsearch = urlencode(trim($search));
 $urloption =array(
 'controller' =>  'groups',
 'action' =>  $this->action,
 'suche:'.$urlsearch,
 );
 $paginator_params = array(
 'pass' =>  $urloption,
 );
and in the view (in an element):

$paginator->options(array(
'url' =>
$paginator->params['paging'][$model]['options']['url']['pass']));

latter containing my array:
url array(
  controller =>  groups
  action =>  index
  0 =>  suche:K%C3%B6ln
)

But the url of the paging numbers still results in
/gruppen/suche:K�ln/seite:2
K�ln again with "�" causing my paging to break.

Where have I missed to pass on my encoded parameters?

Thanks for any advice

Anja

  anja_liebermann.vcf
<  1KViewDownload




--
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 trouble with umlauts & named parameters

2011-08-17 Thread WebbedIT
Anja,

You have posted your query into someone elses thread.  I suggest you
start your own thread if you want people to find it and offer help.

HTH, Paul.

On Aug 15, 4:05 pm, Anja Liebermann 
wrote:
> Hello,
>
> I have inherited a big application based on cake 1.2. The search works
> via named parameters in the URL because the search form is  placed in
> the layout header *ouch* and works for more than one model.
>
> So the search parameter is passed 
> likehttp://www.mynicedomain.de/gruppen/suche:K�ln
>
> this is passed through a huge routes.php file:
>
>    // Group Overview (with searchword)
>    Router::connect(
>      '/gruppen/suche::search',
>      array(
>        'controller' => 'groups',
>        'action' => 'index'
>      ),
>      array(
>        'search' => '[^/?&:]+'
>      )
>    );
>
> Since it is a German page with all those nasty umlauts I already
> intervene via JavaScript in the search form and encode "K�ln" to
> "K%C3%B6ln" which I successfully catch in the controller via
>
>                 $suche = explode(':',$_SERVER['REQUEST_URI']);
>                 if(isset($suche[1]) && isset($this->params['search'])){
>                         $suchbegriffe = explode(':',$suche[1]);
>                         $suchbegriff = explode('/',$suchbegriffe[0]);
>                         $search = urldecode($suchbegriff[0]);
>                 }
> So now "K%C3%B6ln" is back to "K�ln". and my search works just fine
> until I get more than one page of results. And woe is me!
>
> What I try now is
> in the controller:
> $urlsearch = urlencode(trim($search));
>                 $urloption =                    array(
>                                 'controller' => 'groups',
>                                 'action' => $this->action,
>                                 'suche:'.$urlsearch,
>                         );
>                 $paginator_params = array(
>                         'pass' => $urloption,
>                 );
> and in the view (in an element):
>
> $paginator->options(array(
>    'url' =>
> $paginator->params['paging'][$model]['options']['url']['pass']));
>
> latter containing my array:
> url array(
>      controller => groups
>      action => index
>      0 => suche:K%C3%B6ln
> )
>
> But the url of the paging numbers still results in
> /gruppen/suche:K�ln/seite:2
> K�ln again with "�" causing my paging to break.
>
> Where have I missed to pass on my encoded parameters?
>
> Thanks for any advice
>
> Anja
>
>  anja_liebermann.vcf
> < 1KViewDownload

-- 
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 with POST parameters

2011-06-08 Thread byqsri
My search box is about a field is in a hasMany association of the
Model that I use and not a field directly of the Model.
Can I use CakeDc Search Plugin also in this case?
Many thanks

On 8 Giu, 08:27, Ryan Schmidt  wrote:
> Why not just make the search form GET in the first place?
>
> On Jun 8, 2011, at 01:00, Walther wrote:
>
>
>
>
>
>
>
> > What you want is a PRG (Post/Redirect/Get) pattern. Basically the user
> > POSTs the search form, your script redirects the user back to the
> > referrer page, but with a new GET parameter set to their search
> > parameter.
>
> > Take a look at the CakeDC Search plugin (https://github.com/cakedc/
> > search) it includes all the functionality you want (plus more), is
> > free and is amazingly versatile.
>
> > On Jun 7, 9:37 am, byqsri  wrote:
> >> Hi
> >> I have a search box ( a form with some parameters).
> >> To show the results of the search I use the paginator helper.
> >> Now my problem is the if I click on "Next" link I lost the parameters
> >> search .
> >> How can I do to keep the parameters search?How can I do a pagination
> >> with POST parameters?

-- 
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 with POST parameters

2011-06-07 Thread Ryan Schmidt
Why not just make the search form GET in the first place?

On Jun 8, 2011, at 01:00, Walther wrote:

> What you want is a PRG (Post/Redirect/Get) pattern. Basically the user
> POSTs the search form, your script redirects the user back to the
> referrer page, but with a new GET parameter set to their search
> parameter.
> 
> Take a look at the CakeDC Search plugin (https://github.com/cakedc/
> search) it includes all the functionality you want (plus more), is
> free and is amazingly versatile.
> 
> On Jun 7, 9:37 am, byqsri  wrote:
>> Hi
>> I have a search box ( a form with some parameters).
>> To show the results of the search I use the paginator helper.
>> Now my problem is the if I click on "Next" link I lost the parameters
>> search .
>> How can I do to keep the parameters search?How can I do a pagination
>> with POST parameters?


-- 
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 with POST parameters

2011-06-07 Thread Walther
What you want is a PRG (Post/Redirect/Get) pattern. Basically the user
POSTs the search form, your script redirects the user back to the
referrer page, but with a new GET parameter set to their search
parameter.

Take a look at the CakeDC Search plugin (https://github.com/cakedc/
search) it includes all the functionality you want (plus more), is
free and is amazingly versatile.

On Jun 7, 9:37 am, byqsri  wrote:
> Hi
> I have a search box ( a form with some parameters).
> To show the results of the search I use the paginator helper.
> Now my problem is the if I click on "Next" link I lost the parameters
> search .
> How can I do to keep the parameters search?How can I do a pagination
> with POST parameters?
> Many Thanks

-- 
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 with POST parameters

2011-06-07 Thread Ryan Schmidt
On Jun 7, 2011, at 02:37, byqsri wrote:

> I have a search box ( a form with some parameters).
> To show the results of the search I use the paginator helper.
> Now my problem is the if I click on "Next" link I lost the parameters
> search .
> How can I do to keep the parameters search?How can I do a pagination
> with POST parameters?

Use GET instead of POST. If you can't because there are too many, consider 
storing the POST parameters in the session.



-- 
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 Limits

2011-05-30 Thread Phang Mulianto
do you try use

$this->Model->findAll('criteria','fields','order','yourlimit','page');

this will limit the result queried from the database.

paginate only limit the view in the view layer and it depends on the total
record returned by your query.

hope helps

rgds,

Mulianto

On Mon, May 30, 2011 at 5:13 PM, majna  wrote:

> Urghhh. Then use paginate callback (found in Controller::paginate()).
>
> Add this in your model:
>
> public function paginateCount($conditions = array(), $recursive = 0,
> $extra = array()) {
>if (isset($extra['myHardLimit'])) {
>return $extra['myHardLimit'];
>}
>
>$parameters = compact('conditions');
>if ($recursive != $this->recursive) {
>$parameters['recursive'] = $recursive;
>}
>return $this->find('count', array_merge($parameters, $extra));
> }
>
> Use in controller:
> $this->paginate(array('myHardLimit'=>300,
> 'condition'=>'Post.published'=>1));
>
> I think this should work...
>
> On May 30, 8:50 am, Okalany Daniel  wrote:
> > Thanks. Its not what i was looking for though. I'm looking for a way to
> > limit all the records returned by a pagination. Not to limit the records
> per
> > page.
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > On Fri, May 27, 2011 at 8:08 PM, majna  wrote:
> > >http://book.cakephp.org/view/1232/Controller-Setup
> >
> > > On May 27, 3:20 pm, Okalany Daniel  wrote:
> > > > How would i set the limit in the model? I couldn't find it.
> >
> > > > 2011/5/26 Alejandro Gómez Fernández 
> >
> > > > >
> >
> > > > > --
> > > > > 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+unsubscr...@googlegroups.com For more options, visit this
> > > group
> > > > > athttp://groups.google.com/group/cake-php
> >
> > > > --
> > > > OKALANY DANIEL,
> > > > P.O BOX 26150,
> > > > Kampala.,
> > > > Uganda.http://okasoft.net
> > > > --
> >
> > > --
> > > 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
> >
> > --
> > OKALANY DANIEL,
> > P.O BOX 26150,
> > Kampala.,
> > Uganda.http://okasoft.net
> > --
>
> --
> 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 Limits

2011-05-30 Thread majna
Urghhh. Then use paginate callback (found in Controller::paginate()).

Add this in your model:

public function paginateCount($conditions = array(), $recursive = 0,
$extra = array()) {
if (isset($extra['myHardLimit'])) {
return $extra['myHardLimit'];
}

$parameters = compact('conditions');
if ($recursive != $this->recursive) {
$parameters['recursive'] = $recursive;
}
return $this->find('count', array_merge($parameters, $extra));
}

Use in controller:
$this->paginate(array('myHardLimit'=>300,
'condition'=>'Post.published'=>1));

I think this should work...

On May 30, 8:50 am, Okalany Daniel  wrote:
> Thanks. Its not what i was looking for though. I'm looking for a way to
> limit all the records returned by a pagination. Not to limit the records per
> page.
>
>
>
>
>
>
>
>
>
> On Fri, May 27, 2011 at 8:08 PM, majna  wrote:
> >http://book.cakephp.org/view/1232/Controller-Setup
>
> > On May 27, 3:20 pm, Okalany Daniel  wrote:
> > > How would i set the limit in the model? I couldn't find it.
>
> > > 2011/5/26 Alejandro Gómez Fernández 
>
> > > > -BEGIN PGP SIGNED MESSAGE-
> > > > Hash: SHA1
>
> > > > You want to limit the number of rows the database engine send to cake?
> > > > This limit must be set in the "select" command, so, may be, it must be
> > > > set in the model. Do you try this?
>
> > > > Regards,
>
> > > > Alejandro.
>
> > > > El 26/05/2011 10:11, Okalany Daniel escribió:
> > > > > Hi All,
> > > > > i can't seem to be able to limit the number of records returned from
> > > > cakephp
> > > > > pagination.
>
> > > > > $this->paginate('limit'=>30);
> > > > > limits the number of results per page. But i want to limit the total
> > > > dataset
> > > > > returned. Set it to like 300 since i have a very large table.
>
> > > > > regards,
> > > > > Daniel
>
> > > > -BEGIN PGP SIGNATURE-
> > > > Version: GnuPG v1.4.11 (MingW32)
> > > > Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org/
>
> > > > iQEcBAEBAgAGBQJN3mE/AAoJEHQn9CmeN9DJ3wYH/37cOKjIvWUTuJKkgLrPikNQ
> > > > ZmBmqbdwdksI03FIYTJsh6Q7Ozw8m3/bJx0rUYO0qPvNs2QfyJpzJLSDsZl+ljf2
> > > > Zb6P/vEe4Y8nS8r7zGjavRAzuCbWzJeoPSRNGcsBw2ZnnAGCAUqwSMxElvFl3TC7
> > > > NsNVSiei/tpeuOFrLmZPyGk8/MQqHW+t+4aJDuSoVahsNHR/2WH+9YM9E9NmjdPB
> > > > eqdsrOXrUux7Wbs8EUbJkoh+GRaJGlhOuGd61oDInoSXwuRxOGN2vqap9b7lfaJq
> > > > wlGmCFGx+RiRJ8fT40J2+oVc8Rles/yyFvA0l73ZJksqRfpw0M3GsFnBsK0ME4o=
> > > > =e1Am
> > > > -END PGP SIGNATURE-
>
> > > > --
> > > > 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+unsubscr...@googlegroups.com For more options, visit this
> > group
> > > > athttp://groups.google.com/group/cake-php
>
> > > --
> > > OKALANY DANIEL,
> > > P.O BOX 26150,
> > > Kampala.,
> > > Uganda.http://okasoft.net
> > > --
>
> > --
> > 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
>
> --
> OKALANY DANIEL,
> P.O BOX 26150,
> Kampala.,
> Uganda.http://okasoft.net
> --

-- 
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 Limits

2011-05-29 Thread Okalany Daniel
Thanks. Its not what i was looking for though. I'm looking for a way to
limit all the records returned by a pagination. Not to limit the records per
page.

On Fri, May 27, 2011 at 8:08 PM, majna  wrote:

> http://book.cakephp.org/view/1232/Controller-Setup
>
> On May 27, 3:20 pm, Okalany Daniel  wrote:
> > How would i set the limit in the model? I couldn't find it.
> >
> > 2011/5/26 Alejandro Gómez Fernández 
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > > -BEGIN PGP SIGNED MESSAGE-
> > > Hash: SHA1
> >
> > > You want to limit the number of rows the database engine send to cake?
> > > This limit must be set in the "select" command, so, may be, it must be
> > > set in the model. Do you try this?
> >
> > > Regards,
> >
> > > Alejandro.
> >
> > > El 26/05/2011 10:11, Okalany Daniel escribió:
> > > > Hi All,
> > > > i can't seem to be able to limit the number of records returned from
> > > cakephp
> > > > pagination.
> >
> > > > $this->paginate('limit'=>30);
> > > > limits the number of results per page. But i want to limit the total
> > > dataset
> > > > returned. Set it to like 300 since i have a very large table.
> >
> > > > regards,
> > > > Daniel
> >
> > > -BEGIN PGP SIGNATURE-
> > > Version: GnuPG v1.4.11 (MingW32)
> > > Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org/
> >
> > > iQEcBAEBAgAGBQJN3mE/AAoJEHQn9CmeN9DJ3wYH/37cOKjIvWUTuJKkgLrPikNQ
> > > ZmBmqbdwdksI03FIYTJsh6Q7Ozw8m3/bJx0rUYO0qPvNs2QfyJpzJLSDsZl+ljf2
> > > Zb6P/vEe4Y8nS8r7zGjavRAzuCbWzJeoPSRNGcsBw2ZnnAGCAUqwSMxElvFl3TC7
> > > NsNVSiei/tpeuOFrLmZPyGk8/MQqHW+t+4aJDuSoVahsNHR/2WH+9YM9E9NmjdPB
> > > eqdsrOXrUux7Wbs8EUbJkoh+GRaJGlhOuGd61oDInoSXwuRxOGN2vqap9b7lfaJq
> > > wlGmCFGx+RiRJ8fT40J2+oVc8Rles/yyFvA0l73ZJksqRfpw0M3GsFnBsK0ME4o=
> > > =e1Am
> > > -END PGP SIGNATURE-
> >
> > > --
> > > 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
> >
> > --
> > OKALANY DANIEL,
> > P.O BOX 26150,
> > Kampala.,
> > Uganda.http://okasoft.net
> > --
>
> --
> 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
>



-- 
OKALANY DANIEL,
P.O BOX 26150,
Kampala.,
Uganda.
http://okasoft.net
--

-- 
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 Limits

2011-05-27 Thread majna
http://book.cakephp.org/view/1232/Controller-Setup

On May 27, 3:20 pm, Okalany Daniel  wrote:
> How would i set the limit in the model? I couldn't find it.
>
> 2011/5/26 Alejandro Gómez Fernández 
>
>
>
>
>
>
>
>
>
> > -BEGIN PGP SIGNED MESSAGE-
> > Hash: SHA1
>
> > You want to limit the number of rows the database engine send to cake?
> > This limit must be set in the "select" command, so, may be, it must be
> > set in the model. Do you try this?
>
> > Regards,
>
> > Alejandro.
>
> > El 26/05/2011 10:11, Okalany Daniel escribió:
> > > Hi All,
> > > i can't seem to be able to limit the number of records returned from
> > cakephp
> > > pagination.
>
> > > $this->paginate('limit'=>30);
> > > limits the number of results per page. But i want to limit the total
> > dataset
> > > returned. Set it to like 300 since i have a very large table.
>
> > > regards,
> > > Daniel
>
> > -BEGIN PGP SIGNATURE-
> > Version: GnuPG v1.4.11 (MingW32)
> > Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org/
>
> > iQEcBAEBAgAGBQJN3mE/AAoJEHQn9CmeN9DJ3wYH/37cOKjIvWUTuJKkgLrPikNQ
> > ZmBmqbdwdksI03FIYTJsh6Q7Ozw8m3/bJx0rUYO0qPvNs2QfyJpzJLSDsZl+ljf2
> > Zb6P/vEe4Y8nS8r7zGjavRAzuCbWzJeoPSRNGcsBw2ZnnAGCAUqwSMxElvFl3TC7
> > NsNVSiei/tpeuOFrLmZPyGk8/MQqHW+t+4aJDuSoVahsNHR/2WH+9YM9E9NmjdPB
> > eqdsrOXrUux7Wbs8EUbJkoh+GRaJGlhOuGd61oDInoSXwuRxOGN2vqap9b7lfaJq
> > wlGmCFGx+RiRJ8fT40J2+oVc8Rles/yyFvA0l73ZJksqRfpw0M3GsFnBsK0ME4o=
> > =e1Am
> > -END PGP SIGNATURE-
>
> > --
> > 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
>
> --
> OKALANY DANIEL,
> P.O BOX 26150,
> Kampala.,
> Uganda.http://okasoft.net
> --

-- 
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 Limits

2011-05-27 Thread Okalany Daniel
How would i set the limit in the model? I couldn't find it.

2011/5/26 Alejandro Gómez Fernández 

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> You want to limit the number of rows the database engine send to cake?
> This limit must be set in the "select" command, so, may be, it must be
> set in the model. Do you try this?
>
> Regards,
>
>
> Alejandro.
>
>
> El 26/05/2011 10:11, Okalany Daniel escribió:
> > Hi All,
> > i can't seem to be able to limit the number of records returned from
> cakephp
> > pagination.
> >
> > $this->paginate('limit'=>30);
> > limits the number of results per page. But i want to limit the total
> dataset
> > returned. Set it to like 300 since i have a very large table.
> >
> > regards,
> > Daniel
> >
>
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.11 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iQEcBAEBAgAGBQJN3mE/AAoJEHQn9CmeN9DJ3wYH/37cOKjIvWUTuJKkgLrPikNQ
> ZmBmqbdwdksI03FIYTJsh6Q7Ozw8m3/bJx0rUYO0qPvNs2QfyJpzJLSDsZl+ljf2
> Zb6P/vEe4Y8nS8r7zGjavRAzuCbWzJeoPSRNGcsBw2ZnnAGCAUqwSMxElvFl3TC7
> NsNVSiei/tpeuOFrLmZPyGk8/MQqHW+t+4aJDuSoVahsNHR/2WH+9YM9E9NmjdPB
> eqdsrOXrUux7Wbs8EUbJkoh+GRaJGlhOuGd61oDInoSXwuRxOGN2vqap9b7lfaJq
> wlGmCFGx+RiRJ8fT40J2+oVc8Rles/yyFvA0l73ZJksqRfpw0M3GsFnBsK0ME4o=
> =e1Am
> -END PGP SIGNATURE-
>
> --
> 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
>



-- 
OKALANY DANIEL,
P.O BOX 26150,
Kampala.,
Uganda.
http://okasoft.net
--

-- 
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 Limits

2011-05-27 Thread Okalany Daniel
I need to paginate.

On Thu, May 26, 2011 at 5:48 PM, euromark wrote:

> in this case dont use pagination
> a simple find('all') will do the trick
>
>
> On 26 Mai, 16:18, Alejandro Gómez Fernández  wrote:
> > -BEGIN PGP SIGNED MESSAGE-
> > Hash: SHA1
> >
> > You want to limit the number of rows the database engine send to cake?
> > This limit must be set in the "select" command, so, may be, it must be
> > set in the model. Do you try this?
> >
> > Regards,
> >
> > Alejandro.
> >
> > El 26/05/2011 10:11, Okalany Daniel escribi :
> >
> > > Hi All,
> > > i can't seem to be able to limit the number of records returned from
> cakephp
> > > pagination.
> >
> > > $this->paginate('limit'=>30);
> > > limits the number of results per page. But i want to limit the total
> dataset
> > > returned. Set it to like 300 since i have a very large table.
> >
> > > regards,
> > > Daniel
> >
> > -BEGIN PGP SIGNATURE-
> > Version: GnuPG v1.4.11 (MingW32)
> > Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org/
> >
> > iQEcBAEBAgAGBQJN3mE/AAoJEHQn9CmeN9DJ3wYH/37cOKjIvWUTuJKkgLrPikNQ
> > ZmBmqbdwdksI03FIYTJsh6Q7Ozw8m3/bJx0rUYO0qPvNs2QfyJpzJLSDsZl+ljf2
> > Zb6P/vEe4Y8nS8r7zGjavRAzuCbWzJeoPSRNGcsBw2ZnnAGCAUqwSMxElvFl3TC7
> > NsNVSiei/tpeuOFrLmZPyGk8/MQqHW+t+4aJDuSoVahsNHR/2WH+9YM9E9NmjdPB
> > eqdsrOXrUux7Wbs8EUbJkoh+GRaJGlhOuGd61oDInoSXwuRxOGN2vqap9b7lfaJq
> > wlGmCFGx+RiRJ8fT40J2+oVc8Rles/yyFvA0l73ZJksqRfpw0M3GsFnBsK0ME4o=
> > =e1Am
> > -END PGP SIGNATURE-
>
> --
> 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
>



-- 
OKALANY DANIEL,
P.O BOX 26150,
Kampala.,
Uganda.
http://okasoft.net
--

-- 
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 Limits

2011-05-27 Thread Okalany Daniel
This sets the limit on data per page, not data returned from the database.
Looks like limit means two different things when set from paginate, and when
set from model->find

On Fri, May 27, 2011 at 10:54 AM, majna  wrote:

> Set "limit" param as an array $this->paginate(array('limit'=>30));
> http://book.cakephp.org/view/165/Controller-Setup
>
> On May 26, 9:11 am, Okalany Daniel  wrote:
> > Hi All,
> > i can't seem to be able to limit the number of records returned from
> cakephp
> > pagination.
> >
> > $this->paginate('limit'=>30);
> > limits the number of results per page. But i want to limit the total
> dataset
> > returned. Set it to like 300 since i have a very large table.
> >
> > regards,
> > Daniel
>
> --
> 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
>



-- 
OKALANY DANIEL,
P.O BOX 26150,
Kampala.,
Uganda.
http://okasoft.net
--

-- 
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 Limits

2011-05-27 Thread Okalany Daniel
This is doing the same thing, setting the page limit not the whole dataset
limit. I'll keep trying though


On Fri, May 27, 2011 at 12:04 PM, Marcus Silva
wrote:

> This is how you can do it:
>
> $this->paginate['Account']['limit'] = 3;
> $this->paginate['Account']['order'] = 'RAND()';
> $this->paginate['Account']['conditions'] = array();
> $this->set('accounts',$this->paginate('Account'));
>
> Replace Account with the model name.  Thats how you do it in the
> controller.  If you want you can skip doing this all the time by
> simply declaring $paginate in the app controller.  In there you can
> list as many paginating default data you want.
>
> I hope its been helpful.
>
> cheers
>
> On May 26, 2:11 pm, Okalany Daniel  wrote:
> > Hi All,
> > i can't seem to be able to limit the number of records returned from
> cakephp
> > pagination.
> >
> > $this->paginate('limit'=>30);
> > limits the number of results per page. But i want to limit the total
> dataset
> > returned. Set it to like 300 since i have a very large table.
> >
> > regards,
> > Daniel
>
> --
> 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
>



-- 
OKALANY DANIEL,
P.O BOX 26150,
Kampala.,
Uganda.
http://okasoft.net
--

-- 
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 Limits

2011-05-27 Thread Marcus Silva
This is how you can do it:

$this->paginate['Account']['limit'] = 3;
$this->paginate['Account']['order'] = 'RAND()';
$this->paginate['Account']['conditions'] = array();
$this->set('accounts',$this->paginate('Account'));

Replace Account with the model name.  Thats how you do it in the
controller.  If you want you can skip doing this all the time by
simply declaring $paginate in the app controller.  In there you can
list as many paginating default data you want.

I hope its been helpful.

cheers

On May 26, 2:11 pm, Okalany Daniel  wrote:
> Hi All,
> i can't seem to be able to limit the number of records returned from cakephp
> pagination.
>
> $this->paginate('limit'=>30);
> limits the number of results per page. But i want to limit the total dataset
> returned. Set it to like 300 since i have a very large table.
>
> regards,
> Daniel

-- 
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 Limits

2011-05-27 Thread majna
Set "limit" param as an array $this->paginate(array('limit'=>30));
http://book.cakephp.org/view/165/Controller-Setup

On May 26, 9:11 am, Okalany Daniel  wrote:
> Hi All,
> i can't seem to be able to limit the number of records returned from cakephp
> pagination.
>
> $this->paginate('limit'=>30);
> limits the number of results per page. But i want to limit the total dataset
> returned. Set it to like 300 since i have a very large table.
>
> regards,
> Daniel

-- 
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 Limits

2011-05-26 Thread euromark
in this case dont use pagination
a simple find('all') will do the trick


On 26 Mai, 16:18, Alejandro Gómez Fernández  wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> You want to limit the number of rows the database engine send to cake?
> This limit must be set in the "select" command, so, may be, it must be
> set in the model. Do you try this?
>
> Regards,
>
> Alejandro.
>
> El 26/05/2011 10:11, Okalany Daniel escribi :
>
> > Hi All,
> > i can't seem to be able to limit the number of records returned from cakephp
> > pagination.
>
> > $this->paginate('limit'=>30);
> > limits the number of results per page. But i want to limit the total dataset
> > returned. Set it to like 300 since i have a very large table.
>
> > regards,
> > Daniel
>
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.11 (MingW32)
> Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org/
>
> iQEcBAEBAgAGBQJN3mE/AAoJEHQn9CmeN9DJ3wYH/37cOKjIvWUTuJKkgLrPikNQ
> ZmBmqbdwdksI03FIYTJsh6Q7Ozw8m3/bJx0rUYO0qPvNs2QfyJpzJLSDsZl+ljf2
> Zb6P/vEe4Y8nS8r7zGjavRAzuCbWzJeoPSRNGcsBw2ZnnAGCAUqwSMxElvFl3TC7
> NsNVSiei/tpeuOFrLmZPyGk8/MQqHW+t+4aJDuSoVahsNHR/2WH+9YM9E9NmjdPB
> eqdsrOXrUux7Wbs8EUbJkoh+GRaJGlhOuGd61oDInoSXwuRxOGN2vqap9b7lfaJq
> wlGmCFGx+RiRJ8fT40J2+oVc8Rles/yyFvA0l73ZJksqRfpw0M3GsFnBsK0ME4o=
> =e1Am
> -END PGP SIGNATURE-

-- 
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 Limits

2011-05-26 Thread Alejandro Gómez Fernández
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

You want to limit the number of rows the database engine send to cake?
This limit must be set in the "select" command, so, may be, it must be
set in the model. Do you try this?

Regards,


Alejandro.


El 26/05/2011 10:11, Okalany Daniel escribió:
> Hi All,
> i can't seem to be able to limit the number of records returned from cakephp
> pagination.
> 
> $this->paginate('limit'=>30);
> limits the number of results per page. But i want to limit the total dataset
> returned. Set it to like 300 since i have a very large table.
> 
> regards,
> Daniel
> 

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJN3mE/AAoJEHQn9CmeN9DJ3wYH/37cOKjIvWUTuJKkgLrPikNQ
ZmBmqbdwdksI03FIYTJsh6Q7Ozw8m3/bJx0rUYO0qPvNs2QfyJpzJLSDsZl+ljf2
Zb6P/vEe4Y8nS8r7zGjavRAzuCbWzJeoPSRNGcsBw2ZnnAGCAUqwSMxElvFl3TC7
NsNVSiei/tpeuOFrLmZPyGk8/MQqHW+t+4aJDuSoVahsNHR/2WH+9YM9E9NmjdPB
eqdsrOXrUux7Wbs8EUbJkoh+GRaJGlhOuGd61oDInoSXwuRxOGN2vqap9b7lfaJq
wlGmCFGx+RiRJ8fT40J2+oVc8Rles/yyFvA0l73ZJksqRfpw0M3GsFnBsK0ME4o=
=e1Am
-END PGP SIGNATURE-

-- 
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 hasMAny

2011-04-24 Thread acl68
Ho Domink,

maybe this link can help you:

http://stackoverflow.com/questions/1694047/cakephp-pagination-with-conditions-
on-has-many

On the first glance it looks like somebody has the same problem.

Anja


Am Samstag, 23. April 2011, um 23:47:26 schrieb Dominik Gajewski:
> Hi.
> I have problem with pagination. Everything is working till i don't
> want sort byt admission date. I think is only need to add one line of
> code in $var paginate. Or maybe that is problem becasue UserData
> hasMany MainBook and i want select only this one which is empty in
> field MainBook.extract_date
> 
> Could you help me?
> 
> I have tables in database
> 
> user_datas
> 
> id
> user_id
> name
> sName
> surname
> birthDate
> sex
> nationality
> pesel
> 
> main_books
> 
> id
> year
> baby_id
> user_data_id
> admission_date
> admission_mode
> extract_date
> extract_mode
> doctor_id
> 
> Model MainBook
> ===
> class MainBook extends AppModel{
>   var $name = 'MainBook';
> 
>   var $belongsTo = array(
>   'UserData' => array(
>   'className' => 'UserData',
>   'foreignKey' => 'user_data_id'
>   )
>   );
> }
> 
> Model UserData
> ===
> class UserData extends AppModel{
>   var $name = 'UserData';
>   var $hasMany = array(
>   'MainBook' => array(
>   'className' => 'MainBook',
>   'foreignKey' => 'user_data_id'
>   ),
>   );
> }
> 
> MainBooksController
> ===
> class MainBooksController extends AppController{
> 
>   var $name = 'MainBooks';
> 
>   var $paginate = array(
> 'limit' => 20,
> 'order' => array(
>   'UserData.surname' => 'asc',
> ),
> 'conditions' => array(
>   'User.status' => '1'
> ),
> );
> 
> 
>   function show_current(){
>   /**
>   Menu i kontrola sesji
>*/
>   $s = $this->sesionCheck(2);
>   $m = $this->menu($s);
>   $this->set('menu', $m);
> 
>   $data = $this->paginate('UserData');
>   $this->set('data', $data);
> 
> 
>   }
> }
> 
> My view show_current.ctp
> 
>   
>   Paginator->sort('Name', 'UserData.name'); 
?>
>   Paginator->sort('Surname', 
'UserData.surname');
> ?> Paginator->sort('PESEL', 'UserData.pesel');
> ?> Paginator->sort('Admission Date',
> 'MainBook.admission_date'); ?>   
>  
>   
>
>
>
>
>   
>   
> 

-- 
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 with recursion while using loadModel

2011-03-20 Thread ShadowCross
In the CakePHP Book (http://book.cakephp.org/view/1039/Associations-
Linking-Models-Together), there are several sections that you should
note:

In the end of "3.7.6.5 hasAndBelongsToMany (HABTM)" (although it
applies to all relation types), the Book states:

The same binding trick can be used to easily paginate your HABTM
models. Just one word of caution: since paginate requires two queries
(one to count the records and one to get the actual data), be sure to
supply the false parameter to your bindModel(); which essentially
tells CakePHP to keep the binding persistent over multiple queries,
rather than just one as in the default behavior. Please refer to the
API for more details.

In "3.7.6.7 Creating and Destroying Associations on the Fly", there's
an info box after the second code box:

Removing or adding associations using bind- and unbindModel() only
works for the next find operation only unless the second parameter has
been set to false. If the second parameter has been set to false, the
bind remains in place for the remainder of the request.

So you should really be executing

  $this->Transactions-
>bindModel(array('belongsTo'=>array('Item'=>array('className'=>'Item'),'Mem
ber'=>array('className'=>'Member'))), false);

Rather than the bindModel()/unbindModel() methods, consider using the
ContainableBehavior.  The paginate() method directly supports it (see:
http://book.cakephp.org/view/1326/Using-Containable-with-pagination),
and has other advantages as well.

On Mar 19, 3:06 am, euromark  wrote:
> have you tried
> var $uses = array('Transaction');
>
> PS: why is your model Transactions??? and not Transaction?
>
> On 19 Mrz., 07:26, "ashok.b"  wrote:
>
>
>
> > Hi, In my "Reports" controller, which is just a dummy controller
> > without any actual database, I'm trying to generate a paginated view
> > of other models. For example, to generate paginated view of
> > "Transactions" model I'm doing the following:
>
> > $this->loadModel('Transactions');
> > $this->Transactions->bindModel(array('belongsTo'=>array('Item'=>array('clas 
> > sName'=>'Item'),'Mem ber'=>array('className'=>'Member';
>
> > $results = $this->paginate('Transactions',null,array('recursive'=>1));
>
> > But this is not giving me associated data from Items and Members. If I
> > do a
>
> > $this->Transactions->find('all',array('recursive'=>1))
>
> > I get the associated data, but not paginated. How will I get paginated
> > view which includes the associated data too?

-- 
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 with recursion while using loadModel

2011-03-19 Thread euromark
have you tried
var $uses = array('Transaction');

PS: why is your model Transactions??? and not Transaction?


On 19 Mrz., 07:26, "ashok.b"  wrote:
> Hi, In my "Reports" controller, which is just a dummy controller
> without any actual database, I'm trying to generate a paginated view
> of other models. For example, to generate paginated view of
> "Transactions" model I'm doing the following:
>
> $this->loadModel('Transactions');
> $this->Transactions->bindModel(array('belongsTo'=>array('Item'=>array('className'=>'Item'),'Mem
>  ber'=>array('className'=>'Member';
>
> $results = $this->paginate('Transactions',null,array('recursive'=>1));
>
> But this is not giving me associated data from Items and Members. If I
> do a
>
> $this->Transactions->find('all',array('recursive'=>1))
>
> I get the associated data, but not paginated. How will I get paginated
> view which includes the associated data too?

-- 
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: URL for last page

2011-02-28 Thread OldWest
Jeremy,
I was searching a while for this simple last() solution. I recall reading 
about the first and last methods, but imagine my trouble searching keywords 
'first' and 'last' in Google and Cake doc!!. Thanks for refreshing memory. 
This is how I ran it:

Paginator->*first*(__('[ << first page ]', true), array(), 
null, array('class' => 'disabled')); ?>
.
Paginator->*last*(__('[ last page >> ]', true), array(), 
null, array('class' => 'disabled')); ?>

-- 
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 w/ query data in url for initial search submission not holding but all subsequent pages have url params

2011-02-15 Thread OldWest
I should clarify: I removed the footer instance of:

options = array('url'=>$searchdetails); ?>

And just kept the header instance. Seems to be working as expected now : )

-- 
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 w/ query data in url for initial search submission not holding but all subsequent pages have url params

2011-02-15 Thread OldWest
SOLVED it!

In my view, I had an instance of:

options = array('url'=>$searchdetails); ?>

below my paginator counter near the page footer.

I took the same:

options = array('url'=>$searchdetails); ?>

And placed it in the header of my view, and it solved the issue. 

It appears the vars were not being saved until I initiated the pagination by 
clicking Next>>, so adding it at the header saves the immediately on the 
first search.

-- 
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 in controller

2011-02-11 Thread Mattijs
It's the latter - setting pagination options array for each model you
are paginating.

On 11 feb, 13:51, Stephen  wrote:
> Wouldn't it be :
>
> var $paginate = array('order' => array('Gift.created' => 'desc',
> 'GiftPhoto.created' => 'desc'));
>
> or
>
> var $paginate = array('Gift' => array('order' => array('Gift.created' =>
> 'desc')), 'GiftPhoto' => array('order' => array('GiftPhoto.created' =>
> 'desc')));
>
> ?
>
> On 11 February 2011 12:33, euromark  wrote:
>
>
>
> > why didnt you try it?
>
> > On 11 Feb., 04:44, "chris...@yahoo.com"  wrote:
> > > Hi guys,...
> > > a ???
> > > How can I have two or more pagination in same controller?
> > > if I put to together like this, ... will it work?
>
> > >   var $paginate = array('order' => array('Gift.created' => 'desc'));
>
> > >   var $paginate = array('order' => array('GiftPhoto.created' =>
> > > 'desc'));
>
> > > Thanks
> > > chris
>
> > --
> > 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
>
> --
> Kind Regards
>  Stephen @ NinjaCoderMonkey
>
>  www.ninjacodermonkey.co.uk

-- 
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 in controller

2011-02-11 Thread Stephen
Wouldn't it be :

var $paginate = array('order' => array('Gift.created' => 'desc',
'GiftPhoto.created' => 'desc'));

or

var $paginate = array('Gift' => array('order' => array('Gift.created' =>
'desc')), 'GiftPhoto' => array('order' => array('GiftPhoto.created' =>
'desc')));

?



On 11 February 2011 12:33, euromark  wrote:

> why didnt you try it?
>
> On 11 Feb., 04:44, "chris...@yahoo.com"  wrote:
> > Hi guys,...
> > a ???
> > How can I have two or more pagination in same controller?
> > if I put to together like this, ... will it work?
> >
> >   var $paginate = array('order' => array('Gift.created' => 'desc'));
> >
> >   var $paginate = array('order' => array('GiftPhoto.created' =>
> > 'desc'));
> >
> > Thanks
> > chris
>
> --
> 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
>



-- 
Kind Regards
 Stephen @ NinjaCoderMonkey

 www.ninjacodermonkey.co.uk

-- 
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 in controller

2011-02-11 Thread euromark
why didnt you try it?

On 11 Feb., 04:44, "chris...@yahoo.com"  wrote:
> Hi guys,...
> a ???
> How can I have two or more pagination in same controller?
> if I put to together like this, ... will it work?
>
>   var $paginate = array('order' => array('Gift.created' => 'desc'));
>
>   var $paginate = array('order' => array('GiftPhoto.created' =>
> 'desc'));
>
> Thanks
> chris

-- 
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 SELECT COUNT(*) query slow

2010-12-30 Thread web
Thank you very much I tried that and it worked 

-Original Message-
From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On
Behalf Of Andras Kende
Sent: Wednesday, December 29, 2010 2:58 PM
To: cake-php@googlegroups.com
Subject: Re: pagination SELECT COUNT(*) query slow

Hello,

Indexing the foreign keys would be ideal too..

Also you could override the core paginateCount, so its will not join 6
tables at the count(*) query

http://book.cakephp.org/view/1237/Custom-Query-Pagination

I did it this way, its handled by the 'extra':

controller:

$this->paginate = array(
'extra' => array('recursive' => -1),
'limit' => 50,
'contain' => array(
'ForumCategory',
'UserProfile',
'LastUserProfile',
),
'order' => array('ForumTopic.modified' =>
'DESC'),
'conditions' => array('ForumTopic.is_active' =>
1),
'fields' => array(
'ForumCategory.name',
'ForumTopic.id',
'ForumTopic.name',
'ForumTopic.forum_post_count',
'ForumTopic.modified',
'UserProfile.first_name',
'UserProfile.last_name',
'LastUserProfile.first_name',
'LastUserProfile.last_name',
)
);
$this->set('topics', $this->paginate('ForumTopic'));


model:

public function PaginateCount($conditions = null, $recursive =
0, $extra = array()) {
$rec = empty($extra['extra']['recursive']) ? $recursive
: $extra['extra']['recursive'];
return $this->find('count', array(
'conditions' => $conditions,
'recursive' => $rec,
));
}


Andras Kende
http://www.kende.comn



On Dec 29, 2010, at 2:00 PM, arron wrote:

> So i have a relationship table that has 6 tables the primary id is
> indexed as well as the models that paginate is using .
> 
> 
> The problem i am having with pagination is when i edit a row or add a
> row the  SELECT COUNT(*) query takes forever  around 11956MS it also
> maxes out my CPU for about 8 seconds. I  only have 92K records, if i
> edit a row or add a row via phpmyadmin it only takes about 7ms. any
> suggestions ? Can i turn off the or get rid of the  SELECT COUNT(*)
> query ?
> 
> 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

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 SELECT COUNT(*) query slow

2010-12-30 Thread web
I will try that thanks


-Original Message-
From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On
Behalf Of Andras Kende
Sent: Wednesday, December 29, 2010 2:58 PM
To: cake-php@googlegroups.com
Subject: Re: pagination SELECT COUNT(*) query slow

Hello,

Indexing the foreign keys would be ideal too..

Also you could override the core paginateCount, so its will not join 6
tables at the count(*) query

http://book.cakephp.org/view/1237/Custom-Query-Pagination

I did it this way, its handled by the 'extra':

controller:

$this->paginate = array(
'extra' => array('recursive' => -1),
'limit' => 50,
'contain' => array(
'ForumCategory',
'UserProfile',
'LastUserProfile',
),
'order' => array('ForumTopic.modified' =>
'DESC'),
'conditions' => array('ForumTopic.is_active' =>
1),
'fields' => array(
'ForumCategory.name',
'ForumTopic.id',
'ForumTopic.name',
'ForumTopic.forum_post_count',
'ForumTopic.modified',
'UserProfile.first_name',
'UserProfile.last_name',
'LastUserProfile.first_name',
'LastUserProfile.last_name',
)
);
$this->set('topics', $this->paginate('ForumTopic'));


model:

public function PaginateCount($conditions = null, $recursive =
0, $extra = array()) {
$rec = empty($extra['extra']['recursive']) ? $recursive
: $extra['extra']['recursive'];
return $this->find('count', array(
'conditions' => $conditions,
'recursive' => $rec,
));
}


Andras Kende
http://www.kende.comn



On Dec 29, 2010, at 2:00 PM, arron wrote:

> So i have a relationship table that has 6 tables the primary id is
> indexed as well as the models that paginate is using .
> 
> 
> The problem i am having with pagination is when i edit a row or add a
> row the  SELECT COUNT(*) query takes forever  around 11956MS it also
> maxes out my CPU for about 8 seconds. I  only have 92K records, if i
> edit a row or add a row via phpmyadmin it only takes about 7ms. any
> suggestions ? Can i turn off the or get rid of the  SELECT COUNT(*)
> query ?
> 
> 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

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 SELECT COUNT(*) query slow

2010-12-29 Thread Andras Kende
Hello,

Indexing the foreign keys would be ideal too..

Also you could override the core paginateCount, so its will not join 6 tables 
at the count(*) query

http://book.cakephp.org/view/1237/Custom-Query-Pagination

I did it this way, its handled by the 'extra':

controller:

$this->paginate = array(
'extra' => array('recursive' => -1),
'limit' => 50,
'contain' => array(
'ForumCategory',
'UserProfile',
'LastUserProfile',
),
'order' => array('ForumTopic.modified' => 'DESC'),
'conditions' => array('ForumTopic.is_active' => 1),
'fields' => array(
'ForumCategory.name',
'ForumTopic.id',
'ForumTopic.name',
'ForumTopic.forum_post_count',
'ForumTopic.modified',
'UserProfile.first_name',
'UserProfile.last_name',
'LastUserProfile.first_name',
'LastUserProfile.last_name',
)
);
$this->set('topics', $this->paginate('ForumTopic'));


model:

public function PaginateCount($conditions = null, $recursive = 0, 
$extra = array()) {
$rec = empty($extra['extra']['recursive']) ? $recursive : 
$extra['extra']['recursive'];
return $this->find('count', array(
'conditions' => $conditions,
'recursive' => $rec,
));
}


Andras Kende
http://www.kende.comn



On Dec 29, 2010, at 2:00 PM, arron wrote:

> So i have a relationship table that has 6 tables the primary id is
> indexed as well as the models that paginate is using .
> 
> 
> The problem i am having with pagination is when i edit a row or add a
> row the  SELECT COUNT(*) query takes forever  around 11956MS it also
> maxes out my CPU for about 8 seconds. I  only have 92K records, if i
> edit a row or add a row via phpmyadmin it only takes about 7ms. any
> suggestions ? Can i turn off the or get rid of the  SELECT COUNT(*)
> query ?
> 
> 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 SELECT COUNT(*) query slow

2010-12-29 Thread Ryan Schmidt

On Dec 29, 2010, at 13:00, arron wrote:

> So i have a relationship table that has 6 tables the primary id is
> indexed as well as the models that paginate is using .
> 
> 
> The problem i am having with pagination is when i edit a row or add a
> row the  SELECT COUNT(*) query takes forever  around 11956MS it also
> maxes out my CPU for about 8 seconds. I  only have 92K records, if i
> edit a row or add a row via phpmyadmin it only takes about 7ms. any
> suggestions ? Can i turn off the or get rid of the  SELECT COUNT(*)
> query ?

Have you asked your database server why the query is slow? Perhaps using 
EXPLAIN? That might point out a missing index or something.



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 using associated model record count?

2010-12-13 Thread Toby G
Thanks for the response, Cricket.  Unfortunately, I can't use the
HABTM relationship, as the joining table contains notes notes relating
to the link.

I think the idea of storing the number in the member table could be
the best option.  Think I'll add a beforeSave method to the Role model
to ensure it's kept up to date with each save.  It's that or filter
the find results each time.  Overhead isn't too much of an issue on
this project, so no need ot test the 'cheapest' option on this.

Thanks,

T

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


  1   2   3   4   5   >