Re: store array into session
As a last resort, you could always use PHP's serialize and unserialize functions to convert the array into a string and back. I think there must be a better way to do it, but I've got no ideas about how currently. If you're building a busy site, then using serialize is performance wise not the best option. On 28 aug, 10:31, persianshadow persiansha...@gmail.com wrote: hi i want store array of ids into session but i explore API of cakephp and see $value ( Session-write($name,$value) ) only get string , i need it for store id of items that user select . anybody have idea for do this ? thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com 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?hl=en -~--~~~~--~~--~--~---
Re: Passing data from the view to the controller
If your really want to secure that kind of stuff, you could add an extra hidden field with an encrypted version of the article ID: ?=$input-hidden('postIdKey',array('value'=sha1(Configure::read('Security.salt').$post['Post']['id'])))? and then after submission check if this key is correct: if ($data['Post']['postIdKey'] == sha1(Configure::read('Security.salt').$data['Post']['id'])) Miles J wrote: Just grab the id from the actions ID argument. -- View this message in context: http://www.nabble.com/Passing-data-from-the-view-to-the-controller-tp25180826p25186878.html Sent from the CakePHP mailing list archive at Nabble.com. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com 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?hl=en -~--~~~~--~~--~--~---
Re: how to add css to individual view.
Hi, If you want to include extra.css to your view, add this code to your view file: ?php $html-css('extra',null,null,false); ? In your layout, make sure that there's this line somewhere between the head tags (already included in the default layout): ?php echo $scripts_for_layout; ? Read the CakePHP book for more info: http://book.cakephp.org/view/831/css Have fun! Melgior. ruchika batra wrote: hiI am a beginner.i want to add css to the individual view i have created.please help me how to do that.thanks in advance. -- View this message in context: http://www.nabble.com/how-to-add-css-to-individual-view.-tp25191224p25191569.html Sent from the CakePHP mailing list archive at Nabble.com. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com 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?hl=en -~--~~~~--~~--~--~---
Re: Joining two arrays to use in a Select box with the formhelper
Hi, That's easy. You can use array_unshift to add an entry to the start of an array. Just add this to your controller: $isps = $this-Consultation-Isp-find('list'); array_unshift($isps, array(none=None of the above)); And you should be all set. Greets, Melgior. On 27 aug, 19:52, channel5 edd.daw...@comptonsolutions.com wrote: Hi I have a select box that is populated by a database: $isps = $this-Consultation-Isp-find('list'); and then output using the form helper in the view: echo $form-select('isp_id', $isps, array('selected' = $ispselect), array(), 'select your supplier'); This works fine, however what I want to do is have an extra option inserted between the empty element 'select your supplier' and the first item from the array $isp , this option would allow me to have the option selected be none of the below. I can't for the life of me figure out how to do this, can anyone give me any pointers? Thanks very much c5 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com 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?hl=en -~--~~~~--~~--~--~---
Re: Joining two arrays to use in a Select box with the formhelper
Yes, you could use array_push() indeed, although you don't even need to. The PHP manual recommends this method if you want to add just one entry: $isps['none'] = None of the above; This way 'none' will show up as last in the dropdown, as long as you put the line after -find(). On 27 aug, 20:52, DigitalDude e.blumsten...@googlemail.com wrote: Hey, nice one, didn't know about that. Would it be correct for an added value at the END of the array to use array_push() ? On 27 Aug., 20:48, Melgior melg...@hotmail.com wrote: Hi, That's easy. You can use array_unshift to add an entry to the start of an array. Just add this to your controller: $isps = $this-Consultation-Isp-find('list'); array_unshift($isps, array(none=None of the above)); And you should be all set. Greets, Melgior. On 27 aug, 19:52, channel5 edd.daw...@comptonsolutions.com wrote: Hi I have a select box that is populated by a database: $isps = $this-Consultation-Isp-find('list'); and then output using the form helper in the view: echo $form-select('isp_id', $isps, array('selected' = $ispselect), array(), 'select your supplier'); This works fine, however what I want to do is have an extra option inserted between the empty element 'select your supplier' and the first item from the array $isp , this option would allow me to have the option selected be none of the below. I can't for the life of me figure out how to do this, can anyone give me any pointers? Thanks very much c5 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com 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?hl=en -~--~~~~--~~--~--~---
Re: Where do you put code needed in controllers and models?
Most people seem to be fan of 'fat' models: put all your code that handles data in your models and keep your controllers thin and easy to read. Since your function parses data I would put it into the model indeed. If you need it in every model/controller, you can add it to app_model. You could also create a behaviour (the model's equivalent of a component). On 27 aug, 20:57, Nancy nancy.milli...@gmail.com wrote: Would a component be the right thing to use? For instance, I have a routine that parses data and I need it both in models and controllers. How do you include a component in model? I guess I can always access the model from the controller, so perhaps app_model is a better choice. Any opinions welcome! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com 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?hl=en -~--~~~~--~~--~--~---