Events don't work when lazy load model class
Hi, I created an event 'Model.User.created' and attached the listener to my model as you can see below and it is working well App::uses('AppModel', 'Model'); App::uses('CakeEvent', 'Event'); class User extends AppModel { public function afterSave($created, $options = array()) { $event = new CakeEvent('Model.User.created', $this, array( 'id' = $this-id, 'data' = $this-data[$this-alias] )); $this-getEventManager()-dispatch($event); } } /*/ // Attach to model App::uses('UserListener', 'Event'); App::uses('ClassRegistry', 'Utility'); $user = ClassRegistry::init('User'); $user-getEventManager()-attach(new UserListener()); When I lazy load the model class User, the event doesn't work. so *How can I allow the event to work on lazy load?* Please advise -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Migrate Passwords
Hi, How can I migrate my users passwords from SimplePasswordHasher to BlowfishPasswordHasher *without interrupt my users to change their passwords*? Thanks -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Load model in bootstrap
Hello, I want to load model in bootstrap.php so I made it with two techniques as the following: App::uses('ClassRegistry', 'Utility'); ClassRegistry::init('Option')-load(); and App::import('Model', 'Option'); $option = new Option(); $option-load(); Both of them worked for me but I don't know the deference between ClassRegistry::init and App::import ? And what is the best choice for my case? Thanks -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Re: Load model in bootstrap
Hi euromark, Thanks for your reply. So you recommend to use ClassRegistry::init On Monday, February 3, 2014 1:03:21 AM UTC+2, euromark wrote: The second example uses App::import() which in 2.x is only used for importing vendor classes (as it does not support lazyloading of classes) You would have to use App::uses('Option', 'Model'). Even if in this case it would not really make a difference. But stick to the first one as it is the recommended approach. Am Sonntag, 2. Februar 2014 23:53:11 UTC+1 schrieb gonzela2006: Hello, I want to load model in bootstrap.php so I made it with two techniques as the following: App::uses('ClassRegistry', 'Utility'); ClassRegistry::init('Option')-load(); and App::import('Model', 'Option'); $option = new Option(); $option-load(); Both of them worked for me but I don't know the deference between ClassRegistry::init and App::import ? And what is the best choice for my case? Thanks -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Router redirect pass all parameters to another domian
Hello, I want to use *Router::redirect* to redirect to another domain and pass all parameters to this domain Example: Redirect this url http://domain-*one*.com/posts/view/1 to http://domain-*two*.com/posts/view/1 I tried the following Router::redirect( '/*', 'http://domain-*two*.com/', array('persist' = true) ); but it redirect to http://domain-*two*.com/ without parameters. Please advise Thanks -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Routing problem with /* url
Hi, I want my posts url to be like this: example.com/post-slug so I added the routing rule on routes.php like this Router::connect('/*', array('controller' = 'posts', 'action' = 'view')); It works well but other links give 404 error like this one Error: The requested address '/members/users/login' was not found on this server. Please advise Thanks -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Re: Routing problem with /* url
Hi Stephen, s members a prefix, or do you have a users method with login parameter, or do you have that as a custom route? Yes, members is a prefix but the problem also exists with urls without prefix like /pages/display/about I found a post on Mark Story's blog that is talking about my problem but it was for CakePHP 1.3 how can I use it with CakePHP 2? http://mark-story.com/posts/view/using-custom-route-classes-in-cakephp Thanks On Friday, January 3, 2014 9:16:58 PM UTC+2, Stephen S wrote: A few things come to my mind off the top off my head. You could route your controller-action url's first, to catch the actual links such as /members/users/login (is members a prefix, or do you have a users method with login parameter, or do you have that as a custom route?) Then providing you did those routes correctly, the bottom route would catch anything that didn't match the earlier ones, hopefully your post slug. Another idea would be to use a regular expression to match the pattern of a post-slug, if there are any distinguishing features this would be much more effective. If not I would recommend doing something like this: /posts/post-slug /blog/post-slug /keyword/post-slug (i.e. if I was writing on a health care blog, I would use /health/post-slug. This could produce something like /health/top-10-diet-tips which holds the keyword health as well as the slug.) It would be easier to avoid issues if you did it this way. HTH -- Kind Regards Stephen Speakman -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Re: Routing problem with /* url
But other links like /pages/display/about gave me 404 error as it routes to posts controller not pages controller. Thanks On Friday, January 3, 2014 10:07:23 PM UTC+2, Stephen S wrote: The link you gave me is done a little differently to how you are doing it now, all the post is introducing is a new method to parse the route itself. Normally you may have something like /posts/view/slug which may be public function view($slug = null), then you may execute a query to find the first post record which contained that exact slug and load the results into an array. Mark is doing a similar search in his actual custom route file, caching it, then passing that information to the controller so it doesn't have to do that. He doesn't appear to mention the issue you are having, unless I missed it, I'm afraid. Try this for me and see if it helps Router::connect( /members/:plugin/:controller, array('action' = 'index', 'prefix' = members, members = true) ); Router::connect( /members/:plugin/:controller/:action/*, array('prefix' = members, members = true) ); Router::connect( /members/:controller, array('action' = 'index', 'prefix' = members, members = true) ); Router::connect( /members/:controller/:action/*, array('prefix' = members, members = true) ); Router::connect('/*', array('controller' = 'posts', 'action' = 'view')); Then try to access /post-slug and /members/users/login and see what happens. On 3 January 2014 19:31, gonzela2006 gonze...@gmail.com javascript:wrote: Hi Stephen, s members a prefix, or do you have a users method with login parameter, or do you have that as a custom route? Yes, members is a prefix but the problem also exists with urls without prefix like /pages/display/about I found a post on Mark Story's blog that is talking about my problem but it was for CakePHP 1.3 how can I use it with CakePHP 2? http://mark-story.com/posts/view/using-custom-route-classes-in-cakephp Thanks On Friday, January 3, 2014 9:16:58 PM UTC+2, Stephen S wrote: A few things come to my mind off the top off my head. You could route your controller-action url's first, to catch the actual links such as /members/users/login (is members a prefix, or do you have a users method with login parameter, or do you have that as a custom route?) Then providing you did those routes correctly, the bottom route would catch anything that didn't match the earlier ones, hopefully your post slug. Another idea would be to use a regular expression to match the pattern of a post-slug, if there are any distinguishing features this would be much more effective. If not I would recommend doing something like this: /posts/post-slug /blog/post-slug /keyword/post-slug (i.e. if I was writing on a health care blog, I would use /health/post-slug. This could produce something like /health/top-10-diet-tips which holds the keyword health as well as the slug.) It would be easier to avoid issues if you did it this way. HTH -- Kind Regards Stephen Speakman -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+u...@googlegroups.com javascript:. To post to this group, send email to cake...@googlegroups.comjavascript: . Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out. -- Kind Regards Stephen Speakman -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Re: Help in simple query!
@Dr. Drijk @resting Model names must be singular. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Help in simple query!
@Dakota I'm already setting the relation as below class Student extends AppModel { var $name = 'Student'; var $hasMany = array('StudentAttendance'); AND class StudentAttendance extends AppModel { var $name = 'StudentAttendance'; var $belongsTo = 'Student'; On Thursday, May 30, 2013 8:26:28 AM UTC+2, Dakota wrote: That would be the expected result for that query. You aren't including the 'SudentAttendance' model in your query. Looking how to use Containable, or custom join. You don't say what kind of relation there is between StudentAttendance and Student. CakePHP can't guess what you are trying to do, you need to tell it (The guessing part is coming up in version 4 as part of the MRD featureset) -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Help in simple query!
Hello, I used the following code in StudentAttendances controller: $students = $this -StudentAttendance-Student- find('all', array( 'conditions' = array( 'NOT' = array('StudentAttendance.date' = array($year.'-'.$month.'-'.$day)) ), 'fields' = array('Student.id', 'Student.name'), 'order' = 'Student.name ASC' )); On Wednesday, May 29, 2013 8:02:29 AM UTC+2, resting wrote: It will be helpful if you show us what you had done to produce that error. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Help in simple query!
Hello, As you can see on the below image https://lh3.googleusercontent.com/-_Q29P1DXHlQ/UaUWfBmdtYI/AX8/CbEsouqCcCg/s1600/Presentation1.jpg I want to display students that didn't attendance on date 2013-03-01 so the result should be as the following: *id name* 2 Marta Simon 4 Rex Maxwell 6 Vivian Ellis I know this is simple query but I got this error Error: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'StudentAttendance.date' in 'where clause' Thanks, -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Can't validate URL
Hello, can't validate the below url using 'rule' = 'url' on my model https://www.google.com/search?sugexp=les;gs_rn=1gs_ri=serptok=ryp3YY4UdU39xLhgeQ6ElQpq=cakephp cakephp cakephp cakephp cakephp cakephp cakephp cakephp cakephp cakephp cakephp cakephp cakephp cakephp cakephp cakephp cakephpcp=5gs_id=1a6xhr=tq=lorem ipsumpf=pclient=firefox-atbo=drls=org.mozilla:en-US:officialsclient=psy-aboq=loremgs_l=pbx=1bav=on.2,or.r_gc.r_pw.r_qf.bvm=bv.41248874,d.ZG4biw=1366bih=650#hl=enclient=firefox-atbo=drls=org.mozilla:en-US:officialsclient=psy-abq=Lorem ipsum dolor sit amet, consectetur adipiscing elitoq=Lorem ipsum dolor sit amet, consectetur adipiscing elitgs_l=serp.12..0l4.23366.23366.2.24779.1.1.0.0.0.0.289.289.2-1.1.0.les;..0.0...1c.1.9MZ2Kf0IJq0pbx=1bav=on.2,or.r_gc.r_pw.r_qf.bvm=bv.41248874,d.ZG4fp=4d3ec0306f8423d6biw=1366bih=650 Please advise -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Can't validate URL
Hello euromark, No spam, I'm just trying to find a solution to my problem in different places. On Thursday, January 24, 2013 6:59:20 PM UTC+2, euromark wrote: the same spam as http://stackoverflow.com/questions/14505837/cakephp-cant-validate-url ? Am Donnerstag, 24. Januar 2013 17:16:49 UTC+1 schrieb gonzela2006: Hello, can't validate the below url using 'rule' = 'url' on my model https://www.google.com/search?sugexp=les;gs_rn=1gs_ri=serptok=ryp3YY4UdU39xLhgeQ6ElQpq=cakephpcakephp cakephp cakephp cakephp cakephp cakephp cakephp cakephp cakephp cakephp cakephp cakephp cakephp cakephp cakephp cakephpcp=5gs_id=1a6xhr=tq=lorem ipsumpf=pclient=firefox-atbo=drls=org.mozilla:en-US:officialsclient=psy-aboq=loremgs_l=pbx=1bav=on.2,or.r_gc.r_pw.r_qf.bvm=bv.41248874,d.ZG4biw=1366bih=650#hl=enclient=firefox-atbo=drls=org.mozilla:en-US:officialsclient=psy-abq=Lorem ipsum dolor sit amet, consectetur adipiscing elitoq=Lorem ipsum dolor sit amet, consectetur adipiscing elitgs_l=serp.12..0l4.23366.23366.2.24779.1.1.0.0.0.0.289.289.2-1.1.0.les;..0.0...1c.1.9MZ2Kf0IJq0pbx=1bav=on.2,or.r_gc.r_pw.r_qf.bvm=bv.41248874,d.ZG4fp=4d3ec0306f8423d6biw=1366bih=650 Please advise -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Can't validate URL
Hello euromark, Thanks for your reply I'm trying to make my own short link service for my blog and I wish to make it using CakePHP I think I can't validate this URL because it is too long *Note*: I have tried to encode this URL before validate it and still getting false URL. Please advise -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Routing help
Any help please -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Routing help
Hello Mathew, Thanks for your reply. Regarding to my question,I have wrote wrong controller the right one must be *posts *not *users*. Really I need to make it as a subdomian and I have found an article on Bakery http://bakery.cakephp.org/articles/Mum_Chamber/2008/02/04/subdomaining-with-cake I'll give a try On Thursday, January 17, 2013 10:03:14 PM UTC+2, Mathew wrote: I don't think cakes routing can handle subdomain changes. For that you would have to write your own customer router in CakePHP 2. I don't recommend using subdomains to view user profiles. It introduces a lot of issues for SEO, SSL, cookies and sessions. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Routing help
I have tried the following Router::connect('/*', array('controller' = 'posts', 'action' = 'view', 'members'=1)); and the result is http://domain.com/username/post-alias and it works but the all other links give me 404 not found -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Routing help
Hello ibejohn818, How can I make conditional statement in routes.php file? On Thursday, January 17, 2013 10:43:17 PM UTC+2, ibejohn818 wrote: You would be best served by triggering your route using a conditional statement in your routes file then using a custom route class to verify the username passed in and returning the correct controller/action to dispatch. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Routing help
I got it :) Could you please help me to make this routing http://domain.com/members/posts/view/username/posttitle to be http://username.domain.com/posttitle On Thursday, January 17, 2013 11:05:49 PM UTC+2, ibejohn818 wrote: if(preg_match('/*FILTER*/',$_SERVER['HTTP_HOST'])) { Router::connect()…... } -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Routing help
Hello, I need your help to make this routing http://domain.com/members/users/view/username/posttitle to be http://username.domain.com/posttitle Where domain.com - My domain members - Routing prefix users - Controller view - Action username - Member username(First variable for view() action) posttitle- Member post title(Second variable for view() action) Please help me Thanks -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Routing help
Hello, I have already created the wildcard subdomain *.domian.com. I just need to know how to make the routing process. Thanks, -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Conditional validation rule1 OR rule2
Thanks cricket AD7six. I have used the following code to validate variable if it url or email. public $validate = array( 'variable' = array( 'url' = array( 'rule' = array('urlOrEmail'), 'message' = 'Please supply a valid URL/email address.' ) ) ); public function urlOrEmail($field = array()) { $key = key($field); if(Validation::url($field[$key], true)) { return TRUE; } elseif (Validation::email($field[$key] ,true)) { return TRUE; } else { return FALSE; } } Thanks -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Conditional validation rule1 OR rule2
Hello Cricket, I got this error message: *Error: * Call to undefined method ModelValidator::url() Please advise On Saturday, January 12, 2013 3:11:26 AM UTC+2, cricket wrote: You'll need to create your own validation method. http://book.cakephp.org/2.0/en/models/data-validation.html#custom-validation-rules Personally, I'd create columns for both url and email in the table, then set up a custom rule to check that either one is there, and that whichever one is there is correct. Something like this: public $validate = array( 'email' = array( 'rule' = array('emailOrUrl', 'url'), 'message' = 'Please supply a valid URL or email address' ), 'url' = array( 'rule' = array('emailOrUrl', 'email'), 'message' = 'Please supply a valid URL or email address' ) ); function emailOrUrl($field = array(), $other_field = null) { $key = key($field); /* If this is empty, the other shouldn't be */ if (empty($field[$key]) empty($this-data[$this-alias][$other_field])) { return false; } switch ($key) { case 'email': return $this-validator()-email($field[[$key]); case 'url': return $this-validator()-url($field[[$key]); default: return false; } } Check the API for other params you can pass to these two methods. http://api20.cakephp.org/class/validation On Fri, Jan 11, 2013 at 2:49 PM, gonzela2006 gonze...@gmail.comjavascript: wrote: Hello, I want to perform conditional validation between two rules public $validate = array( 'variable' = array( 'notEmpty' = array( 'rule' = 'notEmpty' ), 'url' = array( 'rule' = array('url', true), 'message' = 'Please supply a valid URL address.' ) 'email' = array( 'rule'= array('email', true), 'message' = 'Please supply a valid email address.' ) ) ); I want to check if the variable is url or email Thanks, gonzela2006 -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake...@googlegroups.comjavascript:. To unsubscribe from this group, send email to cake-php+u...@googlegroups.com javascript:. Visit this group at http://groups.google.com/group/cake-php?hl=en. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Conditional validation rule1 OR rule2
Hello, Any help please -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Conditional validation rule1 OR rule2
Hello, I want to perform conditional validation between two rules public $validate = array( 'variable' = array( 'notEmpty' = array( 'rule' = 'notEmpty' ), 'url' = array( 'rule' = array('url', true), 'message' = 'Please supply a valid URL address.' ) 'email' = array( 'rule'= array('email', true), 'message' = 'Please supply a valid email address.' ) ) ); I want to check if the variable is url *or* email Thanks, gonzela2006 -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Autocomplete example for cakephp 2.2
Hi Greg, I want an example for cakephp 2.1.x or 2.2.x. Thanks On Wednesday, July 25, 2012 6:16:06 PM UTC+2, Greg wrote: I use a jQuery autocomplete control and write a method in the desired controller which returns JSON and must be requested as XHR ($this-request-is('ajax');) pretty straight forward to implement this way. Json views make it ridiculously straight forward (just a bit of config really) if you are still stuck i'll grab an example from work tomorrow and dump it for you. On Wed, Jul 25, 2012 at 11:27 PM, euromark dereurom...@googlemail.comwrote: Although the description might be german, the example itself should be understandable: http://www.cakephp-forum.de/tutorials-und-snippets/autocomplete-mit-jquery-t1211.html Am Mittwoch, 25. Juli 2012 14:48:37 UTC+2 schrieb Dr. Tarique Sani: Keep your js separate from the php and any solution will work. Tell us what specifically is not working Cheers Tarique On Wed, Jul 25, 2012 at 6:40 AM, Christopher von Hessert cvhess...@gmail.com wrote: Hi, I'm looking all over google for a way to implement a Autocomplete input field with no luck. All examples I have found are for cakephp 1.3 Does anyone have a working example for cakephp 2.2? Thanks. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscribe@**googlegroups.comcake-php%2bunsubscr...@googlegroups.comFor more options, visit this group at http://groups.google.com/**group/cake-phphttp://groups.google.com/group/cake-php -- ==**==**= PHP for E-Biz: http://sanisoft.com ==**==**= -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Search form like google
Hi, Thanks Dr. Tarique and I'll try the above tutorial and feedback you with the result :) On Tuesday, June 12, 2012 9:30:22 AM UTC+3, Dr. Tarique Sani wrote: A bit dated but should get you started http://blogfreakz.com/cakephp/cakephp-jquery-autocomplete-tutorial/ -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Search form like google
Hi, I'm a* newbie* on CakePHP 2 and I'm looking for a way to have a search box with ajax auto complete just like google does as you can see on the below image https://lh5.googleusercontent.com/-r2LP5SW66x0/T9aQnbdZ9YI/AXY/mADzCvXpkGk/s1600/search+form.png Thanks, gonzela2006 -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php