Re: Themed assets not loading on production server
Update: Layouts and other View files will load properly from the Themed folder. It's only assets like css and js that don't load. So it must have something to do with the dispatcher? PHP 5.2.17 is on dev server and 5.2.14 on production server. -Corie On Nov 9, 9:42 am, Corie corie.sl...@gmail.com wrote: I'm using the Theme viewClass and loading assets through a Themed folder and everything is working well on my local development server, but when taking it online nothing is being loaded from the Themed folder and it's getting a 404 when trying the default locations. Here's the folder structure: View -Themed --default ---webroot css -admin.css and it's not finding admin.css here so it looks for webrootcssadmin.css which doesn't exist. Anyone have any suggestions as to how to debug? -- 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: Themed assets not loading on production server
Fixed! Theme folder names must always be CamelCased. The reason it worked on development server is because of case insensitivity. That always gets me. -Corie On Nov 10, 8:41 pm, Corie corie.sl...@gmail.com wrote: Update: Layouts and other View files will load properly from the Themed folder. It's only assets like css and js that don't load. So it must have something to do with the dispatcher? PHP 5.2.17 is on dev server and 5.2.14 on production server. -Corie On Nov 9, 9:42 am, Corie corie.sl...@gmail.com wrote: I'm using the Theme viewClass and loading assets through a Themed folder and everything is working well on my local development server, but when taking it online nothing is being loaded from the Themed folder and it's getting a 404 when trying the default locations. Here's the folder structure: View -Themed --default ---webroot css -admin.css and it's not finding admin.css here so it looks for webrootcssadmin.css which doesn't exist. Anyone have any suggestions as to how to debug? -- 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
Themed assets not loading on production server
I'm using the Theme viewClass and loading assets through a Themed folder and everything is working well on my local development server, but when taking it online nothing is being loaded from the Themed folder and it's getting a 404 when trying the default locations. Here's the folder structure: View -Themed --default ---webroot css -admin.css and it's not finding admin.css here so it looks for webrootcssadmin.css which doesn't exist. Anyone have any suggestions as to how to debug? -- 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
requestAction array based urls inside plugin
Regarding the new array based URLs in a requestAction, can this work for plugins as well? I tried with and without a plugin key and got errors. The requestAction works when using the old style string URL. $data = $this-requestAction( array( 'plugin' = 'pluginName', 'controller' = 'controllerName', 'action' = 'index' ) ); -- 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
2.0 AclNode not finding proper model for Aro
I installed a fresh copy of 2.0.0-RC2 and set up a simple UsersController and Model, and enabled Auth and Acl Components. I can log in, but when trying to access any page requiring an Acl-check() I get the following error. Warning (512): AclNode::node() - Couldn't find Aro node identified by Array ( [Aro0.model] = id [Aro0.foreign_key] = 1 ) [CORE/Cake/Model/AclNode.php, line 179] The Aro model should be User. A similar ticket was reported in Lighthouse back in May and supposedly fixed: http://cakephp.lighthouseapp.com/projects/42648/tickets/1749-cakephp-20-auth-user-breaks-acl-lookups-when-auth-authorize-is-set-to-actions I tried setting $this-Auth-authorize to crud and actions and got the same result. Any clue what I might be missing? -- 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: Bootstrapping in 1.3
Hey, that works. Thanks so much. I was trying to use the APP_PATH constant which wasn't actually set. -Corie On Sep 14, 12:37 am, Dr. Loboto drlob...@gmail.com wrote: For such installation you must provide more precise paths to App::build: App::build( array ( 'controllers' = array ( CONTROLLERS, CAKE_CORE_INCLUDE_PATH.DS.'shares'.DS.'controllers'.DS, ), ) ); And yes, Cake 1.2 have different behavior and place local path always first in line (and it seems much more reasonable for me personally). On Sep 13, 9:20 pm, Corie corie.sl...@gmail.com wrote: The bootstrap in 1.3 doesn't seem to function like it did in 1.2, where I could use a shared directory to use controllers, models, etc. when the local app/ one was not available. Now when I use the same method, the shared file is always used, regardless of the existence of the local one. Here's what I have in boostrap.php: App::build(array( 'controllers' = array(CAKE_CORE_INCLUDE_PATH . DS . 'shares' . DS . 'controllers' . DS) )); I used pages_controller.php to test. The /shares/controllers/ pages_controller.php is always used even if /app/controllers/ pages_controller.php exists. I also tried adding /app/controllers/ to the controllers array first and second and got the same result. Bootstrapping still works to pull in extra files, but has it really lost this great feature? -Corie 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: SEOable Plugin
It's a good idea. It's definitely something that is needed on larger sites where SEO is important and setting the title / description / keywords is not feasible in one controller at a time. I created, for my sites, a Meta controller, which has an initialization method that collects all views and adds them to a database table with default title and description. You then access the Meta page through an Admin Panel to reword everything. I think the initialization method could use some reworking, but everything seems to function okay. Maybe it could be turned into a plugin too, for easier integration. I'll share the code in case someone wants it. Where should I put it? -Corie On Sep 13, 4:48 pm, @gbrlgon gbrl...@gmail.com wrote: Hi, i'm thinking on create a SEOable Plugin, to set title/description/ facebook image/etc from an admin interface. This data could be set for each controller widely o for specific actions or records(views). I haven´t found anything related to this subject. What do you thing about the idea? Regards, Gabriel 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
Bootstrapping in 1.3
The bootstrap in 1.3 doesn't seem to function like it did in 1.2, where I could use a shared directory to use controllers, models, etc. when the local app/ one was not available. Now when I use the same method, the shared file is always used, regardless of the existence of the local one. Here's what I have in boostrap.php: App::build(array( 'controllers' = array(CAKE_CORE_INCLUDE_PATH . DS . 'shares' . DS . 'controllers' . DS) )); I used pages_controller.php to test. The /shares/controllers/ pages_controller.php is always used even if /app/controllers/ pages_controller.php exists. I also tried adding /app/controllers/ to the controllers array first and second and got the same result. Bootstrapping still works to pull in extra files, but has it really lost this great feature? -Corie 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: Bootstrapping in 1.3
In my server environment there are several sites. Most don't need much customization and use the same shared controller. But some do need customization and so I make a local copy of the controller and make the modifications. I need the bootstrap to load the local file if it exists, otherwise load the shared file. -Corie On Sep 13, 1:10 pm, Miles J mileswjohn...@gmail.com wrote: Enlighten me, but why would you need a shared and local version of the same controller? It should be one or the other. On Sep 13, 7:20 am, Corie corie.sl...@gmail.com wrote: The bootstrap in 1.3 doesn't seem to function like it did in 1.2, where I could use a shared directory to use controllers, models, etc. when the local app/ one was not available. Now when I use the same method, the shared file is always used, regardless of the existence of the local one. Here's what I have in boostrap.php: App::build(array( 'controllers' = array(CAKE_CORE_INCLUDE_PATH . DS . 'shares' . DS . 'controllers' . DS) )); I used pages_controller.php to test. The /shares/controllers/ pages_controller.php is always used even if /app/controllers/ pages_controller.php exists. I also tried adding /app/controllers/ to the controllers array first and second and got the same result. Bootstrapping still works to pull in extra files, but has it really lost this great feature? -Corie 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
Order of merged paths in App::build (bootstrapping in 1.3)
From the API: App::build -- Build path references. Merges the supplied $paths with the base paths and the default core paths. How can I change the order in which the paths are merged, and thus called? In 1.2 I used bootstrapping to share controllers, models, views, etc. across multiple applications, but I could still override the shared file by creating one locally in an app. The bootstrapping method would look first in the base path (app), second in the supplied $controllerPaths array, and third in the core library. Now in 1.3 it seems the order is supplied path in App::build, then base (app), then in the core. Any idea how to change this? -Corie 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: customizing error messages from form helper
You can change the class 'error-message' to whatever you want by setting it in the options array of your $form-input call: $form-input('field', array('error' = array('class' = 'custom-error- class'))); Or you could take the automatic error out of the input div and put it on its own where you have more control: ?php echo $form-input('field', array('error' = false));? div class=error-message'?php echo $form-error('field', array ('class' = 'nested-div'));?/div -Corie On Feb 28, 11:15 pm, horatio bnab...@says.mu wrote: two questions-- the default class returned from error() within the html helper is error-message. how do i override this in my controller? more importantly, how can i inject some html content inside the error div after a failed form validation? right now its: div class=error-messageerror message here/div i would like it to hypothetically be: div class=error-messagediv class=nested-diverror message here/div/div is this possible sanely? -- View this message in context:http://www.nabble.com/customizing-error-messages-from-form-helper-tp2... 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: HtmlHelper and Umlauts
I had to go digging through the core code for this one. ?php echo $html-image('image.jpg', array('alt' = 'euml;', 'escape' = false));? Seems to work. -Corie On Feb 28, 12:45 pm, Kuje m...@jenskuttig.de wrote: Hello, I have an issue with the htmlHelper: If I want to insert an Image with an alternative text I use ?php echo $html-image('path/to/image.jpg', array('alt' = 'My alt text'); ? This works fine as long as the alt text does not include any umlaut. With an '' in it it works fine: it is translated to 'amp;'. But a German umlaut 'ü' is not translated but alt text is empty (which seems to be a problem of htmlspecialchars with UTF-8. Any idea of a solution for this problem? --~--~-~--~~~---~--~~ 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: customizing error messages from form helper
I guess you could extend the formHelper and array_merge 'error' = 'false' into the options and then a $this-error() call after it. You could also throw in the conditional if ($this-isFieldError('field')). -Corie On Mar 1, 3:29 pm, horatio bnab...@says.mu wrote: thanks corie. is there any way you know of to do this globally so i dont have to repeat the code so often? corie wrote: You can change the class 'error-message' to whatever you want by setting it in the options array of your $form-input call: $form-input('field', array('error' = array('class' = 'custom-error- class'))); Or you could take the automatic error out of the input div and put it on its own where you have more control: ?php echo $form-input('field', array('error' = false));? div class=error-message'?php echo $form-error('field', array ('class' = 'nested-div'));?/div -Corie On Feb 28, 11:15 pm, horatio bnab...@says.mu wrote: two questions-- the default class returned from error() within the html helper is error-message. how do i override this in my controller? more importantly, how can i inject some html content inside the error div after a failed form validation? right now its: div class=error-messageerror message here/div i would like it to hypothetically be: div class=error-messagediv class=nested-diverror message here/div/div is this possible sanely? -- View this message in context:http://www.nabble.com/customizing-error-messages-from-form-helper-tp2... Sent from the CakePHP mailing list archive at Nabble.com. -- View this message in context:http://www.nabble.com/customizing-error-messages-from-form-helper-tp2... 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: Tree reorder method won't work if other model methods are called first
I finally tracked down the problem. The reorder method calls children to get the nodes of the root level first, but children has the following condition: if ($id === null $model-id) { $id = $model-id; } elseif (!$id) { $id = null; } So if you were saving things to the model beforehand, the $model-id is probably still set. Do unset() or $model-id = null; before calling reorder and everything works. Is there some sort of cleanup or reset method for the model? -Corie On Oct 9, 3:07 pm, Corie [EMAIL PROTECTED] wrote: I'm having a strange issue with theTreebehavior method, reorder(). If I do this it works: function order() { $this-Page-reorder(array('field' = 'Page.order', 'order' = 'ASC')); } But if I do this, it won't reorder thetree: function order() { $this-data = array(); foreach($this-params['form']['rows_list'] as $order = $id) { $this-data[] = array('id' = $id, 'order' = $order); } $this-Page-saveAll($this-data); $this-Page-reorder(array('field' = 'Page.order', 'order' = 'ASC')); } I know the saving of my order fields is working because I can do the saveAll, edit the function putting the reorder() call first, then call the function again and it will reorder it properly. The order() function here is being called by Ajax. Anyone have a clue? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Tree reorder method won't work if other model methods are called first
I'm having a strange issue with the Tree behavior method, reorder(). If I do this it works: function order() { $this-Page-reorder(array('field' = 'Page.order', 'order' = 'ASC')); } But if I do this, it won't reorder the tree: function order() { $this-data = array(); foreach($this-params['form']['rows_list'] as $order = $id) { $this-data[] = array('id' = $id, 'order' = $order); } $this-Page-saveAll($this-data); $this-Page-reorder(array('field' = 'Page.order', 'order' = 'ASC')); } I know the saving of my order fields is working because I can do the saveAll, edit the function putting the reorder() call first, then call the function again and it will reorder it properly. The order() function here is being called by Ajax. Anyone have a clue? --~--~-~--~~~---~--~~ 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: HABTM Query: use containable or not?
Thanks for the reply Dave. Your nested contain example helped me figure out a way to solve my needs. I was trying to do a find() on the Album model, when I actually needed to turn it around and do a find() on Category which contains Album.active = 1. $this-Category-contain('Album.active = 1'); $data = $this-Category-find('all', array( 'conditions' = array('Category.id' = 1) ) ); And to get the Images included in each Album: $data = $this-Category-find('all', array( 'conditions' = array('Category.id' = 1), 'contain' = array( 'Album' = array( 'Image', 'conditions' = array('Album.active' = 1) ) ) ) ); -Corie On Jul 3, 4:59 pm, DaveMahon [EMAIL PROTECTED] wrote: Yesterday I started a blog for my CakePHP frustrations and joys. While I haven't done any customization and I'll probably murder my future PageRank by doing this so early, I posted an article that I think might help. http://lampable.blogspot.com/2008/07/taming-containables-in-cakephp-1... On Jul 2, 12:07 pm, Corie [EMAIL PROTECTED] wrote: I'm confused about the new Containable behavior, the missing Bindable behavior and how to do a HABTM find with conditions. Here's the set up, simplified. Category model habtm = Album Album model hasMany = Image I want to return all the Albums (Images included) where conditions are Category.id = 1 AND Album.active = 1. I've tried going at it different ways without success. Does anyone have a suggestion? -Corie --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
HABTM Query: use containable or not?
I'm confused about the new Containable behavior, the missing Bindable behavior and how to do a HABTM find with conditions. Here's the set up, simplified. Category model habtm = Album Album model hasMany = Image I want to return all the Albums (Images included) where conditions are Category.id = 1 AND Album.active = 1. I've tried going at it different ways without success. Does anyone have a suggestion? -Corie --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Shipping Modules
I'm building a shopping cart and want to integrate shipping APIs. Now, I've found existing code for UPS Rates Services and something similar for FedEx. But what I really want is an API that will actually create a shipment, schedule it for pickup, provide a label and tracking code, etc. You can't even get a UPS developer's kit without submitting a request form. For all the shopping carts out there using modular plugins for shipping and payment processors, I figured there had to be some code already written for a full shipment creator. I just can't find it. Might anyone know of such a PHP morsel that could make a good topping for a Cake app? -Corie --~--~-~--~~~---~--~~ 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: Using bootstrap to load app_controller
I opened a ticket https://trac.cakephp.org/ticket/4959 Supposedly it's as expected. -Corie On Jun 16, 5:33 pm, Corie [EMAIL PROTECTED] wrote: Perhaps I will. This works for now: $controllerPaths = array(CAKE_CORE_INCLUDE_PATH . DS . 'shares' . DS . 'controllers' . DS); if(!file_exists(ROOT . DS . APP_DIR . DS . 'app_controller.php')) { $controllerPaths[] = CAKE_CORE_INCLUDE_PATH . DS . 'shares' . DS . 'app_controller' . DS; } -Corie On Jun 16, 5:19 pm, Samuel DeVore [EMAIL PROTECTED] wrote: On Mon, Jun 16, 2008 at 1:54 PM, Corie [EMAIL PROTECTED] wrote: This is precisely what I've done. I just can't get the app_controller shared if I ever want to use a different local app_controller. Could I do something like: if( file_exists( APP_DIR . DS . 'app_controller.php') ) { use it } else { use the shared one } Would it just need to be included? I think you should open a ticket on trac.cakephp.org it seems that this is not the expected behavior but maybe they need to just clarify the documentation a little. I wouldn't think you need to do something like that. Sam D -Corie On Jun 16, 4:49 pm, Chris Hartjes [EMAIL PROTECTED] wrote: On Mon, Jun 16, 2008 at 4:45 PM, Samuel DeVore [EMAIL PROTECTED] wrote: It is documented in the manual http://manual.cakephp.org/view/32/installation#advanced-installation-35 Thanks for pointing that out, Sam. -- Chris Hartjes Internet Loudmouth Motto for 2008: Moving from herding elephants to handling snakes... @TheKeyBoard:http://www.littlehart.net/atthekeyboard --~--~-~--~~~---~--~~ 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: image upload - anything over than phpThumb
I would first try testing with no additional components and just use a href=http://us2.php.net/manual/en/function.move-uploaded- file.phpmove_uploaded_file/a. Once you confirm it works start debugging components. I've had success using Image Toolbox, also in the bakery. -Corie On Jun 19, 7:44 pm, koala kid [EMAIL PROTECTED] wrote: Hi all, I've tired in vain all day to upload an image via a form to my site. I've tried using the phpThumb Component (http://bakery.cakephp.org/ articles/view/phpthumb-component) and also manually via $_FILES. I keep getting an error such as the one below, which is from the component: [0] = Can not write to target directory [/path-to-my-dir/html/app/ webroot/img/thumb/] I would really appreciate any assistance I could get or some code that is proven to work. The directory has write permissions 777. Thanks in advance. --~--~-~--~~~---~--~~ 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: Hansel and Gretel do Cake
I used it on one website with a lot of static pages. You can see the breadcrumb in action here: http://www.youngtravel.com/pages/geographies/africa_mid_east/botswana_chiefs_camp I used a small element to build the crumbs. ?php if($page!='home') { $path = explode('/', $this-here); array_shift($path); $url = '/'; $link = ''; foreach($path as $part) { if($part == '' || $part == 'pages') $url .= array_shift($path).'/'; } if(stristr($url, 'pages')) $link = '/pages'; $html-addCrumb('Young Travel Cruises', '/pages/home'); foreach($path as $page) { $link .= '/'.$page; $html-addCrumb(Inflector::humanize($page), $link); } } ? div id=breadcrumb ?php echo $html-getCrumbs(' raquo; ');? /div I built this a long time ago so I'm certain there's a better way to do it. -Corie On Jun 18, 10:47 am, leo [EMAIL PROTECTED] wrote: I'm trying to make some sense out of the two methods addCrumb and getCrumbs. Okay, I haven't put them to the test yet, but I'm wondering two things:- 1. Has anybody used them and can they link me to a realworld website. 2. Shouldn't there be a deleteCrumb function for the backwards nav? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Using bootstrap to load app_controller
I'm using the bootstrap file to load up default controllers and other stuff. In app/config/bootstrap.php $modelPaths = array(CAKE_CORE_INCLUDE_PATH . DS . 'shares' . DS . 'models' . DS); $behaviorPaths = array(CAKE_CORE_INCLUDE_PATH . DS . 'shares' . DS . 'models' . DS . 'behaviors' . DS); $viewPaths = array(CAKE_CORE_INCLUDE_PATH . DS . 'shares' . DS . 'views' . DS); $helperPaths = array(CAKE_CORE_INCLUDE_PATH . DS . 'shares' . DS . 'views' . DS . 'helpers' . DS); $controllerPaths = array(CAKE_CORE_INCLUDE_PATH . DS . 'shares' . DS . 'controllers' . DS); $componentPaths = array(CAKE_CORE_INCLUDE_PATH . DS . 'shares' . DS . 'controllers' . DS . 'components' . DS); This all works as expected and cascades properly. app/controllers/test_controller.php will first if it exists if not then cake_core/shares/controllers/test_controller.php will load. But when I put an app_controller in cake_core/shares/controllers/ it always loads it even if my app has its own app_controller. It only loads the local version if I remove the one from shares. Is there any way around this? Or is it not meant to load an app_controller? -Corie --~--~-~--~~~---~--~~ 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: Using bootstrap to load app_controller
BTW, if you're testing this, make sure to delete your tmp/cache/ persistent/ files. -Corie On Jun 16, 3:45 pm, Corie [EMAIL PROTECTED] wrote: I'm using the bootstrap file to load up default controllers and other stuff. In app/config/bootstrap.php $modelPaths = array(CAKE_CORE_INCLUDE_PATH . DS . 'shares' . DS . 'models' . DS); $behaviorPaths = array(CAKE_CORE_INCLUDE_PATH . DS . 'shares' . DS . 'models' . DS . 'behaviors' . DS); $viewPaths = array(CAKE_CORE_INCLUDE_PATH . DS . 'shares' . DS . 'views' . DS); $helperPaths = array(CAKE_CORE_INCLUDE_PATH . DS . 'shares' . DS . 'views' . DS . 'helpers' . DS); $controllerPaths = array(CAKE_CORE_INCLUDE_PATH . DS . 'shares' . DS . 'controllers' . DS); $componentPaths = array(CAKE_CORE_INCLUDE_PATH . DS . 'shares' . DS . 'controllers' . DS . 'components' . DS); This all works as expected and cascades properly. app/controllers/test_controller.php will first if it exists if not then cake_core/shares/controllers/test_controller.php will load. But when I put an app_controller in cake_core/shares/controllers/ it always loads it even if my app has its own app_controller. It only loads the local version if I remove the one from shares. Is there any way around this? Or is it not meant to load an app_controller? -Corie --~--~-~--~~~---~--~~ 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: Using bootstrap to load app_controller
I've not found any examples. What would you recommend as a better way to share models, controllers, and views between multiple sites? -Corie On Jun 16, 3:59 pm, Chris Hartjes [EMAIL PROTECTED] wrote: On Mon, Jun 16, 2008 at 3:45 PM, Corie [EMAIL PROTECTED] wrote: I'm using the bootstrap file to load up default controllers and other stuff. Why would you do it this way when none of the examples out there do anything remotely similar to this. -- Chris Hartjes Internet Loudmouth Motto for 2008: Moving from herding elephants to handling snakes... @TheKeyBoard:http://www.littlehart.net/atthekeyboard --~--~-~--~~~---~--~~ 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: Using bootstrap to load app_controller
I build a lot of small web sites and most of them use the same type of controllers so I'd like to be able to have one set of these to update instead of 20 to update every time I make a change. Maybe plugins would be another route to go, but that would require having to update all the sites for every small change I make. It gives me a great stepping stone to have this template when I start a new site. And when I want to add another feature I can do so for all sites at the same time. -Corie On Jun 16, 4:16 pm, Chris Hartjes [EMAIL PROTECTED] wrote: On Mon, Jun 16, 2008 at 4:11 PM, Corie [EMAIL PROTECTED] wrote: I've not found any examples. What would you recommend as a better way to share models, controllers, and views between multiple sites? -Corie Having never done that (i.e. sharing models, controllers and views between multiple sites) I do not have an answer, but from what I do know about building CakePHP apps, it is definitely not that way. Perhaps you could explain a little more what it is you are trying to do. -- Chris Hartjes Internet Loudmouth Motto for 2008: Moving from herding elephants to handling snakes... @TheKeyBoard:http://www.littlehart.net/atthekeyboard --~--~-~--~~~---~--~~ 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: Using bootstrap to load app_controller
This is precisely what I've done. I just can't get the app_controller shared if I ever want to use a different local app_controller. Could I do something like: if( file_exists( APP_DIR . DS . 'app_controller.php') ) { use it } else { use the shared one } Would it just need to be included? -Corie On Jun 16, 4:49 pm, Chris Hartjes [EMAIL PROTECTED] wrote: On Mon, Jun 16, 2008 at 4:45 PM, Samuel DeVore [EMAIL PROTECTED] wrote: It is documented in the manual http://manual.cakephp.org/view/32/installation#advanced-installation-35 Thanks for pointing that out, Sam. -- Chris Hartjes Internet Loudmouth Motto for 2008: Moving from herding elephants to handling snakes... @TheKeyBoard:http://www.littlehart.net/atthekeyboard --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Auth errors in RC1
I've got a development server and a live server running my websites. I've upgraded to RC1 and I'm getting some errors when trying to access some pages that rely on Acl. Auth works because it logs me in but any page that requires Acl gives these errors. Notice (8): Undefined index: action [CORE/cake/libs/controller/ components/auth.php, line 439] Notice (8): Undefined index: action [CORE/cake/libs/controller/ components/auth.php, line 440] Notice (8): Undefined index: controller [CORE/cake/libs/controller/ components/auth.php, line 440] Warning (512): Auth::startup() - Attempted access of un-mapped action in controller [CORE/cake/libs/controller/components/auth.php, line 440] Warning (2): Cannot modify header information - headers already sent by (output started at /usr/lib/php/cake/cake/basics.php:111) [CORE/ cake/libs/controller/controller.php, line 576] I'm using $this-Auth-authorize = 'crud'; The code and file structure is the exact same on both servers. One works (winblows) and one does not (linux). --~--~-~--~~~---~--~~ 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: Auth errors in RC1
Thanks for the tip. I double checked the schema and they're correct. I also downloaded the live database to the local machine and it still works locally. Just curious, but why doesn't the acl join table follow cake conventions? Shouldn't it be acos_aros instead of aros_acos? -Corie On Jun 12, 12:16 pm, aranworld [EMAIL PROTECTED] wrote: Could it have something to do with case sensitivity? I also am using Auth with 'crud' and am not having any troubles with the current svn version of cake on either my local windows or remote linux servers. There must be some difference between the two servers. Maybe the database schemas are different? I once ran into trouble with the Acl Component, because in my aros_acos table the crud columns were set as INT, when they should have been CHAR. -Aran On Jun 12, 8:34 am, Corie [EMAIL PROTECTED] wrote: I've got a development server and a live server running my websites. I've upgraded to RC1 and I'm getting some errors when trying to access some pages that rely on Acl. Auth works because it logs me in but any page that requires Acl gives these errors. Notice (8): Undefined index: action [CORE/cake/libs/controller/ components/auth.php, line 439] Notice (8): Undefined index: action [CORE/cake/libs/controller/ components/auth.php, line 440] Notice (8): Undefined index: controller [CORE/cake/libs/controller/ components/auth.php, line 440] Warning (512): Auth::startup() - Attempted access of un-mapped action in controller [CORE/cake/libs/controller/components/auth.php, line 440] Warning (2): Cannot modify header information - headers already sent by (output started at /usr/lib/php/cake/cake/basics.php:111) [CORE/ cake/libs/controller/controller.php, line 576] I'm using $this-Auth-authorize = 'crud'; The code and file structure is the exact same on both servers. One works (winblows) and one does not (linux). --~--~-~--~~~---~--~~ 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: Auth errors in RC1
I did delete all the cached files. That's become a habit since it does so often cause problems. My guess for aros_acos was so that it came after acos and aros in the tables list. :p -Corie On Thu, Jun 12, 2008 at 2:58 PM, aranworld [EMAIL PROTECTED] wrote: Have you deleted all the files in your app/cache directories? Often when I have a problem on one server but not the other it is due to the model cache being outdated on the misbehaving server. By naming it unconventionally, they protect against someone accidentally creating their own acos_aros table and overwriting the table that the ACL component relies on ... at least that is my best guess. -Aran On Jun 12, 9:43 am, Corie [EMAIL PROTECTED] wrote: Thanks for the tip. I double checked the schema and they're correct. I also downloaded the live database to the local machine and it still works locally. Just curious, but why doesn't the acl join table follow cake conventions? Shouldn't it be acos_aros instead of aros_acos? -Corie On Jun 12, 12:16 pm, aranworld [EMAIL PROTECTED] wrote: Could it have something to do with case sensitivity? I also am using Auth with 'crud' and am not having any troubles with the current svn version of cake on either my local windows or remote linux servers. There must be some difference between the two servers. Maybe the database schemas are different? I once ran into trouble with the Acl Component, because in my aros_acos table the crud columns were set as INT, when they should have been CHAR. -Aran On Jun 12, 8:34 am, Corie [EMAIL PROTECTED] wrote: I've got a development server and a live server running my websites. I've upgraded to RC1 and I'm getting some errors when trying to access some pages that rely on Acl. Auth works because it logs me in but any page that requires Acl gives these errors. Notice (8): Undefined index: action [CORE/cake/libs/controller/ components/auth.php, line 439] Notice (8): Undefined index: action [CORE/cake/libs/controller/ components/auth.php, line 440] Notice (8): Undefined index: controller [CORE/cake/libs/controller/ components/auth.php, line 440] Warning (512): Auth::startup() - Attempted access of un-mapped action in controller [CORE/cake/libs/controller/components/auth.php, line 440] Warning (2): Cannot modify header information - headers already sent by (output started at /usr/lib/php/cake/cake/basics.php:111) [CORE/ cake/libs/controller/controller.php, line 576] I'm using $this-Auth-authorize = 'crud'; The code and file structure is the exact same on both servers. One works (winblows) and one does not (linux). -- -Corie Slate House of Tech www.houseoftech.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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Auth errors in RC1
I did some tinkering around in the auth component. Notice (8): Undefined index: action [CORE/cake/libs/controller/components/ auth.php, line 439] was pointing at line 439 ( if (!isset($this- actionMap[$this-params['action']])) { ) because the $this-params variable is empty. So I added $this-params = $controller-params; to the startup method and it fixed it, somewhat. Started getting these errors: Auth::startup() - Attempted access of un-mapped action admin_index in controller admin so I just mapped them out. I thought that was supposed to be automatic for the admin stuff? I also noticed the same type of Undefined errors in the Email component where $this-Controller isn't staying set after the initialization method (only in 1.2 RC1), so there must be something going on deeper somewhere... all beyond me. -Corie On Jun 12, 3:03 pm, Corie Slate [EMAIL PROTECTED] wrote: I did delete all the cached files. That's become a habit since it does so often cause problems. My guess for aros_acos was so that it came after acos and aros in the tables list. :p -Corie On Thu, Jun 12, 2008 at 2:58 PM, aranworld [EMAIL PROTECTED] wrote: Have you deleted all the files in your app/cache directories? Often when I have a problem on one server but not the other it is due to the model cache being outdated on the misbehaving server. By naming it unconventionally, they protect against someone accidentally creating their own acos_aros table and overwriting the table that the ACL component relies on ... at least that is my best guess. -Aran On Jun 12, 9:43 am, Corie [EMAIL PROTECTED] wrote: Thanks for the tip. I double checked the schema and they're correct. I also downloaded the live database to the local machine and it still works locally. Just curious, but why doesn't the acl join table follow cake conventions? Shouldn't it be acos_aros instead of aros_acos? -Corie On Jun 12, 12:16 pm, aranworld [EMAIL PROTECTED] wrote: Could it have something to do with case sensitivity? I also am using Auth with 'crud' and am not having any troubles with the current svn version of cake on either my local windows or remote linux servers. There must be some difference between the two servers. Maybe the database schemas are different? I once ran into trouble with the Acl Component, because in my aros_acos table the crud columns were set as INT, when they should have been CHAR. -Aran On Jun 12, 8:34 am, Corie [EMAIL PROTECTED] wrote: I've got a development server and a live server running my websites. I've upgraded to RC1 and I'm getting some errors when trying to access some pages that rely on Acl. Auth works because it logs me in but any page that requires Acl gives these errors. Notice (8): Undefined index: action [CORE/cake/libs/controller/ components/auth.php, line 439] Notice (8): Undefined index: action [CORE/cake/libs/controller/ components/auth.php, line 440] Notice (8): Undefined index: controller [CORE/cake/libs/controller/ components/auth.php, line 440] Warning (512): Auth::startup() - Attempted access of un-mapped action in controller [CORE/cake/libs/controller/components/auth.php, line 440] Warning (2): Cannot modify header information - headers already sent by (output started at /usr/lib/php/cake/cake/basics.php:111) [CORE/ cake/libs/controller/controller.php, line 576] I'm using $this-Auth-authorize = 'crud'; The code and file structure is the exact same on both servers. One works (winblows) and one does not (linux). -- -Corie Slate House of Techwww.houseoftech.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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
How to view all Cake queries?
Of course I have debug set to 2, but sometimes redirects are used. I'm specifically trying to troubleshoot an Auth problem and need to see the queries generated. What can I do? --~--~-~--~~~---~--~~ 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: How to view all Cake queries?
Thanks a bunch. That's precisely what I needed. On Apr 18, 11:05 am, grigri [EMAIL PROTECTED] wrote: Write the sql queries to a text log file. I created a custom datasource to allow syntax hilighting of the sql log and file-based logging. More details in this thread:http://groups.google.com/group/cake-php/browse_thread/thread/9609699b... Code here:http://openpaste.org/en/6181/ Hope this helps grigri On Apr 18, 3:59 pm, Corie [EMAIL PROTECTED] wrote: Of course I have debug set to 2, but sometimes redirects are used. I'm specifically trying to troubleshoot an Auth problem and need to see the queries generated. What can I do? --~--~-~--~~~---~--~~ 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: HABTM
I have had a lot of problems with HABTM also. I'm convinced it's all bugged, and trying to find any solution to these simple problems leads you to workarounds and extra behaviors, which I don't consider solutions. Have you tried leaving out the foreignKey and associationForeignKey and letting Cake apply them automatically? On Feb 23, 2:13 pm, villas [EMAIL PROTECTED] wrote: @blogica. Everyone who has made HABTM work is a guru as far as I'm concerned :) To test what is being returned, I'm simply putting this in my controller view: $this-User-recursive = 1; debug($this-User-findAll()); the Group array is always empty. Do I need to put more stuff in the model? Can anyone share a working example? On Feb 23, 6:37 pm, b logica [EMAIL PROTECTED] wrote: Oh, I'm by no stretch a Cake guru. I'm still working on my first app (porting over an existing site) in my spare time. But I'm trying to answer what questions I can so the gurus don't have to. Of course, corrections to any erroneous info I might give are more than welcome. I think that part of the problem with the $associationForeignKey/$foreignKey is that, under some circumstances, it doesn't matter if they're reversed. I say that because I just did just that in one of my models and it showed no obvious effect. But (if I'm correct in that assumption) problems definitely will show up if there are other inconsistencies. What I mean is, once the models, controllers, etc. are set up correctly, it may be that *sometimes* those values may be switched without showing any errors. But this will only be the case once everything's set up. Until then, if the values are switched, things will go wrong immediately. I'm just talking out of my arse right now; none of this has been tested. But I can see for myself that switching the values doesn't cause any obvious error. Actually, upon further thought, I think that it's not crucial for SELECT but that a save would fail miserably (or, more likely, have very inconsistent results). As for your initial problem, you probably need to set the correct recursion. You can also look into using the Bindable behavior: http://bakery.cakephp.org/articles/view/bindable-behavior-control-you... On Sat, Feb 23, 2008 at 12:38 PM, villas [EMAIL PROTECTED] wrote: @blogica. Thanks for your reply and although you may be right about the keys being reversed in my inital post, I had already tried them both ways before posting. You are also right about other examples being confused. The CookBook example seems to be wrong in a couple of ways and when I eventually discover how this works, I'll be delighted to propose amendments. Until then, perhaps the best way for me to figure this out is by copying someone's working code. Perhaps some kind soul would provide the barest working example for me to copy. Otherwise, I hope blogica or some other guru may provide an insight. On Feb 23, 4:56 pm, b logica [EMAIL PROTECTED] wrote: You have your keys reversed. 'foreignKey' = 'user_id', 'associationForeignKey' = 'group_id', This same thing has caught me up, over and over again, due to looking at the array and its keys from the wrong perspective. Rather than the keys values be about Group they are more about User, as pertains to Group. I hope that makes sense. Just remember that the key with 'association' is for the 'other' model (ie. not the model for the present class but the one that is the key in the $hasAndBelongsToMany array. A surprising number of examples out there have it reversed. I think there's an example in the docs somewhere that has it reversed, also. On Sat, Feb 23, 2008 at 10:22 AM, villas [EMAIL PROTECTED] wrote: Cake 1.2 Beta / Php 5.xx / Firebird 2 I have never succeeded in making even the simplest HABTM association work. I tried scaffold and reading everything I could and experimenting different ways. Here is the simple setup: Users: id, name Groups: id, name Groups_Users: user_id, group_id Model: User.php class User extends AppModel { var $name = 'User'; var $useTable = 'users'; var $hasAndBelongsToMany = array( 'Group' = array('className' = 'Group', 'joinTable' = 'groups_users', 'foreignKey' = 'group_id', 'associationForeignKey' = 'user_id', 'unique' = true, 'conditions' = '', 'fields' = '', 'order' = '',
Re: HABTM
I built a quick test with HABTM and got it to work. groups_controller.php class GroupsController extends AppController { var $name = 'Groups'; var $helpers = array('Html', 'Form'); function index() { $this-Group-recursive = 1; pr($this-Group-findAll()); } } users_controller.php class UsersController extends AppController { var $name = 'Users'; var $helpers = array('Html', 'Form'); function index() { $this-User-recursive = 1; pr($this-User-findAll()); } } Model: group.php class Group extends AppModel { var $name = 'Group'; var $useTable = 'groups'; var $hasAndBelongsToMany = array( 'User' = array( 'className' = 'User' ) ); } Model: user.php class User extends AppModel { var $name = 'User'; var $useTable = 'users'; var $hasAndBelongsToMany = array( 'Group' = array( 'className' = 'Group' ) ); } Here's the print out from the users controller with associated groups data. Array ( [0] = Array ( [User] = Array ( [id] = 1 [name] = bob ) [Group] = Array ( [0] = Array ( [id] = 1 [name] = admins ) ) ) [1] = Array ( [User] = Array ( [id] = 3 [name] = hank ) [Group] = Array ( [0] = Array ( [id] = 3 [name] = janitors ) ) ) [2] = Array ( [User] = Array ( [id] = 2 [name] = john ) [Group] = Array ( [0] = Array ( [id] = 2 [name] = editors ) [1] = Array ( [id] = 3 [name] = janitors ) ) ) ) On Feb 23, 9:13 pm, villas [EMAIL PROTECTED] wrote: Thanks b logica. I already tried recursive = 1,2,3 etc, but that didn't work. Thanks also for the bindable-behaviour example and I will try it in the morning. However, I'm already using work-around solutions. My point is that Cake's own HABTM model just doesn't seem to work for the simplest of cases. If anyone has a true HABTM model working, I would still be happy to hear it. On Feb 23, 10:36 pm, b logica [EMAIL PROTECTED] wrote: On Sat, Feb 23, 2008 at 4:46 PM, villas [EMAIL PROTECTED] wrote: Thanks for the idea. My set up is so simple that I can try anything in seconds :) Try: $recursive = 2; $this-User-find('[all|first|list]', $conditions, $fields, $recursive); I commented out the key lines as you suggested and it just worked as before, it returned the [user] data but not the [group]. In other words, no change. I've been playing with this on and off since November and it has not worked yet! If someone could post here the simplest working example, I would be grateful. Until then, I'm sceptical that anyone actually uses HABTM. I can just imagine that everyone has given it a try and then just found ways to work around the problem! Try using the Bindable behavior. Comment out the binding params in your models, leaving: var $hasAndBelongsToMany = 'Group'; var $hasAndBelongsToMany = 'User'; class AppModel extends Model{ var $actsAs = array('Bindable' = array('notices' = true)); ... } UsersController: $criteria = array( 'conditions' = array('User.name' = 'foo'), 'restrict' = array( 'Group(id,name)' ) ); $this-set('users', $this-User-find('all', $criteria, null, null)); Here's a working example. This controller action is for a member directory. An alphabetical list of links is provided, each passing its letter. A list of members, with associated data, is returned. function findByLetter() { $letter = $this-params['letter']; $conditions = array( 'conditions' = LOWER(SUBSTRING(last_name, 1, 1)) = '${letter}', 'restrict' = array( 'MemberProfile(organisation)', 'Discipline(id,name_en,slug_en)' ) ); $this-Member-order =
Switching useDbConfig variable
I'm running the same cake app on two different servers, development and production. I want to change the database config that's used depending on the server. I've got the following set up now. /config/database.php class DATABASE_CONFIG { var $development = array( 'driver' = 'mysql', 'persistent' = false, 'host' = 'localhost', 'port' = '', 'login' = 'admin', 'password' = 'password', 'database' = 'db', 'schema' = '', 'prefix' = '', 'encoding' = '' ); var $production = array( 'driver' = 'mysql', 'persistent' = false, 'host' = 'localhost', 'port' = '', 'login' = 'user_admin', 'password' = 'password', 'database' = 'user_db', 'schema' = '', 'prefix' = '', 'encoding' = '' ); } /models/table.php class Table extends AppModel { var $name = 'Table'; function beforeFind() { if(is_dir('D:\webserver\private_html\site')) { $this-useDbConfig = 'development'; } elseif(is_dir(DS.'home'.DS.'user'.DS.'public_html')) { $this-useDbConfig = 'production'; } } } It just keeps trying to use the 'default' config. I've also tested my logic by just putting $this-useDbConfig = 'development'; directly under the beforeFind() function, but it still does nothing. Do I need to put this somewhere else? --~--~-~--~~~---~--~~ 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: Switching useDbConfig variable
Oh, nevermind. I just reread. I guess I was simply trying to set up the if else inside the database_config class and set the $default accordingly. On Feb 8, 1:37 pm, Corie [EMAIL PROTECTED] wrote: That actually does look like a better solution, as I was also trying to figure out how to make it switch for all Models. I'm a bit new to OOP, how do you set up your /config/database.php file? You have to put the conditionals in a function right? On Feb 8, 11:32 am, grigri [EMAIL PROTECTED] wrote: Interesting... I do it a completely different way. I have 2 database config files : database.dev.php and database.live.php, each containing a full DATABASE_CONFIG class with my configurations (default, test, and whatever else I need for the app). Then, in /config/database.php, I have this: if (empty($_SERVER['SERVER_NAME']) || in_array(strtolower($_SERVER[SERVER_NAME]), array('grigri', 'localhost'))) { require ./database.dev.php;} else { require ./database.live.php; } This way the models don't have to make any changes, it's all automatic. How do other people deal with this? On Feb 8, 4:23 pm, Corie [EMAIL PROTECTED] wrote: I'm running the same cake app on two different servers, development and production. I want to change the database config that's used depending on the server. I've got the following set up now. /config/database.php class DATABASE_CONFIG { var $development = array( 'driver' = 'mysql', 'persistent' = false, 'host' = 'localhost', 'port' = '', 'login' = 'admin', 'password' = 'password', 'database' = 'db', 'schema' = '', 'prefix' = '', 'encoding' = '' ); var $production = array( 'driver' = 'mysql', 'persistent' = false, 'host' = 'localhost', 'port' = '', 'login' = 'user_admin', 'password' = 'password', 'database' = 'user_db', 'schema' = '', 'prefix' = '', 'encoding' = '' ); } /models/table.php class Table extends AppModel { var $name = 'Table'; function beforeFind() { if(is_dir('D:\webserver\private_html\site')) { $this-useDbConfig = 'development'; } elseif(is_dir(DS.'home'.DS.'user'.DS.'public_html')) { $this-useDbConfig = 'production'; } } } It just keeps trying to use the 'default' config. I've also tested my logic by just putting $this-useDbConfig = 'development'; directly under the beforeFind() function, but it still does nothing. Do I need to put this somewhere else? --~--~-~--~~~---~--~~ 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: Switching useDbConfig variable
That actually does look like a better solution, as I was also trying to figure out how to make it switch for all Models. I'm a bit new to OOP, how do you set up your /config/database.php file? You have to put the conditionals in a function right? On Feb 8, 11:32 am, grigri [EMAIL PROTECTED] wrote: Interesting... I do it a completely different way. I have 2 database config files : database.dev.php and database.live.php, each containing a full DATABASE_CONFIG class with my configurations (default, test, and whatever else I need for the app). Then, in /config/database.php, I have this: if (empty($_SERVER['SERVER_NAME']) || in_array(strtolower($_SERVER[SERVER_NAME]), array('grigri', 'localhost'))) { require ./database.dev.php;} else { require ./database.live.php; } This way the models don't have to make any changes, it's all automatic. How do other people deal with this? On Feb 8, 4:23 pm, Corie [EMAIL PROTECTED] wrote: I'm running the same cake app on two different servers, development and production. I want to change the database config that's used depending on the server. I've got the following set up now. /config/database.php class DATABASE_CONFIG { var $development = array( 'driver' = 'mysql', 'persistent' = false, 'host' = 'localhost', 'port' = '', 'login' = 'admin', 'password' = 'password', 'database' = 'db', 'schema' = '', 'prefix' = '', 'encoding' = '' ); var $production = array( 'driver' = 'mysql', 'persistent' = false, 'host' = 'localhost', 'port' = '', 'login' = 'user_admin', 'password' = 'password', 'database' = 'user_db', 'schema' = '', 'prefix' = '', 'encoding' = '' ); } /models/table.php class Table extends AppModel { var $name = 'Table'; function beforeFind() { if(is_dir('D:\webserver\private_html\site')) { $this-useDbConfig = 'development'; } elseif(is_dir(DS.'home'.DS.'user'.DS.'public_html')) { $this-useDbConfig = 'production'; } } } It just keeps trying to use the 'default' config. I've also tested my logic by just putting $this-useDbConfig = 'development'; directly under the beforeFind() function, but it still does nothing. Do I need to put this somewhere else? --~--~-~--~~~---~--~~ 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: hasOne association question
Thanks for the reply Brian. Interesting thought on reversing the association, that would work pretty well me thinks, but it doesn't follow the program logic. Shouldn't something like this work... $unansweredQuestions = $this-Question-findAll(array('Answer.id' = '')); It just doesn't. On Jan 26, 10:17 pm, brian_gaff [EMAIL PROTECTED] wrote: Is this proper behavior? It seems like it should not return an Answer array at all. Yes. You can do something like if(isset($question['Answer']['id'])) { /* do something with answer */ } You might consider reversing it and putting the foriegn key in the questions table, and having each Answer haveOne question and each Question belongTo an answer. If you do that you can do: $questionsWithNoAns = $this-Question- findAll(array('Question.answer_id' = 0)); On Jan 25, 12:18 pm, Corie [EMAIL PROTECTED] wrote: Using Cake 1.2, when I perform a findAll() on a model with a hasOne association it's returning an array for the associated table even if there is no record. Here's an example. // question.php class Question extends AppModel { var $name = 'Question'; var $hasOne = 'Answer'; } // answer.php class Answer extends AppModel { var $name = 'Answer'; var $belongsTo = 'Question'; } // questions_controller.php class QuestionsController extends AppController { function index() { $questions = $this-Question-findAll(); pr($questions); } } // outputs Array ( [0] = Array ( [Question] = Array ( [id] = 4 [question] = why? [created] = 2008-01-25 00:23:44 [ip] = 192.168.0.101 ) [Answer] = Array ( [id] = [question_id] = [answer] = [created] = [name] = ) ) ) Is this proper behavior? It seems like it should not return an Answer array at all. Anyways, another question is, how would I go about finding only questions which do not have answers? --~--~-~--~~~---~--~~ 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: hasOne association question
Oh wait, I just figured it out. $unansweredQuestions = $this-Question-findAll(array('Answer.id' = null)); Had no idea I could just put null in there. Sweet, thanks. On Jan 27, 12:10 am, Corie [EMAIL PROTECTED] wrote: Thanks for the reply Brian. Interesting thought on reversing the association, that would work pretty well me thinks, but it doesn't follow the program logic. Shouldn't something like this work... $unansweredQuestions = $this-Question-findAll(array('Answer.id' = '')); It just doesn't. On Jan 26, 10:17 pm, brian_gaff [EMAIL PROTECTED] wrote: Is this proper behavior? It seems like it should not return an Answer array at all. Yes. You can do something like if(isset($question['Answer']['id'])) { /* do something with answer */ } You might consider reversing it and putting the foriegn key in the questions table, and having each Answer haveOne question and each Question belongTo an answer. If you do that you can do: $questionsWithNoAns = $this-Question- findAll(array('Question.answer_id' = 0)); On Jan 25, 12:18 pm, Corie [EMAIL PROTECTED] wrote: Using Cake 1.2, when I perform a findAll() on a model with a hasOne association it's returning an array for the associated table even if there is no record. Here's an example. // question.php class Question extends AppModel { var $name = 'Question'; var $hasOne = 'Answer'; } // answer.php class Answer extends AppModel { var $name = 'Answer'; var $belongsTo = 'Question'; } // questions_controller.php class QuestionsController extends AppController { function index() { $questions = $this-Question-findAll(); pr($questions); } } // outputs Array ( [0] = Array ( [Question] = Array ( [id] = 4 [question] = why? [created] = 2008-01-25 00:23:44 [ip] = 192.168.0.101 ) [Answer] = Array ( [id] = [question_id] = [answer] = [created] = [name] = ) ) ) Is this proper behavior? It seems like it should not return an Answer array at all. Anyways, another question is, how would I go about finding only questions which do not have answers? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
hasOne association question
Using Cake 1.2, when I perform a findAll() on a model with a hasOne association it's returning an array for the associated table even if there is no record. Here's an example. // question.php class Question extends AppModel { var $name = 'Question'; var $hasOne = 'Answer'; } // answer.php class Answer extends AppModel { var $name = 'Answer'; var $belongsTo = 'Question'; } // questions_controller.php class QuestionsController extends AppController { function index() { $questions = $this-Question-findAll(); pr($questions); } } // outputs Array ( [0] = Array ( [Question] = Array ( [id] = 4 [question] = why? [created] = 2008-01-25 00:23:44 [ip] = 192.168.0.101 ) [Answer] = Array ( [id] = [question_id] = [answer] = [created] = [name] = ) ) ) Is this proper behavior? It seems like it should not return an Answer array at all. Anyways, another question is, how would I go about finding only questions which do not have answers? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
How to select using HABTM?
I'm a bit confused about how to select records from a table in a HABTM association. I have categories and I have images. I want to get all the images in a specific category. Models: class Category extends AppModel { var $name = 'Category'; var $hasAndBelongsToMany = array('Image' = array('className'= 'Image', 'conditions' = '', 'order'= '', 'limit'= '', 'unique' = true, 'finderQuery' = '', 'deleteQuery' = '', ) ); var $validate = array( 'name' = VALID_NOT_EMPTY, 'parentid' = VALID_NUMBER ); } class Image extends AppModel { var $name = 'Image'; var $hasAndBelongsToMany = array('Category' = array('className'= 'Category', 'conditions' = '', 'order'= '', 'limit'= '', 'unique' = true, 'finderQuery' = '', 'deleteQuery' = '', ) ); var $validate = array( 'filename' = VALID_NOT_EMPTY ); } What is the best way to select all the images from a specific category? --~--~-~--~~~---~--~~ 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: $ajax-submit() not writing script tag inside ajax called view
Okay, I just figured out that it is writing the script tag but my view generated source button wasn't showing it. Is there an error proof way to view all output? The ajax call looks good now and the form looks correct, but when I submit the form and pr($this-params) there's no data array in it. $this-data is also empty, even though the form element names are data[Model][column]. Any ideas what i'm doing wrong? On Oct 23, 11:06 pm, corie [EMAIL PROTECTED] wrote: Oh and also, using $ajax-form() will work fine in this case, but I don't want to use it because it uses a deprecated $html method and I want to be able to submit to different locations depending on the button clicked. On Oct 23, 1:42 pm, corie [EMAIL PROTECTED] wrote: I'm having a strange issue with $ajax-submit() not writing the script tag after the input, but only inside of an ajax called view. Here is the edit view (called with ajax into another view): h2Edit Category/h2 form method=post action=?php echo $html-url('/categories/edit') ? ?php echo $html-hidden('Category/id')? p label for=CategoryNameName:/labelbr / ?php echo $html-input('Category/name', array('style' = 'width: 400px;'))? ?php echo $html-tagErrorMsg('Category/name', 'Name is required.') ? /p p label for=CategoryDescriptionDescription:/labelbr / ?php echo $html-textarea('Category/description', array('rows'='5', 'style' = 'width:400px;')) ? /p p label for=CategoryParentidParent Category:/label ?php echo $html-selectTag('Category/parentid', $cat_select, $data['Category']['parentid'], null, null, false, false)? /p p ?php echo $ajax-submit('Save', array('update' = '/categories/ edit')); ? /p /form I've traced through all the functions that $ajax-submit() uses and echoed out the results all the way down to $javascript-codeBlock(). codeBlock() is the function which encloses the $script inside script tags. I echoed out the $script and it looks okay: Event.observe('button18502', 'click', function(event) { new Ajax.Updater('categories','/cake/categories/edit', {asynchronous:true, evalScripts:true, requestHeaders:['X-Update', 'categories']}) }, false); But when it tries to return sprintf($this-tags['javascriptblock'], $script), nothing is returned. Again, this all works inside a view NOT called by ajax. --~--~-~--~~~---~--~~ 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: $ajax-submit() not writing script tag inside ajax called view
Cool extension, but it still doesn't show the script tags when called through ajax. I figured out my problem. I was using a custom helper extension to create ajax submit buttons, but I had forgot to include the following: if (!isset($options['with'])) { $options['with'] = 'Form.serialize(Event.element(event).form)'; } Works perfectly now. On Oct 24, 11:03 am, Chris Hartjes [EMAIL PROTECTED] wrote: On 10/24/07, Corie [EMAIL PROTECTED] wrote: Any ideas what i'm doing wrong? No, but have you tried using FireBug in FireFox to debug your Ajax stuff? Best debugging tool I've ever used for figuring out problems with Ajax-related stuff. -- Chris Hartjes My motto for 2007: Just build it, damnit! @TheKeyboard -http://www.littlehart.net/atthekeyboard --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Can $ajax-sortable drag around table rows?
I have a table in which I want to sort the rows by using the drag and drop methods of $ajax-sortable, but it's not working. Are table rows even draggable, or do I have to make a nested table inside a ul? --~--~-~--~~~---~--~~ 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: Can $ajax-sortable drag around table rows?
Yea I did the same. It's not as efficient but it works well. On Oct 24, 6:29 pm, schneimi [EMAIL PROTECTED] wrote: I had the same problem and ended up in using a nested table inside a ul, but I don't like it very much. I found out that there is a tag option which can be used like $ajax-sortable('sortable_table', array('tag' = 'tr')) but it didn't work as well. On 24 Okt., 20:25, Corie [EMAIL PROTECTED] wrote: I have a table in which I want to sort the rows by using the drag and drop methods of $ajax-sortable, but it's not working. Are table rows even draggable, or do I have to make a nested table inside a ul? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
$ajax-submit() not writing script tag inside ajax called view
I'm having a strange issue with $ajax-submit() not writing the script tag after the input, but only inside of an ajax called view. Here is the edit view (called with ajax into another view): h2Edit Category/h2 form method=post action=?php echo $html-url('/categories/edit') ? ?php echo $html-hidden('Category/id')? p label for=CategoryNameName:/labelbr / ?php echo $html-input('Category/name', array('style' = 'width: 400px;'))? ?php echo $html-tagErrorMsg('Category/name', 'Name is required.') ? /p p label for=CategoryDescriptionDescription:/labelbr / ?php echo $html-textarea('Category/description', array('rows'='5', 'style' = 'width:400px;')) ? /p p label for=CategoryParentidParent Category:/label ?php echo $html-selectTag('Category/parentid', $cat_select, $data['Category']['parentid'], null, null, false, false)? /p p ?php echo $ajax-submit('Save', array('update' = '/categories/ edit')); ? /p /form I've traced through all the functions that $ajax-submit() uses and echoed out the results all the way down to $javascript-codeBlock(). codeBlock() is the function which encloses the $script inside script tags. I echoed out the $script and it looks okay: Event.observe('button18502', 'click', function(event) { new Ajax.Updater('categories','/cake/categories/edit', {asynchronous:true, evalScripts:true, requestHeaders:['X-Update', 'categories']}) }, false); But when it tries to return sprintf($this-tags['javascriptblock'], $script), nothing is returned. Again, this all works inside a view NOT called by ajax. --~--~-~--~~~---~--~~ 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: $ajax-submit() not writing script tag inside ajax called view
Oh and also, using $ajax-form() will work fine in this case, but I don't want to use it because it uses a deprecated $html method and I want to be able to submit to different locations depending on the button clicked. On Oct 23, 1:42 pm, corie [EMAIL PROTECTED] wrote: I'm having a strange issue with $ajax-submit() not writing the script tag after the input, but only inside of an ajax called view. Here is the edit view (called with ajax into another view): h2Edit Category/h2 form method=post action=?php echo $html-url('/categories/edit') ? ?php echo $html-hidden('Category/id')? p label for=CategoryNameName:/labelbr / ?php echo $html-input('Category/name', array('style' = 'width: 400px;'))? ?php echo $html-tagErrorMsg('Category/name', 'Name is required.') ? /p p label for=CategoryDescriptionDescription:/labelbr / ?php echo $html-textarea('Category/description', array('rows'='5', 'style' = 'width:400px;')) ? /p p label for=CategoryParentidParent Category:/label ?php echo $html-selectTag('Category/parentid', $cat_select, $data['Category']['parentid'], null, null, false, false)? /p p ?php echo $ajax-submit('Save', array('update' = '/categories/ edit')); ? /p /form I've traced through all the functions that $ajax-submit() uses and echoed out the results all the way down to $javascript-codeBlock(). codeBlock() is the function which encloses the $script inside script tags. I echoed out the $script and it looks okay: Event.observe('button18502', 'click', function(event) { new Ajax.Updater('categories','/cake/categories/edit', {asynchronous:true, evalScripts:true, requestHeaders:['X-Update', 'categories']}) }, false); But when it tries to return sprintf($this-tags['javascriptblock'], $script), nothing is returned. Again, this all works inside a view NOT called by ajax. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---