Re: Can a plugin component auto-load a helper
you should always mention the current cakephp version I am assuming however that you use 1.3 (due to App::import) yes, you can. quite easily as a matter of fact. inside your component, all you have to do: $this-controller-helpers[] = 'MyPluginName.MyHelperName'; or $controller-helpers[] = 'MyPluginName.MyHelperName'; (depending on where you are) dont pass the helpers in this set. bad idea :) On 9 Dez., 00:51, Toby G t...@cubicmushroom.co.uk wrote: Hi there, I've been attempting to get a plugin component auto-load the plugin's helper file. I have added it to the controller's helper array, but it's not loading the helper into view (under $this-Helper), so I think that the helpers have already been loaded prior to me adding the plugin helper to the array. Is there any way of doing this safely? I did think I could App::import the helper in the plugin then pass it using $this-controller-set(), but it feels like too much of a hack, does not conform to naming conventions. Any help welcome. Thanks, T -- 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
Re: Can a plugin component auto-load a helper
Thanks for the reply, yes, sorry, it is v1.3. This is what I'd done... $this-controller-helpers['Facebook.Facebook'] = array( #'config' = $this-config, ); ... but I am getting an error in my layout where I include... $this-Facebook-init(); The error is Undefined property: View::$Facebook. Any ideas why this might be happening? T On Dec 9, 9:23 am, euromark dereurom...@googlemail.com wrote: you should always mention the current cakephp version I am assuming however that you use 1.3 (due to App::import) yes, you can. quite easily as a matter of fact. inside your component, all you have to do: $this-controller-helpers[] = 'MyPluginName.MyHelperName'; or $controller-helpers[] = 'MyPluginName.MyHelperName'; (depending on where you are) dont pass the helpers in this set. bad idea :) On 9 Dez., 00:51, Toby G t...@cubicmushroom.co.uk wrote: Hi there, I've been attempting to get a plugin component auto-load the plugin's helper file. I have added it to the controller's helper array, but it's not loading the helper into view (under $this-Helper), so I think that the helpers have already been loaded prior to me adding the plugin helper to the array. Is there any way of doing this safely? I did think I could App::import the helper in the plugin then pass it using $this-controller-set(), but it feels like too much of a hack, does not conform to naming conventions. Any help welcome. Thanks, T -- 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
Re: Can a plugin component auto-load a helper
Yeah, pay attention to what was shown above your reply - you are setting the facebook helper's name to be the key of the array but the code above your reply is very clearly not setting the key to the helpers name but using a normal numeric index. On Dec 9, 2:52 am, Toby G t...@cubicmushroom.co.uk wrote: Thanks for the reply, yes, sorry, it is v1.3. This is what I'd done... $this-controller-helpers['Facebook.Facebook'] = array( #'config' = $this-config, ); ... but I am getting an error in my layout where I include... $this-Facebook-init(); The error is Undefined property: View::$Facebook. Any ideas why this might be happening? T On Dec 9, 9:23 am, euromark dereurom...@googlemail.com wrote: you should always mention the current cakephp version I am assuming however that you use 1.3 (due to App::import) yes, you can. quite easily as a matter of fact. inside your component, all you have to do: $this-controller-helpers[] = 'MyPluginName.MyHelperName'; or $controller-helpers[] = 'MyPluginName.MyHelperName'; (depending on where you are) dont pass the helpers in this set. bad idea :) On 9 Dez., 00:51, Toby G t...@cubicmushroom.co.uk wrote: Hi there, I've been attempting to get a plugin component auto-load the plugin's helper file. I have added it to the controller's helper array, but it's not loading the helper into view (under $this-Helper), so I think that the helpers have already been loaded prior to me adding the plugin helper to the array. Is there any way of doing this safely? I did think I could App::import the helper in the plugin then pass it using $this-controller-set(), but it feels like too much of a hack, does not conform to naming conventions. Any help welcome. Thanks, T -- 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
Can a plugin component auto-load a helper
Hi there, I've been attempting to get a plugin component auto-load the plugin's helper file. I have added it to the controller's helper array, but it's not loading the helper into view (under $this-Helper), so I think that the helpers have already been loaded prior to me adding the plugin helper to the array. Is there any way of doing this safely? I did think I could App::import the helper in the plugin then pass it using $this- controller-set(), but it feels like too much of a hack, does not conform to naming conventions. Any help welcome. Thanks, T -- 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