Extending the datasource interface / How to avoid dispatchMethod in datasource.
Hello, I am implementing a datasource and I want to be able to invoke a method on a model which uses the datasource such as: $this->AModelUsingMyDatasource->my_method(); However it seems that all invocations on models are routed through the query method. I have implemented the following workaround in my datasource: function query($method, $params, &$Model) { array_unshift($params, $Model); switch ($method) { case 'my_method': case 'another_method_of_mine': return $this->dispatchMethod($method, $params); default: trigger_error("Unkown method {$method}.", E_USER_WARNING); return false; } } But to me this seems quite nasty... is there a better way to achieve this? The motivation is that i want to extend the find/read/create/delete interface of the datasource since my datasource needs some additional operations. I would like to override the code which initially routes the invocation to query(...) but cannot seem to find it in the CakePHP codebase. Cheers -Simon Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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 work with different schemas?
Hey! Take a look at PostgreSQL faq entry 4.17: http://www.postgresql.org/docs/faqs.FAQ.html I'm not sure I understand your question. What do you mean when you say schema and what do you mean when you say database? On Feb 26, 8:59 pm, persivo_cunha wrote: > Hy, > > I have something to work with schemas and PostgreSQL. I would like to > make join between tables of different schemas, but from the same > database. > > Someone can work this way? --~--~-~--~~~---~--~~ 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: Autocomplete items above input instead of below
And the answer to my own question is to add the "!important" tag so the properties aren't overridden. For reference then this is the css i ended up with: div.auto_complete { position: absolute; width: 150px; bottom: 60px !important; top: auto !important; background-color: white; border:1px solid #888; margin: 0; padding:0; z-index:200; } Thx, for input people! On Feb 9, 5:51 pm, safl wrote: > Allrighty then... > > Autocomplete() uses absolute positioning. > > The default behavior adds the attribute "top: XXpx;". > For it to behave the way i want it i simply add the attribute: > "bottom: XXpx" and remove the attribute "top: XXpx;". > > I've tried and tested it by using firebug and changing the attributes. > > This is great I found the CSS i need, hurray. > > But, the attribute "top" is constantly added dynamically and overrules > the effect of the "bottom" property. > How can work around this? > > On Feb 9, 5:08 pm, "dr. Hannibal Lecter" wrote: > > > Simply check which HTML elements are generated by the autocomplete > > (via FireBug or whatever you use), and write some CSS for those > > elements. > > > On Feb 9, 5:02 pm, safl wrote: > > > > Then let rephrase/ add the question: how do i edit the css to > > > position somewhere else? > > > > On Feb 9, 12:01 pm, Miles J wrote: > > > > > Wouldn't you just edit the css to position somewhere else? --~--~-~--~~~---~--~~ 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: Autocomplete items above input instead of below
Allrighty then... Autocomplete() uses absolute positioning. The default behavior adds the attribute "top: XXpx;". For it to behave the way i want it i simply add the attribute: "bottom: XXpx" and remove the attribute "top: XXpx;". I've tried and tested it by using firebug and changing the attributes. This is great I found the CSS i need, hurray. But, the attribute "top" is constantly added dynamically and overrules the effect of the "bottom" property. How can work around this? On Feb 9, 5:08 pm, "dr. Hannibal Lecter" wrote: > Simply check which HTML elements are generated by the autocomplete > (via FireBug or whatever you use), and write some CSS for those > elements. > > On Feb 9, 5:02 pm, safl wrote: > > > Then let rephrase/ add the question: how do i edit the css to > > position somewhere else? > > > On Feb 9, 12:01 pm, Miles J wrote: > > > > Wouldn't you just edit the css to position somewhere else? --~--~-~--~~~---~--~~ 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: Autocomplete items above input instead of below
Then let rephrase/ add the question: how do i edit the css to position somewhere else? On Feb 9, 12:01 pm, Miles J wrote: > Wouldn't you just edit the css to position somewhere else? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Autocomplete items above input instead of below
Hey People, How can i get Ajax::autoComplete() to popup suggestions above the input element instead of below it? This mockup illustrates what i want it to do: http://i679.photobucket.com/albums/vv154/safl_dk/autocomplete.png -safl --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Can i avoid using parseExtensions?
Hello People, I really like the router functionality parseExtensions, problem is just that it relies on me polluting my namespace with .xml, .rss and all that nasty stuff. I don't want data representation exposed in my webapp URI. I want clean URIs, so accessing resources in my webapp is done through resources: http://myhost/books http://myhost/books/1 etc. not: http://myhost/books.xml I would really love something equivalent to parseExtensions that set's up helpers, requesthandler, viewpath and layoutpath for me but based on headers not extensions. So i don't have to do it manually. Does this exist in cake? Will it ever? Regards, Simon --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Bindable behavior and Pagination
If I've just read the documentation a bit more careful i would have found that the first parameter set's the "reset". So calls like $this->SomeModel->restrict(false, "SomeModelRestriction"); would do the trick.. ciao... On Jan 5, 2:11 pm, safl <[EMAIL PROTECTED]> wrote: > I just upgraded to beta6311 from some old release where i used $this- > > >SomeModel->expects() > > Anyway "expects" does not seem to work properly anymore so i > refactored the code to use the behavior "Bindable" instead. But now my > problem is that i don't know how to tell: > > $this->someModel->restrict() to NOT reset the model restrictions. > > So using pagination fails horribly since the models aren't restricted. > > How do i fix this? > > regards, > Simon --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Bindable behavior and Pagination
I just upgraded to beta6311 from some old release where i used $this- >SomeModel->expects() Anyway "expects" does not seem to work properly anymore so i refactored the code to use the behavior "Bindable" instead. But now my problem is that i don't know how to tell: $this->someModel->restrict() to NOT reset the model restrictions. So using pagination fails horribly since the models aren't restricted. How do i fix this? regards, Simon --~--~-~--~~~---~--~~ 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: Extending AppController
I just tried out your suggestion, however i ended up with the same issue as just doing a "require" from bootstrap. The ModuleController can't see AppController and extend that class, the actual error msg is: "Class 'AppController' not found in module_controller.php on line 3". On Aug 2, 3:05 pm, Grzegorz Pawlik <[EMAIL PROTECTED]> wrote: > Sorry if i just write 2nd time something- thread is long and i could > miss something. > Have You tried something like: > > put in /app/vendors file called module_controller.php with definition > class ModuleController extends AppController. > Then in /config/bootstrap.php call vendor('module_controller'); > Now your ModuleController should be accessible and it extends your > AppController. And some off Your controllers can be an extension of > AppController or ModelController- just like (I think) You want to do > this. Am I right? > > On Aug 2, 12:59 pm, safl <[EMAIL PROTECTED]> wrote: > > > Hmm unfortunately no. As an example of one of the things that > > ModuleController will be doing is this: > > > ... > > var $components = array('Preferences'); > > > > function index() { > > > > $this->redirect($this->Preferences->get('App',$this->name,null,'action'),true); > > > } > > ... > > > What the code does is fetch the preferred action from a users > > preferences of any given controller and then redirect the user to that > > action. > > I used to have that index function defined in all of the controllers > > that needed this "preferred redirection", that lead to redundant code > > which was a pain to maintain. > > > But since having it in AppController would be very annoying since not > > all Controllers must behave like this for their "index". > > In some cases doing it would be very wrong (eg. the controller which > > handles login/logout stuff among others) and when using scaffolding in > > the early stages of adding something new to the project. > > > On Aug 2, 11:57 am, "Jon Bennett" <[EMAIL PROTECTED]> wrote: > > > > Hi Simon, > > > > > Hmm it just seems weird that it's not possible to go down this road.. > > > > all I'm doing is simple OO.. I'm merely extending an object.. > > > > > I've considered another strategy, if you could comment on whether this > > > > strides against Cake I would appreciate it very much. > > > > > Inspired by "Scaffold" i could do something like this: > > > > > class Module extends Object {..} > > > > > Then I implement logic in AppController that loads functions and > > > > properties from "Module" if "var $module;" is set, just like > > > > scaffolding works. > > > > Then "modules" are now a new abstract object in cake that wasn't there > > > > before, managing logic for controllers with the property of being a > > > > "module". > > > > > Is this more in compliance with cake? > > > > hmm, no, not really, at least not IMHO. A more cake way to do it would > > > be to have your usual controllers/models/views, which are _generally_ > > > mapped to your data structure (but not always), and a single > > > app_controller. I would then abstract the functionality you require > > > for each 'module' into components, and either include them all in > > > app_controller, so all controllers have access to the one they need, > > > or add the correct one to each controllers own $components array. > > > > Woudl you be able to abstract the code you need like this? > > > > Cheers, > > > > Jon > > > ps: lets keep this on-list please. > > > > -- > > > > jon bennett > > > t: +44 (0) 1225 341 039 w:http://www.jben.net/ > > > iChat (AIM): jbendotnet Skype: jon-bennett --~--~-~--~~~---~--~~ 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: Extending AppController
Hmm unfortunately no. As an example of one of the things that ModuleController will be doing is this: ... var $components = array('Preferences'); function index() { $this->redirect($this->Preferences->get('App',$this- >name,null,'action'),true); } ... What the code does is fetch the preferred action from a users preferences of any given controller and then redirect the user to that action. I used to have that index function defined in all of the controllers that needed this "preferred redirection", that lead to redundant code which was a pain to maintain. But since having it in AppController would be very annoying since not all Controllers must behave like this for their "index". In some cases doing it would be very wrong (eg. the controller which handles login/logout stuff among others) and when using scaffolding in the early stages of adding something new to the project. On Aug 2, 11:57 am, "Jon Bennett" <[EMAIL PROTECTED]> wrote: > Hi Simon, > > > > > Hmm it just seems weird that it's not possible to go down this road.. > > all I'm doing is simple OO.. I'm merely extending an object.. > > > I've considered another strategy, if you could comment on whether this > > strides against Cake I would appreciate it very much. > > > Inspired by "Scaffold" i could do something like this: > > > class Module extends Object {..} > > > Then I implement logic in AppController that loads functions and > > properties from "Module" if "var $module;" is set, just like > > scaffolding works. > > Then "modules" are now a new abstract object in cake that wasn't there > > before, managing logic for controllers with the property of being a > > "module". > > > Is this more in compliance with cake? > > hmm, no, not really, at least not IMHO. A more cake way to do it would > be to have your usual controllers/models/views, which are _generally_ > mapped to your data structure (but not always), and a single > app_controller. I would then abstract the functionality you require > for each 'module' into components, and either include them all in > app_controller, so all controllers have access to the one they need, > or add the correct one to each controllers own $components array. > > Woudl you be able to abstract the code you need like this? > > Cheers, > > Jon > ps: lets keep this on-list please. > > -- > > jon bennett > t: +44 (0) 1225 341 039 w:http://www.jben.net/ > iChat (AIM): jbendotnet Skype: jon-bennett --~--~-~--~~~---~--~~ 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: Extending AppController
On Aug 2, 9:09 am, AD7six <[EMAIL PROTECTED]> wrote: > On Aug 2, 12:58 am, safl <[EMAIL PROTECTED]> wrote: > > > And not all controllers are modules so i do not wish for all > > controllers in /controllers to extend Module controller. > > Only the ones which are "Modules". > > By doing this the code is quite easy to follow and understand which > > parts are responsible for what. > > > But my problem is the nasty solution of dumping the class definition > > into /app/app_controller.php ... > > All ideas, > > Look into plugins thx, haven't actually explored the possiblities of using plug-ins, but it seems like a very nifty that i got some other uses for except for my current problem at hand. > > >tips and hints > > For the question as posed: > > require_once(APP.'module_controller.php'); > Class WidgetController extends ModuleController { > ... etc. I might just end up doing this, It's not all that pretty but it does make a better solution than my current. Thx for the input! > > > are very welcome! > > 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 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: Extending AppController
And not all controllers are modules so i do not wish for all controllers in /controllers to extend Module controller. Only the ones which are "Modules". By doing this the code is quite easy to follow and understand which parts are responsible for what. But my problem is the nasty solution of dumping the class definition into /app/app_controller.php ... All ideas, tips and hints are very welcome! On Aug 2, 12:54 am, safl <[EMAIL PROTECTED]> wrote: > thx for all the replies. > > I should have said that i already tried placing a > module_controller.php in /app/, that didn't work. > When i then let my controllers inside of /controllers extend > ModuleController, i get the error "class not found or something like > that". > Problem is that module_controller.php in /app/module_controller.php > (right next to app_controller.php) is not the the include path and not > loaded at the right "time" as the basics.php in /cake does. > I tried fixing this by adding the /app path to php's include path > inside of /app/config/bootstrap.php but that didnt work either. > > My current solution is that i have simply dumped the class definition > inside of /app/app_controller.php. > Now i don't even have to say this, but that is one ugly solution :) > > To be more clear about what i wish to achieve. I wan't my > ModuleController to be an extension of AppController. > > As a design point of view this makes AppController a more "abstract" > or "general" class than ModuleController. The AppController contains > everything that is required for an "Application Controller", the > "Module Controller" extends this functionality and properties and > implements stuff which is only needed for "Modules". > > The application I'm doing is fairly big. I got 11 "Modules" > integrated. (Helpdesk, Surveillance, Inventory Management etc..). > > Therefore i really wan't to split the controller logic into smaller > chunks. > > On Aug 1, 9:33 pm, francky06l <[EMAIL PROTECTED]> wrote: > > > Hi LS, did not think about this .. but I safi wants to make different > > classes inherit from a bunch of "specialized" AppControler, this not > > the way .. If all classes inherit from "ModelController", better to > > "enhance" AppController itself .. > > This is my 2 cents on top :-) > > > On Aug 1, 9:27 pm, LS <[EMAIL PROTECTED]> wrote: > > > > My 2 cents: > > > Make model_controller.php in the same level as app_controller.php > > > make this model_controller declaration: > > > class ModelController extends Controller {} > > > and this app_controller declaration: > > > class AppController extends ModelController {} > > > > This way, you won't have to change any controller in your application. > > > > Regards, > > > - LS > > > > On Aug 1, 4:11 pm, francky06l <[EMAIL PROTECTED]> wrote: > > > > > I think you can place your module_controller.php file at same level of > > > > app_controller.php. This should work without problem having you > > > > ModuleController extending AppController and other controller > > > > extending ModuleController. > > > > > On Aug 1, 5:54 pm, safl <[EMAIL PROTECTED]> wrote: > > > > > > Hello, > > > > > > I would like to have different controller types that are extends of > > > > > the basic AppController. > > > > > > Let's say i got "class ModuleController extends AppController" where > > > > > should i then place my "module_controller.php" so my controllers in / > > > > > controllers be able to: "class WhateverController extends > > > > > ModuleController" instead of "class WhateverController extends > > > > > AppController"? > > > > > And without messing with the Cake installation. > > > > > > The thing is I got a bunch of logic in AppController in beforeFilter > > > > > and the use of a couple of components and stuff like that but I only > > > > > wan't a subset of my controllers in /controller to inherit these > > > > > properties. > > > > > > And other controllers will very soon like to inherit some other > > > > > properties of some other controller type. > > > > > > regards, > > > > > Simon --~--~-~--~~~---~--~~ 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: Extending AppController
thx for all the replies. I should have said that i already tried placing a module_controller.php in /app/, that didn't work. When i then let my controllers inside of /controllers extend ModuleController, i get the error "class not found or something like that". Problem is that module_controller.php in /app/module_controller.php (right next to app_controller.php) is not the the include path and not loaded at the right "time" as the basics.php in /cake does. I tried fixing this by adding the /app path to php's include path inside of /app/config/bootstrap.php but that didnt work either. My current solution is that i have simply dumped the class definition inside of /app/app_controller.php. Now i don't even have to say this, but that is one ugly solution :) To be more clear about what i wish to achieve. I wan't my ModuleController to be an extension of AppController. As a design point of view this makes AppController a more "abstract" or "general" class than ModuleController. The AppController contains everything that is required for an "Application Controller", the "Module Controller" extends this functionality and properties and implements stuff which is only needed for "Modules". The application I'm doing is fairly big. I got 11 "Modules" integrated. (Helpdesk, Surveillance, Inventory Management etc..). Therefore i really wan't to split the controller logic into smaller chunks. On Aug 1, 9:33 pm, francky06l <[EMAIL PROTECTED]> wrote: > Hi LS, did not think about this .. but I safi wants to make different > classes inherit from a bunch of "specialized" AppControler, this not > the way .. If all classes inherit from "ModelController", better to > "enhance" AppController itself .. > This is my 2 cents on top :-) > > On Aug 1, 9:27 pm, LS <[EMAIL PROTECTED]> wrote: > > > My 2 cents: > > Make model_controller.php in the same level as app_controller.php > > make this model_controller declaration: > > class ModelController extends Controller {} > > and this app_controller declaration: > > class AppController extends ModelController {} > > > This way, you won't have to change any controller in your application. > > > Regards, > > - LS > > > On Aug 1, 4:11 pm, francky06l <[EMAIL PROTECTED]> wrote: > > > > I think you can place your module_controller.php file at same level of > > > app_controller.php. This should work without problem having you > > > ModuleController extending AppController and other controller > > > extending ModuleController. > > > > On Aug 1, 5:54 pm, safl <[EMAIL PROTECTED]> wrote: > > > > > Hello, > > > > > I would like to have different controller types that are extends of > > > > the basic AppController. > > > > > Let's say i got "class ModuleController extends AppController" where > > > > should i then place my "module_controller.php" so my controllers in / > > > > controllers be able to: "class WhateverController extends > > > > ModuleController" instead of "class WhateverController extends > > > > AppController"? > > > > And without messing with the Cake installation. > > > > > The thing is I got a bunch of logic in AppController in beforeFilter > > > > and the use of a couple of components and stuff like that but I only > > > > wan't a subset of my controllers in /controller to inherit these > > > > properties. > > > > > And other controllers will very soon like to inherit some other > > > > properties of some other controller type. > > > > > regards, > > > > Simon --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Extending AppController
Hello, I would like to have different controller types that are extends of the basic AppController. Let's say i got "class ModuleController extends AppController" where should i then place my "module_controller.php" so my controllers in / controllers be able to: "class WhateverController extends ModuleController" instead of "class WhateverController extends AppController"? And without messing with the Cake installation. The thing is I got a bunch of logic in AppController in beforeFilter and the use of a couple of components and stuff like that but I only wan't a subset of my controllers in /controller to inherit these properties. And other controllers will very soon like to inherit some other properties of some other controller type. regards, Simon --~--~-~--~~~---~--~~ 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: Reusing view code
This seems like the thing to do. I have one issue... only the first $this->render(...,'ajax'); Is actually rendered, the rest arent? In my controller i got for each action: ... if ($this->RequestHandler->isAjax()) $this->RequestHandler->renderAs($this, 'ajax'); ... So the action works on It's own with default layout, and the first action i request is rendered "inline" so what am i missing here? On Jul 29, 12:05 am, rtconner <[EMAIL PROTECTED]> wrote: > I think this would be likely best case > > $this->viewPath = 'anothercontrollers_folder'; // not needed if file > is in controllers viewPath already > $this->render('view_file', 'ajax'); // don't use extention ('ajax' is > the layout name) > > Also read up on RequestHandler, it might help you automate this, maybe > overwrite beforeRender in app_controller. > > On Jul 28, 12:16 pm, safl <[EMAIL PROTECTED]> wrote: > > > Hello, > > > I'm struggling with my views. I can't seem to find the proper way to > > reuse view code so what i am doing now is a very nasty: > > > viewPath.'/set_setting.ctp'); ?> > > > I am guessing that this is not the intended way to do It but i can't > > seem to figure out how i am supposed to resuse my views. > > > The thing is, I got a the controller action -> "user_settings/ > > mySettings'. The view "my_settings.ctp", contains several ajax forms, > > each with different actions ('setSetting', 'changePassword', > > 'setInformation' etc.). > > > These actions need a view to display the form after perform the user > > submission of data and reload the form properly afterwards. > > So If i don't do the above include of my forms i would be forces to > > have the code in both my_settings.ctp and in each individual action > > view. > > > Does anybody have a better solution than the above require/include? > > > regards, > > Simon --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Reusing view code
Hello, I'm struggling with my views. I can't seem to find the proper way to reuse view code so what i am doing now is a very nasty: viewPath.'/set_setting.ctp'); ?> I am guessing that this is not the intended way to do It but i can't seem to figure out how i am supposed to resuse my views. The thing is, I got a the controller action -> "user_settings/ mySettings'. The view "my_settings.ctp", contains several ajax forms, each with different actions ('setSetting', 'changePassword', 'setInformation' etc.). These actions need a view to display the form after perform the user submission of data and reload the form properly afterwards. So If i don't do the above include of my forms i would be forces to have the code in both my_settings.ctp and in each individual action view. Does anybody have a better solution than the above require/include? regards, Simon --~--~-~--~~~---~--~~ 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: Join fails across multiple databases with HABTM
ok, I didn't search the group properly. The thing I'm requesting seems not to be supported, what people seem to do instead and which I ended up doing was adding a third class for association. Meaning instead of having two models with HABTM. I now have two Models with hasMany (originally HABTM) and the third ''new'' class with belongsTo associations. By creating the join model one other thing is achieved, extra fields (the ones apart from the ones associating the two tabels) can now be accessed. Nate on model setup: http://groups.google.com/group/cake-php/browse_thread/thread/bef70558f7854732/6363603e04fcee68?lnk=st&q=&rnum=10#6363603e04fcee68 On Jul 24, 10:23 pm, safl <[EMAIL PROTECTED]> wrote: > Hey, > > The case is: > I've got 2 models(Customer and Server), one is using $useDbConfig = > 'crm' the other is using $useDbConfig = 'monitoring'. > Each DB configuration specifies connection to it's own database (crm > and monitoring). > > I've got HABTM between these to models, and I need HABTM, but when > querying i get "Table doesn't exist" since the join table only lives > in one of the databases. All other associations seems to work across > databases. > > My question is: > > How can I in the "$hasAndBelongsToMany" definition specify that the > join table is living in a different database? > > regards, > Simon --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Join fails across multiple databases with HABTM
Hey, The case is: I've got 2 models(Customer and Server), one is using $useDbConfig = 'crm' the other is using $useDbConfig = 'monitoring'. Each DB configuration specifies connection to it's own database (crm and monitoring). I've got HABTM between these to models, and I need HABTM, but when querying i get "Table doesn't exist" since the join table only lives in one of the databases. All other associations seems to work across databases. My question is: How can I in the "$hasAndBelongsToMany" definition specify that the join table is living in a different database? regards, Simon --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
CakePHP + Xdebug + Vim
Hey, I'm trying to use Vim and Xdebug to debug my CakePHP apps. The setup is functioning, however i have huge problems getting to my breakpoint All is good if i wanted to debug index.php but i want to debug stuff in my controllers and views but the execution path very very very long. And i need to find the right path to step into but it takes forever to through every execution. Does anybody have experience in using the setup? How can i quickly goto my breakpoint? regards, Simon --~--~-~--~~~---~--~~ 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: Using redirect on https
I'm sry for spamming the list. The problem had nothing to do with CakePHP but it was a misconfiguration of Apache-SSL. Somehow i was browsing with https url and got the "Accept the certificate" popup but the actual traffic was http not https... very weird. Anyway some tingling with virtualhost configuration and it now works properly. cheers On Jun 20, 3:26 pm, safl <[EMAIL PROTECTED]> wrote: > My app runs on a server that only runs https no http. When i do a: > > $this->redirect('controller/action', null, true); > > The created url is: > > http://cake.devenvironment.local/controller/action/ > > The obvious error is that the 's' is missing on the url, what am i > doing wrong here? > Or what is Cake doing wrong and how can i fix it? I don't wan't to > hardcode the path into the redirect since the application is running > or different machines all of them https. > > cheers, > safl --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Using redirect on https
My app runs on a server that only runs https no http. When i do a: $this->redirect('controller/action', null, true); The created url is: http://cake.devenvironment.local/controller/action/ The obvious error is that the 's' is missing on the url, what am i doing wrong here? Or what is Cake doing wrong and how can i fix it? I don't wan't to hardcode the path into the redirect since the application is running or different machines all of them https. cheers, safl --~--~-~--~~~---~--~~ 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: Associations cross databases
Grant Cox's reply solved my issue. Having a db config setup with "persistent = false" is REQUIRED for it to work (as nate states) but it is not sufficient. Login/pass needs to be different (at least with MySQL DBMS) for each dbconfig as Grant Cox states. Then associations across databases works. My issue is solved, i am very thankful! This great journey of CakePHP continues, I'm loving it :) On Feb 21, 5:01 am, "nate" <[EMAIL PROTECTED]> wrote: > All you have to do is set the 'persistent' key to false in both > connections, and the driver will set the $new_link parameter itself. > > On Feb 20, 6:53 pm, "Grant Cox" <[EMAIL PROTECTED]> wrote: > > > It should just work - just make sure you have the appropriate > > connections in your app/config/database.php, and that each model has > > the appropriate $useDbConfig set. > > > The only thing that can mess it up, is a bug, apparently in MySQL, > > where connections to multiple databases need to have different > > usernames and passwords. So, in your app/config/database.php, each > > connection needs to connect with a different username/password. > > > I found out about this from someone on the IRC channel (probably > > PhpNut) some months ago, but I didn't keep a note of any urls for more > > information... --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Associations cross databases
Hey Bakers! Is it possible to utilize cakePHP for setups with cross database joins? F.ex. 3 Databases: "crm", "monitoring", "helpdesk". I then want to find a specific Customer (stored in "crm") join with all associated "Host" (stored in "monitoring"), and lastly join "Ticket" (stored in "helpdesk"). In plain vanilla it would be something like: SELECT h.*, c.*, t.* FROM monitoring.hosts AS h, crm.customers AS c, helpdesk.tickets WHERE c.id = 'some_int' AND h.cust_id = c.id AND t.cust_id = c.id I've tried using "useDbConfig" and playing around with my database configuration (persistent connection) But i get errors like "SQL Error in model xxx:". I then tried specifying a table prefix (thinking appending the database would be a fix) but then i just got errors like "No Database table for model XXX (expected "myPrefix.xxx"), create it first.". I found in the manual that it's possible to perform custom SQL in the model (like the plain vanilla sql above), but since my entire app is split into subsystems on DB level then i would not really gain much advance in using cakePHP since i wouldn't get all those nifty features that i am longing :) And the short version is: Please help me! Is it possible to utilize cakePHP for setups with cross database joins? Thanks, Simon --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---