On Fri, Aug 20, 2010 at 8:14 AM, Jack <[email protected]> wrote: > Hi, > > I'd like to know the best way to keep order in my photogallery. I > upload a new photo and I want it to display between the third and > fourth photo. > > There can be a field 'order' and contain numbers. I can display photos > by 'order'. Sounds good. But when I try to put a photo somewhere in > the middle, I will need to change this field (increase by 1) in almost > every record. > > Is there any other way to keep order and allow users to move photos up > and down? > > If there's not, here's another question: > how to do this: > > SQL query($photo_order, $gallery_id = php variables): > > UPDATE photos SET photo_order = (photo_order+1) WHERE photo_order >= > $photo_order AND gallery_id = $gallery_id > > using CakePHP's methods?
Take a look at either of these SortableBehaviors: http://bakery.cakephp.org/articles/view/sortablebehavior-sort-your-models-arbitrarily http://github.com/sersilva/cakephp-sortable-behavior 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 [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
