> Why not just move this (surely generic) plugin element to your app > view element folder?
Because the plugin contains much more than just the element: it contains a model, views and a controller as well. My plan is to use renderElement to get the main view of each widget to load quickly (using your method), and then load the edit view of a widget after the user presses an ajax link. The edit view will reside in the plugins folder. The reason I really would like to have everything in one folder, is because this is the only part of my app that users can contribute to: they can write new widgets, and other users should be able to easily install them by just dropping the widget folder into the plugins folder. I want users with no knowledge of Cake to be able to easily expand the app's functionality, instead of saying: drop this file here, and that file there, an another one there... I know this is the Cake way of working, and it's great for me as a programmer, but I don't want to bother users with technicalities. So -just for this tiny part of the app- I'd like to override the default path of elements and components. I've seen this being done in the themeable view class (http://abing.gotdns.com/posts/2006/themeable- view-class-for-cakephp/) which I use in my app, so would it take a similar approach to add a path for cake to look for elements? Something like: if (file_exists(APP . 'plugins' . DS . $this->plugin . DS . 'views' . DS . 'elements' . DS . $name . $this->ext)) { $elementFileName = APP . 'plugins' . DS . $this->plugin . DS . 'views' . DS . 'elements' . DS . $name . $this->ext; } I am aware that what I want goes against the Cake framework, but as I explained above, in this case I feel I have a good reason to. So can someone please explain how to roughly accomplish this? I can then decide if I want to do it or not. On 3 mei, 13:55, AD7six <[EMAIL PROTECTED]> wrote: > On 3 mayo, 02:48, gerbenzomp <[EMAIL PROTECTED]> wrote: > > > A while ago AD7six told me that it is possible to override the default > > path of an element when calling renderElement(). Up to now, it hasn't > > become clear to me how to change that path, and what the path should > > look like. > > > When an element resides in app/plugins/my_plugin/views/elements/ > > my_element.thtml, how would I point to that location using > > renderElement(); ? > > Hi gerbenzomp, > > If something is a bit difficult to do, it's wise to think if you are > trying to do something a 'wrong' way. > > You can easily make cake look for an element in a subfolder of where > it would normally look (echo $this->renderElement('folder/subfolder/ > file');) it is very difficult to make cake look for an element in a > plugin, when you are not in it unless you write the code to do so > yourself. > > Why not just move this (surely generic) plugin element to your app > view element folder? > > hth, > > AD --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" 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 -~----------~----~----~----~------~----~------~--~---
