Or you could use the Tree behaviour? That has reordering and moving built right in.
Jeremy Burns Class Outfit [email protected] http://www.classoutfit.com On 20 Aug 2010, at 21:20, Nabil Alsharif wrote: > One thing you could do is use a next_photo_id field and chain the > photos one after the other, just like a linked list. > > On Fri, Aug 20, 2010 at 12:11 PM, cricket <[email protected]> wrote: >> 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 >> > > 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 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
