Validation Rules Implementation Sequence
Hello geeks.. what about the implementation of validation rules... whether the first defined rule is implemented first or the last is implemented first. In more fields i got the last to be implemented to be first but in few there is no sequence.. Any idea?? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Help debugging pseudocoder.com Asset Packer CakePHP Plugin
http://github.com/mcurry/asset/tree/master http://github.com/mcurry/asset/tree/master I am having problems with this plugin. No errors, but when viewing the source, at the point where the CSS/JS files should be linked, there is no more markup, resulting in a blank page. Per asset.php lines 16-19, I tried all sorts of things, but cannot figure out how to debug. Since the asset packing only runs when Cake's debug is set to 0, how can I debug the problem? If I can figure the debug issue out, hopefully I can solve on my own. I did make a couple of assumptions from the README file instructions: #1: JSMin is in: vendors/jsmin/jsmin.php #3: The helper is in: app/plugins/asset/asset.php That's correct, right? -- View this message in context: http://n2.nabble.com/Help-debugging-pseudocoder.com-Asset-Packer-CakePHP-Plugin-tp3060340p3060340.html 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: Help debugging pseudocoder.com Asset Packer CakePHP Plugin
Try logging the error with log(), or checking your error/debug logs. On Jun 10, 11:22 pm, RyOnLife ryan.mckil...@gmail.com wrote: http://github.com/mcurry/asset/tree/masterhttp://github.com/mcurry/asset/tree/master I am having problems with this plugin. No errors, but when viewing the source, at the point where the CSS/JS files should be linked, there is no more markup, resulting in a blank page. Per asset.php lines 16-19, I tried all sorts of things, but cannot figure out how to debug. Since the asset packing only runs when Cake's debug is set to 0, how can I debug the problem? If I can figure the debug issue out, hopefully I can solve on my own. I did make a couple of assumptions from the README file instructions: #1: JSMin is in: vendors/jsmin/jsmin.php #3: The helper is in: app/plugins/asset/asset.php That's correct, right? -- View this message in context:http://n2.nabble.com/Help-debugging-pseudocoder.com-Asset-Packer-Cake... 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: Help debugging pseudocoder.com Asset Packer CakePHP Plugin
I'm tailing my logs and nothing suspicious is turning up. Re: the #3 instruction from above, I did realize I was getting a helper error when Cake was in debug mode, so now using: app/plugins/asset/views/helpers/asset.php So, I've got the helper plugin working correctly when Cake is in debug mode and it doesn't have to compress anything. But when Cake goes out of debug mode, the source markup still stops where the CSS/JS should be linked. I'm using this in my default layout: ?php echo $asset-scripts_for_layout(); ? That's in place of Cake's normal: ?php echo $scripts_for_layout; ? -- View this message in context: http://n2.nabble.com/Help-debugging-pseudocoder.com-Asset-Packer-CakePHP-Plugin-tp3060340p3060420.html 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: ACL, Auth, and terminology.
That makes things bit clear.. But Why we need roles and groups both? Isn't either of them is enough.. and fulfill the requirement.. As We can have users under groups in AROs and assign certain ACOs to a group so that the usres of that group have access to those ACOs.. What you think?? And I am a bit worried about the management of all this... Any idea for simplicity --~--~-~--~~~---~--~~ 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: Model + 2x behaviors = headache :(
bump!!! On 9 Giu, 16:20, Ernesto e.fanz...@gmail.com wrote: here's some pr output. @@@ AutoCodeBehavior @@@ $model-data @ AutoCode::beforeValidate (begin of function) Note: this is the original data array returned by the view Array ( [Order] = Array ( [customer_id] = 30 [ref] = T ) ) $model-data @ AutoCode::beforeValidate (end of function) Note: the Code field is successfully added to model data array Array ( [Order] = Array ( [customer_id] = 30 [ref] = T [Code] = 20090609 ) ) @@@ AutoDateBehavior @@@ $model-data @ AutoDate::beforeSave (begin of function) Note: the $model-data array is equal to the original one, Code field is magically disappeared, maybe Cake passes the original data array and not the modified one to every behavior? Array ( [Order] = Array ( [customer_id] = 30 [ref] = T ) ) $model-data @ AutoDate::beforeSave (end of function) Note: field EstimatedDeliveryDate is successfully added Array ( [Order] = Array ( [customer_id] = 30 [ref] = T [EstimatedDeliveryDate] = 2009-06-09 ) ) @@@ Model @@@ $this-data @ model::beforeSave Note: there's only EstimatedDeliveryDate field in data array. It seems like the first behavior didn't work at all Array ( [Order] = Array ( [customer_id] = 30 [ref] = T [EstimatedDeliveryDate] = 2009-06-09 ) ) On 9 Giu, 15:52, Ernesto e.fanz...@gmail.com wrote: here's my code. i removed all the comments. class OrderModel extends AppModel { var $actsAs = array(AutoCode, AutoDate); var $validate = array( Code = array( unique = array( rule = isUnique, allowEmpty = false, on = create ) ), ) } class AutoCodeBehavior extends ModelBehavior { function beforeValidate ($model) { $model-data[$model-alias][Code] = date(Ymd); return true; } } class AutoDateBehavior extends ModelBehavior { function beforeSave ($model) { $model-data[$model-alias][EstimatedDeliveryDate] = date(Y-m-d); return true; } } On 9 Giu, 15:04, Rob Conner rtcon...@gmail.com wrote: You probably should paste code, your in theory based on code you told us your wrote is correct. But that doesn't solve the problem. So there must be some error in your code. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Auth problem
Hello, I have an AdminsController class that uses User model to validate the username and password. the app_controller's before filter looks like this public function beforeFilter() { $this-set('site_url', 'http://localhost/cake/'); //Override default fields used by Auth component $this-Auth-fields = array('username'='email_address','password'='password'); $this-Auth-loginAction = array('controller' = 'admins', 'action'= 'login'); $this-Auth-logoutRedirect = array('controller'= 'admins', 'action' ='login'); $this-Auth-loginError = __('Invalid username or password', true); //$this-Auth-authError = __(' ', true); //this is for now. $this-Auth-loginRedirect = array( 'controller' = 'admins', 'action' = 'manage_users' ); //$this-set('admin', false); } After it logs in I dont see Auth component setting User information in session. I want the user to login before using any other page. My AdminsControllers beforeFilter and login() looks like this public function beforeFilter() { parent::beforeFilter(); $this-Auth-allow('login'); } function login() { $this-Session-write('userrole', ''); if(isset($this-data)) { //echo pr($this-data); $temp = $this-User-find(array('email_address'=$this-data['User']['email_address'])); //echo pr($this-Auth); $this-Session-write('userrole', $temp['Group'][0]['name']); //$this-Session-write('user_logged_id', $this-Auth['data']['username']); //once admin user logs in, he is redirected to manage users' page $this-redirect('/admins/manage_users'); } } Whats happening is everytime i login with correct password, I get Auth error ' You are not authorized to access that location.' and it goes back to login page again. In the function login, the echo pr($this-data); has empty string for password. Any pointers? Thanks, Bharani _ Lauren found her dream laptop. Find the PC that’s right for you. http://www.microsoft.com/windows/choosepc/?ocid=ftp_val_wl_290 --~--~-~--~~~---~--~~ 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: Model + 2x behaviors = headache :(
I don't know why, but model data modification is possible only in beforeSave method (at least in model itself) but your AutoCodeBehavior try to do it in beforeValidate method. On Jun 11, 2:38 pm, Ernesto e.fanz...@gmail.com wrote: bump!!! On 9 Giu, 16:20, Ernesto e.fanz...@gmail.com wrote: here's some pr output. @@@ AutoCodeBehavior @@@ $model-data @ AutoCode::beforeValidate (begin of function) Note: this is the original data array returned by the view Array ( [Order] = Array ( [customer_id] = 30 [ref] = T ) ) $model-data @ AutoCode::beforeValidate (end of function) Note: the Code field is successfully added to model data array Array ( [Order] = Array ( [customer_id] = 30 [ref] = T [Code] = 20090609 ) ) @@@ AutoDateBehavior @@@ $model-data @ AutoDate::beforeSave (begin of function) Note: the $model-data array is equal to the original one, Code field is magically disappeared, maybe Cake passes the original data array and not the modified one to every behavior? Array ( [Order] = Array ( [customer_id] = 30 [ref] = T ) ) $model-data @ AutoDate::beforeSave (end of function) Note: field EstimatedDeliveryDate is successfully added Array ( [Order] = Array ( [customer_id] = 30 [ref] = T [EstimatedDeliveryDate] = 2009-06-09 ) ) @@@ Model @@@ $this-data @ model::beforeSave Note: there's only EstimatedDeliveryDate field in data array. It seems like the first behavior didn't work at all Array ( [Order] = Array ( [customer_id] = 30 [ref] = T [EstimatedDeliveryDate] = 2009-06-09 ) ) On 9 Giu, 15:52, Ernesto e.fanz...@gmail.com wrote: here's my code. i removed all the comments. class OrderModel extends AppModel { var $actsAs = array(AutoCode, AutoDate); var $validate = array( Code = array( unique = array( rule = isUnique, allowEmpty = false, on = create ) ), ) } class AutoCodeBehavior extends ModelBehavior { function beforeValidate ($model) { $model-data[$model-alias][Code] = date(Ymd); return true; } } class AutoDateBehavior extends ModelBehavior { function beforeSave ($model) { $model-data[$model-alias][EstimatedDeliveryDate] = date(Y-m-d); return true; } } On 9 Giu, 15:04, Rob Conner rtcon...@gmail.com wrote: You probably should paste code, your in theory based on code you told us your wrote is correct. But that doesn't solve the problem. So there must be some error in your code. --~--~-~--~~~---~--~~ 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: Model + 2x behaviors = headache :(
that's not correct. a pr in model::beforeValidate shows the Code field. the data array seems to be resetted at every behavior call On 11 Giu, 10:13, Dr. Loboto drlob...@gmail.com wrote: I don't know why, but model data modification is possible only in beforeSave method (at least in model itself) but your AutoCodeBehavior try to do it in beforeValidate method. On Jun 11, 2:38 pm, Ernesto e.fanz...@gmail.com wrote: bump!!! On 9 Giu, 16:20, Ernesto e.fanz...@gmail.com wrote: here's some pr output. @@@ AutoCodeBehavior @@@ $model-data @ AutoCode::beforeValidate (begin of function) Note: this is the original data array returned by the view Array ( [Order] = Array ( [customer_id] = 30 [ref] = T ) ) $model-data @ AutoCode::beforeValidate (end of function) Note: the Code field is successfully added to model data array Array ( [Order] = Array ( [customer_id] = 30 [ref] = T [Code] = 20090609 ) ) @@@ AutoDateBehavior @@@ $model-data @ AutoDate::beforeSave (begin of function) Note: the $model-data array is equal to the original one, Code field is magically disappeared, maybe Cake passes the original data array and not the modified one to every behavior? Array ( [Order] = Array ( [customer_id] = 30 [ref] = T ) ) $model-data @ AutoDate::beforeSave (end of function) Note: field EstimatedDeliveryDate is successfully added Array ( [Order] = Array ( [customer_id] = 30 [ref] = T [EstimatedDeliveryDate] = 2009-06-09 ) ) @@@ Model @@@ $this-data @ model::beforeSave Note: there's only EstimatedDeliveryDate field in data array. It seems like the first behavior didn't work at all Array ( [Order] = Array ( [customer_id] = 30 [ref] = T [EstimatedDeliveryDate] = 2009-06-09 ) ) On 9 Giu, 15:52, Ernesto e.fanz...@gmail.com wrote: here's my code. i removed all the comments. class OrderModel extends AppModel { var $actsAs = array(AutoCode, AutoDate); var $validate = array( Code = array( unique = array( rule = isUnique, allowEmpty = false, on = create ) ), ) } class AutoCodeBehavior extends ModelBehavior { function beforeValidate ($model) { $model-data[$model-alias][Code] = date(Ymd); return true; } } class AutoDateBehavior extends ModelBehavior { function beforeSave ($model) { $model-data[$model-alias][EstimatedDeliveryDate] = date(Y-m-d); return true; } } On 9 Giu, 15:04, Rob Conner rtcon...@gmail.com wrote: You probably should paste code, your in theory based on code you told us your wrote is correct. But that doesn't solve the problem. So there must be some error in your code. --~--~-~--~~~---~--~~ 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: xml parsing problem
Try use the var_dump() or debug().I had the same problem and i am using the debug().To be more specific here is some code which might help you: $results = $parsed_xml = new XML($results); $parsed_xml = Set::reverse($parsed_xml); debug($results); (or var_dump($results)) 2009/6/11 robert123 generics...@gmail.com i am using the below codes, took from the bakery, straight App::import('Xml'); // your XML file's location $file = my_xml_file.xml; // now parse it $parsed_xml = new XML($file); $parsed_xml = Set::reverse($parsed_xml); // this is what i call magic // see the returned array print_r($parsed_xml); the my_xml_file.xml have the data below order id=3525314 /orderorder id=3525317 /order it has two order data, the my_xml_file.xml was generated from the database using $xml-serialize($data); but whenever the code above is executed I only get Array ( [Order] = Array ( [id] = 3525314 ) ) that is it is only reads the first order and never the second order, how can i make it to read the whole xml data into an array, thank you http://www.generics.ws --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Error: Create the class SController below in file: app\controllers\s_controller.php
Hi Everybody, Something strange happens when users try to login by the first time on the little web app that I was implemented in cakePHP. When the user fill username fill password textbox and after that press enter key (pay attention that the cursor is in the end of password textbox) the system show the error listed below: But if the user do the same action cited above and instead he/she uses mouse to click on de buttom submit, everything works fine. I have no controller named as S. instead I have 3 others ones that start with letter S: subjects_controller.php, slots_controller.php slot:_users_controller.php I'm using CakePHP 1.2.2.8120 apache 2.2.x Mysql 5.01 Windows XP Configure::write('debug', 2); Any sugestions? Thanks for the support Missing Controller Error: SController could not be found. Error: Create the class SController below in file: app\controllers \s_controller.php ?php class SController extends AppController { var $name = 'S'; } ? Notice: If you want to customize this error message, create app\views \errors\missing_controller.ctp (default) 3 queries took 6 ms NrQuery Error AffectedNum. rows Took (ms) 1 DESCRIBE `aros` 7 7 2 2 DESCRIBE `acos` 7 7 2 3 DESCRIBE `aros_acos`7 7 2 --~--~-~--~~~---~--~~ 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: Error: Create the class SController below in file: app\controllers\s_controller.php
Please show the login forms html code! Also mention if you are using javascript to catch the mouse, and so on! Everything that may be of help in understanding your problem and thus help you better! Enjoy, John On Jun 11, 12:11 pm, Alexandre Brasil alexandrepernambuc...@gmail.com wrote: Hi Everybody, Something strange happens when users try to login by the first time on the little web app that I was implemented in cakePHP. When the user fill username fill password textbox and after that press enter key (pay attention that the cursor is in the end of password textbox) the system show the error listed below: But if the user do the same action cited above and instead he/she uses mouse to click on de buttom submit, everything works fine. I have no controller named as S. instead I have 3 others ones that start with letter S: subjects_controller.php, slots_controller.php slot:_users_controller.php I'm using CakePHP 1.2.2.8120 apache 2.2.x Mysql 5.01 Windows XP Configure::write('debug', 2); Any sugestions? Thanks for the support Missing Controller Error: SController could not be found. Error: Create the class SController below in file: app\controllers \s_controller.php ?php class SController extends AppController { var $name = 'S';} ? Notice: If you want to customize this error message, create app\views \errors\missing_controller.ctp (default) 3 queries took 6 ms Nr Query Error Affected Num. rows Took (ms) 1 DESCRIBE `aros` 7 7 2 2 DESCRIBE `acos` 7 7 2 3 DESCRIBE `aros_acos` 7 7 2 --~--~-~--~~~---~--~~ 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: ACL, Auth, and terminology.
On 11 Cze, 08:58, CMNAJS cmn...@gmail.com wrote: But Why we need roles and groups both? Isn't either of them is enough.. and fulfill the requirement.. As We can have users under groups in AROs and assign certain ACOs to a group so that the usres of that group have access to those ACOs.. IMO there's one problem with both of these approaches. Having a User HABTM Role would require to iterate through all Roles the user has to determine if the Role has access. The User as ARO approach has another problem - you can't have a User in multiple Groups, thus you can't have a User be 'Post Admin' _and_, say, 'Comment Admin'. You have to either create a separate group 'Post and Comment Manager' or assign permissions directly to the user. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Big difference between CakePHP and Joomla
Hi, I'm now to CakePHP, I like to build a website for kids, an education and interactive interface, something like ( www.cghub.com ), I would like to offer for kids many education / intelligent services to learn and have fun in the same time ... so I began with learning CakePHP, and I know already Joomla, my principal question to begin this discussion with you is ( What is the big difference between CakePHP and Joomla ? ) I'm not expert with php, I'm still learning, you can check the following link to have an idea about my level : http://www.beginfromhere.com also some nice php developers helped me in this way. Best regards for all, and I hope I will have your answer, opinions, comments soon. Best regards, bbparis --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
question about aros_acos table
Hi people, As i am building my 1st ACL app and i am facing some problems i 'd like to ask a question: When i run cake schema run create DbAcl the 3 tables are created (aros,acos,aros_acos) In my users controller i have the following functions : add(not create),edit (not update),view(not read),delete,change_status. Is the name convention in acos and aros_acos table so important so that the permissions would be fine? I mean am i supposed to change my functions name to create,read etc? And what about the other which are not included in acos table? Ty 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 cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Deep find, how to tell cake to follow all relations?
Hello, I have the following models / relations: ?php class Service extends AppModel { var $useTable = 'service'; var $belongsTo = array('ServiceGroup', 'ServiceType'); } ? ?php class ServiceType extends AppModel { var $useTable = 'service_type'; var $hasMany = array( 'Service', 'ServiceTypeField' = array( 'dependent' = true )); } ? ?php class ServiceTypeField extends AppModel { var $useTable = 'service_type_field'; var $belongsTo = array('ServiceType'); var $hasMany = array( 'ServiceTypeFieldValue' = array( 'dependent' = true )); } ? ?php class ServiceTypeFieldValue extends AppModel { var $useTable = 'service_type_field_value'; var $belongsTo = array('ServiceTypeField'); } ? in Service controller, I want to query all ServiceTypeFields and related ServiceTypeFieldValues with certain Service id. So I tried this: $service_id = 1; $params = array( 'conditions' = array('Service.id' = $service_id), 'order' = array('Service.name'), ); $serviceTypeFieldList = $this-Service-ServiceType-ServiceTypeField- find('all', $params); that generates the followin SQL: Query: SELECT `ServiceTypeField`.`id`, `ServiceTypeField`.`service_type_id`, `ServiceTypeField`.`name`, `ServiceType`.`id`, `ServiceType`.`name` FROM `service_type_field` AS `ServiceTypeField` LEFT JOIN `service_type` AS `ServiceType` ON (`ServiceTypeField`.`service_type_id` = `ServiceType`.`id`) WHERE `Service`.`id` = 1 ORDER BY `Service`.`name` ASC and that does not work as the Service table isn't bound to the relations and it cannot find Service.id or Service.name. What I'm doing wrong? How can I tell cake to join Service to the find too? --~--~-~--~~~---~--~~ 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: Deep find, how to tell cake to follow all relations?
On 06/11/2009 02:15 PM, doze wrote: and that does not work as the Service table isn't bound to the relations and it cannot find Service.id or Service.name. What I'm doing wrong? How can I tell cake to join Service to the find too? Looks like a Containable job. http://book.cakephp.org/view/474/Containable --~--~-~--~~~---~--~~ 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: List of protected class names
I wrote a small script to test the mentioned names: Possible is: admin app_model bake baker behavior cake element error layout page scaffold schema test translate xml NOT possible is: app appmodel cache component debugger file folder helper inflector model object router set The not possible class names are singular, but the related model tables are named plural. On 10 Jun., 17:52, Marcelo Andrade mfandr...@gmail.com wrote: On Wed, Jun 10, 2009 at 8:13 AM, powtacpow...@gmx.de wrote: What are protected (model) class names in CakePHP 1.2? I discovered objects apps folder so far. Beside the class name already used, I guess the subfolders names inside models, views and controllers. components elements errors helpers layouts pages scaffolds Not for sure, but all of these are candidates to be reserved words in Cake. Best regards. -- MARCELO DE F. ANDRADE Belem, PA, Amazonia, Brazil Linux User #221105 http://mfandrade.wordpress.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: Big difference between CakePHP and Joomla
To borrow a phrase I heard the other day, it's like comparing an orange to a polar bear. Joomla is an off-the-shelf CMS that provides a functional website in a matter of minutes, you can customise the look and feel using templates and extend the functionality using extenstions, etc... CakePHP is a framework to build websites, but you start with nothing. Not even a database, you have to design everything from the ground up. Apparently Joomla does support MVC development now (I'm only going off what someone told me about 12 months ago), but to me the two things are completely different . HIH :) From: bbparis bilalbas...@gmail.com To: CakePHP cake-php@googlegroups.com Sent: Thursday, 11 June, 2009 6:56:45 PM Subject: Big difference between CakePHP and Joomla Hi, I'm now to CakePHP, I like to build a website for kids, an education and interactive interface, something like ( www.cghub.com ), I would like to offer for kids many education / intelligent services to learn and have fun in the same time ... so I began with learning CakePHP, and I know already Joomla, my principal question to begin this discussion with you is ( What is the big difference between CakePHP and Joomla ? ) I'm not expert with php, I'm still learning, you can check the following link to have an idea about my level : http://www.beginfromhere.com also some nice php developers helped me in this way. Best regards for all, and I hope I will have your answer, opinions, comments soon. Best regards, bbparis Need a Holiday? Win a $10,000 Holiday of your choice. Enter now.http://us.lrd.yahoo.com/_ylc=X3oDMTJxN2x2ZmNpBF9zAzIwMjM2MTY2MTMEdG1fZG1lY2gDVGV4dCBMaW5rBHRtX2xuawNVMTEwMzk3NwR0bV9uZXQDWWFob28hBHRtX3BvcwN0YWdsaW5lBHRtX3BwdHkDYXVueg--/SIG=14600t3ni/**http%3A//au.rd.yahoo.com/mail/tagline/creativeholidays/*http%3A//au.docs.yahoo.com/homepageset/%3Fp1=other%26p2=au%26p3=mailtagline --~--~-~--~~~---~--~~ 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: Deep find, how to tell cake to follow all relations?
Hmm.. I have briefly looked at Containable, but I have understoon that it does just the opposite, e.g. limits or filters the results that would be normally returned. I still don't quite understand how I should use it. Could you give me an example based on my situtation? Br, Anssi On 11 kesä, 14:54, Alexandru Ciobanu ics.cake...@gmail.com wrote: On 06/11/2009 02:15 PM, doze wrote: and that does not work as the Service table isn't bound to the relations and it cannot find Service.id or Service.name. What I'm doing wrong? How can I tell cake to join Service to the find too? Looks like a Containable job. http://book.cakephp.org/view/474/Containable --~--~-~--~~~---~--~~ 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: Logging changes made on edit action
Thanks Chris, I knew there must of been something already written for this. Will go try it out!! --~--~-~--~~~---~--~~ 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: Html-image outputs path relative to index.php, doesn't work if the url is (localhost)/app/controller/action
Well, that is strange. The only slight warning bell in the back of my head is $menu. What is $menu? A helper? If you include and instantiate that object yourself then possibly, maybe, that throws the html helper off. I have only ever used helpers inside the layout, a view or an element On Jun 10, 5:13 pm, Jasper jjwtim...@gmail.com wrote: CSS input in layout\default.ctp: echo $html-css( 'global' ); CSS output: link rel=stylesheet type=text/css href=/jtcms/css/global.css / In layout\default.ctp: echo $menu-show(); In menu.php: $output .= $html-image(pijl_rechts.gif, array(alt = Move Right,'url' = array('controller' = 'links', 'action' = 'makeChild', $val['Link']['id']) )); return $output; Image URL output: a href=/jtcms/webpages/view/1Page 1/aa href=/jtcms/links/ makeParent/7img src=img/pijl_links.gif alt=Move left //a Notice the href having /jtcms, and the img having img in front. On 10 jun, 09:27, Martin Westin martin.westin...@gmail.com wrote: Problems with linking to images css or javascript are often the result of problems with the rewriting of urls. That is why I wanted you to check the .htaccess files were there. Also the fact that you had app as a component of your path is odd and might have thrown Cake a bit. But I now noticed a tiny detail in your original post. You wrote that you got a path like .\ (dot backslash). That does not look right either. Paths always use forward slashes and, in my installations, they are all output as absolute paths (starting from the website root). The strange part is that all the things that I know of that can cause this kind of problem would also show themselves for your css and javascript. On Jun 9, 8:12 pm, Jasper jjwtim...@gmail.com wrote: I don't have the .htaccess file in my cake folder, but it isn't in the cake zip archive either. But excuse me, I don't understand what the .htaccess has to do with my problem in the first post. Cake writes a relative URL, that works ok if you put the helper in the action.ctp, but I have it in the default.ctp layout file. Now image urls are relative to index.php so to speak, and the browser is confused with urls like /controller/ action/parameter, because the image doesn't exist in /controller/ action/img/image.gif. Maybe this has to do with the default.ctp being rendered before it is passed to the action, so it doens't know how to construct the url for the action? On 9 jun, 16:20, Martin Westin martin.westin...@gmail.com wrote: if htdocs is the root folder your urls should look something like localhost/jtcms/controller/action You might also have lost one of the .htaccess files that help Apache give Cake the correct path info. There should be one (usually invisible) in each of the folders jtcms, app, webroot. Especially Mac users (like me) can loose these since they are invisible and do not always come along in a normal copy operation. On Jun 9, 10:08 am, Jasper jjwtim...@gmail.com wrote: htdocs/jtcms/app htdocs/jtcms/cake But if I configure cake correct, it does output the full image path? I couldn't believe I was the only one with this problem... On 8 jun, 16:11, Martin Westin martin.westin...@gmail.com wrote: Not a bug. You either have a configuration problem or just missed how your install does its redirection. You should never have to use app in your urls. try using urls like localhost/controller/action What is your layout? localhost points to a folder containing cake, app, vendors, ... ? On Jun 8, 9:27 am, Jasper jjwtim...@gmail.com wrote: Hi, The Html-image helper in the layoutfile outputs an img tag with the path .\img\image.gif. The browser can only find it when I am only one level deep, i.e. http://localhost/app/controller;. When I add a trailing slash, the images are broken. And when I visit an action, like http://localhost/app/controller/action;, it's also broken. The browser looks for http://localhost/app/controllers/img/image.gif; code-tag: $html-image(pijl_onder.gif, array(alt = Move Down,'url' = array('controller' = 'links', 'action' = 'moveDown', $val['Link'] ['id'],1) )) Is this a bug?- Tekst uit oorspronkelijk bericht niet weergeven - - Tekst uit oorspronkelijk bericht weergeven -- Tekst uit oorspronkelijk bericht niet weergeven - - Tekst uit oorspronkelijk bericht weergeven -- Tekst uit oorspronkelijk bericht niet weergeven - - Tekst uit oorspronkelijk bericht weergeven - --~--~-~--~~~---~--~~ 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
Re: Big difference between CakePHP and Joomla
Ahh, the recurring million dollar question: Should you start with Joomla and add your custom stuff as a Joomla component, or build everything from scratch with cake? I've spent far too much time in the past agonizing over this. My own conclusion was if you're not in the web development business, and can live with what Joomla is, go with Joomla. It does what it was built for well, and deployment is instant and cheap. Anyone in the web development business, who is in it for the long term, would be better off building their development infrastructure on top of cake, then re-using that as a base to deliver different types of web apps. The real development money is (in my opinion) not in the blogs, forums, articles, galleries, etc. as that stuff is already available for free, with zillions of features, and has been super-tested on more platforms than you can dream. The meat and potatoes money in development, I believe, are companies whose web apps are their main business, they depend on them for revenues, and therefore it is worth it for them to constantly add new features, as it helps them make money. For that kind of target market, Joomla will not get you very far. --~--~-~--~~~---~--~~ 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: Poll: what do you hate about CakePHP?
A bug, is a bug, is a bug. Feel free to repeat it indefinitely. To me, bug is a bug only if a) others are able to reproduce it and b) it is not a feature. I think you are bug, a bug, a bug, because you don't work for me. Now decide if you'll close it as wontfix, worksforme or needmoreinfo. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
modify created and modified fields in scaffold views
Is there an elegant way to make the two fields created and modified visible/editable in scaffold views? thx sorry for a repost but the first one seemed to have vanished somehow. --~--~-~--~~~---~--~~ 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: Relationship question
Right. Thanks for that. So to make this work with the relations you out lined below if I add employee_id to the posts table , creates employees tables with investor_id post_id that should do it for db changes? Add the employees controller/model and add the relationshis to the other models Investor / Posts. Thanks again. Dave -Original Message- From: John Andersen [mailto:j.andersen...@gmail.com] Sent: June-11-09 2:43 AM To: CakePHP Subject: Re: Relationship question Hi Dave, On the assumption, that one post will only be handled by one employee, the following relationships would be required: Investor hasMany Posts Investor hasMany Employees Employee (handles) hasMany Posts Post belongsTo Investor Post belongsTo (is handled by) Employee (the Handler) I do not see a need for the relationship: Post hasOne Investor My understanding of the hasOne relationship, is that the foreignkey then is at the Investor end, which I assume is not the case, but maybe you can clarify that? Enjoy, John On Jun 10, 7:00 pm, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: I want to add to an app a new function. Basically I have Investors that hasMany Posts. Nothing crazy there Now I want to add Employees that belongTo Investors so an Investor company can if they choose add employees to manage different Posts . So if an Investor company has 35 Posts they can add an employee(s) and say employee1 will handle Post3, employee2 will handle Post 5,6,7 soon and so on Right now the Investor hasMany Posts so to expand this idea I cant figure out how Post - Employee Relationship would be Investor hasMany Posts Investor hasMany Employees Employee hasMany Posts Post belongsTo Investor Post hasOne Investor Ideas? Dave --~--~-~--~~~---~--~~ 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: $javascript-event() with Event:Selectors
Hi Ishmael, The event:Selectors style requires a slightly different syntax because of how it's set up, and you need to write it like this: $javascript-event('.post .title:mouseover', 'this.select (.delete_action).invoke(show)'); Hope that helps, - Nate On Jun 8, 9:06 pm, isho iri...@gmail.com wrote: I having some trouble figuring out how to use $javascript-event() with selectors other than #id's First of all I was getting this error message EventSelectors is not defined until I included the js lib event-selectors.js that I found on github. (http://github.com/Caged/javascript-bits/tree/ 16af773a1316774b53805b7fc63b5e1eec34c35d/event-selectors) The documentation doesn't really make this clear so I may have included the wrong library. Now I'm getting the js error: mouseout is not defined This is my php code: --- echo $javascript-event('.post .title', 'mouseover','this.select (.delete_action).invoke(show)'); --- and here's the generated javascript: var Rules = { '.post .title': function(element, event) { mouseout }} EventSelectors.start(Rules); It seems like the method signature for this usage of the event() method is different. Does anyone know how to do this? I'm fairly new to cakephp and prototype. Best, Ishmael --~--~-~--~~~---~--~~ 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: Deep find, how to tell cake to follow all relations?
On 06/11/2009 03:27 PM, doze wrote: Could you give me an example based on my situtation? Something like this. $serviceTypeFieldList = $this-ServiceTypeField-find('all', array('conditions' = array('your conditions array here'), 'contain' = array('ServiceType' = array('Service'), 'ServiceTypeFieldValue'))); Please note that this is just an example, adjust to your needs. --~--~-~--~~~---~--~~ 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: Logging changes made on edit action
Hey, I'm pretty sure I have set up everything correctly, but this is not working out to well for me. The logable Behavior never gets called... I must say I have never worked with behaviors before and these next few lines may sounds very noobish this is how I set it up: --- in each model needed I have added : var $actsAs = array(Logable); --- added the Behavior code in: app-models-behaviors-Logable.php --- added this to the app_controller-beforeFilter: if (sizeof($this-uses) $this-{$this-modelClass}-Behaviors- attached('Logable')) { $this-{$this-modelClass}-setUserData($this-activeUser); } --- created my logs table: CREATE TABLE `logs` ( `id` bigint(10), `title` varchar(255), `created` datetime, `description` varchar(255), `model` varchar(255), `action` varchar(255), `change` varchar(255) ); and finally created a log model (log.php): ?php class Log extends AppModel { var $order = 'Log.created DESC'; } ? Could anyone tell me what am I doing wrong? --~--~-~--~~~---~--~~ 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: Javascript in Ajax views
Ok, I understand that. Thanks for the explanation. So it almost sounds like I need to either have the events external to the tags or else I need some code to evaluate the javascript in the tags (I found a pure javascript example). But where would I put that code? In my main page or inside the Ajax rendered view? Hmmm... maybe it doesn't matter. I think from my experiments I determined that code inside the script tags was getting evaluated. But why isn't the $javascript-link ('filename') tag getting loaded I wonder? On Jun 10, 6:27 pm, brian bally.z...@gmail.com wrote: On Wed, Jun 10, 2009 at 4:02 PM, Nancynancy.milli...@gmail.com wrote: Something seems to happen when you have javascript embedded in an ajax rendered view and it is getting me confused! I have this line at the top, it works when I call the view directly, but doesn't seem to do anything when ajax renders the view: ?= $javascript-link('clearSelect'); ? I see the alerts when the page is loaded directly but not through ajax. The function works ok when loaded directly but not through ajax. I'm using Protype and Ajax. == clearSelect.js == alert(hello!); function unselectAll(ele) { alert(ele); var obj=$(ele); for (var i=0; i obj.options.length; i++) { obj.options[i].selected = null; } } = I've also run into this issue when I have buttons and things on my form I try to put some Javascript on, and they just don't work. I've googled for an answer and realize that perhaps events aren't getting hooked up but I'm not knowledgeable enough to figure out on my own how to address that. So any specifics would be hugely appreciated! And it looks like my javascript source file isn't being included at all. No, it is not. You have to understand what an AJAX request is, and what your javascript function is doing with the result. In your case, the view is being rendered by Cake into an HTML block which, when sent back to the client, is inserted into the DOM. A javascript include is not going to work because the tag will not be evaluated. It's a similar situation for event handlers. When the HTML chunk is inserted int the DOM, if there's no instruction to evaluate the page again in order to register event handlers you're not going to get the expected results. I use jQuery, not Prototype, so I can't give you any specifics to deal with that. --~--~-~--~~~---~--~~ 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: Logging changes made on edit action
Never mind, I got it, app-models-behaviors-Logable.php needs to be app-models-behaviors-logable.php an hour wasted for a god damn lower case L. Hehehehe, back to work :D! --~--~-~--~~~---~--~~ 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: Javascript in Ajax views
On Thu, Jun 11, 2009 at 11:06 AM, Nancynancy.milli...@gmail.com wrote: Ok, I understand that. Thanks for the explanation. So it almost sounds like I need to either have the events external to the tags or else I need some code to evaluate the javascript in the tags (I found a pure javascript example). But where would I put that code? In my main page or inside the Ajax rendered view? Hmmm... maybe it doesn't matter. You can create a function which sets your event handlers on certain elements. Call this on page load as well from your AJAX 'success' callback. I think from my experiments I determined that code inside the script tags was getting evaluated. But why isn't the $javascript-link ('filename') tag getting loaded I wonder? On Jun 10, 6:27 pm, brian bally.z...@gmail.com wrote: On Wed, Jun 10, 2009 at 4:02 PM, Nancynancy.milli...@gmail.com wrote: Something seems to happen when you have javascript embedded in an ajax rendered view and it is getting me confused! I have this line at the top, it works when I call the view directly, but doesn't seem to do anything when ajax renders the view: ?= $javascript-link('clearSelect'); ? I see the alerts when the page is loaded directly but not through ajax. The function works ok when loaded directly but not through ajax. I'm using Protype and Ajax. == clearSelect.js == alert(hello!); function unselectAll(ele) { alert(ele); var obj=$(ele); for (var i=0; i obj.options.length; i++) { obj.options[i].selected = null; } } = I've also run into this issue when I have buttons and things on my form I try to put some Javascript on, and they just don't work. I've googled for an answer and realize that perhaps events aren't getting hooked up but I'm not knowledgeable enough to figure out on my own how to address that. So any specifics would be hugely appreciated! And it looks like my javascript source file isn't being included at all. No, it is not. You have to understand what an AJAX request is, and what your javascript function is doing with the result. In your case, the view is being rendered by Cake into an HTML block which, when sent back to the client, is inserted into the DOM. A javascript include is not going to work because the tag will not be evaluated. It's a similar situation for event handlers. When the HTML chunk is inserted int the DOM, if there's no instruction to evaluate the page again in order to register event handlers you're not going to get the expected results. I use jQuery, not Prototype, so I can't give you any specifics to deal with that. --~--~-~--~~~---~--~~ 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: modify created and modified fields in scaffold views
On Thu, Jun 11, 2009 at 9:46 AM, JuergenRiemerjuergen.rie...@gmail.com wrote: Is there an elegant way to make the two fields created and modified visible/editable in scaffold views? thx sorry for a repost but the first one seemed to have vanished somehow. You can change the templates Cake uses. Copy cake/libs/views/scaffolds/* to app/views/scaffolds/ to edit. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Can containable GROUP BY?
Hi, I find myself needing to get associated data grouped by a field but Containable seems to interpret the group key as an extra field to include. @line 267 containable specifies a bunch of valid options but groups is not one of them. Trying to be cheeky and adding group to the list makes the errors go away but the group statement is still ignored... and that is as far as I have come trying to understand the internals of Containable. My question is if the missing group is a small oversight that can be easily implemented or if grouping has been intentionally abandoned after it proved to be too complex, or something? --~--~-~--~~~---~--~~ 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: Can containable GROUP BY?
Have a look at this thread: http://groups.google.com/group/cake-php/browse_thread/thread/4b1351b60bb2093f On Thu, Jun 11, 2009 at 11:45 AM, Martin Westinmartin.westin...@gmail.com wrote: Hi, I find myself needing to get associated data grouped by a field but Containable seems to interpret the group key as an extra field to include. @line 267 containable specifies a bunch of valid options but groups is not one of them. Trying to be cheeky and adding group to the list makes the errors go away but the group statement is still ignored... and that is as far as I have come trying to understand the internals of Containable. My question is if the missing group is a small oversight that can be easily implemented or if grouping has been intentionally abandoned after it proved to be too complex, or something? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Extract help
I am using the Wizard component and validating HABTM but the Wizard spits out an array like this: debug($this-data); [Certification] = Array ( [Certification] = Array ( [Certification] = Array ( [0] = sdgsdfg ) ) ) This will not validate for some reason...i think because of the triple [Certification] My validation compares submitted values against possible values in the db with function checkValues($data) { if (!empty($this-data)) { $results = array_diff($this-data['Certification']['Certification'], $this-find('list', array('fields' = 'id', 'order' = 'id ASC'))); if (empty($results)) { return true; } else { return false; } } } So my question is how can I strip out the extra [Certification] to maye the array look like [Certification] = Array ( [Certification] = Array ( [0] = sdgsdfg ) ) Then pass it to the model for validation? Thanks Dave --~--~-~--~~~---~--~~ 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: Route instead of redirect?
Have you tried using App::import('Controller', 'ControllerName') to get an instance of a new controller? You'd then have to initialize it with the bootstrap stuff that Cake automatically does for you (assuming you want the object attributes set correctly). From there I would guess that you could make any calls that you want. However, I'd caution against doing something like this. Personally (and, I think conventionally), a URL/URI should represent a resource (let's say a web page for this example). The same URI should always access the same resource (although, I grant you, it'll change over time if it's DB driven). If you're not sending redirects, you're kind of breaking this model. So make sure this is something you really want to do before you do it. Why do you not like redirects, anyway? On Jun 10, 9:31 am, TimG t...@gurske.com wrote: Did I stump the experts? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Scalability of a CakePHP application
Hi I develop a web application in cake and now I must to scale my system. I think to replicate all my code in all my webservers but I have a doubt : The static images I must replicate in all them? And the javascripts and the css in webroot? If not how can I modify the helpers (html , javascript ... ) in the way to use the right url where there are image,js,css or can I do it with config of cake? Another question : the files that are uploaded by users how can manage this in an enviroment with many web server? I'm very interested about other experiences relative on how manage the code's problem in scalable enviroment --~--~-~--~~~---~--~~ 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: question about aros_acos table
Short answer: no, you don't have to change the names of your actions. You could try to 'map' them into crud or use action based acl. Complete one: http://book.cakephp.org/view/641/Simple-Acl-controlled-Application --- kiang On Jun 11, 7:08 pm, Paulos23 paulitosthe...@gmail.com wrote: Hi people, As i am building my 1st ACL app and i am facing some problems i 'd like to ask a question: When i run cake schema run create DbAcl the 3 tables are created (aros,acos,aros_acos) In my users controller i have the following functions : add(not create),edit (not update),view(not read),delete,change_status. Is the name convention in acos and aros_acos table so important so that the permissions would be fine? I mean am i supposed to change my functions name to create,read etc? And what about the other which are not included in acos table? Ty 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 cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
RE: Extract help - Possible solution?
What I have done is $strippedCertifications = $this-data; $strippedCertifications = Set::extract($this-data, 'Certification.Certification.Certification.{n}'); $arr = array('Certification' = array ('Certification' = $strippedCertifications)); $this-$strippedCertifications-set($arr); if ($this-Certification-validates()) { return true; } return false; So I get the values from the array only then rebuild the array I need it and it validates now. But is there a cleaner way to do this based on the code above? -Original Message- From: Dave Maharaj :: WidePixels.com [mailto:d...@widepixels.com] Sent: June-11-09 1:32 PM To: cake-php@googlegroups.com Subject: Extract help I am using the Wizard component and validating HABTM but the Wizard spits out an array like this: debug($this-data); [Certification] = Array ( [Certification] = Array ( [Certification] = Array ( [0] = sdgsdfg ) ) ) This will not validate for some reason...i think because of the triple [Certification] My validation compares submitted values against possible values in the db with function checkValues($data) { if (!empty($this-data)) { $results = array_diff($this-data['Certification']['Certification'], $this-find('list', array('fields' = 'id', 'order' = 'id ASC'))); if (empty($results)) { return true; } else { return false; } } } So my question is how can I strip out the extra [Certification] to maye the array look like [Certification] = Array ( [Certification] = Array ( [0] = sdgsdfg ) ) Then pass it to the model for validation? Thanks Dave --~--~-~--~~~---~--~~ 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: Javascript in Ajax views
Ok, here's what I ended up doing and I think it works. I have this getting loaded in my main page. pre function sethtml(div,content) { var search = content; var script; while( script = search.match(/(script[^]+javascript[^]+\s* (!--)?)/i)) { search = search.substr(search.indexOf(RegExp.$1) + RegExp. $1.length); if (!(endscript = search.match(/((--)?\s*\/script)/))) break; block = search.substr(0, search.indexOf(RegExp.$1)); search = search.substring(block.length + RegExp.$1.length); var oScript = document.createElement('script'); oScript.text = block; document.getElementsByTagName(head).item(0).appendChild (oScript); } document.getElementById(div).innerHTML=content; } /pre /* I'm not clever enough to write this, found it here: http://www.modernmethod.com/sajax/forum/viewtopic.php?t=847 */ In my ajaxlink I have a callback on completion to sethtml like this: pre $this-Ajax-link($text, $opts, array('update' = $update.Data, 'complete' = sethtml('.$update.Data',request), ) ); /pre Through trial and error I found that request contains the content returned from the Ajax call. It seems to work! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Using distinct and sum in query
Hi, this query here doesn't work http://bin.cakephp.org/saved/47129 So i tried using sql query browser to check whether my query statement is correct. select distinct month(created) as created, sum(cost) as total_cost from finances group by created; And the result is the same, here's the array http://bin.cakephp.org/view/614424760 The months are not unique and the costs are not summed up. Please help, my big thanks to those who would spend time reading this. Regards, wayne --~--~-~--~~~---~--~~ 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: ACL, Auth, and terminology.
Well, I see a difference between roles and groups and therefore I think it would actually be easier to separate them. Roles are very basic and only define the user's level of access. ie: the areas the user can access. Groups, however, can be more informative. They are not only an entity which has many objects, but depending on your application, they can be an entity other users interact with. For example, you may have feature where users can become fans or friends of the group Yellow Team. Yellow Team may have it's own profile, avatar, etc. I don't see the same type of functionality being defined for roles. Thus, I think it's actually more clearer and simple to make the distinction between the two. On Jun 11, 2:58 am, CMNAJS cmn...@gmail.com wrote: That makes things bit clear.. But Why we need roles and groups both? Isn't either of them is enough.. and fulfill the requirement.. As We can have users under groups in AROs and assign certain ACOs to a group so that the usres of that group have access to those ACOs.. What you think?? And I am a bit worried about the management of all this... Any idea for simplicity --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Help with CSS Rollover Links
First, I'm just starting to learn Cake, so my question may seem a little idiotic... I'm trying to add some rollover buttons to a page in a CakePHP application that I inherited from a previous developer. I prefer to do CSS rollovers vs. Javascript. So far the layout is working very well, but I'm having a tough time figuring out how to make a graphical button with a link using the CSS rollover method (1 background image that changes position on hover). If this were HTML, my code would look like this: a class=homebtn href=index.html/a That CSS class 'homebtn' would handle the image, size, float, hover, etc. and the HREF part tells it where to link to. Easy enough. In Cake, my code looks like this... ?php echo $html-link($html-style(homebtn), array('controller'='blog', 'action' = 'index')); ? My best guess is that the code above is saying: make an HTML link of the CSS class 'homebtn' and process clicks through the controller named 'blog'. The problem is that the image/rollover part doesn't work and I can't find any info on how to make it work. The CSS class doesn't seem to be getting pulled in. All that shows is a text link that says 'homebtn', which does link correctly, by the way. I'm using CakePHP 1.2 and the class 'homebtn' is in my style.css stylesheet which is properly linked into the head of default.ctp. Suggestions? --~--~-~--~~~---~--~~ 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: ACL, Auth, and terminology.
Yes, a scenerio where User HABTM Role you'd have to iterate through all the roles, but this can be cached once the user logs in. Once the user is logged in, they would have a cached list of areas they have access to. I don't see that is too much of a problem. I think a system can become extremely more flexible by having roles and groups. A question many people always have when reading those ACL tutorials is... How do I make it so a user only edits his own post? or How do I make it so a user only edits certain posts? This is where groups would come in. The user would belong to a group and whatever rights the group has for an object, then the user has those rights too. By also having roles, it also creates a hierarchy of user access rights. John as a manager(role) and member of the group Yellow Team has the right to create, edit, delete posts AND moderate comments. Bill as a contributer (role) and member of the group Yellow Team may only have the right to create, edit, and delete posts. If Bill tries to access /posts/moderate_comments/25/, then he will be denied.. even if he has access to the resource Post.25. On Jun 11, 6:01 am, Michał mic...@sawicz.net wrote: On 11 Cze, 08:58, CMNAJS cmn...@gmail.com wrote: But Why we need roles and groups both? Isn't either of them is enough.. and fulfill the requirement.. As We can have users under groups in AROs and assign certain ACOs to a group so that the usres of that group have access to those ACOs.. IMO there's one problem with both of these approaches. Having a User HABTM Role would require to iterate through all Roles the user has to determine if the Role has access. The User as ARO approach has another problem - you can't have a User in multiple Groups, thus you can't have a User be 'Post Admin' _and_, say, 'Comment Admin'. You have to either create a separate group 'Post and Comment Manager' or assign permissions directly to the user. --~--~-~--~~~---~--~~ 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: Please Help on How To Extract Records from Array
hi Sam; Thanx for your help. I finally got it working, was missing simple array outputing syntax. This is what I did, in case anybody may need it later: select ?php foreach($agents as $key =$val):? option?php echo $key.' '.$val; ?/option ?php endforeach;? /select regards -sam On Jun 10, 5:35 pm, kwameda...@gmail.com kwameda...@gmail.com wrote: Ok, the VIEW display should look like below: Agents Employed In This Office (header) == 1. John Mensah 2. Sumani Abdulai 3. Eric Adotey 4. Sam Darko 5. Moses Adjei 5. Kwabena Kyeremeh I fact the above (in an array) is what the print_r outputs and I would want it in a (possibly) drop-down select option tag even though 'select option' may not be a native VIEW object. -sam On Jun 10, 4:04 pm, Sam Sherlock sam.sherl...@gmail.com wrote: $Jurisdiction = array( agents = array( John = Mensah, Sumani = Abdulai, Eric = Adotey, Sam = Darko, Moses = Adjei, Kwabena = Kyeremeh ), jurisdiction = array( Jurisdiction = array(), Owner = array(), Agent = array(), Transaction = array(), Vendor = array() ), num_agents = 3 ); $juris = Set::extract('/agents', $Jurisdiction); foreach($juris[0]['agents'] as $fname = $lname): echo(br /br /my name is: . $fname); echo(br /my surname is: . $lname); endforeach; which outputs == my name is: John my surname is: Mensah my name is: Sumani my surname is: Abdulai my name is: Eric my surname is: Adotey my name is: Sam my surname is: Darko my name is: Moses my surname is: Adjei my name is: Kwabena my surname is: Kyeremeh --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Weird Form
I have a form and for some reason the names are all wacked. (Using Wizard Component) view the rendered HTML and see name=data[Certification][Certification][Certification][] but its not for Programs..they show up fine. Code for the form is below and HTML below that. Ideas why this is happening? FORM VIEW: ?php echo $form-create('Investor', array('id'='NewListing','url'=$this-here));? ?php echo $form-input('Certification.Certification',array('multiple'='checkbox', 'label'=false)); ? ?php echo $form-input('Program.Program',array('multiple'='checkbox', 'label'=false)); ? div class=submit ?php echo $form-submit('Continue', array('div'=false));? ?php echo $form-submit('Cancel', array('name'='Cancel','div'=false));? /div ?php echo $form-end();? /div The form gets rendered like this: form id=NewListing method=post action=/investors/wizard/requirement fieldset style=display:none; input type=hidden name=_method value=POST / /fieldset div class=input select input type=hidden name=data[Program][Program] value= / div class=checkbox input type=checkbox name=data[Program][Program][] value=33 id=ProgramProgram33 / label for=ProgramProgram33RSP/label /div div class=checkbox input type=checkbox name=data[Program][Program][] value=1 id=ProgramProgram1 / label for=ProgramProgram1ACCTD/label /div div class=checkbox input type=checkbox name=data[Program][Program][] value=2 id=ProgramProgram2 / label for=ProgramProgram2NIARB/label /div /div div class=input select input type=hidden name=data[Certification][Certification][Certification] value= / div class=checkbox input type=checkbox name=data[Certification][Certification][Certification][] value=13 id=CertificationCertification13 / label for=CertificationCertification13State/label /div div class=checkbox input type=checkbox name=data[Certification][Certification][Certification][] value=1 id=CertificationCertification1 / label for=CertificationCertification1Federal/label /div div class=checkbox input type=checkbox name=data[Certification][Certification][Certification][] value=9 id=CertificationCertification9 / label for=CertificationCertification9National/label /div div class=submit input type=submit value=Continue / input type=submit name=Cancel value=Cancel / /div /form Dave --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Session.timeout vs session cookie expiration date
I haven't found any documentation on this. But I'm assuming the Session.timeout and Cookie expiration date are not equal. In fact, by experimenting with the three different security levels, I found the following: low = cookie expires in 25 years medium = cookie expires in 1 week high = cookie expires at the end of the session Can anyone confirm these values? Also, I'm assuming a new session uses the same cookie if it exists rather than overwriting itcorrect? Thanks. --~--~-~--~~~---~--~~ 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: Help with CSS Rollover Links
echo $html-link( '', array( 'controller'='blog', 'action' = 'index' ), array( 'class' = 'homebtn' ) ); But it looks to me like you should have an id=homebtn (presumably, there's only one on the page) with a class for the more general style rules. And why don't you have any text in the link?That's not very accessible. On Thu, Jun 11, 2009 at 12:58 PM, DbZeroOnedbzero...@gmail.com wrote: First, I'm just starting to learn Cake, so my question may seem a little idiotic... I'm trying to add some rollover buttons to a page in a CakePHP application that I inherited from a previous developer. I prefer to do CSS rollovers vs. Javascript. So far the layout is working very well, but I'm having a tough time figuring out how to make a graphical button with a link using the CSS rollover method (1 background image that changes position on hover). If this were HTML, my code would look like this: a class=homebtn href=index.html/a That CSS class 'homebtn' would handle the image, size, float, hover, etc. and the HREF part tells it where to link to. Easy enough. In Cake, my code looks like this... ?php echo $html-link($html-style(homebtn), array('controller'='blog', 'action' = 'index')); ? My best guess is that the code above is saying: make an HTML link of the CSS class 'homebtn' and process clicks through the controller named 'blog'. The problem is that the image/rollover part doesn't work and I can't find any info on how to make it work. The CSS class doesn't seem to be getting pulled in. All that shows is a text link that says 'homebtn', which does link correctly, by the way. I'm using CakePHP 1.2 and the class 'homebtn' is in my style.css stylesheet which is properly linked into the head of default.ctp. Suggestions? --~--~-~--~~~---~--~~ 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: Help with CSS Rollover Links
Probably has an image, set as a background or something with on rollover changes background image or whatever. To OP, this is not the best option as if your viewer has images disabled, or they are using screen readers and you have no alt text, and no text for the link, they are kind of SOL. So you should probably change it so your site is more accessible. On Jun 11, 10:22 am, brian bally.z...@gmail.com wrote: echo $html-link( '', array( 'controller'='blog', 'action' = 'index' ), array( 'class' = 'homebtn' ) ); But it looks to me like you should have an id=homebtn (presumably, there's only one on the page) with a class for the more general style rules. And why don't you have any text in the link?That's not very accessible. On Thu, Jun 11, 2009 at 12:58 PM, DbZeroOnedbzero...@gmail.com wrote: First, I'm just starting to learn Cake, so my question may seem a little idiotic... I'm trying to add some rollover buttons to a page in a CakePHP application that I inherited from a previous developer. I prefer to do CSS rollovers vs. Javascript. So far the layout is working very well, but I'm having a tough time figuring out how to make a graphical button with a link using the CSS rollover method (1 background image that changes position on hover). If this were HTML, my code would look like this: a class=homebtn href=index.html/a That CSS class 'homebtn' would handle the image, size, float, hover, etc. and the HREF part tells it where to link to. Easy enough. In Cake, my code looks like this... ?php echo $html-link($html-style(homebtn), array('controller'='blog', 'action' = 'index')); ? My best guess is that the code above is saying: make an HTML link of the CSS class 'homebtn' and process clicks through the controller named 'blog'. The problem is that the image/rollover part doesn't work and I can't find any info on how to make it work. The CSS class doesn't seem to be getting pulled in. All that shows is a text link that says 'homebtn', which does link correctly, by the way. I'm using CakePHP 1.2 and the class 'homebtn' is in my style.css stylesheet which is properly linked into the head of default.ctp. Suggestions? --~--~-~--~~~---~--~~ 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: List of protected class names
I updated the my script with all potential class names from Possible is: acl aclbase aclbehavior aclcomponent aclnode aclshell aco acoaction admin ajaxhelper apcengine apishell app_model apphelper aro authcomponent bake baker bakeshell behavior cachehelper cake cakeschema cakesocket consoleshell containablebehavior controllertask cookiecomponent dbacl dbaclschema dbconfigtask dboadodb dbodb2 dbofirebird dbomssql dbomysql dbomysqlbase dbomysqli dboodbc dbooracle dbopostgres dbosource dbosqlite dbosybase element emailcomponent error errorhandler extracttask flay formhelper htmlhelper httpsocket i18n i18nmodel i18nschema i18nshell iniacl javascripthelper jshelper jshelperobject l10n layout magicdb magicfileresource mediaview memcacheengine modeltask multibyte numberhelper page pagescontroller paginatorhelper permission plugintask projecttask requesthandlercomponent rsshelper sanitize scaffold schema schemashell securitycomponent sessionhelper sessionsschema shell shelldispatcher test testsuiteshell testtask texthelper themeview timehelper translate translatebehavior treebehavior viewtask xcacheengine xml xmlelement xmlhelper xmlmanager xmlnode xmltextnode NOT possible is: app appcontroller appmodel behaviorcollection cache cacheengine cakelog cakesession classregistry component configure connectionmanager controller datasource debugger dispatcher file fileengine folder helper inflector model modelbehavior object overloadable overloadable2 router security sessioncomponent set string validation --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Multiple Checkbox Validation help
I am trying to validate multiple checkboxes of a HABTM table. I managed to validate the values but cannot get a message to display. I have my own compare values in db against submitted data to validate but no message appears I then see in the cookbook var $validate = array( 'function' = array( 'allowedChoice' = array( 'rule' = array('inList', array('Foo', 'Bar')), 'message' = 'Enter either Foo or Bar.' ) ) ); and var $validate = array( 'multiple' = array( 'rule' = array('multiple', array('in' = array('foo', 'bar'), 'min' = 1, 'max' = 3)), 'message' = 'Please select one, two or three options' ) ); Would either of these work for validating multiple checkboxes? And how do I get the values of the fields when they say 'rule' = array('inList', array('Foo', 'Bar')), Or 'rule' = array('multiple', array('in' = array('foo', 'bar'), 'min' = 1, 'max' = 3)), Thanks, Dave --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Different types of users
I am trying to build an application similar to a customer-supplier relationship. I am having a problem figuring out how to model this relationship to differentiate between the types of users. For example, people who use my application will include: Administrators Managers Customers Suppliers ... which are the entries in my Groups table. All users share some information, such as contact info, which I figured should be stored in the Users table. However, suppliers have some information that others do not such as Insurance Provider and Policy Number, and therefore should not be included in the Users table. My current setup is like so. create table groups ( id int not null auto_increment primary key, name varchar(100) not null unique ); create table users ( id int not null auto_increment primary key, group_id int not null, email varchar(255) not null unique, password varchar(255) not null ); create table suppliers ( id int not null auto_increment primary key, user_id int not null, ins_provider varchar(255) not null, policy_number varchar(100) not null ); This does not seem correct, because it allows all users to be associated with suppliers. Administrators, for instance, do not have an ins_provider or policy. This seems like it should be a fairly simple solution, but I can't seem to figure it out. Please do not just reference some page in the Cookbook without explanation, because I have read that about 100 times, and still cannot figure this out. --~--~-~--~~~---~--~~ 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: User Registration Default Group
The AclBehavior is pretty confusing for a newb. I understand that it is used for parent/child relationships. I assume that I need to set User.group_id to a value when a user registers. I want the default group to be Members, which has an id of 3. So, in my register controller, I put: $this-data['User']['group_id'] = 3 However, I don't know if this is the best solution. On May 22, 7:19 am, dr. Hannibal Lecter lecter...@gmail.com wrote: Take a look at the AclBehavior: http://book.cakephp.org/view/545/Using-the-AclBehavior On May 21, 6:49 pm, nic nic.mang...@gmail.com wrote: Can someone inform me of the best way to set a default group for a new user? --~--~-~--~~~---~--~~ 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: Session.timeout vs session cookie expiration date
I was having the same concern. I looked at session.php (under cake/libs/), in function __initSession(): security: high : $this-cookieLifeTime = 0 security: medium : $this-cookieLifeTime = 7 * 86400 security: low : $this-cookieLifeTime = 78894 foldiman wrote: I haven't found any documentation on this. But I'm assuming the Session.timeout and Cookie expiration date are not equal. In fact, by experimenting with the three different security levels, I found the following: low = cookie expires in 25 years medium = cookie expires in 1 week high = cookie expires at the end of the session Can anyone confirm these values? Also, I'm assuming a new session uses the same cookie if it exists rather than overwriting itcorrect? Thanks. -- View this message in context: http://www.nabble.com/Session.timeout-vs-session-cookie-expiration-date-tp23985613p23987281.html 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: Error: Create the class SController below in file: app\controllers\s_controller.php
Hi John, Thanks for your reply: Because I'm new on cake, I just tried do exactally as followed cake tutorial (simple ACL...). So here's my login.ctp div class=users form ?php if ($session-check('Message.auth')) $session-flash('auth'); echo $form-create('User', array('url' = array('controller' = 'users', 'action' ='login'))); ? fieldset legend?php __('Login');?/legend ?php echo $form-input('User.username'); echo $form-input('User.password'); ? /fieldset ?php echo $form-end('Login');? /div My users_controllers.php, I think that I use only html and form helpers. Login logout methods are the same as show on tutorial: class UsersController extends AppController { var $name = 'Users'; var $helpers = array('Html', 'Form'); var $paginate = array('limit' = 10, 'order'=array ('User.id'='desc')); function login() { //Auth Magic } function logout() { $this-Session-setFlash('Sucessful logout, bye'); $this-redirect($this-Auth-logout()); } //and so on... Regards Alexandre --~--~-~--~~~---~--~~ 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: Created, Modified not set in related model on save
I've been working on this over the last 10 days and still haven't found a solution. I haven't even found any clues. It's impossible to tell how many people have read this but not one person has replied so I'm bumping it up the list. On Jun 1, 4:00 pm, Stuart stuart.ba...@gmail.com wrote: I haven't experienced this before but I'll try to explain it. I have a Facilities model that hasMany Documents and Document belongsTo Facility. When a user creates a new facility they have the option of uploading a document related to that facility. If a document is uploaded when the facility is created all is well. The problem is when a user chooses to add a document and associate it with an existing facility. When the document is uploaded all table columns are populated as expected except for created and modified which are NULL. The add_document function is in the facilities_controller which looks like this: cake 1.2.3.166 function admin_add_document($id = null){ if (empty($this-data)) { $this-data = $this-Facility-findById($id); } else { if (is_uploaded_file($this-data['Document']['0']['File'] ['tmp_name'])) { $fileData = fread(fopen($this-data['Document']['0']['File'] ['tmp_name'], r), $this-data['Document']['0']['File']['size']); $this-data['Document']['facility_id'] = $this-Facility-id; $this-data['Document']['name'] = $this-data ['Document']['0']['File']['name']; $this-data['Document']['title'] = $this-data ['Document']['0']['title']; $this-data['Document']['file_type'] = $this-data ['Document']['0']['File']['type']; $this-data['Document']['size'] = $this-data ['Document']['0']['File']['size']; $this-data['Document']['content'] = $fileData; $this-Facility-Document-create(); if ($this-Facility-Document-save($this-data, array ('validate' = 'first'))) { $this-Session-setFlash('The Document has been saved', 'flash_good'); $this-redirect(array('action'='view', $this-Facility-id)); } } else { $this-Session-setFlash('The Document for facility_id '.$id.' could not be saved.', 'flash_bad'); } } } The admin_add function that works looks like this: function admin_add() { if (!empty($this-data)) { if (is_uploaded_file($this-data['Document']['0']['File'] ['tmp_name'])) { $fileData = fread(fopen($this-data['Document']['0']['File'] ['tmp_name'], r), $this-data['Document']['0']['File']['size']); $this-data['Document']['0']['name'] = $this-data ['Document']['0']['File']['name']; $this-data['Document']['0']['file_type'] = $this-data ['Document']['0']['File']['type']; $this-data['Document']['0']['size'] = $this-data ['Document']['0']['File']['size']; $this-data['Document']['0']['content'] = $fileData; if ($this-Facility-saveAll($this-data, array('validate' = 'first'))) { $this-Session-setFlash('Saved Facility and uploaded Document.', 'flash_good'); $this-redirect(array('action'='view', $this-Facility-id)); } } else { if ($this-Facility-save($this-data)) { $this-Session-setFlash('Saved Facility. No file uploaded.', 'flash_good'); $this-redirect(array('action'='view', $this-Facility-id)); } } } Can anyone point me in the right direction? I haven't been able to find much information on how exactly CakePHP automagically sets the values for these columns so if there's some good documentation this please let me know. 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 cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Scalability of a CakePHP application
Ciao Marco, I think that this topic is a little bit off, more related to clustering tecniques than cake in general. However, the answer is depends. If you want to cluster using multiple different web servers, than you are showing yourself possible issues, but if you decide for instance to store the filesystem getting files into a networked filesystem, all server could access them. Database is easy to cluster, webserver can be clustered with a proxy in front of it, copying the application on all the php enviroment is quite easy to do with versioning tools to keep the code updated everywhere.. Ah, don't forget to put the sessions into the database and don't leave them on one server disk.. unless you use sticky sessions on the proxy to cluster... Julien 2009/6/11 marco.rizze...@gmail.com marco.rizze...@gmail.com: Hi I develop a web application in cake and now I must to scale my system. I think to replicate all my code in all my webservers but I have a doubt : The static images I must replicate in all them? And the javascripts and the css in webroot? If not how can I modify the helpers (html , javascript ... ) in the way to use the right url where there are image,js,css or can I do it with config of cake? Another question : the files that are uploaded by users how can manage this in an enviroment with many web server? I'm very interested about other experiences relative on how manage the code's problem in scalable enviroment -- Julien Buratto --~--~-~--~~~---~--~~ 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: Big difference between CakePHP and Joomla
Joomla is a CMS application built on a custom framework. CakePHP is just a framework - no application. - James On Jun 11, 4:56 am, bbparis bilalbas...@gmail.com wrote: Hi, I'm now to CakePHP, I like to build a website for kids, an education and interactive interface, something like (www.cghub.com), I would like to offer for kids many education / intelligent services to learn and have fun in the same time ... so I began with learning CakePHP, and I know already Joomla, my principal question to begin this discussion with you is ( What is the big difference between CakePHP and Joomla ? ) I'm not expert with php, I'm still learning, you can check the following link to have an idea about my level : http://www.beginfromhere.com also some nice php developers helped me in this way. Best regards for all, and I hope I will have your answer, opinions, comments soon. Best regards, bbparis --~--~-~--~~~---~--~~ 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: Please Please Help - Non conventional CakePHP ACL Setup...
If you want to use a completely custom security model, you'll have to build a completely custom set of components to support it. Unless you're going to translate your setup into an ACL model, there isn't much you can do. - James On Jun 3, 6:26 am, Jenski jenski...@hotmail.co.uk wrote: I have a database setup like this (I know it isnt the best setup but its out of my power to change it :-( Basically there are 3 levels of users - Admin - Managers - Staff Few notes: -Each member of staff belongs to department -If the Staffs logon_code appears in the manager table they are a Manager, otherwise they are a member of staff -If the staffs logon_code appears in the manager table and SystemAdmin is set to 1, they are Admin How on earth do I go about setting ACL/Auth for this? Any ideas? CREATE TABLE `tblStaff` ( `StaffID` int(11) NOT NULL auto_increment, `dept_id` varchar(5) default NULL, `logon_code` char(10) NOT NULL, `forename` char(50) NOT NULL, `surname` char(50) NOT NULL, PRIMARY KEY (`StaffID`), ) ; CREATE TABLE `tblManager` ( `ManagerID` varchar(15) NOT NULL, `logon_code` varchar(15) NOT NULL, `dept_id` varchar(5) NOT NULL, `SystemAdmin` tinyint(1) unsigned default NULL, PRIMARY KEY (`ManagerID`) ) ; CREATE TABLE `tblDepartment` ( `dept_id` varchar(5) NOT NULL, `sect_id` varchar(50) default NULL, `subsect_id` varchar(50) default NULL, `sect_name` varchar(50) default NULL, `sect_abbr` varchar(50) default NULL, `subsect_name` varchar(50) default NULL, PRIMARY KEY (`dept_id`) ) ; --~--~-~--~~~---~--~~ 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: xml parsing problem
when i did var_dump($parsed_xml); it shows array(1) { [Order]= array(1) { [id]= string(7) 3525314 } } hence when the xml was parsed to array only one record is stored into the array, my question is anyone knows how to get the 2 records into an array? Thank you On Jun 11, 4:48 pm, paulos nikolo paulitosthe...@gmail.com wrote: Try use the var_dump() or debug().I had the same problem and i am using the debug().To be more specific here is some code which might help you: $results = $parsed_xml = new XML($results); $parsed_xml = Set::reverse($parsed_xml); debug($results); (or var_dump($results)) 2009/6/11 robert123 generics...@gmail.com i am using the below codes, took from the bakery, straight App::import('Xml'); // your XML file's location $file = my_xml_file.xml; // now parse it $parsed_xml = new XML($file); $parsed_xml = Set::reverse($parsed_xml); // this is what i call magic // see the returned array print_r($parsed_xml); the my_xml_file.xml have the data below order id=3525314 /orderorder id=3525317 /order it has two order data, the my_xml_file.xml was generated from the database using $xml-serialize($data); but whenever the code above is executed I only get Array ( [Order] = Array ( [id] = 3525314 ) ) that is it is only reads the first order and never the second order, how can i make it to read the whole xml data into an array, thank you http://www.generics.ws --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Cache::delete() very slow
I have a function which reorders a tree list using TreeBehavior's moveup()/movedown(). This list is, more or less, a set of navigation links. I'm using ACL so that I can display a slightly different version for each of several (5-10) groups. To avoid having to make an ACL lookup every page view, the trees are cached. So, any time a node is edited/added/deleted/moved, I remove the cached trees. This is generally ok as these actions will be performed only sporadically and always by an admin. To move nodes around, I'm using some jquery drag drop and then sending an AJAX request. The method that handles the move includes a call to __removeGroupSections() (shown below). I'm consistently seeing this request take ~20 seconds. If I comment out the call to __removeGroupSections() the request comes back in ~1 second. So, can anyone suggest a faster way to accomplish this? Here's the config I'm using--basic file cache. I'm sure the other suggestions in core.php would all be much more efficient but I don't really know much about them. Aside from any suggestions for improving use of file cache, I'd appreciate any comments about the differences between APC, XCache, and memcached. Especially as may pertain to Cake. I'm definitely interested in learning something about all of this. Cache::config( 'default', array( 'engine' = 'File', 'duration'= 3600, 'probability'= 100, 'path' = CACHE, 'prefix' = 'cake_', 'lock' = false, 'serialize' = true ) ); private function __removeGroupSections($aros = array()) { if (empty($aros)) { $aros = $this-Acl-Aro-find('all'); } foreach ($aros as $aro) { Cache::delete(sections_for_group_{$aro['Aro']['foreign_key']}); } } And it's not due to the ARO lookup. I hard-coded the IDs into the method with the same slow result: private function __removeGroupSections($aros = array()) { $ids = array(1,2,3,4,5,6); foreach ($ids as $id) { Cache::delete(sections_for_group_{$id}); } } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How to model a web host app?
Thanks. I had seen that before but I am just now beginning to see how it will fit. Is it possible to do something like that with full domains rather than simply subdomains? Miles On Jun 11, 1:42 am, Steve oliveira.st...@gmail.com wrote: You may want to check out this article in the bakery:http://bakery.cakephp.org/articles/view/one-core-one-app-multiple-dom... It may not do it exactly that way you want to, but it should give you an idea on accomplishing some of the things you want to do. --~--~-~--~~~---~--~~ 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: Error: Create the class SController below in file: app\controllers\s_controller.php
Ok, that didn't give me any errors! So what are your settings for the Auth component in the AppController? And are you using any Javascript? If yes, then try to remove it and test the login again! Enjoy, John On Jun 11, 11:18 pm, Alexandre Brasil alexandrepernambuc...@gmail.com wrote: Hi John, Thanks for your reply: Because I'm new on cake, I just tried do exactally as followed cake tutorial (simple ACL...). So here's my login.ctp div class=users form ?php if ($session-check('Message.auth')) $session-flash('auth'); echo $form-create('User', array('url' = array('controller' = 'users', 'action' ='login'))); ? fieldset legend?php __('Login');?/legend ?php echo $form-input('User.username'); echo $form-input('User.password'); ? /fieldset ?php echo $form-end('Login');? /div My users_controllers.php, I think that I use only html and form helpers. Login logout methods are the same as show on tutorial: class UsersController extends AppController { var $name = 'Users'; var $helpers = array('Html', 'Form'); var $paginate = array('limit' = 10, 'order'=array ('User.id'='desc')); function login() { //Auth Magic } function logout() { $this-Session-setFlash('Sucessful logout, bye'); $this-redirect($this-Auth-logout()); } //and so on... Regards Alexandre --~--~-~--~~~---~--~~ 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: Relationship question
Investors - id ... Posts - id - investor_id (mandatory) - employee_id (optional) ... Employees - id - investor_id (mandatory) ... That's all, no post_id in employees! The belongsTo definition in the Post model, does not require a foreign key in the Employee model! :) The Investor / Post relationship is a master / detail relationship. The same goes for the Employee / Post relationship, except that it is not mandatory! John On Jun 11, 5:03 pm, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: Right. Thanks for that. So to make this work with the relations you out lined below if I add employee_id to the posts table , creates employees tables with investor_id post_id that should do it for db changes? Add the employees controller/model and add the relationshis to the other models Investor / Posts. Thanks again. Dave [snip] --~--~-~--~~~---~--~~ 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: Can containable GROUP BY?
Thanks Brian, So, you have to trick Containable by puting it into a condition ... like the good old days :) /Martin On Jun 11, 6:01 pm, brian bally.z...@gmail.com wrote: Have a look at this thread: http://groups.google.com/group/cake-php/browse_thread/thread/4b1351b6... On Thu, Jun 11, 2009 at 11:45 AM, Martin Westinmartin.westin...@gmail.com wrote: Hi, I find myself needing to get associated data grouped by a field but Containable seems to interpret the group key as an extra field to include. @line 267 containable specifies a bunch of valid options but groups is not one of them. Trying to be cheeky and adding group to the list makes the errors go away but the group statement is still ignored... and that is as far as I have come trying to understand the internals of Containable. My question is if the missing group is a small oversight that can be easily implemented or if grouping has been intentionally abandoned after it proved to be too complex, or something? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---