Ok, this is what I did for the multiple messages. I created an array $allmessages = array();
and then on every action on the same function I pushed a message into the array like so: array_push($allmessages, 'my message here'); and at the end of the function I imploded the array and set the flash message like so: $allmessages = implode('<br />', $allmessages); $this->Session->setFlash($allmessages,'flash_failure'); // All failure messages use same template good / bad practice? Cannot think of any other easy / fast way to do it... On Mar 14, 5:29 pm, Sarpidon <epap...@gmail.com> wrote: > Thank you for your answers. > > What I did was to create a hidden input with the current timestamp > (when the edit page is generated) > > Upon save I check if the record has a greater timestamp than the one > from the hidden input and if so i redirect back with a flash message > saying "This post has already been updated by user XXX 3 minutes ago". > > I think this is a better approach as it does not lock the page rather > than check whether the record has been updated while you were editing > the page. The problem with this is that all the changes are lost. So I > am thinking of creating custom validation function that will handle > the data. > > And no I have another problem.I am trying to display multiple flash > messages and I cannot seem to be able to make it work.... > > I tried thishttp://mrphp.com.au/code/multiple-flash-messages-style-cakephp > but no lack (I am using 1.3.7 - I've made the changes for 1.3 but > still... ) > > On Mar 14, 4:13 pm, mi...@brightstorm.co.uk wrote: > > > > Ok. I guess I am looking for Optimistic Locking, > > > > has this been implemented on CakePHP? Anyone? > > > I'd add a field in your article table called editor_id and fill with the > > user id when you begin to edit. then remove the id when you save. > > > obviously this will cause all sorts of locking hell if your user fails to > > save the article which is going to bite you on whatever way you do it. > > > mikek > > > > Thanks > > > > On Mar 14, 2:50 pm, Sarpidon <epap...@gmail.com> wrote: > > >> Hi, I tried searching for it but I cannot find anything useful. I am > > >> trying to lock a page that is being edited by another user. In our > > >> site there could be many admins editing the frontpage (choosing main > > >> articles and so on), I want to be able to restrict the page to be > > >> edited by a single user every time (and display a message to users > > >> that are trying to edit the particular page . e.g. - This page is > > >> being edited by user XXXX please try again later). > > > >> Is there a preferable approach to something like this? > > > >> I guess I could store a cookie when the page is "open" and "closed" > > >> but I am not sure how many things I have to take into consideration. > > > >> Any help will be appreciated. > > > > -- > > > Our newest site for the community: CakePHP Video Tutorials > > >http://tv.cakephp.org > > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp > > > others with their CakePHP related questions. > > > > To unsubscribe from this group, send email to > > > cake-php+unsubscr...@googlegroups.com For more options, visit this group > > > athttp://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 cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php