Re: Find most uses categories with a count?
If items is not unique you need to add 'group by' clause to the query. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: find all with at least one associated model
The easiest way would be to Use countercache and then just add post_count 0 to conditions... if you cant zdf countercache for some reason you could also inner join the posts Table, which would leave all blogs that have no assocciated post... On 1 Nov., 18:29, Max D max.doerf...@googlemail.com wrote: Hi, i use cake 1.3 and I have a Blog hasMany Post association and now I want to find all the Blogs, which have at least one Post. I use the Containable Behavior. I understand, that I could do a Blog-find('all', array('contain' = array('Post'))) and simply filter the results for the Blogs, where the Post array is empty. But this doesn't work if I want to use pagination. I tried to paginate over the Post model: $this-paginate = array('Post' = array( 'contain' = array('Blog'), 'order' = 'Blog.created DESC', 'group' = 'Post.blog_id', 'limit' = 5, )); $blog = $this-paginate('Post'); The Blog array looks good. I just get the Blogs with one Post each (which I don't actually need). But all the PaginatorHelper functions return wrong results. $this-Paginator-counter(array('model' = 'Post')); always returns 1, although there are 3 results in the $blogs array. Any ideas how I can achieve this? Thanks in advance Max Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: not following naming conventions
It still doesn't show me the error message I set up in the model :( I only get the fail message I specified in the controller. And in addition, it doesn't show the already-posted data, just the clear form which suck really hard. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Subclassing TestSuite: put a class BetterTestSuite between MyGroupTest and TestSuite does not work?
Hi everybody I'm having the following test group: class MyGroupTest extends TestSuite { function __construct() { TestManager::addTestFile($this, APP_TEST_CASES.DS.'views'.DS.'applications'.DS.'bla1.test.php'); TestManager::addTestFile($this, APP_TEST_CASES.DS.'views'.DS.'applications'.DS.'bla2.test.php'); } } Works like a charm. So I wanted to refactor this a bit: class MyGroupTest extends TestSuite { var $tests = array('bla1', 'bla2'); function __construct() { foreach($this-tests as $test) { TestManager::addTestFile($this, APP_TEST_CASES.DS.'views'.DS.'applications'.DS.$test.'.test.php'); } } } Works like a charm. But now I wanted to put the constructor into its own class, so I can subclass any other group test from it: class BetterTestSuite extends TestSuite { var $tests = array(); function __construct() { foreach($this-tests as $test) { TestManager::addTestFile($this, APP_TEST_CASES.DS.'views'.DS.'applications'.DS.$test.'.test.php'); } } } class MyGroupTest extends BetterTestSuite { var $tests = array('bla1', 'bla2'); } Does *not* work. The result is always: 0/0 test cases complete: 0 passes, 0 fails and 0 exceptions. Anybody knows why? No idea what's the problem here... I guess it has something to do with how SimpleTest handles groups and stuff (maybe it depends on that the tests are really put into TestCase and not into a subclass of TestCase or something)... But I just don't find the reason... Thanks a lot for help! Josh Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: not following naming conventions
how do you set the error message? you need to show us your controller code for this action otherwise we cannot help you On 2 Nov., 10:34, grandioso something.like.a.phenome...@gmail.com wrote: It still doesn't show me the error message I set up in the model :( I only get the fail message I specified in the controller. And in addition, it doesn't show the already-posted data, just the clear form which suck really hard. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Do not show flash message when a url redirects to the login page
Hi, I was looking how to do not show flash message when a url redirects to the login page Thanks in advance! Alberto Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
How can let Cakephp don't clear view cache when related models changed?
How can let Cakephp don't clear view cache when related models changed? For example, I have a Food model and the follow views those use the Food model: /foods/index.ctp /foods/list.ctp /foods/view.ctp I turn on view cache setting for all the three actions. When someone request the url /foods/index or /foods/list,cakephp generates cached files. When someone request the url /foods/view,I update the click_count column of the model Food. And, cakephp clear the previous cache files automatic. But I wanna save the cache files for 24 hours. I hope cakephp don't to clear the cached files when related model changed (I just update the model's click_count.) . How can I do it? Thanks for some answers. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Newbie trying to pass xml object
Let me start by saying that I am very new to php and cakephp. I went through the blog tutorial (:-)) and now am facing a problem which I believe is something simple, but can't seem to get it to work. I have an xml file which I am reading into my view then upon selection of one of the nodes, call my controller to display the children of that node. Here are my code snippets: In my view: ?php $registryFile = simplexml_load_file(../models/registry.xml); $modules = $registryFile-modules; foreach($modules-children() as $module) { $links = $module-links; echo $this-Html-link($module- name,array('action'='Modules','$links')); echo br/; } ? In my controller: class MyController extends AppController { function Modules($InParent) { echo dt.$InParent./dt; foreach($InParent-children() as $link) { echo dd.$link-name./dd; } } } I keep getting an error that Fatal error: Call to a member function children() on a non-object. Any assistance is appreciated. Thanks. Mocha Man Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Error on test.php page, missing arguments.php on Simple Test
I had this problem too. A little searching and reading up on the SimpleTest bug tracker and I found out the following. This isn't a Cake issue, its a SimpleTest one. arguments.php is a file called internally in the SimpleTest code and it isn't in the download for 1.1 alpha or 1.0.1. There is an issue already in the issue tracker for SimpleTest at http://sourceforge.net/tracker/index.php?func=detailaid=3100649group_id=76550atid=547455 it recommends downloading the arguments.php file directly from the SVN repo http://simpletest.svn.sourceforge.net/viewvc/simpletest/simpletest/trunk/arguments.php However this leads on to another issue.. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Error on test.php page, missing arguments.php on Simple Test
hi kadanis On Tue, November 2, 2010 12:15 pm, kadanis wrote: I had this problem too. A little searching and reading up on the SimpleTest bug tracker and I found out the following. This isn't a Cake issue, its a SimpleTest one. arguments.php is a file called internally in the SimpleTest code and it isn't in the download for 1.1 alpha or 1.0.1. There is an issue already in the issue tracker for SimpleTest at http://sourceforge.net/tracker/index.php?func=detailaid=3100649group_id=76550atid=547455 it recommends downloading the arguments.php file directly from the SVN repo http://simpletest.svn.sourceforge.net/viewvc/simpletest/simpletest/trunk/arguments.php However this leads on to another issue.. Yup. seems thats just moved the problem.. I'm wondering then whether its worth using an even older version of simpletest? theres got to be a version that works somewhere. -- Mike Karthauser Managing Director - Brightstorm Ltd Email: mi...@brightstorm.co.uk Web: http://www.brightstorm.co.uk Tel: 07939 252144 (mobile) Fax: 0870 1320560 Address: 1 Brewery Court, North Street, Bristol, BS3 1JS Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Select Box Values
I have a form that has a select box: echo $form-input('location',array('type'='select','options'= $locations)); The form action populates the select box with locations: $this-set('locations',$this-Result-find('list',array('fields' = array('location'),'group'=array('location'; However the problem is that the select box is not taking the location field value but the first column value instead. How can I have the select box be populated with the actual field value of location. Just to clarify, the field is displaying correctly it is just the values being submitted that are not working. Thanks in advance. Also I want to say I really appreciate the help of everyone in this group, you have been a great help!! Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Select Box Values
In your find('list') function you have specified the fields to use, and you have only given one field; 'location'. Try changing that to: array('id', 'location') so that you have two columns; id location. Jeremy Burns Class Outfit jeremybu...@classoutfit.com http://www.classoutfit.com On 2 Nov 2010, at 08:55, Briko03 wrote: I have a form that has a select box: echo $form-input('location',array('type'='select','options'= $locations)); The form action populates the select box with locations: $this-set('locations',$this-Result-find('list',array('fields' = array('location'),'group'=array('location'; However the problem is that the select box is not taking the location field value but the first column value instead. How can I have the select box be populated with the actual field value of location. Just to clarify, the field is displaying correctly it is just the values being submitted that are not working. Thanks in advance. Also I want to say I really appreciate the help of everyone in this group, you have been a great help!! Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Select Box Values
Just to clarify, I want location displayed and location submitted. Should I still do two columns? On Nov 2, 8:59 am, Jeremy Burns | Class Outfit jeremybu...@classoutfit.com wrote: In your find('list') function you have specified the fields to use, and you have only given one field; 'location'. Try changing that to: array('id', 'location') so that you have two columns; id location. Jeremy Burns Class Outfit jeremybu...@classoutfit.comhttp://www.classoutfit.com On 2 Nov 2010, at 08:55, Briko03 wrote: I have a form that has a select box: echo $form-input('location',array('type'='select','options'= $locations)); The form action populates the select box with locations: $this-set('locations',$this-Result-find('list',array('fields' = array('location'),'group'=array('location'; However the problem is that the select box is not taking the location field value but the first column value instead. How can I have the select box be populated with the actual field value of location. Just to clarify, the field is displaying correctly it is just the values being submitted that are not working. Thanks in advance. Also I want to say I really appreciate the help of everyone in this group, you have been a great help!! Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Select Box Values
try array('location', 'location') then :) On 2 Nov., 14:04, Briko03 nathanrlar...@gmail.com wrote: Just to clarify, I want location displayed and location submitted. Should I still do two columns? On Nov 2, 8:59 am, Jeremy Burns | Class Outfit jeremybu...@classoutfit.com wrote: In your find('list') function you have specified the fields to use, and you have only given one field; 'location'. Try changing that to: array('id', 'location') so that you have two columns; id location. Jeremy Burns Class Outfit jeremybu...@classoutfit.comhttp://www.classoutfit.com On 2 Nov 2010, at 08:55, Briko03 wrote: I have a form that has a select box: echo $form-input('location',array('type'='select','options'= $locations)); The form action populates the select box with locations: $this-set('locations',$this-Result-find('list',array('fields' = array('location'),'group'=array('location'; However the problem is that the select box is not taking the location field value but the first column value instead. How can I have the select box be populated with the actual field value of location. Just to clarify, the field is displaying correctly it is just the values being submitted that are not working. Thanks in advance. Also I want to say I really appreciate the help of everyone in this group, you have been a great help!! Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Error on test.php page, missing arguments.php on Simple Test
A bit of further research and I've found a post on the CakePHP bug reports regarding this. The CakePHP dev team know about the issue, it's to do with a change in SimpleTest from using $this-ClassName() to $this-__construct(), among other things. As the 1.1alpha version of SimpleTest is still not entirely stable, Mark Story (from CakePHP dev team) said on the bug tracker that they wouldn't be making changes to Cake core files until SimpleTest was in stable release. Which is fair enough. See http://cakephp.lighthouseapp.com/projects/42648/tickets/1250-support-for-simpletest-11alpha for bug and Marks response I've downloaded and run ST 1.0.1 from their site under the Older stable releases section and it appears to work fine with CakePHP 1.3.5 Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: repeated URL
What does your Auth config look like? What do you mean? What info on Auth config should i post? What does your login have in it? users_controller.php has this function. nothing more than what the default cakePHP login has. asks for username and password. function login() { // http://book.cakephp.org/view/643/Preparing-to-Add-Auth // Authenticate Magic // http://book.cakephp.org/view/649/Logging-in if ($this-Session-read('Auth.User')) { $this-Session-setFlash('You are logged in!'); $this-redirect('/', null, false); } // } Are you using mod_rewrite? I have these 3 .htaccess and 3 index.php files /var/www/web2/web/.htaccess IfModule mod_rewrite.c RewriteEngine On RewriteRule ^$ app/webroot/[L] RewriteRule (.*) app/webroot/$1 [L] /IfModule /var/www/web2/web/index.php contains : define('APP_DIR', 'app'); define('WEBROOT_DIR', 'webroot'); define('WWW_ROOT', ROOT . DS . APP_DIR . DS . WEBROOT_DIR . DS); define('ROOT', dirname(__FILE__)); // should above be : define('ROOT','/var/www/web2/web'); /var/www/web2/web/app/.htaccess IfModule mod_rewrite.c RewriteEngine On RewriteRule ^$ webroot/[L] RewriteRule (.*) webroot/$1 [L] /IfModule /var/www/web2/web/app/index.php require 'webroot' . DIRECTORY_SEPARATOR . 'index.php'; /var/www/web2/web/app/webroot/.htaccess IfModule mod_rewrite.c RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php?url=$1 [QSA,L] /IfModule /var/www/web2/web/app/webroot/index.php contains : define('ROOT', '/var/www/web2/web'); define('APP_DIR', 'app'); define('CAKE_CORE_INCLUDE_PATH', '/var/www/web2/web'); Have you checked what headers the server is returning? How is this done? Also, why do you have app in the URL in the first place? Why not set app to be the webserver's root? How do I do this? thanks, i hope these info help. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Select Box Values
That workedTHANKS! On Nov 2, 9:33 am, euromark dereurom...@googlemail.com wrote: try array('location', 'location') then :) On 2 Nov., 14:04, Briko03 nathanrlar...@gmail.com wrote: Just to clarify, I want location displayed and location submitted. Should I still do two columns? On Nov 2, 8:59 am, Jeremy Burns | Class Outfit jeremybu...@classoutfit.com wrote: In your find('list') function you have specified the fields to use, and you have only given one field; 'location'. Try changing that to: array('id', 'location') so that you have two columns; id location. Jeremy Burns Class Outfit jeremybu...@classoutfit.comhttp://www.classoutfit.com On 2 Nov 2010, at 08:55, Briko03 wrote: I have a form that has a select box: echo $form-input('location',array('type'='select','options'= $locations)); The form action populates the select box with locations: $this-set('locations',$this-Result-find('list',array('fields' = array('location'),'group'=array('location'; However the problem is that the select box is not taking the location field value but the first column value instead. How can I have the select box be populated with the actual field value of location. Just to clarify, the field is displaying correctly it is just the values being submitted that are not working. Thanks in advance. Also I want to say I really appreciate the help of everyone in this group, you have been a great help!! Check out the new CakePHP Questions sitehttp://cakeqs.organdhelpothers with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Error on test.php page, missing arguments.php on Simple Test
On Tue, November 2, 2010 1:41 pm, kadanis wrote: A bit of further research and I've found a post on the CakePHP bug reports regarding this. The CakePHP dev team know about the issue, it's to do with a change in SimpleTest from using $this-ClassName() to $this-__construct(), among other things. As the 1.1alpha version of SimpleTest is still not entirely stable, Mark Story (from CakePHP dev team) said on the bug tracker that they wouldn't be making changes to Cake core files until SimpleTest was in stable release. Which is fair enough. See http://cakephp.lighthouseapp.com/projects/42648/tickets/1250-support-for-simpletest-11alpha for bug and Marks response I've downloaded and run ST 1.0.1 from their site under the Older stable releases section and it appears to work fine with CakePHP 1.3.5 i've done the same making sure i added the arguments.php file to that one as well. -- Mike Karthauser Managing Director - Brightstorm Ltd Email: mi...@brightstorm.co.uk Web: http://www.brightstorm.co.uk Tel: 07939 252144 (mobile) Fax: 0870 1320560 Address: 1 Brewery Court, North Street, Bristol, BS3 1JS Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Control user ownership and restrict content access?
I've been using Auth and ACL in their pure form (and obAuth as well) but I'm interested if there is some flexibility in content access. If we don't do any specific manipulation, edit/delete methods have no restrictions user wise. If we do have some tables f.e. orders, accounts, tickets etc that belong to a user, we could do accounts/edit/ 5 and edit user number five. But we need to specifically do a manual verification if that number 5 account belongs to a user. Is there any centralized verification for that kind of relations? Probably something in the app_model or setting edit/delete functions with some predefined constraints in the app_controller? It's security unwise, but on the other hand there is no rule for that kind of access rules. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: repeated URL
On Tue, Nov 2, 2010 at 9:46 AM, matsakaw igebas...@gmail.com wrote: What does your Auth config look like? What do you mean? What info on Auth config should i post? You need to configure Auth in AppController::beforeFilter() http://book.cakephp.org/view/1250/Authentication What does your login have in it? users_controller.php has this function. nothing more than what the default cakePHP login has. asks for username and password. function login() { // http://book.cakephp.org/view/643/Preparing-to-Add-Auth // Authenticate Magic // http://book.cakephp.org/view/649/Logging-in if ($this-Session-read('Auth.User')) { $this-Session-setFlash('You are logged in!'); $this-redirect('/', null, false); } // } Try commenting all of that out for now. Just leave login() as an empty method. Are you using mod_rewrite? I have these 3 .htaccess and 3 index.php files /var/www/web2/web/.htaccess IfModule mod_rewrite.c RewriteEngine On RewriteRule ^$ app/webroot/ [L] RewriteRule (.*) app/webroot/$1 [L] /IfModule /var/www/web2/web/index.php contains : define('APP_DIR', 'app'); define('WEBROOT_DIR', 'webroot'); define('WWW_ROOT', ROOT . DS . APP_DIR . DS . WEBROOT_DIR . DS); define('ROOT', dirname(__FILE__)); // should above be : define('ROOT','/var/www/web2/web'); __FILE__ means the current filename, and dirname() returns the directory part of the path. So it amounts to the same thing. Better to leave it as is. /var/www/web2/web/app/.htaccess IfModule mod_rewrite.c RewriteEngine On RewriteRule ^$ webroot/ [L] RewriteRule (.*) webroot/$1 [L] /IfModule /var/www/web2/web/app/index.php require 'webroot' . DIRECTORY_SEPARATOR . 'index.php'; /var/www/web2/web/app/webroot/.htaccess IfModule mod_rewrite.c RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php?url=$1 [QSA,L] /IfModule /var/www/web2/web/app/webroot/index.php contains : define('ROOT', '/var/www/web2/web'); define('APP_DIR', 'app'); define('CAKE_CORE_INCLUDE_PATH', '/var/www/web2/web'); Have you checked what headers the server is returning? How is this done? The easiest way is probably with the Firebug or LiveHTTPHeaders plugins for Firefox. Also, why do you have app in the URL in the first place? Why not set app to be the webserver's root? How do I do this? Actually, I meant, app/webroot, but anyway ... It depends on what your DocumentRoot is set to for Apache. It looks like yours is: /var/www/web2/web/ But, because you do have the .htaccess file in that dir, you shouldn't need to supply 'app/' in the URL to get a proper Cake request from Apache. When you request http://abc.domain.com/ Apache should look at the .htaccess file in that dir and following the rewrite rule pointing it instead to app/webroot/index.php. It should do the same if requesting http://abc.domain.com/app (notice those two .htaccess files both point the request to app/webroot/index.php) If you can edit your httpd.conf or virtual host configs, the best thing to do is to set DocumentRoot to: /var/www/web2/web/app/webroot If you can do that, for performance benefits, you should also remove (or rename) all of the .htaccess files and add both AllowOverride None (to tell Apache to ignore .htaccess) and the contents of app/webroot/.htaccess to the Directory block in your Apache config. Putting it all together: DocumentRoot /var/www/web2/web/app/webroot Directory /var/www/web2/web/app/webroot AllowOverride None DirectoryIndex index.php Order allow,deny Allow from all IfModule mod_rewrite.c RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php?url=$1 [QSA,L] /IfModule /Directory (There's other stuff you'll need that has nothing to do with this subject, though.) Now, any request to http://abc.domain.com/ will go to index.php by default. Anything else you place under webroot (javascript, css, html, images, whatever) will be served normally, as long as Apache can see it. The only downside to doing this is if you've got other stuff in your DocumentRoot (stats, logs, other shared hosting stuff). If that's the case, you can deal with it through addition of some RewriteRules in your config, but that's beyond the scope of this post (I have to get back to work). (hint: if possible, set up subdomains for your stats, PHPMySQLAdmin, etc.) Now, whether that will fix your problem, I don't know. It's been years since I really got my hands dirty with mod_rewrite and I couldn't say what's going on with your situation. Is this a shared hosting environment? I'm wondering if there's something else configured that's
Re: Newbie trying to pass xml object
On Tue, Nov 2, 2010 at 12:20 AM, mochaman mochama...@gmail.com wrote: Let me start by saying that I am very new to php and cakephp. I went through the blog tutorial (:-)) and now am facing a problem which I believe is something simple, but can't seem to get it to work. I have an xml file which I am reading into my view then upon selection of one of the nodes, call my controller to display the children of that node. Here are my code snippets: In my view: ?php $registryFile = simplexml_load_file(../models/registry.xml); $modules = $registryFile-modules; foreach($modules-children() as $module) { $links = $module-links; echo $this-Html-link($module- name,array('action'='Modules','$links')); echo br/; } ? In my controller: class MyController extends AppController { function Modules($InParent) { echo dt.$InParent./dt; foreach($InParent-children() as $link) { echo dd.$link-name./dd; } } } I keep getting an error that Fatal error: Call to a member function children() on a non-object. Any assistance is appreciated. You can't pass an XML node through an HTTP request. Not like that, anyway. And, if you're going to fetch these from a file, you'd be better off doing it in the controller. In which case, you could then pass a node ID to your controller function, having it fetch just those child nodes. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: not following naming conventions
On Tue, Nov 2, 2010 at 5:34 AM, grandioso something.like.a.phenome...@gmail.com wrote: It still doesn't show me the error message I set up in the model :( I only get the fail message I specified in the controller. And in addition, it doesn't show the already-posted data, just the clear form which suck really hard. My guess is that you're calling redirect(). If the save() or validates() doesn't return true, just let the code execution pass through the rest of the action. That way, your view is re-displayed. If you redirect then $this-data and $this-validationErrors will be empty. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Standard mechanism for telling why a record hasn't been deleted?
On Tue, Nov 2, 2010 at 10:09 AM, psybear83 psybea...@gmail.com wrote: Hi all Is there a standard mechanism for telling why a record hasn't been deleted? When a record isn't deleted, it just tells Xxx was not deleted, but without any reason. So for example, when I'm creating a beforeDelete(..) hook that prevents the record from deletion, how should I let the user know why it hasn't been deleted? Would using a $deletionError variable be an acceptable way? function beforeDelete($cascade) { if($this-hasDependentRecords()) { $this-deletionError = 'record has dependent records'; return false; } } And in the controller: if ($this-Post-delete($id)) { ... } else { $this-Session-setFlash('Post was not deleted because '.$this-Post- deletionError); } What do you think about this solution? Is there a better way? Seems reasonable. I don't know if there's anything built in. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Value from select to controller
Hi May seem very basic but I have a login form that expects a username password and a location. The location is chosen from a select and I want to write the selected location to the session data for the user. I need in passing the chosen location id from the form to the controller. Thanks Antar Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
empty respose after formular was sent
Hello I have a form for my model 'Student'. So I have this page with the url 'students/add' to add new ones. It all works unless I submit the form. I checked the params via $this-params in beforeRender and the URL seemed to be the same when I submitted the form as well as when just displaying the form. So I debugged in the Security Component inside the method 'blackHole', the parameter $error is 'auth' at this point. Therefore I set up all the Auth stuff once again, but it had no affect. I once worked.. but I have no clue, at which point it died. I'd appreciate it if anybody could give me a hint.. Regards, rethab Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: empty respose after formular was sent
Edit: When I submit the form, I get an empty page, but with status code 200. Further, I added debug messages to beforeFilter, afterFilter and beforeRender of which only the beforeFilter debbug-msg appeared in the output. Regards, rethab On Nov 2, 9:43 pm, rethab rethab...@gmail.com wrote: Hello I have a form for my model 'Student'. So I have this page with the url 'students/add' to add new ones. It all works unless I submit the form. I checked the params via $this-params in beforeRender and the URL seemed to be the same when I submitted the form as well as when just displaying the form. So I debugged in the Security Component inside the method 'blackHole', the parameter $error is 'auth' at this point. Therefore I set up all the Auth stuff once again, but it had no affect. I once worked.. but I have no clue, at which point it died. I'd appreciate it if anybody could give me a hint.. Regards, rethab Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: empty respose after formular was sent
I sorry for my one man conversation, but I hope this is gonna be my last post and will probably help you. I noticed some similar behavior like this bug: https://trac.cakephp.org/ticket/5489 Actually, the bug described there happens when submitting a file, which I did not do. But as for the similarities: I managed to get the form working after I had disabled the Security component. Secondly, as I went through the apache logs, I discovered the 404 errors unlike my web browser which showed code: 200. My form did not only contain data for the model Student but also some other things which were related to it. works: - security enabled, form with student data only - security disabled, form with all data When submitting additional data in combination with an activated security component, it failed. As for cake, I'm really not a pro, but I suppose there might be an issue in the generation of _Token (key, fields) in combination with additional (more than just the ordinary model) form data. Regards, rethab On Nov 2, 9:46 pm, rethab rethab...@gmail.com wrote: Edit: When I submit the form, I get an empty page, but with status code 200. Further, I added debug messages to beforeFilter, afterFilter and beforeRender of which only the beforeFilter debbug-msg appeared in the output. Regards, rethab On Nov 2, 9:43 pm, rethab rethab...@gmail.com wrote: Hello I have a form for my model 'Student'. So I have this page with the url 'students/add' to add new ones. It all works unless I submit the form. I checked the params via $this-params in beforeRender and the URL seemed to be the same when I submitted the form as well as when just displaying the form. So I debugged in the Security Component inside the method 'blackHole', the parameter $error is 'auth' at this point. Therefore I set up all the Auth stuff once again, but it had no affect. I once worked.. but I have no clue, at which point it died. I'd appreciate it if anybody could give me a hint.. Regards, rethab Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Standard mechanism for telling why a record hasn't been deleted?
Hi, Personally for these kinds of errors, I prefer to rely on the errors raised by the database. However, AFAIK, CakePHP does not return these errors automatically. I found a solution, but it uses a very discussed technique: accessing the Session in the model layer. It could also use a model variable instead, that would be then read in the controller actions, but this would mean updating a lot of them... This is what it looks like: app_controller function beforeFilter() { AppModel :: $cakeSession = $this-Session; } app_model --- class AppModel extends Model { static $cakeSession = null; function delete($id = null, $cascade = true) { $result = parent :: delete($id, $cascade); $this-store_datasource_error(); return $result; } /* * Override save() and saveAll() functions here as well if you want */ function store_datasource_error() { if(!empty($this-getDataSource()-error)) { $this-validationErrors['datasource'] = $this- translate_datasource_error($this-getDataSource()-error); AppModel :: $cakeSession-write('datasource_error', $this- validationErrors['datasource']); } } function translate_datasource_error($error_msg) { if(stripos($error_msg, 'violates foreign key constraint) !== false) { $error_msg = __('this item is referenced in the database', true); } elseif(stripos($error_msg, 'duplicate key value violates unique constraint') !== false) { $error_msg = __('this value already exists', true); } elseif( ... ) { ... } return $error_msg; } } Layout - ?php if($this-Session-check('datasource_error')) { echo $this-Session-read('datasource_error'); $this-Session-delete('datasource_error'); } ? Kind regards, nIcO On 2 nov, 15:09, psybear83 psybea...@gmail.com wrote: Hi all layer Is there a standard mechanism for telling why a record hasn't been deleted? When a record isn't deleted, it just tells Xxx was not deleted, but without any reason. So for example, when I'm creating a beforeDelete(..) hook that prevents the record from deletion, how should I let the user know why it hasn't been deleted? Would using a $deletionError variable be an acceptable way? function beforeDelete($cascade) { if($this-hasDependentRecords()) { $this-deletionError = 'record has dependent records'; return false; } } And in the controller: if ($this-Post-delete($id)) { ...} else { $this-Session-setFlash('Post was not deleted because '.$this-Post- deletionError); } What do you think about this solution? Is there a better way? Thanks, Josh Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Standard mechanism for telling why a record hasn't been deleted?
On Tue, Nov 2, 2010 at 6:31 PM, alaxos ala...@gmail.com wrote: Hi, Personally for these kinds of errors, I prefer to rely on the errors raised by the database. However, AFAIK, CakePHP does not return these errors automatically. I found a solution, but it uses a very discussed technique: accessing the Session in the model layer. It could also use a model variable instead, that would be then read in the controller actions, but this would mean updating a lot of them... Or you could just let the controller get the error from the model and set it for the view. Far less complicated. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Value from select to controller
On Tue, Nov 2, 2010 at 10:23 AM, Antar i.chart...@antar.co.uk wrote: Hi May seem very basic but I have a login form that expects a username password and a location. The location is chosen from a select and I want to write the selected location to the session data for the user. I need in passing the chosen location id from the form to the controller. Get it from $this-data. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Error on test.php page, missing arguments.php on Simple Test
Hey kadanis thanks for helping with those links, aprecciate it,I downloaded the 1.0.1 version and after that the arguments.php file itself and now the test.php page looks ok! next time i get a problem i'll remind going to cakephp lighthouse should be really helpful http://mark-story.com/posts/view/cakephp-and-phpunit , he says that cake is moving to Php Unit ... hope it will not bring more difficulty for those who just started with Simple Test On 2 nov, 12:47, Mike Karthauser mi...@brightstorm.co.uk wrote: On Tue, November 2, 2010 1:41 pm, kadanis wrote: A bit of further research and I've found a post on the CakePHP bug reports regarding this. The CakePHP dev team know about the issue, it's to do with a change in SimpleTest from using $this-ClassName() to $this-__construct(), among other things. As the 1.1alpha version of SimpleTest is still not entirely stable, Mark Story (from CakePHP dev team) said on the bug tracker that they wouldn't be making changes to Cake core files until SimpleTest was in stable release. Which is fair enough. See http://cakephp.lighthouseapp.com/projects/42648/tickets/1250-support-... for bug and Marks response I've downloaded and run ST 1.0.1 from their site under the Older stable releases section and it appears to work fine with CakePHP 1.3.5 i've done the same making sure i added the arguments.php file to that one as well. -- Mike Karthauser Managing Director - Brightstorm Ltd Email: mi...@brightstorm.co.uk Web:http://www.brightstorm.co.uk Tel: 07939 252144 (mobile) Fax: 0870 1320560 Address: 1 Brewery Court, North Street, Bristol, BS3 1JS Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Acl and bindNode
I haven't been able to get it to work as advertised. I believe that (short of the documentation being wrong), it is a bug. Chris. On Oct 29, 5:23 am, Jeremy Burns | Class Outfit jeremybu...@classoutfit.com wrote: Anybody else got any more ideas on this? Anyone using it with success? Jeremy Burns Class Outfit jeremybu...@classoutfit.com (t) +44 (0) 208 123 3822 (m) +44 (0) 7973 481949 Skype: jeremy_burnshttp://www.classoutfit.com On 27 Oct 2010, at 17:10, Jeremy Burns | Class Outfit wrote: I wish that were the case, but the guide then gives an example of the aros table, which only includes groups:http://book.cakephp.org/view/1547/Acts-As-a-Requester Jeremy Burns Class Outfit jeremybu...@classoutfit.com http://www.classoutfit.com On 27 Oct 2010, at 13:41, cricket wrote: On Tue, Oct 26, 2010 at 4:40 PM, Jeremy Burns jeremybu...@classoutfit.com wrote: According to the online tutorial: In case we want simplified per-group only permissions, we need to implement bindNode() in User model. Code View function bindNode($user) { return array('Group' = array('id' = $user['User']['group_id'])); } function bindNode($user) { return array('Group' = array('id' = $user['User'] ['group_id'])); } This method will tell ACL to skip checking User Aro's and to check only Group Aro's. I've done this but I'm still getting users added to the aros table. What am I missing? I believe that's normal. Users will still be present in aros but the point is that ACL won't /check/ User, but Group. Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Basic issue with HABTM
Hi guys, I am having some trouble with pretty basic things but it took me precious hours today, and I decided to ask for some light ... I have this config that I am trying to make work: http://bin.cakephp.org/view/2004163346 I baked everything with cake bake and I need a way to proper save all 3 models on submit Any hints or ideas ? -- Fernando Barrocal fbarro...@gmail.com +55 11 8257-7200 +55 11 3020-7332 skype: fbarrocal Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Do not show flash message when a url redirects to the login page
Set your layout to recognize when on the login page and encapsulate your flash message on a if based on this condition! On Tue, Nov 2, 2010 at 08:20, alberto alberto.pri...@gmail.com wrote: Hi, I was looking how to do not show flash message when a url redirects to the login page Thanks in advance! Alberto Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.comcake-php%2bunsubscr...@googlegroups.comFor more options, visit this group at http://groups.google.com/group/cake-php?hl=en -- Fernando Barrocal fbarro...@gmail.com +55 11 8257-7200 +55 11 3020-7332 skype: fbarrocal Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Basic issue with HABTM
Some updates on here (paste bins are used to delete my post even when I ask to mantain) /* Tables /* users people contacts -- 1---1 n---n -- id id id username user_id phone f_name Yes, there is a people_contacts table with both Ids /* View */ ?php echo $this-Form-create('User'); echo $this-Form-input('username'); echo $this-Form-input('Person.f_name'); echo $this-Form-input('Contact.0.phone'); echo $this-Form-end(__('Submit', true)); ? /* Controller */ function register($step = create_account) { if (!empty($this-data)) { $this-User-create(); if ($this-User-saveAll($this-data)) { $this-Session-setFlash(__('The user has been saved', true)); } else { $this-Session-setFlash(__('The user could not be saved.', true)); } } } On Tue, Nov 2, 2010 at 22:15, Fernando Barrocal fbarro...@gmail.com wrote: Hi guys, I am having some trouble with pretty basic things but it took me precious hours today, and I decided to ask for some light ... I have this config that I am trying to make work: http://bin.cakephp.org/view/2004163346 I baked everything with cake bake and I need a way to proper save all 3 models on submit Any hints or ideas ? -- Fernando Barrocal fbarro...@gmail.com +55 11 8257-7200 +55 11 3020-7332 skype: fbarrocal -- Fernando Barrocal fbarro...@gmail.com +55 11 8257-7200 +55 11 3020-7332 skype: fbarrocal Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Anyone care to help with Media Temple dv?
I had my site on Media Temple gs service no problem. Now moving it to dv and I got nothing. Uploaded everything but no htaccess file appears so I think that might be part of the problem. Get no error message other than 500 server error. Any ideas / help would be great as I cant seem to find anything. Dave Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: repeated URL
thanks a lot cricket! Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Can i send email through mysql/cakephp when the users are offline?
My objective is to send a mail when the users are offline. It depends on a particular row or value inserted in the table. if such an option provide by cake or mysql,please help me.. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: repeated URL
i have these : 1. users_controller.php class UsersController extends AppController { /* 01 http://book.cakephp.org/view/52/name The $name attribute should be set to the name of the controller. Usually this is just the plural form of the primary model the controller uses. It will be singularized, underscored and then be used to open the table ?? */ var $name = 'Users'; var $helpers = array('Html', 'Form', 'Javascript', 'Ajax'); var $components = array('RequestHandler'); // var $components = array('RequestHandler', 'Auth'); // Auth is not necessary here anymore, it was declared in app_controller already function login() { // items commented as suggested } function logout() { //00http://book.cakephp.org/view/643/Preparing-to-Add-Auth //00Leave empty for now. now = when initializing aros, acos, groups and users the first time //05http://book.cakephp.org/view/327/Simple-User-Authentication //05Redirect users to this action if they click on a Logout button. //05All we need to do here is trash the session information: //05And we should probably forward them somewhere, too... $this-Session-delete('User'); //00http://book.cakephp.org/view/650/Logout //00next two lines were added after groups/build_acl, and users/ initDB were visited in browser's URL field $this-Session-setFlash('Good-Bye'); $this-redirect($this-Auth-logout()); } function beforeFilter() { parent::beforeFilter(); // should display nothing (even if http://localhost/groups/index or http://localhost/groups/view/2 is typed by guest at browser's URL field), // letting Acl take over authentication ... $this-Auth-allowedActions = array('index', 'view'); } 2. app_controller.php class AppController extends Controller { /* references : //00 http://book.cakephp.org/view/643/Preparing-to-Add-Auth; //00http://book.cakephp.org/view/646/Creating-ACOs; //01 http://lemoncake.wordpress.com/2007/07/19/using-authcomponent-and-acl-in-cakephp-12/ //02 http://www.littlehart.net/atthekeyboard/2007/09/11/a-hopefully-useful-tutorial-for-using-cakephps-auth-component/ //03 http://www.honk.com.au/index.php/2009/10/13/debugging-cakephp-auth-component/ //04 http://www.studiocanaria.com/articles/cakephp_auth_component_users_groups_permissions_revisited //01It is very import that you include the AclComponent before the AuthComponent otherwise you will get this funky error message. Fatal error: Call to a member function check() on a non-object in /var/www/ geoff/cake/cake/libs/controller/components/acl.php on line 87 The reason for this is that Components are started in the order they appear in the $components list, and the AuthComponent does all its magic at startup, so when Auth tries to use Acl::check() there is no Acl. mark_story : originally (circa buildAcl) : $components = array('Auth', 'Acl') changed to (circa build_acl): $components = array('Acl', 'Auth') but there was no mention of his reversing to Acl, Auth order in the cake manual //01 */ var $helpers = array('Html', 'Csv'); var $components = array('Acl', 'Auth'); function beforeFilter() { //00 Configure Authenticate Component //TODO : understand the difference of authorizing 'actions' with authorizing 'controllers' $this-Auth-authorize = 'actions'; //02 Tell Auth what controller / action pair it needs to use to present the login form. $this-Auth-loginAction = array('controller' = 'users', 'action' = 'login'); //02 Tell the Auth component where the user should be redirected when user is logged-out. $this-Auth-logoutRedirect = array('controller' = 'users', 'action' = 'login'); //02 Tell the Auth component where the user should be redirected after a successful authentication. $this-Auth-loginRedirect = array('controller' = 'home'); /* //00 http://book.cakephp.org/view/646/Creating-ACOs Create a 'root' or top level ACO called 'controllers'. The purpose of this root node is to make it easy to allow/deny access on a global application scope, and allow the use of the Acl for purposes not related to controllers/actions such as checking model record permissions. As we will be using a global root ACO we need to make a small modification to our AuthComponent configuration. AuthComponent needs to know about the existence of this root node, so that when making ACL checks it can use the correct node path when looking up controllers/ actions. In AppController add the following to the beforeFilter: $this- Auth-actionPath = 'controllers/'; //00 */ $this-Auth-actionPath = 'controllers/'; //00 http://book.cakephp.org/view/647/An-Automated-tool-for-creating-ACOs //00