cake-php@googlegroups.com
[Top] [All Lists]

Re: Recursive Pagination

Subject: Re: Recursive Pagination
From: WebRenovator
Date: Wed, 24 Feb 2010 22:39:01 -0800 PST
Hi Jesse

Have you tried

$this->set('categories', $this->paginate('Category', array('Item.name
LIKE '%the%')));

If I remember correctly cake automatically adds an '=' when you use it
like you had. I.e.
array('Item.name LIKE'=>'%the%') will produce the following sql:
WHERE Item.name LIKE = '%the%'

If you have your debug level set to 2 you should see the sql output
which might help you get your query into the state you need it.

On Feb 24, 7:41 pm, Jesse <goo...@xxxxxxxxxxxxxxxx> wrote:
> Hi,
>
> I am working on converting an existing script from classic php (its a
> mess) to cakephp for a more clean cut,
> lean running application. I am working on a view that shows Categories
> and Items with recursive of 1.
>
> I have managed to get my category view to show all the products under
> each category with pagination
> however, I need to filter the items being shown but I am not sure how
> to do this.
>
> I tried adding this in my category controller to filter by item:
> $this->set('categories', $this->paginate('Category', array('Item.name
> LIKE' => '%the%')));
>
> but i get this error:
> SQL Error: 1054: Unknown column 'Item.name' in 'where clause'
>
> Can anyone point me in the right direction to get this working?
>
> DATA EXAMPLE:
>
> Alice Wonderland Belt Buckles
> --------------------------------------------------------------------------------
>
> Item(s):
> Who Are You? Buckle
> Through The Looking Glass Buckle
> Alice & Humpty Buckle
> Cheshire-Cat Buckle
> The Mad Tea Party Buckle
> Tweedle Dee & Tweedle Dum Buckle
> The White Rabbit Buckle
> Nothing But A Pack Of Cards Buckle
> Art Buckles
>
> --------------------------------------------------------------------------------
>
> Item(s):
> The Scream
> Vitruvian Man Buckle
> Mona Lisa Buckle
> Pattern Belt Buckle
> Pattern Belt Buckle
> Creation of Adam
> A Starry Night Picture Buckle
> The Last Supper Buckle
> Moon Man Buckle
> Rose Belt Buckle
> American Watch Co. Buckle
> Automotive Belt Buckles
>
> --------------------------------------------------------------------------------
>
> Item(s):
> Cadillac Emblem Belt Buckle
> Cadillac Emblem Belt Buckle
> Truck Drivers Move the Nation Buckle
> Corvette Classics silver Belt Buckle
> Red '57 Chevy Belt Buckle
> Silver Chevy grille Belt Buckle
> Chevy Belt Buckle
> 1959 Cadillac Classic Belt Buckle
> Cadillac Belt Buckle
> Yellow school bus Belt Buckle
> Cement Truck Belt Buckle
> Red Tow Truck Belt Buckle
> Dump Truck Belt Buckle
> Blue Semi Truck Belt Buckle
> Corvette Belt Buckle
> Red and Black Train Belt Buckle
> 55 Chevrolet Belt Buckle
> Silver Chevy sign Belt Buckle
> Chevy Buckle
> Tractor Trailer Belt Buckle
> Fire Fighter Truck Belt Buckle
> Bulldozer Belt Buckle
> Train Locomotive Brass Buckle
> Truck Belt Buckle
> Helicopter Belt Buckle
> Chevy Trucks Belt Buckle
> 1994 Camaro Z28 Blue background
> Chevy Z28 Belt Buckle
> Van Belt Buckle
> Peterbilt Belt Buckle
> Peterbilt Belt Buckle
> American Trucker Buckle
> Truckin Aint For Sissies Buckle
> Big Rig Buckle
> Train Belt Buckle
> Kenworth Belt Buckle
> Kenworth Trucks Buckle
> King Of The Road Buckle
> Peterbilt Trucks Buckle
> Hudson Steam Locomotive Buckle
> Cadillac Belt Buckle
> Chevrolet Corvette Circle Belt Buckle
> Chevy Grille Buckle
> Band Belt Buckles

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@xxxxxxxxxxxxxxxx
To unsubscribe from this group, send email to
cake-php+unsubscribe@xxxxxxxxxxxxxxxx For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

<Prev in Thread] Current Thread [Next in Thread>