I added 
'value' =>  date($post_created, strtotime("1 second")) ,
 
so it gets the next post created 1 second or greater and previous post 1
second less or more as neighbours.
 
 

  _____  

From: Dave Maharaj :: WidePixels.com [mailto:[email protected]] 
Sent: June-06-09 9:31 PM
To: [email protected]
Subject: find->neighbours help


I have a pagination set up where the page loads posts based on the User.rank
of the logged in user , the status of the Post and the Post.rank and ordered
from newest to oldest so a user gets a list of Posts that are currently
active and within his permission to view.
 
I checked the pagination results against the db and they load the way i want
so the records returned for that are fine.
 
I added a second find function (find neighbours) so when they click on a
Post they can from within the Post view next or previous but its not in the
order of the original Pagination order. I am getting results but they are no
where near the original pagination order
 
function getNeighbors ($post_key , $rank)
   {
    $q = $this->find('neighbors', array('conditions' => array('Post.status'
=> 0 , 'Post.rank <=' => $rank),
//find the next and previous Post that has a rank of $rank and status of ) 0
             'field' => 'Post.key', 
             'value' => $post_key ,
               'contain' => false)
         ); 
  return $q;
    
   }
 
How can I or is it possble to do so with neighbours? The created should be
in there somewhere because they are Ordered by modified date in the
pagination. Where would I add that to the neighbough find?
 
 
 
Dave




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

  • find->neighbours help Dave Maharaj :: WidePixels.com
    • RE: find->neighbours help - SOLVED Dave Maharaj :: WidePixels.com

Reply via email to