getting data from ClassRegistry
Any consequence(s) of getting viewVars from ClassRegistry? I am trying to get some data in viewVars to be initialize for my helper. Any better way (or best practice) to accomplish this? The main goal is to have my viewVars, that were loaded using AppController::beforeRender(), be accessible by my Helper. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: getting data from ClassRegistry
If on Cake 1.2: $view = ClassRegistry::getObject(view); $vars = $view-getVars(); On Apr 17, 7:47 am, Copongcopong [EMAIL PROTECTED] wrote: Any consequence(s) of getting viewVars from ClassRegistry? I am trying to get some data in viewVars to be initialize for my helper. Any better way (or best practice) to accomplish this? The main goal is to have my viewVars, that were loaded using AppController::beforeRender(), be accessible by my Helper. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
RE: getting data from ClassRegistry
Further on nate's comment: $vars = array(); $view = ClassRegistry::getObject('view'); $viewVars = $view-getVars(); foreach($viewVars as $var) { $vars[$var] = $view-getVar($var); } And 'vars' is now an indexed array with your view vars. -MI --- Remember, smart coders answer ten questions for every question they ask. So be smart, be cool, and share your knowledge. BAKE ON! blog: http://www.MarianoIglesias.com.ar -Mensaje original- De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre de nate Enviado el: Martes, 17 de Abril de 2007 12:37 p.m. Para: Cake PHP Asunto: Re: getting data from ClassRegistry If on Cake 1.2: $view = ClassRegistry::getObject(view); $vars = $view-getVars(); --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: getting data from ClassRegistry
Thanks for your reply, I did do the same suggested code. My other question is, if this is a bad practice, since I am doing this code inside a helper. Thanks. On Apr 18, 1:35 am, Mariano Iglesias [EMAIL PROTECTED] wrote: Further on nate's comment: $vars = array(); $view = ClassRegistry::getObject('view'); $viewVars = $view-getVars(); foreach($viewVars as $var) { $vars[$var] = $view-getVar($var); } And 'vars' is now an indexed array with your view vars. -MI --- Remember, smart coders answer ten questions for every question they ask. So be smart, be cool, and share your knowledge. BAKE ON! blog:http://www.MarianoIglesias.com.ar -Mensaje original- De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre de nate Enviado el: Martes, 17 de Abril de 2007 12:37 p.m. Para: Cake PHP Asunto: Re: getting data from ClassRegistry If on Cake 1.2: $view = ClassRegistry::getObject(view); $vars = $view-getVars(); --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---