Re: Problem with Automagic Form Elements
OK.. Update - Problem resolved! It was my bad, I had put plurals var $uses = array('Orders', 'Businesses'); in the controller instead of singular! Thanks very much for your help, sorry it was a waste of your time! I would however like to get the 'unobtrusive date picker' to work - if anyone has any advice as to how the instructions in the article above can be adapted for 1.2 that would be a real bonus. Kindest Regards Ed --~--~-~--~~~---~--~~ 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: Problem with Automagic Form Elements
Thank you for your advice. However, I am still stuck with the problem. The fields are definitely named correctly. The table for which the automagic works and the table for which it does not were created using the same SQL script. The view was created using bake. I am unable to determine the reason for this anomaly. I would be very grateful for any further input on this. I have also investigated the acrticle by Marcel Manning at http://bakery.cakephp.org/articles/view/using-the-unobtrusive-date-picker-widget-in-cakephp with a view to implementing this. However, the information is out of date and some files referred to in the article do not exist in CakePHP 1.2 (i.e. default.thtml). There are some comments at the bottom but they are not at all helpful. If someone has the aforementioned date picker widget working in 1.2 I'm sure many others as well as I would appreciate if the article was updated to include suitable instructions. Thanks again and kind regards. Ed --~--~-~--~~~---~--~~ 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: Problem with Automagic Form Elements
Ok, sure. The table is as follows: CREATE TABLE `orders` ( `id` int(11) NOT NULL auto_increment, `order_date` datetime NOT NULL default '-00-00 00:00:00', `order_total` float NOT NULL default '0', `business_id` int(11) NOT NULL default '0', `package_id` int(11) default NULL, `option_id` int(11) default NULL, `advert_start_date` date NOT NULL default '-00-00', `advert_end_date` date NOT NULL default '-00-00', `payment_received` tinyint(1) NOT NULL default '0', `status` varchar(50) NOT NULL default '', `ip_address` varchar(20) NOT NULL default '', `op_description_box` tinyint(1) NOT NULL default '0', `op_long_description` tinyint(1) NOT NULL default '0', `op_main_image` tinyint(1) NOT NULL default '0', `op_link_to_company` tinyint(1) NOT NULL default '0', `op_images` smallint(6) default '0', `op_thumbnail_image` tinyint(1) NOT NULL default '0', `op_large_banner` tinyint(1) NOT NULL default '0', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; And the view comes out like this: div class=orders form ?php echo $form-create('Order');? fieldset legend?php __('Add Order');?/legend ?php echo $form-input('order_date'); echo $form-input('order_total'); echo $form-input('business_id'); echo $form-input('package_id'); echo $form-input('option_id'); echo $form-input('advert_start_date'); echo $form-input('advert_end_date'); echo $form-input('payment_received'); echo $form-input('status'); //echo $form-input('ip_address'); echo $form-input('op_description_box'); echo $form-input('op_long_description'); echo $form-input('op_main_image'); echo $form-input('op_link_to_company'); echo $form-input('op_images'); echo $form-input('op_thumbnail_image'); echo $form-input('op_large_banner'); ? /fieldset ?php echo $form-end('Submit');? /div I also note that the tinyint/checkbox fields are not picked up by the automagic either... Hope you are able to shed some light. I apologise in advance if I have missed something obvious! Cheers Ed --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Problem with Automagic Form Elements
Dear Cake People, I hope you can assist with this confusing issue. I am building an application in which several tables contain advert_start_date and advert_end_date fields. In MySQL they are set as the DATE type. The problem I am experiencing is that in the forms for one controller, the input is 'automagically' created as drop-down selection boxes for year, month, day. However, in other controllers only a simple text box is rendered. I cannot figure out why the forms are produced differently. The field names are identical, the data types identical. The views have just all been baked at this stage and contain no specific formatting details. Are there any other factors which could be affecting the 'automagic' behaviour? Thanks in advance, Ed --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Accelerating cakePHP
Hi, I've website which has about 3 uniq visits per day (up to 1500 online). The problem is that CMS written on CakePHP consumes too much of CPUs power. Almost everything is beeing cached (whole views, sometimes db results). In addition the same site was earlier driven by some poor free system which hadn't even had cache, and the CPU usage was about 6 times less. Do you have any tricks and tips to speed up system based on cake? Thx, Pillow --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Efficiency of database driven sessions
Hi, I'm going to implement some online users counter on my website. The simplest way of doing it is counting sessions active for instance for last 3 minutes. I've tried using CAKE_SESSION_SAVE set to cake, and counting files in / app/tmp/sessions/ which last modification time was greater than time()-3*60. But it was very slow because of that gc is running very rarely, and there are too many files to check (my website has up to 3 uniq visits per day). So, another idea is to have database driven sessions, and counting records modified not longer than 3 minutes ago by sql query. However, it also have disadvantages - each $this - Session - read/ write(); equals one database query. I use sessions very often, so number of queries to database on every request has risen rapidly. What do you think, is it going to slow down my website? Do you have better ideas on how to implement online counter? Thx, Pillow --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Translate behavior - finding by translated fields (1.2)
Hi, I wonder is there any better way of finding records by translated fields than this: $this - Page - find(array('I18n__url.content' = $url)); I've fields title, url and content translated. I want to search page not by its id, but by url, which is different for every locale. Pillow --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Changing baseUrl dynamically (1.2)
Hi, I'm trying to implement this kind of links in my app: example.com/en/ page, example.com/de/page etc. This is what my router connections look like: Router::connect('*/pages/edit/', array('controller' = 'pages', 'action' = 'edit')); Router::connect('*/pages/add/', array('controller' = 'pages', 'action' = 'add')); Router::connect('*', array('controller' = 'pages', 'action' = 'display')); And this is what I've in my app_controllers beforeFilter: if (in_array(@$this - params['pass'][0], $this - languages)) { $this - Page - locale = $this - params['pass'][0]; } else { $this - Page - locale = DEFAULT_LANGUAGE; } This works fine. But the problem is with links. I must do $html - link('link', '/'.$lang.'/page'); I would like change the baseUrl to make Router::url automatically generate links with language parameter (/en/) in them. Is it possible? I've tried with Configure::write('baseUrl', '/en/') but without effects. Is it possible? Or maybe I am completely wrong and I should rather use .htaccess to rewrite example.com/en/page/ links to, for instance, example.com/page/lang:en? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Subdirectory in /webroot/img/
Hi, I'm trying to do subdirectory in my /webroot/img/. And my question is how should my /webroot/.htaccces (or /webroot/img/ subdirectory/.htaccess ?) file look like? What I want is of course that I can access my images through http://example.com/img/subdirectory/some_file.jpg Thanks in advance, Pillow --~--~-~--~~~---~--~~ 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: Subdirectory in /webroot/img/
On 5 Sie, 11:55, Preloader [EMAIL PROTECTED] wrote: Hello Pillow, I don't think you have to change the .htaccess at all, it should work from the scratch: You're right. The problem was that file on which I was testing didn't really exist ;) Thx ;) --~--~-~--~~~---~--~~ 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: Bakery Article : How to use ACL in 1.2.x
On 13 Lip, 16:16, Ketan Patel [EMAIL PROTECTED] wrote: I have written an article in Bakery on how to use Acl. The url ishttp://bakery.cakephp.org/articles/view/how-to-use-acl-in-1-2-x I don't know whom to contact for getting the article published. But if some one senior could have a look and let me know the feedback, that would be great. http://tinyurl.com/3crabr : --~--~-~--~~~---~--~~ 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: cakephp 1.2 ACL problem
On 13 Lip, 16:11, Ketan Patel [EMAIL PROTECTED] wrote: I have written an article on 'How to use Acl in 1.2x' which is pending approval on bakery. I don't know if you could access it, though the url ishttp://bakery.cakephp.org/articles/view/how-to-use-acl-in-1-2-x Let me know if it helps you. The problem was auth component. I was trying tu use it + custom ACL checking. It was a bad move. I disabled Auth component, end now everything goes as it should. However, your article (on group as yet) is great :) Ketan, francky06l - thanks for your replies. Pillow --~--~-~--~~~---~--~~ 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: cakephp 1.2 ACL problem
On 13 Lip, 11:39, francky06l [EMAIL PROTECTED] wrote: Using create and save does not seem to fill up the lft / rght fields. No, lft and rght are alright (according to MPTT rules). These are my tables: acos: ++---+---+-++--+-- + | id | parent_id | model | foreign_key | alias | lft | rght | ++---+---+-++--+-- + | 1 | NULL | |NULL | controllers|1 |4 | | 2 | 1 | |NULL | someController |2 |3 | ++---+---+-++--+-- + aros: ++---+---+-+--+--+--+ | id | parent_id | model | foreign_key | alias| lft | rght | ++---+---+-+--+--+--+ | 1 | NULL | |NULL | Users|1 |6 | | 2 | 1 | |NULL | Admin|2 |5 | | 3 | 2 | |NULL | User.Someone |3 |4 | ++---+---+-+--+--+--+ aros_acos: ++++-+---+-+-+ | id | aro_id | aco_id | _create | _read | _update | _delete | ++++-+---+-+-+ | 1 | 1 | 1 | -1 |-1 | -1 | -1 | | 2 | 2 | 2 | 1 | 1 | 1 | 1 | ++++-+---+-+-+ --~--~-~--~~~---~--~~ 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: cakephp 1.2 ACL problem
On 13 Lip, 16:11, Ketan Patel [EMAIL PROTECTED] wrote: I have written an article on 'How to use Acl in 1.2x' which is pending approval on bakery. I don't know if you could access it, though the url ishttp://bakery.cakephp.org/articles/view/how-to-use-acl-in-1-2-x Let me know if it helps you. Ketan I can't access it now. I hope it will be approved soon :) --~--~-~--~~~---~--~~ 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 1.2 ACL problem
I am trying to use ACL in new 1.2. It seems to me that in check method (http://tinyurl.com/ywr9nu) on line 282 should be something like this: for ($i = 0; $i = count($aroPath) - 1; $i++) { rather than: for ($i = count($aroPath) - 1; $i = 0; $i--) { Now Acl is checking from the roots to leafs of AROs and ACOs trees. IMHO it should be done inversly. When I do something like this (Acl tables are now empty): //creating acos $this - Acl - Aco - create(array('alias' = 'controllers')); $this - Acl - Aco - save(); $this - Acl - Aco - create(array('alias' = 'someController', 'parent_id' = 1)); $this - Acl - Aco - save(); //creating aros $this - Acl - Aro - create(array('parent_id' = null, 'alias' = 'Users')); $this - Acl - Aro - save(); $this - Acl - Aro - create(array('parent_id' = 1, 'alias' = 'Admin')); $this - Acl - Aro - save(); //assigning privileges $this - Acl - deny('Users', 'controllers'); $this - Acl - allow('Users/Admin', 'someController'); //creating some user who is children of Users/Admin $this - Acl - Aro - create(array('parent_id' = 2, 'alias' = 'User.Someone')); $this - Acl - Aro - save(); And when I do $this - Acl - check('User.Someone', 'someController'); I am getting false, but I should be getting true... What do you think about it? I hope I am not wrong about the whole ACL idea... ;) --~--~-~--~~~---~--~~ 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: cakephp 1.2 ACL problem
On 12 Lip, 19:20, Ketan Patel [EMAIL PROTECTED] wrote: Did you check in database to see whether your AROs and ACOs are with proper parent/child relationship? Or use console to check cake acl view aros Yes, everything seems to be alright. Shell script outputs nice trees. Acl works fine the way it is. Also, look in the ACL behavior, this will save you the trouble from repeating yourself as it would create Aros or Acos depending on setup automatically when there is a save action and would delete when record is deleted, pretty slick. Hmm, thx :) --~--~-~--~~~---~--~~ 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 1.2 + Auth component (Auth::validate)
Hi, I'm trying to use new Auth component. I've got problem with Auth::validate. I want to use my own validation, not 'actions' or 'objects'. So, as it stands in the comment, in beforeFilter() of my appController I do: $this - Auth - validate = null; However, it doesn't work (maybe I'm wrong?) - the validation occurs and Auth component redirects me to /users/login. When I do $this - Auth - allow('*'); everything is ok. I want to build users system with several groups, that's why I'm not using 'action' type validation (is this good way of doing it?). Thanks! --~--~-~--~~~---~--~~ 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: CakePHP 1.2 + Auth component (Auth::validate)
I've tried already, anything changes... On 5 Lip, 14:59, Chris Hartjes [EMAIL PROTECTED] wrote: On 7/5/07, Pillow [EMAIL PROTECTED] wrote: Try $this-Auth-validate = false --~--~-~--~~~---~--~~ 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: CakePHP 1.2 + Auth component (Auth::validate)
On 5 Lip, 15:33, danfreak [EMAIL PROTECTED] wrote: Dunno if this can help, but I managed as explained in the following post: =http://groups.google.com/group/cake-php/t/871ff4c536bc1e00 Thanks for this post, it helped mi very much to get familiar with Auth component :) However, I don't want to use $this - Auth - allow('action'); --~--~-~--~~~---~--~~ 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: CakePHP 1.2 + Auth component (Auth::validate)
On 5 Lip, 19:38, danfreak [EMAIL PROTECTED] wrote: Try this then in your app_controller: -- $this-Auth-allow('*'); -- It should work as wildcard for every action. I said in my first post I can do it. But I would rather to do that in right way :) Hmm, or maybe it's right and the only way? Anyway, thanks for interest :) --~--~-~--~~~---~--~~ 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 generateFieldNames with $actsAs (1.2 version)
Hi, Do you know how to use generateFieldNames() with $actsAs? I've got model: class Page extends AppModel { public $name = 'Page'; public $actsAs = array('Translate' = array('title', 'body')); } ...controller: class PagesController extends AppController { public $helpers = array('Html', 'Form'); function admin_add() { $this - set('fieldNames', $this - generateFieldNames()); if (!empty($this - data['Page'])) { ... } } } ...and view: ?php echo $form - create('Page'); echo $form - inputs($fieldNames); echo $form - end(); ? The problem is that generateFieldNames() returns only fields wich are physically defined in pages table in DB and returns no title and body fields. Do you know how to make generateFieldNames() to return also translated fields? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---