Well I'm not sure if you can do it with neighbors...

This would probably work though ..

$this->set('neighbors',array(
 $this->Build->find('first',array(
 'conditions'=>array(
 'Build.year_built < '=>$build['Build']['year_built']
 ),
 'order'=>array('Build.year_built desc,Build.title desc')
 )
 ),
  $this->Build->find('first',array(
 'conditions'=>array(
 'Build.year_built > '=>$build['Build']['year_built']
 ),
 'order'=>array('Build.year_built asc,Build.title asc')
 )
 )
 )
   );

On Tue, Aug 16, 2011 at 7:24 PM, Krissy Masters
<[email protected]>wrote:

>  Yeah the plural was typo, but the A,B,C is representing "title" field
> which could be anything entered as a title by the user.****
>
> ** **
>
> *From:* [email protected] [mailto:[email protected]] *On
> Behalf Of *Teddy Zeenny
> *Sent:* Tuesday, August 16, 2011 1:11 PM
> *To:* [email protected]
> *Subject:* Re: Neighbors Help****
>
> ** **
>
> What is the letters' field name ? (ie. A, B...)****
>
> ** **
>
> PS: I think you mean $this->Build->find , not $this->Builds->find****
>
> On Tue, Aug 16, 2011 at 6:31 PM, Krissy Masters <
> [email protected]> wrote:****
>
> I am trying to get my neighbors query based in my 'year_built' value (2001
> to 2011 as values) and placed in alphabetical order****
>
>  ****
>
> So if you were viewing A 2001 next would be possibly B 2001 with prev null
> ****
>
> So if listed would appear like****
>
>  ****
>
> A 2001****
>
> B2001****
>
> D 2002****
>
> A 2003****
>
> G2005****
>
> Z2005****
>
> D2006****
>
> L2007****
>
> And so on so they are grouped in years and sorted alphabetically.****
>
>  ****
>
> I have $this->set('neighbors',$this->Builds->find(****
>
>
> 'neighbors', array('field' => 'year_built', 'value' =>
> $build['Build']['year_built'], ****
>
>
> 'conditions' => array('published' => 1))));****
>
>  ****
>
> Any help would be 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
> [email protected] 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
> [email protected] 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
> [email protected] 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
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to