Re: HELP - Search Pagination on three different models
As a follow up - I ended up making a mysql view table with a UNION join to include the content from all the tables I wanted to search. Then I just searched that table. --~--~-~--~~~---~--~~ 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: Value from Key
for($i = 0; $i count($array); $i++){ echo $array[$i]; // will output your error echo $i; // will output the index. } Still, I have absolutely no idea why would you need to know indexes for error reporting. Faifas On Thu, Apr 30, 2009 at 02:30, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: Right but the [0] [1] will change depending on the array its self. I do not know the number that will be generated as it could be an array of errors. If there is 1 error [0] but if 10 errors? Ideas? -- *From:* Aivaras [mailto:faifas1...@gmail.com] *Sent:* April-29-09 7:42 PM *To:* cake-php@googlegroups.com *Subject:* Re: Value from Key Hey, echo $the_variable_you_are_pr_ing[$key] example: echo $aNonsenceLetters[0]; // outputs: jkl Cheers, Faifas On Thu, Apr 30, 2009 at 00:47, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: How can i get the value of a key? the array is from debug($requests); for example my array is: Array ( [0] = jkl [1] = ii [2] = yyy ) 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 -~--~~~~--~~--~--~---
howto access paginator data in controller
Hi, I see that using the paginator results in a SELECT COUNT(*) query before retrieving the data. I would like to use the result of this query rather than doing another findCount on the model again. How do I access this count data in the controller? Or in general - how do I access the paginator data in the controller (i.e. not the paginated results, but the other information like number of entries, next page, etc.)? Cheers, tobi_one --~--~-~--~~~---~--~~ 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: recursive for parents
Right. I had mixed up the hasMany/belongsTo relationships. I believe that, if it was the other way around, you'd get all the models. there is no way to have the parents of the parents of a model ?! it's really strange... thank you, pietro --~--~-~--~~~---~--~~ 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: Need little help with a validation rule
Hi guys thx for the responses @Brian i already have the notEmptY rule on each field. But the rule will fail is the field is not set. @starkey overriding model::save doesn't sound cake-ish to me... imo a custom validation rule will be more coherent @jstein thx for the hint On 30 Apr, 01:54, brian bally.z...@gmail.com wrote: I assumed the 'required'=true was obvious, given the parameters mentioned. I should have mentioned that, also. On Wed, Apr 29, 2009 at 6:27 PM, jstein jst...@image.dk wrote: On Apr 29, 6:00 pm, brian bally.z...@gmail.com wrote: Just use a rule (eg. notEmpty) for each of them. You'll get errors for whichever fields were not set. No, notEmpty will fail validation, if the field is present but empty. It will NOT fail, if the field is not set at all. If the field MUST be set, use 'required'=true (and still use the notEmpty rule, if empty values should not be allowed). Seehttp://book.cakephp.org/view/129/required I just learned the difference the hard way... ;-) I don't think the case when none of the fields are present can be handled by validation rules, but starkey has given a solution for this. Regards Jonathan --~--~-~--~~~---~--~~ 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: Possible very-low-danger bug in view.php (cake core)
Thx fain. The page you linked says Send an email (post a message) to the google group to see if anyone else has seen the issue. so... someone else encountered this issue? On 29 Apr, 20:05, fain182 fain...@gmail.com wrote: On Wed, Apr 29, 2009 at 2:04 PM, Ernesto e.fanz...@gmail.com wrote: Hello. here's my bootstrap.php. if (!defined(SHARED_ITEMS_FOLDER)) { define(SHARED_ITEMS_FOLDER, CAKE_CORE_INCLUDE_PATH . DS .shared items); } $modelPaths = array(SHARED_ITEMS_FOLDER .models); $viewPaths = array(SHARED_ITEMS_FOLDER .views); Please note that i forgot the trailing directory separator. - Shared models are working. - shared views aren't. maybe there's no trailing DS check in view.php? I think you should report a bug..http://book.cakephp.org/view/759/Bugreport pietro --~--~-~--~~~---~--~~ 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: howto access paginator data in controller
Hi Amit, many thanks for your hint! Worked great! For reference, the count after a pagination call in the controller can be accessed with; $this-params['paging']['Model']['count']; where Model is the name of the model you were paginating. Cheers, tobi_one On 30 Apr., 11:04, Amit Badkas amitrb...@gmail.com wrote: Hi, If you look athttps://trac.cakephp.org/browser/branches/1.2.x.x/cake/libs/controlle... paginate() method's end), you will notice that pagination related parameters get stored in controller's 'params' property Amit http://amitrb.wordpress.com/http://coppermine-gallery.net/http://cheesecake-photoblog.org/http://www.sanisoft.com/blog/author/amitbadkas On Thu, Apr 30, 2009 at 1:12 PM, tobi_one tobias.h...@gmail.com wrote: Hi, I see that using the paginator results in a SELECT COUNT(*) query before retrieving the data. I would like to use the result of this query rather than doing another findCount on the model again. How do I access this count data in the controller? Or in general - how do I access the paginator data in the controller (i.e. not the paginated results, but the other information like number of entries, next page, etc.)? Cheers, tobi_one --~--~-~--~~~---~--~~ 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: cakePHP Media Views vs Apache virtual() subrequest
Hi Martin, Media View should just work for your scenario but if you are really searching for an alternative have a look on mod_xsendfile at http://dickensurl.com/76ad/Repression_is_the_only_lasting_philosophy -David On 29 Apr., 20:41, mar...@sommer.net drmjsom...@gmail.com wrote: Hi, I am working on a cakePHP project, and like the functionality of cakePHP Media Views.http://book.cakephp.org/view/489/Media-Views At issue, though, is that my customer is concerned about the performance of downloading many files through PHP, and would rather I use the PHP virtual() function to pass the file download process off to an Apache subrequest. The intent, is that users will run wget processes, to retrieve many large files. Can anyone verify if cakePHP Media Views uses the PHP virtual() function as well, or provide comparative performance data on using the two options? Thanks, Martin --~--~-~--~~~---~--~~ 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: Auth ignoring Session, redirecting to login under heavy load.
Hi, What's the security level of your application (you can find this in app/config/core.php in 'Security.level' setting)? If it's 'high' then try after changing it to 'medium' or 'low' Amit http://amitrb.wordpress.com/ http://coppermine-gallery.net/ http://cheesecake-photoblog.org/ http://www.sanisoft.com/blog/author/amitbadkas On Thu, Apr 30, 2009 at 2:34 PM, Jonas Hartmann j0n4s.h4rtm...@googlemail.com wrote: Hello, i have an issue with deploying my cake application. Running local on Mac OS X it works like charm. After uploading it to a Ubuntu based VHost on HostEurope I had some headaches with PLESK and its strange standard unix permission setup. After making those things work, I still have one problem left: I lose my session from time to time under heavy load. This happens with either php, cake or database sessions, I have tried all of them. It happens when for Instance I run http://www.domain.tld/admin/categories/index multiple times in Firefox-Tabs at once - thus, if I fire multiple http requests very shortly after each other. I have no clue if multiple users firing multiple events would lead to the same issue, yet (that would be even worse). I got the latest SVN head from 1.2 stable and just uploaded it to make sure that it is not already fixed / an internal problem. I am looking forward to your help/tips in regards to: a.) My small controller code, quoted below? b.) Debugging tips - how should I continue to understand what the problem is? I have disabled cache and debugging is on 2. This is how I test against routing prefix admin. I do not know if it is the best or recommended way. I would welcome suggestions. Best would be if the problem would be fixed afterwards ?php class AppController extends Controller { var $helpers = array('Html', 'Form', 'Javascript', 'Time'); var $components = array('Cookie', 'Session', 'Auth'); function beforeFilter() { if(isset($this-params['prefix'])) { if($this-params['prefix'] == 'admin') { Configure::write('debug', 2); $this-Auth-deny('*'); $this-Auth-allow('login'); } else { $this-Auth-allow('*'); } } else { $this-Auth-allow('*'); } } } ? King regards Jonas Hartmann aka ionas/ionas82 --~--~-~--~~~---~--~~ 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 ignoring Session, redirecting to login under heavy load.
Hello, i have an issue with deploying my cake application. Running local on Mac OS X it works like charm. After uploading it to a Ubuntu based VHost on HostEurope I had some headaches with PLESK and its strange standard unix permission setup. After making those things work, I still have one problem left: I lose my session from time to time under heavy load. This happens with either php, cake or database sessions, I have tried all of them. It happens when for Instance I run http://www.domain.tld/admin/categories/index multiple times in Firefox-Tabs at once - thus, if I fire multiple http requests very shortly after each other. I have no clue if multiple users firing multiple events would lead to the same issue, yet (that would be even worse). I got the latest SVN head from 1.2 stable and just uploaded it to make sure that it is not already fixed / an internal problem. I am looking forward to your help/tips in regards to: a.) My small controller code, quoted below? b.) Debugging tips - how should I continue to understand what the problem is? I have disabled cache and debugging is on 2. This is how I test against routing prefix admin. I do not know if it is the best or recommended way. I would welcome suggestions. Best would be if the problem would be fixed afterwards ?php class AppController extends Controller { var $helpers = array('Html', 'Form', 'Javascript', 'Time'); var $components = array('Cookie', 'Session', 'Auth'); function beforeFilter() { if(isset($this-params['prefix'])) { if($this-params['prefix'] == 'admin') { Configure::write('debug', 2); $this-Auth-deny('*'); $this-Auth-allow('login'); } else { $this-Auth-allow('*'); } } else { $this-Auth-allow('*'); } } } ? King regards Jonas Hartmann aka ionas/ionas82 --~--~-~--~~~---~--~~ 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: howto access paginator data in controller
Hi, If you look at https://trac.cakephp.org/browser/branches/1.2.x.x/cake/libs/controller/controller.php#L1096(at paginate() method's end), you will notice that pagination related parameters get stored in controller's 'params' property Amit http://amitrb.wordpress.com/ http://coppermine-gallery.net/ http://cheesecake-photoblog.org/ http://www.sanisoft.com/blog/author/amitbadkas On Thu, Apr 30, 2009 at 1:12 PM, tobi_one tobias.h...@gmail.com wrote: Hi, I see that using the paginator results in a SELECT COUNT(*) query before retrieving the data. I would like to use the result of this query rather than doing another findCount on the model again. How do I access this count data in the controller? Or in general - how do I access the paginator data in the controller (i.e. not the paginated results, but the other information like number of entries, next page, etc.)? Cheers, tobi_one --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
model::getColumnType (or something equivalent) in Views or Elements
Hello. is there any way to know the column type of a given field from a view (or an element)?? --~--~-~--~~~---~--~~ 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: Value from Key
just do a foreach loop. http://us.php.net/manual/en/control-structures.foreach.php On Apr 30, 3:36 am, Aivaras faifas1...@gmail.com wrote: for($i = 0; $i count($array); $i++){ echo $array[$i]; // will output your error echo $i; // will output the index. } Still, I have absolutely no idea why would you need to know indexes for error reporting. Faifas On Thu, Apr 30, 2009 at 02:30, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: Right but the [0] [1] will change depending on the array its self. I do not know the number that will be generated as it could be an array of errors. If there is 1 error [0] but if 10 errors? Ideas? -- *From:* Aivaras [mailto:faifas1...@gmail.com] *Sent:* April-29-09 7:42 PM *To:* cake-php@googlegroups.com *Subject:* Re: Value from Key Hey, echo $the_variable_you_are_pr_ing[$key] example: echo $aNonsenceLetters[0]; // outputs: jkl Cheers, Faifas On Thu, Apr 30, 2009 at 00:47, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: How can i get the value of a key? the array is from debug($requests); for example my array is: Array ( [0] = jkl [1] = ii [2] = yyy ) 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: Different Validation Rule for Different Purpose?
You don't need to call model-validates for the login or set any variables to dummy values. Here is an article you should read: http://bakery.cakephp.org/articles/view/simple-form-authentication-in-1-2-x-x On Apr 29, 9:57 pm, yangsy...@gmail.com yangsy...@gmail.com wrote: Thanks for your answer. I understand the model validation is towards the model while not the form now. I still have some confusion. If at the login form, I only need to verify username is not null and do not contain special chars (alphaNumeric). What is the right way to do that in CakePHP? Currently, to use the existing validation infrastructure, before validation, I put firstname/lastname to dummy value before call $this- model-validates(). Is that workaround make sense? Best Regards, Yang Sun On Apr 30, 3:32 am, starkey starkey...@gmail.com wrote: I hope this answers your question: The validation is for the model (the database table) and not the form. The error messages appear on the form which may make you think the validation rules are validating the data in the form... but it isn't. The validation rules check the data before an insert or update to the table. Therefore, you only need the one rule to check the first/last/user names and the password. When someone logs in you do a model-find() which doesn't go through the validation rules. Shawn On Apr 29, 4:25 am, yangsy...@gmail.com yangsy...@gmail.com wrote: Hi, I am not sure whether CakePHP suport different validation rules for the same model. My problem is to validate user. In the registration form, I have to validate username/password/ firstname/lastname to be the correct value. But to the login form, I only need user to input username/password. If I specified the validation rules for the registration form in the user model. Then in the login form, I will always got error result because it is still checking rules for firstname/lastname. Does CakePHP provide some standard way to solve that? So I can say I want check 4 fields when do registration and only check 2 fields when do login. Thanks for your help. Best Regards, Yang Sun- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ 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::getColumnType (or something equivalent) in Views or Elements
Get the information from the model! Look at: http://book.cakephp.org/view/71/Model-Attributes#_schema-442 Enjoy, John On Apr 30, 11:37 am, Ernesto e.fanz...@gmail.com wrote: Hello. is there any way to know the column type of a given field from a view (or an element)?? --~--~-~--~~~---~--~~ 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: multiple from error message with escape = false
Hi, The FormHelper::error() needs second argument in same fashion as you used it in Form::input() method's second argument's 'error' key. i.e., echo $form-error('fieldName', array('rule1 = __('Message 1', true), 'rule2 = __('Message 2', true), ..), array('escape' = false)); Hope this helps Amit http://amitrb.wordpress.com/ http://coppermine-gallery.net/ http://cheesecake-photoblog.org/ http://www.sanisoft.com/blog/author/amitbadkas On Wed, Apr 29, 2009 at 11:55 AM, KoPanda kopa...@gmail.com wrote: i have to do add multiple rules to a from field. the website has i18n support so that the error message will be displayed in Chinese when the users view Chinese version of the website. The website is developed in big5 but not utf-8. I have to set the error message with escape=false to make display correctly in Chinese. The can't be done either in the model or $form-input(). I instead call $form-error('Insurance.tel', __('error message', true), 'escape'=false); this works when the field has only one rule. What if the field has multiple validation rules? Like for Insurance.tel, I set the rules like this. 'tel' = array( 'length' = array('rule' = array('between', 8, 8)), 'required' = true, 'rule' = 'numeric' ) the error message only appears when the tel field is not numeric but not appear when the length is not equal to 8 characters. Is there a way that I can do this with $form-error()? 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: Missing table for missing model
Has no one a solution? :( On Apr 29, 9:10 pm, forrestgump vikhya...@gmail.com wrote: Hey Faifas, Yes i havewhat is even more amusing is that...i put back the Seasons table, but there is no Mode,View or controller for it(i deleted them)and the app seems to be running... Cheers2u2, Forrestgump On Apr 29, 7:42 pm, Aivaras faifas1...@gmail.com wrote: Hey, did you remove associations in your other models? Cheers, Faifas On Wed, Apr 29, 2009 at 17:32, forrestgump vikhya...@gmail.com wrote: hey guys, Iam working on a cakephp app and i ran into this problem, though minor it is driving me crazy I had created a complete MVC structure for a Seasons module, then i voted against it and deleted everything related to it..the model,views,controller and the table too... but, my app now keeps giving me an error Missing Database Table Error: Database table seasons for model Season was not found. Notice: If you want to customize this error message, create app\views \errors\missing_table.ctp Can someone help me resolve thisI tried deleting the necessary files in ...\app\tmp\cache\models ...\app\tmp\cache\persistent but still no change Will really appreciate all the help u have to offer.. Regards, Forrestgump --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
saveAll weirdness
Hello. i'm playing with saveAll here's the array i'm saving Array ( [Commessa] = Array ( [Codice] = [XXX] ) [OggettiPerCommessa] = Array ( [1] = Array ( [FieldA] = AAA [FieldB] = BBB ) [2] = Array ( [FieldA] = AAA [FieldB] = BBB ) ) ) and here's my SQL log (Describe queries omitted) 10 START TRANSACTION 11 START TRANSACTION 12 SELECT COUNT(*) AS `count` FROM `commesse` AS `Commessa` WHERE `Commessa`.`Codice` = 'XXX' 13 SELECT COUNT(*) AS `count` FROM `commesse` AS `Commessa` WHERE `Commessa`.`Codice` = 'XXX' 14 INSERT INTO `commesse` (`Codice`) VALUES ('XXX') 15 SELECT LAST_INSERT_ID() AS insertID 16 INSERT INTO `riparazioni` ('Commessa', `FieldA`, 'FieldB') VALUES (10, 'AAA', 'BBB') 17 SELECT LAST_INSERT_ID() AS insertID 18 INSERT INTO `riparazioni` ('Commessa', `FieldA`, 'FieldB') VALUES (10, 'AAA', 'BBB') 19 SELECT LAST_INSERT_ID() AS insertID 20 COMMIT everuthing is working ok but... - Why saveAll uses 2 transactions? - Why so many SELECT LAST_INSERT_ID() AS insertID? --~--~-~--~~~---~--~~ 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: MVC PHP Framework
You have a point although not entirely correct. The models provide standard CRUD operations through 2 simple functions in the DB object. So all you need to do is to pass them array of variables, like $_POST and you can insert or update. In my opinion it's even better that ActiveRecord, because AR requires you to match the fields in the DB table. On the contrary celeroo reads the fields in the table and use only these fields from $_POST that match (the others are ignored). So you don't need to worry about placing some additional fields in the forms - this is something that always drove me nuts with Active record. But the models should be more OOP style and provide standard methods like add(), update() or something like that. I agree on this point. On 30 Апр, 00:55, Faza f...@ansi.pl wrote: LOL their models require you to actually type the SQL queries by hand... I vote spam of the quarter... Dardo Sordi Bogado pisze: We should start giving prices like Spam of the month On Wed, Apr 29, 2009 at 6:35 AM, celeroo celeroo.analyt...@gmail.com wrote: Hi, Here is a nice simple MVC PHP Framework, which is powerful, lightweight, very flexible, transparent. One can easily modify as per their need. It is not complex or very restricted like other frameworks. Just have a look at thishttp://www.celeroo.com/frame/frame.html Thanks celeroo Web Software Development Tool --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Fatal error: Call to a member function find()
Notice (8): Undefined property: Enmn::$Wordtype [APP\controllers \enmns_controller.php, line 27] Code } } $wordtypes = $this-Enmn-Wordtype-find('list'); EnmnsController::add() - APP\controllers\enmns_controller.php, line 27 Object::dispatchMethod() - CORE\cake\libs\object.php, line 115 Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 227 Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 194 [main] - APP\webroot\index.php, line 88 Fatal error: Call to a member function find() on a non-object in F: \wamp\www\dict\app\controllers\enmns_controller.php on line 27 i created code by cake shell command please help me --~--~-~--~~~---~--~~ 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 Component require login in every page
Hello all ! ! ! I'm new to CakePHP and I already have create a login system based on Auth Component. All are fine with that component, but the problem that I have is that if the user logou the system then he can't see any page. The Auth redirects automatic to login form. What can I do, for desplay pages that are not require login ? ? ? ie : index, about, contact us must be public pages. Do not require login. add new article, edit articles, manage users must be private. How to select witch page must be private and witch must be public. My Code : AppController : class AppController extends Controller { var $name = App; var $helpers = array('javascript','html','form'); var $components = array('Auth','newArticle'); function beforeRender() { $this-set('articles', $this-newArticle-getLatest()); } } class UsersController extends AppController { var $name = Users; function beforeFilter() { $this-Auth-allow('register', 'login', 'logout'); } function register() { if(!empty($this-data)) { $this-data['User']['password_confirm'] = $this-Auth-password ($this-data['User']['password_confirm']); $this-User-create(); if($this-User-save($this-data)) { $this-redirect(array('controller'='Pages','action'='index')); } } } function login() { if(!empty($this-data)) { $usr = $this-Auth-login($this-data); if(!empty($usr)) { $this-set('data',$this-Auth-user()); $this-redirect(array('controller'='Pages','action'='index')); } else { $this-Session-setFlash(Η είσοδος απέτιχε); $this-redirect(array('controller'='Users','action'='login')); } } } function logout() { $this-Auth-logout(); $this-redirect(array('controller'='Pages','action'='index')); } } class ArticlesController extends AppController { var $name = Articles; var $paginate = array( 'limit' = 5, 'order' = array( 'Article.id' = 'DESC' ) ); function add() { if(!empty($this-data)) { $this-Article-create(); if($this-Article-save($this-data)) { $this-redirect(array('controller'='Pages','action'='index')); } else { $this-Session-setFlash('Σφάλμα κατά την αποθήκευση'); } } } function view() { $artcl = $this-Article-find('first', array('conditions'=array ('Article.id'=$this-params['named']['artid']))); $this-set('article', $artcl['Article']); } function showAll() { $artcl = $this-paginate('Article'); $this-set('data', $artcl); } } class ProfilesController extends AppController { var $name = Profiles; function view() { $pfl = $this-Profile-find('first', array('conditions'=array ('User.id'=$this-Session-read('Auth.User.id'; $this-set('data', $pfl); } function edit() { if(!empty($this-data)) { if($this-Profile-save($this-data)) { $this-redirect(array('controller'='Profiles','action'='view')); } else { $this-Session-setFlash('Error'); } } else { $pfl = $this-Profile-find('first', array('conditions'=array ('User.id'=$this-Session-read('Auth.User.id'; $this-set('data', $pfl); } } function add() { if(!empty($this-data)) { if($this-Profile-save($this-data)) { $this-redirect(array('controller'='Profiles','action'='view')); } else {
how to retrieve joined result from multiple tables in cakePHP
Hi, can anyone tell me, how to retrieve joined result from multiple tables in cakePHP from using cakePHP mvc architecture. For e.g., I've three tables to join (tbl_topics, tbl_items, tbl_votes. There relationship is defined as, a topic can have many items and an item can have many votes). Now I want to retrieve list of topics with the count of all votes on all items for each topic. SQL query for the same is written below : Select Topic.*, count(Vote.id) voteCount from tbl_topics as Topic Left Outer Join tbl_items as Item ON( Topic.id = Item.topic_id ) Left Outer Join tbl_votes as Vote ON( Item.id = Vote.item_id ); My problem is I can do it easily using $this-Model-query function, but this require sql code to be written in controller which I don't want. I'm trying to find out any other cakePHP function like find() for doing the same. --~--~-~--~~~---~--~~ 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: MVC PHP Framework
Thread closed. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
url validation php4 Bug?
hello, I wrote a message a week ago to explain that the url validation wasn't working well on a production server running php4. The server has been upgraded to php5 and now the validation works smoothly. Before I file this as a bug, anyone has experienced the same problem? Thanks ,n --~--~-~--~~~---~--~~ 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: Compare Array - GOT IT!
Ah, okay I understand what you mean now. It looks like you're doing this in the model; am I correct on that? It should probably be set as a custom validation for the particular field(s) you are concerned about. Since you didn't paste all of your code (you don't need to) I'll just hope that's what you're doing. :) If not, you can find that information in the cookbook: http://book.cakephp.org/view/150/Custom-Validation-Rules If you're not already, you may also want to use the Security Component. On Apr 29, 10:11 pm, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: No no...not giving them the ability to edit the form...install Firebug and anyone can edit a form...I am trying to prevent them from editing the form. I can see the form and use firebug to see the vales in the form checkboxes...value = 1 =3 = so on. I can change the values with Firebug to 599 799 899 or what ever ...so what I am doing is verify that if someone is being cleaver and changes the values to something that it could not possably be then it will not save anything and the logged in users account is supspended because the ony way the form would not save is if someone was messing with it and submited bad data.(the form is only checkboxes) -Original Message- From: Brendon Kozlowski [mailto:brendon...@hotmail.com] Sent: April-29-09 11:15 PM To: CakePHP Subject: Re: Compare Array - GOT IT! I don't believe this is necessary in the first place. Why are you giving someone the ability to edit the form that shouldn't be? That's the first issue I see. Secondly, why are you passing values to be saved if you don't want them overwritten? That's the 2nd issue. Thirdly, why are you even rendering them as form elements rather than simple text within a paragraph tag instead? That'd be the third issue I see. Although you are accomplishing what you want to do, I don't believe you should be trying to do it in the first place as a more elegant (albeit possibly more difficult to grasp?) solution is available. On Apr 29, 4:52 pm, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: I figured it out. //list of possible keys $keys = $this-User-$model_name-find('list', array('fields' = 'id', 'order' = 'id ASC')); debug($keys); $submitted = $this-data[$model_name][$model_name]; debug($this-data[$model_name][$model_name]); $results = array_diff($submitted, $keys); debug($results); So if a evil user tries to change the value in a form and submits, the value is checked against possible values in the databsaeif not found we know someone was doing something they should not have been doing. I am using this for a form that only has checkboxes so it works for me. Any flaws? Thanks, Dave -Original Message- From: Dave Maharaj :: WidePixels.com [mailto:d...@widepixels.com] Sent: April-29-09 6:14 PM To: cake-php@googlegroups.com Subject: re: Compare Array I am trying to do the same type thing with comparing an array. I am using this for a security set up so a user can not change values of a form so I get the list of possible keys //list of possible keys $keys = $this-User-$model_name-find('list', array('fields' = 'id', 'order' = 'id ASC')); debug($keys); Array ( [1] = 1 [2] = 2 [3] = 3 [4] = 4 [5] = 5 [6] = 6 ) // values submitted by user $submitted = $this-data[$model_name][$model_name]; debug($this-data[$model_name][$model_name]); Array ( [0] = 3 [1] = 5 [2] = 6 [3] = 1 ) //how to compare vales against submitted values? $results = array_udiff_assoc($keys, array($submitted)); debug($results); But i need to compare the keys with the submitted data and that where i am stuck. I need to check that the submitted values have a match with the possible values in the database. Can someone point out my error or suggestions? Thanks, Dave- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ 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: recursive for parents
maybe i found the solution.. linkable behavior: http://rafaelbandeira3.wordpress.com/2008/11/16/linkable-behavior-taking-it-easy-in-your-db/ --~--~-~--~~~---~--~~ 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: Auth Component require login in every page
You need this in all your controllers... code function beforeFilter() { //actions we allow without authentication, you can also put them in the app_controller.php $this-Auth-allow('index'); } /code Add all the actions in your controller you want people to have access to without authentication. http://book.cakephp.org/view/247/AuthComponent-Methods for more info Russ On Apr 30, 5:01 am, DatacenterHellas merianosni...@gmail.com wrote: Hello all ! ! ! I'm new to CakePHP and I already have create a login system based on Auth Component. All are fine with that component, but the problem that I have is that if the user logou the system then he can't see any page. The Auth redirects automatic to login form. What can I do, for desplay pages that are not require login ? ? ? ie : index, about, contact us must be public pages. Do not require login. add new article, edit articles, manage users must be private. How to select witch page must be private and witch must be public. My Code : AppController : class AppController extends Controller { var $name = App; var $helpers = array('javascript','html','form'); var $components = array('Auth','newArticle'); function beforeRender() { $this-set('articles', $this-newArticle-getLatest()); } } class UsersController extends AppController { var $name = Users; function beforeFilter() { $this-Auth-allow('register', 'login', 'logout'); } function register() { if(!empty($this-data)) { $this-data['User']['password_confirm'] = $this-Auth-password ($this-data['User']['password_confirm']); $this-User-create(); if($this-User-save($this-data)) { $this-redirect(array('controller'='Pages','action'='index')); } } } function login() { if(!empty($this-data)) { $usr = $this-Auth-login($this-data); if(!empty($usr)) { $this-set('data',$this-Auth-user()); $this-redirect(array('controller'='Pages','action'='index')); } else { $this-Session-setFlash(Η είσοδος απέτιχε); $this-redirect(array('controller'='Users','action'='login')); } } } function logout() { $this-Auth-logout(); $this-redirect(array('controller'='Pages','action'='index')); } } class ArticlesController extends AppController { var $name = Articles; var $paginate = array( 'limit' = 5, 'order' = array( 'Article.id' = 'DESC' ) ); function add() { if(!empty($this-data)) { $this-Article-create(); if($this-Article-save($this-data)) { $this-redirect(array('controller'='Pages','action'='index')); } else { $this-Session-setFlash('Σφάλμα κατά την αποθήκευση'); } } } function view() { $artcl = $this-Article-find('first', array('conditions'=array ('Article.id'=$this-params['named']['artid']))); $this-set('article', $artcl['Article']); } function showAll() { $artcl = $this-paginate('Article'); $this-set('data', $artcl); } } class ProfilesController extends AppController { var $name = Profiles; function view() { $pfl = $this-Profile-find('first', array('conditions'=array ('User.id'=$this-Session-read('Auth.User.id'; $this-set('data', $pfl); } function edit() { if(!empty($this-data)) { if($this-Profile-save($this-data)) { $this-redirect(array('controller'='Profiles','action'='view')); } else { $this-Session-setFlash('Error'); } } else {
Re: Auth Component require login in every page
rgreenphotodesign gave the right code, but I'm going to *guess* it won't work as-is. If by index you meant the home page of your site (home.ctp), you actually need to allow the PagesController method of display. Therefore, in your AppController, you'd add: //App Controller -- global controller function beforeFilter() { $this-Auth-allow('display'); } The Pages Controller handles all page elements that are static and do not have any CakePHP models/controllers directly associated with them. You'd also want to add, in your UsersController's beforeFilter a parent::beforeFilter(); i.e.: //Users Controller function beforeFilter() { parent::beforeFilter(); $this-Auth-allow('register', 'login', 'logout'); } On Apr 30, 10:33 am, rgreenphotodesign rgr...@rgreenphotography.com wrote: You need this in all your controllers... code function beforeFilter() { //actions we allow without authentication, you can also put them in the app_controller.php $this-Auth-allow('index'); } /code Add all the actions in your controller you want people to have access to without authentication. http://book.cakephp.org/view/247/AuthComponent-Methods for more info Russ On Apr 30, 5:01 am, DatacenterHellas merianosni...@gmail.com wrote: Hello all ! ! ! I'm new to CakePHP and I already have create a login system based on Auth Component. All are fine with that component, but the problem that I have is that if the user logou the system then he can't see any page. The Auth redirects automatic to login form. What can I do, for desplay pages that are not require login ? ? ? ie : index, about, contact us must be public pages. Do not require login. add new article, edit articles, manage users must be private. How to select witch page must be private and witch must be public. My Code : AppController : class AppController extends Controller { var $name = App; var $helpers = array('javascript','html','form'); var $components = array('Auth','newArticle'); function beforeRender() { $this-set('articles', $this-newArticle-getLatest()); } } class UsersController extends AppController { var $name = Users; function beforeFilter() { $this-Auth-allow('register', 'login', 'logout'); } function register() { if(!empty($this-data)) { $this-data['User']['password_confirm'] = $this-Auth-password ($this-data['User']['password_confirm']); $this-User-create(); if($this-User-save($this-data)) { $this-redirect(array('controller'='Pages','action'='index')); } } } function login() { if(!empty($this-data)) { $usr = $this-Auth-login($this-data); if(!empty($usr)) { $this-set('data',$this-Auth-user()); $this-redirect(array('controller'='Pages','action'='index')); } else { $this-Session-setFlash(Η είσοδος απέτιχε); $this-redirect(array('controller'='Users','action'='login')); } } } function logout() { $this-Auth-logout(); $this-redirect(array('controller'='Pages','action'='index')); } } class ArticlesController extends AppController { var $name = Articles; var $paginate = array( 'limit' = 5, 'order' = array( 'Article.id' = 'DESC' ) ); function add() { if(!empty($this-data)) { $this-Article-create(); if($this-Article-save($this-data)) { $this-redirect(array('controller'='Pages','action'='index')); } else { $this-Session-setFlash('Σφάλμα κατά την αποθήκευση'); } } } function view() { $artcl = $this-Article-find('first', array('conditions'=array ('Article.id'=$this-params['named']['artid']))); $this-set('article', $artcl['Article']); } function showAll() {
Re: Auth Component require login in every page
I've got it ! ! ! Thanks a lot ! ! ! Now It works perfectly ! ! ! On 30 Απρ, 17:33, rgreenphotodesign rgr...@rgreenphotography.com wrote: You need this in all your controllers... code function beforeFilter() { //actions we allow without authentication, you can also put them in the app_controller.php $this-Auth-allow('index'); } /code Add all the actions in your controller you want people to have access to without authentication. http://book.cakephp.org/view/247/AuthComponent-Methods for more info Russ On Apr 30, 5:01 am, DatacenterHellas merianosni...@gmail.com wrote: Hello all ! ! ! I'm new to CakePHP and I already have create a login system based on Auth Component. All are fine with that component, but the problem that I have is that if the user logou the system then he can't see any page. The Auth redirects automatic to login form. What can I do, for desplay pages that are not require login ? ? ? ie : index, about, contact us must be public pages. Do not require login. add new article, edit articles, manage users must be private. How to select witch page must be private and witch must be public. My Code : AppController : class AppController extends Controller { var $name = App; var $helpers = array('javascript','html','form'); var $components = array('Auth','newArticle'); function beforeRender() { $this-set('articles', $this-newArticle-getLatest()); } } class UsersController extends AppController { var $name = Users; function beforeFilter() { $this-Auth-allow('register', 'login', 'logout'); } function register() { if(!empty($this-data)) { $this-data['User']['password_confirm'] = $this-Auth-password ($this-data['User']['password_confirm']); $this-User-create(); if($this-User-save($this-data)) { $this-redirect(array('controller'='Pages','action'='index')); } } } function login() { if(!empty($this-data)) { $usr = $this-Auth-login($this-data); if(!empty($usr)) { $this-set('data',$this-Auth-user()); $this-redirect(array('controller'='Pages','action'='index')); } else { $this-Session-setFlash(Η είσοδος απέτιχε); $this-redirect(array('controller'='Users','action'='login')); } } } function logout() { $this-Auth-logout(); $this-redirect(array('controller'='Pages','action'='index')); } } class ArticlesController extends AppController { var $name = Articles; var $paginate = array( 'limit' = 5, 'order' = array( 'Article.id' = 'DESC' ) ); function add() { if(!empty($this-data)) { $this-Article-create(); if($this-Article-save($this-data)) { $this-redirect(array('controller'='Pages','action'='index')); } else { $this-Session-setFlash('Σφάλμα κατά την αποθήκευση'); } } } function view() { $artcl = $this-Article-find('first', array('conditions'=array ('Article.id'=$this-params['named']['artid']))); $this-set('article', $artcl['Article']); } function showAll() { $artcl = $this-paginate('Article'); $this-set('data', $artcl); } } class ProfilesController extends AppController { var $name = Profiles; function view() { $pfl = $this-Profile-find('first', array('conditions'=array ('User.id'=$this-Session-read('Auth.User.id'; $this-set('data', $pfl); } function edit() { if(!empty($this-data)) { if($this-Profile-save($this-data)) {
Database column level processing
I need a way to process specific database columns when they are read from or saved to the database. Specifically, we need to format dates to a local formatting when read and format them to database format when saved. The only way I can see is to hook in to beforeSave and afterFind but those hooks act on complex data structures (I have looked at Nik Chankov's date formatter but it fails for all but the simplest queries). What would be ideal is to be able to hook in to just before/after the sql query and process the data there. Any suggestions? TIA Mal --~--~-~--~~~---~--~~ 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: Fatal error: Call to a member function find()
Well the key lines here are: Notice (8): Undefined property: Enmn::$Wordtype [APP\controllers \enmns_controller.php, line 27] and Fatal error: Call to a member function find() on a non-object in F: \wamp\www\dict\app\controllers\enmns_controller.php on line 27 My diagnostic shows that you are in fact calling find on an undefined property (see what I did there?). Now either you're simply misspelling Wordtype (could be WordType, just a guess), or Wordtype isn't related to Enmn. If you post your relations we could go further into details. Good luck! --~--~-~--~~~---~--~~ 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: Auth Component require login in every page
I think you have forgotten to add this to controller beforeFilter(): function beforeFilter() { parent::beforeFilter(); $this-Auth-allowedActions = array('logout', 'initDB'); } http://book.cakephp.org/view/643/Preparing-to-Add-Auth also, I'm not sure but I've read somewhere that 'login' cannot be in allow() array (the auth logic takes care of it) because it can make Auth behave oddly. DatacenterHellas pisze: Hello all ! ! ! I'm new to CakePHP and I already have create a login system based on Auth Component. All are fine with that component, but the problem that I have is that if the user logou the system then he can't see any page. The Auth redirects automatic to login form. What can I do, for desplay pages that are not require login ? ? ? ie : index, about, contact us must be public pages. Do not require login. add new article, edit articles, manage users must be private. How to select witch page must be private and witch must be public. My Code : AppController : class AppController extends Controller { var $name = App; var $helpers = array('javascript','html','form'); var $components = array('Auth','newArticle'); function beforeRender() { $this-set('articles', $this-newArticle-getLatest()); } } class UsersController extends AppController { var $name = Users; function beforeFilter() { $this-Auth-allow('register', 'login', 'logout'); } function register() { if(!empty($this-data)) { $this-data['User']['password_confirm'] = $this-Auth-password ($this-data['User']['password_confirm']); $this-User-create(); if($this-User-save($this-data)) { $this-redirect(array('controller'='Pages','action'='index')); } } } function login() { if(!empty($this-data)) { $usr = $this-Auth-login($this-data); if(!empty($usr)) { $this-set('data',$this-Auth-user()); $this-redirect(array('controller'='Pages','action'='index')); } else { $this-Session-setFlash(Η είσοδος απέτιχε); $this-redirect(array('controller'='Users','action'='login')); } } } function logout() { $this-Auth-logout(); $this-redirect(array('controller'='Pages','action'='index')); } } class ArticlesController extends AppController { var $name = Articles; var $paginate = array( 'limit' = 5, 'order' = array( 'Article.id' = 'DESC' ) ); function add() { if(!empty($this-data)) { $this-Article-create(); if($this-Article-save($this-data)) { $this-redirect(array('controller'='Pages','action'='index')); } else { $this-Session-setFlash('Σφάλμα κατά την αποθήκευση'); } } } function view() { $artcl = $this-Article-find('first', array('conditions'=array ('Article.id'=$this-params['named']['artid']))); $this-set('article', $artcl['Article']); } function showAll() { $artcl = $this-paginate('Article'); $this-set('data', $artcl); } } class ProfilesController extends AppController { var $name = Profiles; function view() { $pfl = $this-Profile-find('first', array('conditions'=array ('User.id'=$this-Session-read('Auth.User.id'; $this-set('data', $pfl); } function edit() { if(!empty($this-data)) { if($this-Profile-save($this-data)) { $this-redirect(array('controller'='Profiles','action'='view')); } else { $this-Session-setFlash('Error'); } } else { $pfl = $this-Profile-find('first', array('conditions'=array ('User.id'=$this-Session-read('Auth.User.id'; $this-set('data', $pfl); } } function add()
Validation on staging server
Hi, I am facing a weird problem and hope somebody has a clue. The problem is that the validation of any model doesn't work after deploying on a staging server. The local app is just working fine and all form data is validated and validation messages are shown. The staging app seems to do nothing with the form data. After submitting a form the same page is shown with empty form inputs. Debug and error logs don't show anything. No php errors at all. Any advice regarding this issue? Thanks, MN --~--~-~--~~~---~--~~ 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: recursive for parents
solution was simple... var $recursive = 4 --~--~-~--~~~---~--~~ 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: recursive for parents
It goes up to 4?!? Signs and wonders ... On Thu, Apr 30, 2009 at 11:26 AM, fain182 fain...@gmail.com wrote: solution was simple... var $recursive = 4 --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Buggy radio buttons using Form Helper?
Hi, I was playing with radio.-buttons today. (rarely used form element in my work) I think it is strage if this is a proper bug but radio buttons seem to be missing seem of the magic of other elements. Am doing something staggeringly wrong here? echo $form-input('spelling_important', array( 'type'='radio', 'options'=$required_variable, 'label'='this does nothing', 'empty'='this does nothing either' )); 1. The naming (first argument to input) makes a lot of difference. Calling the input fieldname I get no label for the whole group. Calling it Modename.fieldname and Fieldname will apear in front of the group in the resulting html. 2. The key label does nothing as far as I can see. Not even to replace the above auto-label. 3. The key options is required. If I leave out type=radio the same tag will automagically pick up on the set variable of the same name as the fieldname given. E.g. setting $houses and calling the input houses will fill the select with options from the variable. Not so when the type is set to radio. 4. The key empty does nothing even though it can be very useful since you can uncheck a radio button. The first thing I found was just a bit strange but the rest of it is really an inconsistency with the select input-type. Since they generally can serve the same logical purpose I expect them to work the same but they don't for some reason. Anyone know why? (I haven't checked these things with checkboxes yet) /Martin --~--~-~--~~~---~--~~ 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: Problem with update of multiple div's with Ajax helper
One of the reasons I wasn't getting any helpful information is becuase I'd disabled debugging for the ajax view. Anyway, it seems that the issue was the model data I was trying to loop through, or just get the size of, needs to be avaialable to the ajax view, even though it is not meant to be updating all of that part of the view. I havn't actually found a way to do what I want still. As I can set this data again, but the update still dosn't seem to work. I've just gone ahead with using an element to update the whole list of data after each ajax call. But this seems to miss some of the point. Any ideas on where I'm going 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: Need little help with a validation rule
Ernesto: I like to make custom validation methods when dealing with complex relationships between fields. http://edwardawebb.com/programming/php-programming/cakephp/validating-optional-fields-cakephp-dreaded-scenario On Apr 30, 4:31 am, Ernesto e.fanz...@gmail.com wrote: Hi guys thx for the responses @Brian i already have the notEmptY rule on each field. But the rule will fail is the field is not set. @starkey overriding model::save doesn't sound cake-ish to me... imo a custom validation rule will be more coherent @jstein thx for the hint On 30 Apr, 01:54, brian bally.z...@gmail.com wrote: I assumed the 'required'=true was obvious, given the parameters mentioned. I should have mentioned that, also. On Wed, Apr 29, 2009 at 6:27 PM, jstein jst...@image.dk wrote: On Apr 29, 6:00 pm, brian bally.z...@gmail.com wrote: Just use a rule (eg. notEmpty) for each of them. You'll get errors for whichever fields were not set. No, notEmpty will fail validation, if the field is present but empty. It will NOT fail, if the field is not set at all. If the field MUST be set, use 'required'=true (and still use the notEmpty rule, if empty values should not be allowed). Seehttp://book.cakephp.org/view/129/required I just learned the difference the hard way... ;-) I don't think the case when none of the fields are present can be handled by validation rules, but starkey has given a solution for this. Regards Jonathan --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Is this even possible in cake? (model associations with unknown models)
My site is build with a lot of plugins. Now, I used to use a 'pages' table that had the column called 'widgets' the column contained a serialized array which contained information about which widgets (models) should be in that page. Something like this: array( [0] = array( 'name' = 'content' 'args' = array( 'id' = 1 ) ) [1] = array( 'name' = 'comments' 'args' = array( 'group_id' = 1 ) ) ) Then I had plugin-models called 'Content' and 'Comments' which had tables like 'content_data', 'content_settings', 'comments_data' and 'comments_settings'. Now someone told me I should never ever have an array inside a database-table. So I tried to do it without an array, and got up with this database structure: A table called 'pages' A table called 'widgets' with columns called 'id' and 'page_id' And all my widgets ('content_data' and 'comments_data') got an extra column called 'widget_id' Now I wanted to give my widgets a var $belongsTo = array('widgets'); But I can't give my 'widgets'-model a var $hasMany = array(?); Cause I don't know which widgets are on a page. Of course, I could try to associate it with EVERY widget (although I wouldn't know how), but that would be very slow when I get a lot of widgets. So, how do I give it the right $hasMany-var? --~--~-~--~~~---~--~~ 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: Compare Array - GOT IT!
Yes... the goal is to secure the form (the checkbox values) so an end user can not modify the values and submit...All values submitted are checked against possible values in the db...so if they don't exist we know someone was messing with the form. So that's all done and working then it was just a matter of selecting the fields that were allowed to have data saved to them so if a user tried to add text field or something to the form it would not save that 'extra' data. The validation is set ('numeric') since its a HABTM table its saving id, user id , program_id That was all...sorry for the confusion Dave -Original Message- From: Brendon Kozlowski [mailto:brendon...@hotmail.com] Sent: April-30-09 11:48 AM To: CakePHP Subject: Re: Compare Array - GOT IT! Ah, okay I understand what you mean now. It looks like you're doing this in the model; am I correct on that? It should probably be set as a custom validation for the particular field(s) you are concerned about. Since you didn't paste all of your code (you don't need to) I'll just hope that's what you're doing. :) If not, you can find that information in the cookbook: http://book.cakephp.org/view/150/Custom-Validation-Rules If you're not already, you may also want to use the Security Component. On Apr 29, 10:11 pm, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: No no...not giving them the ability to edit the form...install Firebug and anyone can edit a form...I am trying to prevent them from editing the form. I can see the form and use firebug to see the vales in the form checkboxes...value = 1 =3 = so on. I can change the values with Firebug to 599 799 899 or what ever ...so what I am doing is verify that if someone is being cleaver and changes the values to something that it could not possably be then it will not save anything and the logged in users account is supspended because the ony way the form would not save is if someone was messing with it and submited bad data.(the form is only checkboxes) -Original Message- From: Brendon Kozlowski [mailto:brendon...@hotmail.com] Sent: April-29-09 11:15 PM To: CakePHP Subject: Re: Compare Array - GOT IT! I don't believe this is necessary in the first place. Why are you giving someone the ability to edit the form that shouldn't be? That's the first issue I see. Secondly, why are you passing values to be saved if you don't want them overwritten? That's the 2nd issue. Thirdly, why are you even rendering them as form elements rather than simple text within a paragraph tag instead? That'd be the third issue I see. Although you are accomplishing what you want to do, I don't believe you should be trying to do it in the first place as a more elegant (albeit possibly more difficult to grasp?) solution is available. On Apr 29, 4:52 pm, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: I figured it out. //list of possible keys $keys = $this-User-$model_name-find('list', array('fields' = 'id', 'order' = 'id ASC')); debug($keys); $submitted = $this-data[$model_name][$model_name]; debug($this-data[$model_name][$model_name]); $results = array_diff($submitted, $keys); debug($results); So if a evil user tries to change the value in a form and submits, the value is checked against possible values in the databsaeif not found we know someone was doing something they should not have been doing. I am using this for a form that only has checkboxes so it works for me. Any flaws? Thanks, Dave -Original Message- From: Dave Maharaj :: WidePixels.com [mailto:d...@widepixels.com] Sent: April-29-09 6:14 PM To: cake-php@googlegroups.com Subject: re: Compare Array I am trying to do the same type thing with comparing an array. I am using this for a security set up so a user can not change values of a form so I get the list of possible keys //list of possible keys $keys = $this-User-$model_name-find('list', array('fields' = 'id', 'order' = 'id ASC')); debug($keys); Array ( [1] = 1 [2] = 2 [3] = 3 [4] = 4 [5] = 5 [6] = 6 ) // values submitted by user $submitted = $this-data[$model_name][$model_name]; debug($this-data[$model_name][$model_name]); Array ( [0] = 3 [1] = 5 [2] = 6 [3] = 1 ) //how to compare vales against submitted values? $results = array_udiff_assoc($keys, array($submitted)); debug($results); But i need to compare the keys with the submitted data and that where i am stuck. I need to check that the submitted values have a match with the possible values in the database. Can someone point out my error or suggestions? Thanks, Dave- Hide
Re: Value from Key
count($results) ? You surely need to study PHP just a little bit more before diving into a framework :') Faifas On Thu, Apr 30, 2009 at 19:06, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: Thanks to everyone, What i did was: ?php $i = 0; foreach ($results as $error) : $i = $i++; ? li?php echo $error ;?/li ?php endforeach; ? Its just for tracking a user actions on my siteso if they do something they should not be doing such as messing with the URL or links/forms with Firebug it saves the 'bad' info they tried changing it to , where they tied changing it to in a db, and I get a report of who was doing stuff they should not be doing. So thats why the number can change..if they added 5 text fields in a form using Firebug or something i see the 5 fields they added and what they tried to submit. -- *From:* Aivaras [mailto:faifas1...@gmail.com] *Sent:* April-30-09 5:06 AM *To:* cake-php@googlegroups.com *Subject:* Re: Value from Key for($i = 0; $i count($array); $i++){ echo $array[$i]; // will output your error echo $i; // will output the index. } Still, I have absolutely no idea why would you need to know indexes for error reporting. Faifas On Thu, Apr 30, 2009 at 02:30, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: Right but the [0] [1] will change depending on the array its self. I do not know the number that will be generated as it could be an array of errors. If there is 1 error [0] but if 10 errors? Ideas? -- *From:* Aivaras [mailto:faifas1...@gmail.com] *Sent:* April-29-09 7:42 PM *To:* cake-php@googlegroups.com *Subject:* Re: Value from Key Hey, echo $the_variable_you_are_pr_ing[$key] example: echo $aNonsenceLetters[0]; // outputs: jkl Cheers, Faifas On Thu, Apr 30, 2009 at 00:47, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: How can i get the value of a key? the array is from debug($requests); for example my array is: Array ( [0] = jkl [1] = ii [2] = yyy ) 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: Value from Key
Thanks for the tip...but you can keep your comments to yourself. If i ask a question and make a mistake im glad to those who point it out but you can keep your critiques to yourself. Maybe I am not a professional PHP guru such as yourself but the way you learn is from mistakes. _ From: Aivaras [mailto:faifas1...@gmail.com] Sent: April-30-09 1:55 PM To: cake-php@googlegroups.com Subject: Re: Value from Key count($results) ? You surely need to study PHP just a little bit more before diving into a framework :') Faifas On Thu, Apr 30, 2009 at 19:06, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: Thanks to everyone, What i did was: ?php $i = 0; foreach ($results as $error) : $i = $i++; ? li?php echo $error ;?/li ?php endforeach; ? Its just for tracking a user actions on my siteso if they do something they should not be doing such as messing with the URL or links/forms with Firebug it saves the 'bad' info they tried changing it to , where they tied changing it to in a db, and I get a report of who was doing stuff they should not be doing. So thats why the number can change..if they added 5 text fields in a form using Firebug or something i see the 5 fields they added and what they tried to submit. _ From: Aivaras [mailto:faifas1...@gmail.com] Sent: April-30-09 5:06 AM To: cake-php@googlegroups.com Subject: Re: Value from Key for($i = 0; $i count($array); $i++){ echo $array[$i]; // will output your error echo $i; // will output the index. } Still, I have absolutely no idea why would you need to know indexes for error reporting. Faifas On Thu, Apr 30, 2009 at 02:30, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: Right but the [0] [1] will change depending on the array its self. I do not know the number that will be generated as it could be an array of errors. If there is 1 error [0] but if 10 errors? Ideas? _ From: Aivaras [mailto:faifas1...@gmail.com] Sent: April-29-09 7:42 PM To: cake-php@googlegroups.com Subject: Re: Value from Key Hey, echo $the_variable_you_are_pr_ing[$key] example: echo $aNonsenceLetters[0]; // outputs: jkl Cheers, Faifas On Thu, Apr 30, 2009 at 00:47, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: How can i get the value of a key? the array is from debug($requests); for example my array is: Array ( [0] = jkl [1] = ii [2] = yyy ) 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 -~--~~~~--~~--~--~---
routing to a non-cake php page (again)
Hi Bakers, I want to use routes to point /about to /blog/about, i.e in webroot, not a controller/action combo. I know I could do this mod rewrite, and it'd be better for performance etc, but given some tight deadlines and a lot of legacy routes to change, it'd be lots simpler for me to do something like: Router::connect('/about', array('url' = '/blog/about')); Is this possible? Or does routing still not apply to things in webroot? (There's a thread with the above title that's basically what I'm asking about, but that was a long time ag, and I thought things might have changed since then?!) --~--~-~--~~~---~--~~ 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: Auth ignoring Session, redirecting to login under heavy load.
On Thu, Apr 30, 2009 at 5:04 AM, Jonas Hartmann j0n4s.h4rtm...@googlemail.com wrote: Hello, i have an issue with deploying my cake application. Running local on Mac OS X it works like charm. After uploading it to a Ubuntu based VHost on HostEurope I had some headaches with PLESK and its strange standard unix permission setup. OT: I'd appreciate it if you posted a quick message discussing some of the problems you encountered with Plesk and the solutions you found. I'll soon be deploying something to a Plesk server and, though I've found a few comments about that online, I haven't seen much in the way of answers. I lose my session from time to time under heavy load. This happens with either php, cake or database sessions, I have tried all of them. It happens when for Instance I run http://www.domain.tld/admin/categories/index multiple times in Firefox-Tabs at once - thus, if I fire multiple http requests very shortly after each other. I have no clue if multiple users firing multiple events would lead to the same issue, yet (that would be even worse). I got the latest SVN head from 1.2 stable and just uploaded it to make sure that it is not already fixed / an internal problem. I am looking forward to your help/tips in regards to: a.) My small controller code, quoted below? b.) Debugging tips - how should I continue to understand what the problem is? I have disabled cache and debugging is on 2. This is how I test against routing prefix admin. I do not know if it is the best or recommended way. I would welcome suggestions. Best would be if the problem would be fixed afterwards ?php class AppController extends Controller { var $helpers = array('Html', 'Form', 'Javascript', 'Time'); var $components = array('Cookie', 'Session', 'Auth'); function beforeFilter() { if(isset($this-params['prefix'])) { if($this-params['prefix'] == 'admin') { Configure::write('debug', 2); $this-Auth-deny('*'); $this-Auth-allow('login'); } else { $this-Auth-allow('*'); } } else { $this-Auth-allow('*'); } } } ? You should never include 'login' in allow(). This is how I have things working: AppController: function beforeFilter() { $this-Auth-fields = array('username' = 'email', 'password' = 'password'); $this-Auth-loginError = 'No matching user found.'; $this-Auth-loginAction = array('controller' = 'users', 'action' = 'login'); $this-Auth-loginRedirect = array('controller' = 'pages', 'action' = 'display', 'home'); $this-Auth-autoRedirect = false; $this-Auth-logoutRedirect = array('controller' = 'users', 'action' = 'login'); /* Auth will check controller's isAuthorized() */ $this-Auth-authorize = 'controller'; /* I have no public pages, so I need a better authError * than the default 'You are not authorized to access that * location.' for users who haven't loged in yet. */ if (!$this-Session-read('User')) { $this-Auth-authError = 'Please log in'; } $admin = Configure::read('Routing.admin'); if (isset($this-params[$admin]) $this-params[$admin]) { $this-layout = 'admin'; } } function isAuthorized() { $admin = Configure::read('Routing.admin'); if (isset($this-params[$admin]) @isset($this-params['prefix'][$admin])) { /* see User::login() */ if ($this-Auth-user('admin') == 0) { return false; } } return true; } UsersController: public function login() { if ($user = $this-Auth-user()) { /* All my Groups below 4 are some kind of admin */ if ($this-Auth-user('group_id') 3) { $this-redirect($this-Auth-loginRedirect); } /* This User is an admin. You might already have an * 'admin' field in your table. I chose not to so I set it * in Auth's session values. */ $this-Session-write('Auth.User.admin', 1); /* The redirect for an admin can be whatever you need */ $this-redirect( array( 'controller' = 'admin', 'action' = 'index', 'admin' = 1 ) ); } }
Eine Frage zu Tabellen Relationen( Error 1054)
Hallo zusammen, ich habe 2 Tabellen mit folgendem Aufbau Tabelle 1 masterdata enthält folgende Felder id, vname, vstrasse, vpostleitzahl, vort, vgericht, vmitglieder, vgenrenummer, vgenre,vansprechpartner Tabelle 2 contacts enthält folgende Felder id canrede, ctitel, cvorname, cname, cstrasse, cpostleitzahl, cort, ctelefon, cfax Die Idee ist die das jedem Eintrag der masterdata(Vereinsliste) genau ein Ansprechpartner zugeordnet ist. Sozusagen eine hasOne beziehung mein masterdata Model sieht folgendermaßen aus class Masterdatum extends AppModel { var $name = 'Masterdatum'; var $hasOne = array('Contact'); } mein contact Model sieht so aus class Contact extends AppModel { var $name = 'Contact'; } Welche Änderungen muss ich an meinem Controller Vornehmen, das es auch so funktioniert. Zur Zeit bekomme ich einen SQL Fehler 1054 und einen Fehler in der foeach-Schleife der index und view.ctp Das cakePHP Framework ist das aktuelle 1.2.2.8120. Kann mir diesbezüglich jemand helfen, denn die Anleitung im cakebook sind dahingehend irgendwie nicht weit genug. Hat jemand eine gute Anleitung wie man einfach solche Beziehungen aufbaut und versteht. Das ist zur Zeit mein größtes Problem. Danke jetzt schon mal Viele Grüße Marcus Radisch --~--~-~--~~~---~--~~ 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: Value from Key
I see that You are offended by my last e-mail and for that I offer my humble apologies. I am not a professional PHP guru and I truly agree with You. Once you make an error you learn from it. Don't get my opinion wrong, I was also criticized by few cakePHP gurus even tho I do know PHP quite well and I know *how* it *hurts* ;) Peace, Faifas On Thu, Apr 30, 2009 at 19:30, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: Thanks for the tip...but you can keep your comments to yourself. If i ask a question and make a mistake im glad to those who point it out but you can keep your critiques to yourself. Maybe I am not a professional PHP guru such as yourself but the way you learn is from mistakes. -- *From:* Aivaras [mailto:faifas1...@gmail.com] *Sent:* April-30-09 1:55 PM *To:* cake-php@googlegroups.com *Subject:* Re: Value from Key count($results) ? You surely need to study PHP just a little bit more before diving into a framework :') Faifas On Thu, Apr 30, 2009 at 19:06, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: Thanks to everyone, What i did was: ?php $i = 0; foreach ($results as $error) : $i = $i++; ? li?php echo $error ;?/li ?php endforeach; ? Its just for tracking a user actions on my siteso if they do something they should not be doing such as messing with the URL or links/forms with Firebug it saves the 'bad' info they tried changing it to , where they tied changing it to in a db, and I get a report of who was doing stuff they should not be doing. So thats why the number can change..if they added 5 text fields in a form using Firebug or something i see the 5 fields they added and what they tried to submit. -- *From:* Aivaras [mailto:faifas1...@gmail.com] *Sent:* April-30-09 5:06 AM *To:* cake-php@googlegroups.com *Subject:* Re: Value from Key for($i = 0; $i count($array); $i++){ echo $array[$i]; // will output your error echo $i; // will output the index. } Still, I have absolutely no idea why would you need to know indexes for error reporting. Faifas On Thu, Apr 30, 2009 at 02:30, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: Right but the [0] [1] will change depending on the array its self. I do not know the number that will be generated as it could be an array of errors. If there is 1 error [0] but if 10 errors? Ideas? -- *From:* Aivaras [mailto:faifas1...@gmail.com] *Sent:* April-29-09 7:42 PM *To:* cake-php@googlegroups.com *Subject:* Re: Value from Key Hey, echo $the_variable_you_are_pr_ing[$key] example: echo $aNonsenceLetters[0]; // outputs: jkl Cheers, Faifas On Thu, Apr 30, 2009 at 00:47, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: How can i get the value of a key? the array is from debug($requests); for example my array is: Array ( [0] = jkl [1] = ii [2] = yyy ) 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 -~--~~~~--~~--~--~---
Multi Field DisplayField...
Hello all, This has probably been asked a couple of times allready. I would like to use multiple fields to generate the labels in a drop down list box. I searched the list, and this search came up with several different strategies to achieve this. I tried to implement one of these strategies but ran in to a problem... I hope someone can help me. I have the following models: Member - id - login - last_name - first_name -member_type_id MemberType - id - title Event - id - description - date Registrations - id - event_id - member_id I made all the models, controllers and views using the cake bake console. That gave me allready a lot of funtionality. It's great fun working with something that does the boring parts for you and allows you to reach the stage in your project where it becomes more interesting so fast. This is my first attempt at something with CakePHP btw, and the main purpose of the application I'm building is to allow me to learn how to use it. But basically it is an event registration system for our club. In the schaffolds that were build the drop down list boxes all jsut displayed numerical IDs. I understood that this was because I didn't use name or title for the database field that has the most meaningfull description. I solved this by setting $displayField in the model to something usefull. So in the Member model I set $displayField initalls to login. But I would be nice if I could use first_name last_name for the lables in the member_id drop down box on my event registration form. I found a possible solution here: http://bakery.cakephp.org/articles/view/multiple-display-field-3 And I decided to use the Set::Combine suggestion made by Barry. So in the Registrations controller I replaced: $members = $this-Registration-Member-find('list'); with: $members = $this-Registration-Member-find('all'); $members = Set::Combine( $members, '{n}.Member.ID', array( '{0}, {1}', '{n}.Member.last_name', '{n}.Member.first_name' ) ); The weird thing is that with this code the drop down list box that gets generate for member_id now, in stead of containing a list of al login values, now contained only one value. The last_name + first_name of the (alphabetically) last member in the table. So the result of my Set::Combine seems to be an array with just one item. Now why is that? Hope someon can help me here. Krist -- krist.vanbes...@gmail.com kr...@vanbesien.org Bremgarten b. Bern, Switzerland -- A: It reverses the normal flow of conversation. Q: What's wrong with top-posting? A: Top-posting. Q: What's the biggest scourge on plain text email discussions? --~--~-~--~~~---~--~~ 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: Value from Key
Its all good no worries. I learned something so no matter how it was written or what not, thanks. Bake on! Dave _ From: Aivaras [mailto:faifas1...@gmail.com] Sent: April-30-09 3:13 PM To: cake-php@googlegroups.com Subject: Re: Value from Key I see that You are offended by my last e-mail and for that I offer my humble apologies. I am not a professional PHP guru and I truly agree with You. Once you make an error you learn from it. Don't get my opinion wrong, I was also criticized by few cakePHP gurus even tho I do know PHP quite well and I know *how* it *hurts* ;) Peace, Faifas On Thu, Apr 30, 2009 at 19:30, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: Thanks for the tip...but you can keep your comments to yourself. If i ask a question and make a mistake im glad to those who point it out but you can keep your critiques to yourself. Maybe I am not a professional PHP guru such as yourself but the way you learn is from mistakes. _ From: Aivaras [mailto:faifas1...@gmail.com] Sent: April-30-09 1:55 PM To: cake-php@googlegroups.com Subject: Re: Value from Key count($results) ? You surely need to study PHP just a little bit more before diving into a framework :') Faifas On Thu, Apr 30, 2009 at 19:06, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: Thanks to everyone, What i did was: ?php $i = 0; foreach ($results as $error) : $i = $i++; ? li?php echo $error ;?/li ?php endforeach; ? Its just for tracking a user actions on my siteso if they do something they should not be doing such as messing with the URL or links/forms with Firebug it saves the 'bad' info they tried changing it to , where they tied changing it to in a db, and I get a report of who was doing stuff they should not be doing. So thats why the number can change..if they added 5 text fields in a form using Firebug or something i see the 5 fields they added and what they tried to submit. _ From: Aivaras [mailto:faifas1...@gmail.com] Sent: April-30-09 5:06 AM To: cake-php@googlegroups.com Subject: Re: Value from Key for($i = 0; $i count($array); $i++){ echo $array[$i]; // will output your error echo $i; // will output the index. } Still, I have absolutely no idea why would you need to know indexes for error reporting. Faifas On Thu, Apr 30, 2009 at 02:30, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: Right but the [0] [1] will change depending on the array its self. I do not know the number that will be generated as it could be an array of errors. If there is 1 error [0] but if 10 errors? Ideas? _ From: Aivaras [mailto:faifas1...@gmail.com] Sent: April-29-09 7:42 PM To: cake-php@googlegroups.com Subject: Re: Value from Key Hey, echo $the_variable_you_are_pr_ing[$key] example: echo $aNonsenceLetters[0]; // outputs: jkl Cheers, Faifas On Thu, Apr 30, 2009 at 00:47, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: How can i get the value of a key? the array is from debug($requests); for example my array is: Array ( [0] = jkl [1] = ii [2] = yyy ) 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: Compare Array - GOT IT!
You can set validation as numeric, AS WELL as your own custom validation, Cake will let you do that. You create a function that checks the values (comparing to the DB in your case), and if it's not valid, your custom validation method simply returns false, and Cake's validation mechanism takes over, providing whatever textual feedback is necessary to the user (if any). I'm not entirely sure if you want or need this, but I thought I'd let you know in case you aren't already using it. On Apr 30, 11:58 am, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: Yes... the goal is to secure the form (the checkbox values) so an end user can not modify the values and submit...All values submitted are checked against possible values in the db...so if they don't exist we know someone was messing with the form. So that's all done and working then it was just a matter of selecting the fields that were allowed to have data saved to them so if a user tried to add text field or something to the form it would not save that 'extra' data. The validation is set ('numeric') since its a HABTM table its saving id, user id , program_id That was all...sorry for the confusion Dave -Original Message- From: Brendon Kozlowski [mailto:brendon...@hotmail.com] Sent: April-30-09 11:48 AM To: CakePHP Subject: Re: Compare Array - GOT IT! Ah, okay I understand what you mean now. It looks like you're doing this in the model; am I correct on that? It should probably be set as a custom validation for the particular field(s) you are concerned about. Since you didn't paste all of your code (you don't need to) I'll just hope that's what you're doing. :) If not, you can find that information in the cookbook:http://book.cakephp.org/view/150/Custom-Validation-Rules If you're not already, you may also want to use the Security Component. On Apr 29, 10:11 pm, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: No no...not giving them the ability to edit the form...install Firebug and anyone can edit a form...I am trying to prevent them from editing the form. I can see the form and use firebug to see the vales in the form checkboxes...value = 1 =3 = so on. I can change the values with Firebug to 599 799 899 or what ever ...so what I am doing is verify that if someone is being cleaver and changes the values to something that it could not possably be then it will not save anything and the logged in users account is supspended because the ony way the form would not save is if someone was messing with it and submited bad data.(the form is only checkboxes) -Original Message- From: Brendon Kozlowski [mailto:brendon...@hotmail.com] Sent: April-29-09 11:15 PM To: CakePHP Subject: Re: Compare Array - GOT IT! I don't believe this is necessary in the first place. Why are you giving someone the ability to edit the form that shouldn't be? That's the first issue I see. Secondly, why are you passing values to be saved if you don't want them overwritten? That's the 2nd issue. Thirdly, why are you even rendering them as form elements rather than simple text within a paragraph tag instead? That'd be the third issue I see. Although you are accomplishing what you want to do, I don't believe you should be trying to do it in the first place as a more elegant (albeit possibly more difficult to grasp?) solution is available. On Apr 29, 4:52 pm, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: I figured it out. //list of possible keys $keys = $this-User-$model_name-find('list', array('fields' = 'id', 'order' = 'id ASC')); debug($keys); $submitted = $this-data[$model_name][$model_name]; debug($this-data[$model_name][$model_name]); $results = array_diff($submitted, $keys); debug($results); So if a evil user tries to change the value in a form and submits, the value is checked against possible values in the databsaeif not found we know someone was doing something they should not have been doing. I am using this for a form that only has checkboxes so it works for me. Any flaws? Thanks, Dave -Original Message- From: Dave Maharaj :: WidePixels.com [mailto:d...@widepixels.com] Sent: April-29-09 6:14 PM To: cake-php@googlegroups.com Subject: re: Compare Array I am trying to do the same type thing with comparing an array. I am using this for a security set up so a user can not change values of a form so I get the list of possible keys //list of possible keys $keys = $this-User-$model_name-find('list', array('fields' = 'id', 'order' = 'id ASC')); debug($keys); Array ( [1] = 1 [2] = 2 [3] = 3 [4] = 4 [5] = 5
Validate HABTM
I have tried figuring this out on my own to no avail. Where do I validate data being saved into a HABTM table? I have USERS: id SYSTEMS: id name USERS_SYSTEMS: id user_id system_id I created a simple form for the User to update their Systems but where is validation for this? Do I validate system_id in system model? Do I make a user_systems model and set a validation rule for system_id and user_id there? There is no system_id in the system model so it makes no sense to me to put it in there. I made a user_systems model and put var $validate = array( 'system_id' = array('rule' = array('minLength', 8)) //min 8 just to check if it works as there are only single digit values in db ); but it still saves so I am at a loss Can someone point out what model do I use to validate the HABTM data being saved to the HABTM table? 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 -~--~~~~--~~--~--~---
htacces issue
Hi, i've installed cake in two servers, two different applications, never had a trouble installing and firing it up. Suddendly I've installed this copy of cake php in a third server...htaccess trouble. I've activated mod_rewrite and tested the installation. And this error appears : Not Found The requested URL /home/user/public_html/application/app/webroot was not found in the server When the cake application IS in fact installed in /home/user/ public_html/application. I've searched the group and the internet for an answer to this (in the other two servers I've had to activate mod_rewrite only to made cake 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 -~--~~~~--~~--~--~---
Re: ACL from View
Faza, appreciate the help. The problem I see with your approach occurs in your earlier example here: in view i put this: (yes, I will make a helper to do it one day) if (in_array($session-read('Auth.User.group'), array(Administrator, Designer)) { ... } This assumes (hard-coded in the view) that group Designer will always have access to this particular view item. If you remove the right from the designer group, but the logged in user is still a member of group Designer then the condition will still pass. It's only checking group membership, not the rights of that group (really, the effective rights of the user is what should be checked) to that particular action in the view. What I want is a way, from the view, is to check if the logged-in user has access to a particular controller/action pair, so that I can show or hide links to any clickable link. --~--~-~--~~~---~--~~ 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: Buggy radio buttons using Form Helper?
Check the test cases, hopefully there is one that covers your issues. If not, add one and submit a ticket. Drop by #cakephp if you want to discuss. Happy Baking. -GwooBot :) --~--~-~--~~~---~--~~ 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: Eine Frage zu Tabellen Relationen( Error 1054)
Hallo Marcus, Auf dieser Mailingliste wird leider nur Englisch gesprochen. Versuch es entweder auf der deutschen CakePHP Mailingliste (http:// groups.google.com/group/cakephp-de) oder poste deine Frage nochmal auf Englisch neu. -David On 30 Apr., 18:59, amarradi radis...@googlemail.com wrote: Hallo zusammen, ich habe 2 Tabellen mit folgendem Aufbau Tabelle 1 masterdata enthält folgende Felder id, vname, vstrasse, vpostleitzahl, vort, vgericht, vmitglieder, vgenrenummer, vgenre,vansprechpartner Tabelle 2 contacts enthält folgende Felder id canrede, ctitel, cvorname, cname, cstrasse, cpostleitzahl, cort, ctelefon, cfax Die Idee ist die das jedem Eintrag der masterdata(Vereinsliste) genau ein Ansprechpartner zugeordnet ist. Sozusagen eine hasOne beziehung mein masterdata Model sieht folgendermaßen aus class Masterdatum extends AppModel { var $name = 'Masterdatum'; var $hasOne = array('Contact'); } mein contact Model sieht so aus class Contact extends AppModel { var $name = 'Contact'; } Welche Änderungen muss ich an meinem Controller Vornehmen, das es auch so funktioniert. Zur Zeit bekomme ich einen SQL Fehler 1054 und einen Fehler in der foeach-Schleife der index und view.ctp Das cakePHP Framework ist das aktuelle 1.2.2.8120. Kann mir diesbezüglich jemand helfen, denn die Anleitung im cakebook sind dahingehend irgendwie nicht weit genug. Hat jemand eine gute Anleitung wie man einfach solche Beziehungen aufbaut und versteht. Das ist zur Zeit mein größtes Problem. Danke jetzt schon mal Viele Grüße Marcus Radisch --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Save fields
Question about selecting fields allowed to have data saved to with a HABTM save. I have a users_systems table which has id, user_id, system_id and a form to update the users systems only...no other data. Now I do not want a User attempting to edit the form and edit other data thats saved in the database by adding a data[User][group_id] text field or anything. The code below i added which gets a list of the tables in the database i am going to be saving to, in this case its the users_systems table. So i debug and sure enough i see the 3 fields id, user_id, system_id. Are the fields in the save() function in addition to the User-$join_table or if you leave it blank only fields in the User-$join_table-can be saved to? Basically I want to restrict data being saved exclusively to the fields in the User-$join_table and no where else. But its still saving data to the User table when I add a text field using firebug to the database. How can I only allow data to be saved to the fields in the users_systems table? Using AJAX so Security Component is of no use I guess. // this seems to do nothing as i can save other fields by adding a text field manually with firebug to save user entered data. $whitelist = array('system_id'); debug(array_intersect(array_keys($this-User-$join_table-schema()), $whitelist)); $this-User-save($this-data, true, array_intersect(array_keys($this-User-$join_table-schema()), $whitelist)); 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 -~--~~~~--~~--~--~---
User Id Updating
I am debugging a save debug($this-User-save($this-data[$model_table], true, array_keys($this-User-$join_table-schema(; Everything is working fine in regards to the save except in the debug array I see User id...and in the SQL log I see UPDATE `users` SET `id` = 3 WHERE `users`.`id` = 3 Array ( [User] = Array ( [id] = 3 ) [System] = Array ( [0] = 3 [1] = 5 [2] = 4 [3] = 6 [4] = 1 [5] = 2 [6] = 3 [7] = 5 [8] = 4 [9] = 6 [10] = 1 [11] = 2 ) ) I have nothing in the controller relating to the User.id except $this-User-id = $this-Auth-user('id'); $this-set('user', $this-User-read('id', $this-Auth-user('id'))); Why is updatng? Any ideas? 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 -~--~~~~--~~--~--~---