HELP NEEDED with Auth Component in Views; Fatal error: (While using Auth component inside a helper)
?php class AccessHelper extends Helper{ var $helpers = array(Session); var $Access; var $Auth; var $user; function beforeRender(){ App::import('Component', 'Access'); $this-Access = new AccessComponent(); App::import('Component', 'Auth'); $this-Auth = new AuthComponent(); $this-Auth-Session = $this-Session; $this-user = $this-Auth-user(); } function check($aco, $action='*'){ if(empty($this-user)) return false; return $this-Access-checkHelper('User::'.$this-user['User'] ['id'], $aco, $action); } function isLoggedin(){ return !empty($this-user); } } ? This access.php file is saved in app/views/helpers In Posts Controller, I have added: var $helpers = array('Access'); So it can be accessed from the view. My Posts index is here: -- h2Welcome to my CakePHP Blog/h2 ? foreach($posts as $post): ? h3a href=/posts/view/? echo $post['Post']['id'] ?? echo $post['Post']['title'] ?/a/h3 p? echo $post['Post']['content'] ?/p ? if($access-isLoggedin() $access-check('Post')): ? smalla href=/posts/edit/? echo $post['Post']['id'] ?edit/a | ? echo $html-link('delete', '/posts/delete/'.$post['Post']['id'], NULL, 'Are you sure?'); ?/small ? endif; ? hr / ? endforeach; ? --- I got this error as I view Posts index: --- Fatal error: Class 'AccessComponent' not found in C:\wamp\www\cakephp \app\views\helpers\access.php on line 10 --- Line 10 points to this: $this-Access = new AccessComponent(); - ~~ What am I trying to accomplish ? The edit and delete links can only be viewed when User is logged in. If not logged in, only the Posts index and view page are viewable-- without displaying the edit and delete links to the Guest users. ~~ Is the method of doing wrong ? what is the suggested way ? Thanks, Maxim 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: HELP NEEDED with Auth Component in Views; Fatal error: (While using Auth component inside a helper)
Hi, Have you had AccessComponent class defined in app/controllers/components/access.php? Amit Badkas PHP Applications for E-Biz: http://www.sanisoft.com On Wed, Dec 29, 2010 at 1:30 PM, John Maxim goog...@gmail.com wrote: ?php class AccessHelper extends Helper{ var $helpers = array(Session); var $Access; var $Auth; var $user; function beforeRender(){ App::import('Component', 'Access'); $this-Access = new AccessComponent(); App::import('Component', 'Auth'); $this-Auth = new AuthComponent(); $this-Auth-Session = $this-Session; $this-user = $this-Auth-user(); } function check($aco, $action='*'){ if(empty($this-user)) return false; return $this-Access-checkHelper('User::'.$this-user['User'] ['id'], $aco, $action); } function isLoggedin(){ return !empty($this-user); } } ? This access.php file is saved in app/views/helpers In Posts Controller, I have added: var $helpers = array('Access'); So it can be accessed from the view. My Posts index is here: -- h2Welcome to my CakePHP Blog/h2 ? foreach($posts as $post): ? h3a href=/posts/view/? echo $post['Post']['id'] ?? echo $post['Post']['title'] ?/a/h3 p? echo $post['Post']['content'] ?/p ? if($access-isLoggedin() $access-check('Post')): ? smalla href=/posts/edit/? echo $post['Post']['id'] ?edit/a | ? echo $html-link('delete', '/posts/delete/'.$post['Post']['id'], NULL, 'Are you sure?'); ?/small ? endif; ? hr / ? endforeach; ? --- I got this error as I view Posts index: --- Fatal error: Class 'AccessComponent' not found in C:\wamp\www\cakephp \app\views\helpers\access.php on line 10 --- Line 10 points to this: $this-Access = new AccessComponent(); - ~~ What am I trying to accomplish ? The edit and delete links can only be viewed when User is logged in. If not logged in, only the Posts index and view page are viewable-- without displaying the edit and delete links to the Guest users. ~~ Is the method of doing wrong ? what is the suggested way ? Thanks, Maxim 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 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: HELP NEEDED with Auth Component in Views; Fatal error: (While using Auth component inside a helper)
Hi Amit, Thanks...! I just put it in the controllers components--access.php: -- ? class AccessComponent extends Object{ var $components = array('Acl', 'Auth'); var $user; function startup(){ $this-user = $this-Auth-user(); } function check($aco, $action='*'){ if(!empty($this-user) $this-Acl-check('User::'.$this- user['User']['id'], $aco, $action)){ return true; } else { return false; } } function checkHelper($aro, $aco, $action = *){ App::import('Component', 'Acl'); $acl = new AclComponent(); return $acl-check($aro, $aco, $action); } } ? -- Now the errors are: ~~ Notice (8): Undefined index: content [APP\views\posts\index.ctp, line 7] ~~ Warning (512): DbAcl::check() - Failed ARO/ACO node lookup in permissions check. Node references: Aro: User::44 Aco: Post [CORE\cake\libs\controller\components\acl.php, line 273] ~~ Regards, Maxim On Dec 29, 4:43 pm, Amit Badkas amit.sanis...@gmail.com wrote: Hi, Have you had AccessComponent class defined in app/controllers/components/access.php? Amit Badkas PHP Applications for E-Biz:http://www.sanisoft.com On Wed, Dec 29, 2010 at 1:30 PM, John Maxim goog...@gmail.com wrote: ?php class AccessHelper extends Helper{ var $helpers = array(Session); var $Access; var $Auth; var $user; function beforeRender(){ App::import('Component', 'Access'); $this-Access = new AccessComponent(); App::import('Component', 'Auth'); $this-Auth = new AuthComponent(); $this-Auth-Session = $this-Session; $this-user = $this-Auth-user(); } function check($aco, $action='*'){ if(empty($this-user)) return false; return $this-Access-checkHelper('User::'.$this-user['User'] ['id'], $aco, $action); } function isLoggedin(){ return !empty($this-user); } } ? This access.php file is saved in app/views/helpers In Posts Controller, I have added: var $helpers = array('Access'); So it can be accessed from the view. My Posts index is here: -- h2Welcome to my CakePHP Blog/h2 ? foreach($posts as $post): ? h3a href=/posts/view/? echo $post['Post']['id'] ?? echo $post['Post']['title'] ?/a/h3 p? echo $post['Post']['content'] ?/p ? if($access-isLoggedin() $access-check('Post')): ? smalla href=/posts/edit/? echo $post['Post']['id'] ?edit/a | ? echo $html-link('delete', '/posts/delete/'.$post['Post']['id'], NULL, 'Are you sure?'); ?/small ? endif; ? hr / ? endforeach; ? --- I got this error as I view Posts index: --- Fatal error: Class 'AccessComponent' not found in C:\wamp\www\cakephp \app\views\helpers\access.php on line 10 --- Line 10 points to this: $this-Access = new AccessComponent(); - ~~ What am I trying to accomplish ? The edit and delete links can only be viewed when User is logged in. If not logged in, only the Posts index and view page are viewable-- without displaying the edit and delete links to the Guest users. ~~ Is the method of doing wrong ? what is the suggested way ? Thanks, Maxim 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.comcake-php%2bunsubscr...@googlegroups.comFor 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: HELP NEEDED with Auth Component in Views; Fatal error: (While using Auth component inside a helper)
Hi, About 'Undefined index: content' error, you should already know how to fix it. About 'DbAcl::check() - Failed ARO/ACO node lookup in permissions check' error, are the ACL tables (aros, acos and aros_acos) populated correctly? Amit Badkas PHP Applications for E-Biz: http://www.sanisoft.com On Wed, Dec 29, 2010 at 2:56 PM, John Maxim goog...@gmail.com wrote: Hi Amit, Thanks...! I just put it in the controllers components--access.php: -- ? class AccessComponent extends Object{ var $components = array('Acl', 'Auth'); var $user; function startup(){ $this-user = $this-Auth-user(); } function check($aco, $action='*'){ if(!empty($this-user) $this-Acl-check('User::'.$this- user['User']['id'], $aco, $action)){ return true; } else { return false; } } function checkHelper($aro, $aco, $action = *){ App::import('Component', 'Acl'); $acl = new AclComponent(); return $acl-check($aro, $aco, $action); } } ? -- Now the errors are: ~~ Notice (8): Undefined index: content [APP\views\posts\index.ctp, line 7] ~~ Warning (512): DbAcl::check() - Failed ARO/ACO node lookup in permissions check. Node references: Aro: User::44 Aco: Post [CORE\cake\libs\controller\components\acl.php, line 273] ~~ Regards, Maxim On Dec 29, 4:43 pm, Amit Badkas amit.sanis...@gmail.com wrote: Hi, Have you had AccessComponent class defined in app/controllers/components/access.php? Amit Badkas PHP Applications for E-Biz:http://www.sanisoft.com On Wed, Dec 29, 2010 at 1:30 PM, John Maxim goog...@gmail.com wrote: ?php class AccessHelper extends Helper{ var $helpers = array(Session); var $Access; var $Auth; var $user; function beforeRender(){ App::import('Component', 'Access'); $this-Access = new AccessComponent(); App::import('Component', 'Auth'); $this-Auth = new AuthComponent(); $this-Auth-Session = $this-Session; $this-user = $this-Auth-user(); } function check($aco, $action='*'){ if(empty($this-user)) return false; return $this-Access-checkHelper('User::'.$this-user['User'] ['id'], $aco, $action); } function isLoggedin(){ return !empty($this-user); } } ? This access.php file is saved in app/views/helpers In Posts Controller, I have added: var $helpers = array('Access'); So it can be accessed from the view. My Posts index is here: -- h2Welcome to my CakePHP Blog/h2 ? foreach($posts as $post): ? h3a href=/posts/view/? echo $post['Post']['id'] ?? echo $post['Post']['title'] ?/a/h3 p? echo $post['Post']['content'] ?/p ? if($access-isLoggedin() $access-check('Post')): ? smalla href=/posts/edit/? echo $post['Post']['id'] ?edit/a | ? echo $html-link('delete', '/posts/delete/'.$post['Post']['id'], NULL, 'Are you sure?'); ?/small ? endif; ? hr / ? endforeach; ? --- I got this error as I view Posts index: --- Fatal error: Class 'AccessComponent' not found in C:\wamp\www\cakephp \app\views\helpers\access.php on line 10 --- Line 10 points to this: $this-Access = new AccessComponent(); - ~~ What am I trying to accomplish ? The edit and delete links can only be viewed when User is logged in. If not logged in, only the Posts index and view page are viewable-- without displaying the edit and delete links to the Guest users. ~~ Is the method of doing wrong ? what is the suggested way ? Thanks, Maxim 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.comcake-php%2bunsubscr...@googlegroups.com cake-php%2bunsubscr...@googlegroups.comcake-php%252bunsubscr...@googlegroups.comFor 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
Re: HELP NEEDED with Auth Component in Views; Fatal error: (While using Auth component inside a helper)
Notice (8): Undefined index: content [APP\views\posts\index.ctp, line 7] ~ Solved the error above, just minor mistake.. Now left unsolved is: Warning (512): DbAcl::check() - Failed ARO/ACO node lookup in permissions check. Node references: Aro: User::44 Aco: Post [CORE\cake\libs\controller\components\acl.php, line 273] Regards, Maxim On Dec 29, 5:26 pm, John Maxim goog...@gmail.com wrote: Hi Amit, Thanks...! I just put it in the controllers components--access.php: -- ? class AccessComponent extends Object{ var $components = array('Acl', 'Auth'); var $user; function startup(){ $this-user = $this-Auth-user(); } function check($aco, $action='*'){ if(!empty($this-user) $this-Acl-check('User::'.$this-user['User']['id'], $aco, $action)){ return true; } else { return false; } } function checkHelper($aro, $aco, $action = *){ App::import('Component', 'Acl'); $acl = new AclComponent(); return $acl-check($aro, $aco, $action); }} ? -- Now the errors are: ~~ Notice (8): Undefined index: content [APP\views\posts\index.ctp, line 7] ~~ Warning (512): DbAcl::check() - Failed ARO/ACO node lookup in permissions check. Node references: Aro: User::44 Aco: Post [CORE\cake\libs\controller\components\acl.php, line 273] ~~ Regards, Maxim On Dec 29, 4:43 pm, Amit Badkas amit.sanis...@gmail.com wrote: Hi, Have you had AccessComponent class defined in app/controllers/components/access.php? Amit Badkas PHP Applications for E-Biz:http://www.sanisoft.com On Wed, Dec 29, 2010 at 1:30 PM, John Maxim goog...@gmail.com wrote: ?php class AccessHelper extends Helper{ var $helpers = array(Session); var $Access; var $Auth; var $user; function beforeRender(){ App::import('Component', 'Access'); $this-Access = new AccessComponent(); App::import('Component', 'Auth'); $this-Auth = new AuthComponent(); $this-Auth-Session = $this-Session; $this-user = $this-Auth-user(); } function check($aco, $action='*'){ if(empty($this-user)) return false; return $this-Access-checkHelper('User::'.$this-user['User'] ['id'], $aco, $action); } function isLoggedin(){ return !empty($this-user); } } ? This access.php file is saved in app/views/helpers In Posts Controller, I have added: var $helpers = array('Access'); So it can be accessed from the view. My Posts index is here: -- h2Welcome to my CakePHP Blog/h2 ? foreach($posts as $post): ? h3a href=/posts/view/? echo $post['Post']['id'] ?? echo $post['Post']['title'] ?/a/h3 p? echo $post['Post']['content'] ?/p ? if($access-isLoggedin() $access-check('Post')): ? smalla href=/posts/edit/? echo $post['Post']['id'] ?edit/a | ? echo $html-link('delete', '/posts/delete/'.$post['Post']['id'], NULL, 'Are you sure?'); ?/small ? endif; ? hr / ? endforeach; ? --- I got this error as I view Posts index: --- Fatal error: Class 'AccessComponent' not found in C:\wamp\www\cakephp \app\views\helpers\access.php on line 10 --- Line 10 points to this: $this-Access = new AccessComponent(); - ~~ What am I trying to accomplish ? The edit and delete links can only be viewed when User is logged in. If not logged in, only the Posts index and view page are viewable-- without displaying the edit and delete links to the Guest users. ~~ Is the method of doing wrong ? what is the suggested way ? Thanks, Maxim 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.comcake-php%2bunsubscr...@googlegroups.comFor 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
Re: HELP NEEDED with Auth Component in Views; Fatal error: (While using Auth component inside a helper)
Thanks Amit, Yes, the first undefined: is solved, I posted a post before yours. I ran the DB sql scripts with no error. The sql is as follow: CREATE TABLE acos ( id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT, parent_id INTEGER(10) DEFAULT NULL, model VARCHAR(255) DEFAULT '', foreign_key INTEGER(10) UNSIGNED DEFAULT NULL, alias VARCHAR(255) DEFAULT '', lft INTEGER(10) DEFAULT NULL, rght INTEGER(10) DEFAULT NULL, PRIMARY KEY (id) ); CREATE TABLE aros_acos ( id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT, aro_id INTEGER(10) UNSIGNED NOT NULL, aco_id INTEGER(10) UNSIGNED NOT NULL, _create CHAR(2) NOT NULL DEFAULT 0, _read CHAR(2) NOT NULL DEFAULT 0, _update CHAR(2) NOT NULL DEFAULT 0, _delete CHAR(2) NOT NULL DEFAULT 0, PRIMARY KEY(id) ); CREATE TABLE aros ( id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT, parent_id INTEGER(10) DEFAULT NULL, model VARCHAR(255) DEFAULT '', foreign_key INTEGER(10) UNSIGNED DEFAULT NULL, alias VARCHAR(255) DEFAULT '', lft INTEGER(10) DEFAULT NULL, rght INTEGER(10) DEFAULT NULL, PRIMARY KEY (id) ); ~~~ On Dec 29, 5:56 pm, Amit Badkas amit.sanis...@gmail.com wrote: Hi, About 'Undefined index: content' error, you should already know how to fix it. About 'DbAcl::check() - Failed ARO/ACO node lookup in permissions check' error, are the ACL tables (aros, acos and aros_acos) populated correctly? Amit Badkas PHP Applications for E-Biz:http://www.sanisoft.com On Wed, Dec 29, 2010 at 2:56 PM, John Maxim goog...@gmail.com wrote: Hi Amit, Thanks...! I just put it in the controllers components--access.php: -- ? class AccessComponent extends Object{ var $components = array('Acl', 'Auth'); var $user; function startup(){ $this-user = $this-Auth-user(); } function check($aco, $action='*'){ if(!empty($this-user) $this-Acl-check('User::'.$this- user['User']['id'], $aco, $action)){ return true; } else { return false; } } function checkHelper($aro, $aco, $action = *){ App::import('Component', 'Acl'); $acl = new AclComponent(); return $acl-check($aro, $aco, $action); } } ? -- Now the errors are: ~~ Notice (8): Undefined index: content [APP\views\posts\index.ctp, line 7] ~~ Warning (512): DbAcl::check() - Failed ARO/ACO node lookup in permissions check. Node references: Aro: User::44 Aco: Post [CORE\cake\libs\controller\components\acl.php, line 273] ~~ Regards, Maxim On Dec 29, 4:43 pm, Amit Badkas amit.sanis...@gmail.com wrote: Hi, Have you had AccessComponent class defined in app/controllers/components/access.php? Amit Badkas PHP Applications for E-Biz:http://www.sanisoft.com On Wed, Dec 29, 2010 at 1:30 PM, John Maxim goog...@gmail.com wrote: ?php class AccessHelper extends Helper{ var $helpers = array(Session); var $Access; var $Auth; var $user; function beforeRender(){ App::import('Component', 'Access'); $this-Access = new AccessComponent(); App::import('Component', 'Auth'); $this-Auth = new AuthComponent(); $this-Auth-Session = $this-Session; $this-user = $this-Auth-user(); } function check($aco, $action='*'){ if(empty($this-user)) return false; return $this-Access-checkHelper('User::'.$this-user['User'] ['id'], $aco, $action); } function isLoggedin(){ return !empty($this-user); } } ? This access.php file is saved in app/views/helpers In Posts Controller, I have added: var $helpers = array('Access'); So it can be accessed from the view. My Posts index is here: -- h2Welcome to my CakePHP Blog/h2 ? foreach($posts as $post): ? h3a href=/posts/view/? echo $post['Post']['id'] ?? echo $post['Post']['title'] ?/a/h3 p? echo $post['Post']['content'] ?/p ? if($access-isLoggedin() $access-check('Post')): ? smalla href=/posts/edit/? echo $post['Post']['id'] ?edit/a | ? echo $html-link('delete', '/posts/delete/'.$post['Post']['id'], NULL, 'Are you sure?'); ?/small ? endif; ? hr / ? endforeach; ? --- I got this error as I view Posts index: --- Fatal error: Class 'AccessComponent' not found in C:\wamp\www\cakephp \app\views\helpers\access.php on line 10 --- Line 10 points to this: $this-Access = new AccessComponent();
Google adword help
Hi, Can anyone tell me how to get data(scrap it) from google adword keyword tool for a particular keyword? Thanks and Regards, Amit 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: HELP NEEDED with Auth Component in Views; Fatal error: (While using Auth component inside a helper)
Hi, My question was 'are the ACL tables (aros, acos and aros_acos) populated correctly?', please refer to http://book.cakephp.org/view/1543/Simple-Acl-controlled-Application to understand how to populate ACL tables. Amit Badkas PHP Applications for E-Biz: http://www.sanisoft.com On Wed, Dec 29, 2010 at 3:35 PM, John Maxim goog...@gmail.com wrote: Thanks Amit, Yes, the first undefined: is solved, I posted a post before yours. I ran the DB sql scripts with no error. The sql is as follow: CREATE TABLE acos ( id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT, parent_id INTEGER(10) DEFAULT NULL, model VARCHAR(255) DEFAULT '', foreign_key INTEGER(10) UNSIGNED DEFAULT NULL, alias VARCHAR(255) DEFAULT '', lft INTEGER(10) DEFAULT NULL, rght INTEGER(10) DEFAULT NULL, PRIMARY KEY (id) ); CREATE TABLE aros_acos ( id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT, aro_id INTEGER(10) UNSIGNED NOT NULL, aco_id INTEGER(10) UNSIGNED NOT NULL, _create CHAR(2) NOT NULL DEFAULT 0, _read CHAR(2) NOT NULL DEFAULT 0, _update CHAR(2) NOT NULL DEFAULT 0, _delete CHAR(2) NOT NULL DEFAULT 0, PRIMARY KEY(id) ); CREATE TABLE aros ( id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT, parent_id INTEGER(10) DEFAULT NULL, model VARCHAR(255) DEFAULT '', foreign_key INTEGER(10) UNSIGNED DEFAULT NULL, alias VARCHAR(255) DEFAULT '', lft INTEGER(10) DEFAULT NULL, rght INTEGER(10) DEFAULT NULL, PRIMARY KEY (id) ); ~~~ On Dec 29, 5:56 pm, Amit Badkas amit.sanis...@gmail.com wrote: Hi, About 'Undefined index: content' error, you should already know how to fix it. About 'DbAcl::check() - Failed ARO/ACO node lookup in permissions check' error, are the ACL tables (aros, acos and aros_acos) populated correctly? Amit Badkas PHP Applications for E-Biz:http://www.sanisoft.com On Wed, Dec 29, 2010 at 2:56 PM, John Maxim goog...@gmail.com wrote: Hi Amit, Thanks...! I just put it in the controllers components--access.php: -- ? class AccessComponent extends Object{ var $components = array('Acl', 'Auth'); var $user; function startup(){ $this-user = $this-Auth-user(); } function check($aco, $action='*'){ if(!empty($this-user) $this-Acl-check('User::'.$this- user['User']['id'], $aco, $action)){ return true; } else { return false; } } function checkHelper($aro, $aco, $action = *){ App::import('Component', 'Acl'); $acl = new AclComponent(); return $acl-check($aro, $aco, $action); } } ? -- Now the errors are: ~~ Notice (8): Undefined index: content [APP\views\posts\index.ctp, line 7] ~~ Warning (512): DbAcl::check() - Failed ARO/ACO node lookup in permissions check. Node references: Aro: User::44 Aco: Post [CORE\cake\libs\controller\components\acl.php, line 273] ~~ Regards, Maxim On Dec 29, 4:43 pm, Amit Badkas amit.sanis...@gmail.com wrote: Hi, Have you had AccessComponent class defined in app/controllers/components/access.php? Amit Badkas PHP Applications for E-Biz:http://www.sanisoft.com On Wed, Dec 29, 2010 at 1:30 PM, John Maxim goog...@gmail.com wrote: ?php class AccessHelper extends Helper{ var $helpers = array(Session); var $Access; var $Auth; var $user; function beforeRender(){ App::import('Component', 'Access'); $this-Access = new AccessComponent(); App::import('Component', 'Auth'); $this-Auth = new AuthComponent(); $this-Auth-Session = $this-Session; $this-user = $this-Auth-user(); } function check($aco, $action='*'){ if(empty($this-user)) return false; return $this-Access-checkHelper('User::'.$this-user['User'] ['id'], $aco, $action); } function isLoggedin(){ return !empty($this-user); } } ? This access.php file is saved in app/views/helpers In Posts Controller, I have added: var $helpers = array('Access'); So it can be accessed from the view. My Posts index is here: -- h2Welcome to my CakePHP Blog/h2 ? foreach($posts as $post): ? h3a href=/posts/view/? echo $post['Post']['id'] ?? echo $post['Post']['title'] ?/a/h3 p? echo $post['Post']['content'] ?/p ? if($access-isLoggedin() $access-check('Post')): ? smalla href=/posts/edit/? echo $post['Post']['id'] ?edit/a | ?
Re: HELP NEEDED with Auth Component in Views; Fatal error: (While using Auth component inside a helper)
Is Bake continued from scaffolding ? can I jump straight to learn Bake ? Must we use Bake to populate the Acl tables ? Regards, Maxim On Dec 29, 6:12 pm, Amit Badkas amit.sanis...@gmail.com wrote: Hi, My question was 'are the ACL tables (aros, acos and aros_acos) populated correctly?', please refer tohttp://book.cakephp.org/view/1543/Simple-Acl-controlled-Applicationto understand how to populate ACL tables. Amit Badkas PHP Applications for E-Biz:http://www.sanisoft.com On Wed, Dec 29, 2010 at 3:35 PM, John Maxim goog...@gmail.com wrote: Thanks Amit, Yes, the first undefined: is solved, I posted a post before yours. I ran the DB sql scripts with no error. The sql is as follow: CREATE TABLE acos ( id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT, parent_id INTEGER(10) DEFAULT NULL, model VARCHAR(255) DEFAULT '', foreign_key INTEGER(10) UNSIGNED DEFAULT NULL, alias VARCHAR(255) DEFAULT '', lft INTEGER(10) DEFAULT NULL, rght INTEGER(10) DEFAULT NULL, PRIMARY KEY (id) ); CREATE TABLE aros_acos ( id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT, aro_id INTEGER(10) UNSIGNED NOT NULL, aco_id INTEGER(10) UNSIGNED NOT NULL, _create CHAR(2) NOT NULL DEFAULT 0, _read CHAR(2) NOT NULL DEFAULT 0, _update CHAR(2) NOT NULL DEFAULT 0, _delete CHAR(2) NOT NULL DEFAULT 0, PRIMARY KEY(id) ); CREATE TABLE aros ( id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT, parent_id INTEGER(10) DEFAULT NULL, model VARCHAR(255) DEFAULT '', foreign_key INTEGER(10) UNSIGNED DEFAULT NULL, alias VARCHAR(255) DEFAULT '', lft INTEGER(10) DEFAULT NULL, rght INTEGER(10) DEFAULT NULL, PRIMARY KEY (id) ); ~~~ On Dec 29, 5:56 pm, Amit Badkas amit.sanis...@gmail.com wrote: Hi, About 'Undefined index: content' error, you should already know how to fix it. About 'DbAcl::check() - Failed ARO/ACO node lookup in permissions check' error, are the ACL tables (aros, acos and aros_acos) populated correctly? Amit Badkas PHP Applications for E-Biz:http://www.sanisoft.com On Wed, Dec 29, 2010 at 2:56 PM, John Maxim goog...@gmail.com wrote: Hi Amit, Thanks...! I just put it in the controllers components--access.php: -- ? class AccessComponent extends Object{ var $components = array('Acl', 'Auth'); var $user; function startup(){ $this-user = $this-Auth-user(); } function check($aco, $action='*'){ if(!empty($this-user) $this-Acl-check('User::'.$this- user['User']['id'], $aco, $action)){ return true; } else { return false; } } function checkHelper($aro, $aco, $action = *){ App::import('Component', 'Acl'); $acl = new AclComponent(); return $acl-check($aro, $aco, $action); } } ? -- Now the errors are: ~~ Notice (8): Undefined index: content [APP\views\posts\index.ctp, line 7] ~~ Warning (512): DbAcl::check() - Failed ARO/ACO node lookup in permissions check. Node references: Aro: User::44 Aco: Post [CORE\cake\libs\controller\components\acl.php, line 273] ~~ Regards, Maxim On Dec 29, 4:43 pm, Amit Badkas amit.sanis...@gmail.com wrote: Hi, Have you had AccessComponent class defined in app/controllers/components/access.php? Amit Badkas PHP Applications for E-Biz:http://www.sanisoft.com On Wed, Dec 29, 2010 at 1:30 PM, John Maxim goog...@gmail.com wrote: ?php class AccessHelper extends Helper{ var $helpers = array(Session); var $Access; var $Auth; var $user; function beforeRender(){ App::import('Component', 'Access'); $this-Access = new AccessComponent(); App::import('Component', 'Auth'); $this-Auth = new AuthComponent(); $this-Auth-Session = $this-Session; $this-user = $this-Auth-user(); } function check($aco, $action='*'){ if(empty($this-user)) return false; return $this-Access-checkHelper('User::'.$this-user['User'] ['id'], $aco, $action); } function isLoggedin(){ return !empty($this-user); } } ? This access.php file is saved in app/views/helpers In Posts Controller, I have added: var $helpers = array('Access'); So it can be accessed from the view. My Posts index is here: -- h2Welcome to my CakePHP Blog/h2 ? foreach($posts as
Re: Can we mix plain php,html and cakephp?
Another reason to use the form helper is the error handling if your marking the form yourself you'd lose this. Taking the time to learn to use the form helper really pays off. - S On 29 December 2010 04:08, cricket zijn.digi...@gmail.com wrote: On Tue, Dec 28, 2010 at 3:27 PM, euromark dereurom...@googlemail.com wrote: no, you can do that sometimes it is cleaner to use cake, sometimes you want the speedier html. you have to decide whats best for you. i usually use the helper for forms etc but tables and p/div blocks are easier with plain html - in my opinion in general, the helper syntax keeps your code up to date it wraps it, so in case the syntax changes, it can be switched automatically if you hard-code it, you need to do those things yourself. I'll add that the only really important thing is that the form element's name corresponds to what Cake would expect. If you're ever unsure of what to use, have FormHelper create the element for you and view source. Then use your HTML version using that name. 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 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
admin edit points featured videos, groups, etc...
Hi guys, How yo.. guys doinnn... I need help calling $point from User Table... I'm getting this error... Notice (8): Undefined index: data [CORE/app/controllers/ videos_controller.php, line 17] Apparently, I admit,.. lol... I don't know how to do this in CAKE. Can some one please help... This is what I have: in my controller: function admin_points() { $point=$_POST['data']['User']['featured_video_points']; // print_r($point); if($point!='') { $sql=UPDATE fociki_users SET featured_video_points= '. $point.' ; mysql_query($sql) or die(mysql_error()); $this-flash('notice', ucfirst(i18n::translate('Points Successfuly Updated'))); } $res=mysql_fetch_array(mysql_query(select featured_video_points from fociki_users )); $result=$res['featured_video_points']; $this-set('points', $result); } and in my ../videos/admin_points.ctp I have: form id=admin_points method=post table style=width: 645px; align=center tr thlabel for=UserFeaturedVideoPoints?php echo ucfirst(__('Enter Points in Mulitiplication', true)) ?/label/th td?php echo $form-text('User/featured_video_points', array('value' = $points ,'style' = 'width: 200px')) ?/td /tr /table p div class=buttons style=float: right; margin-right: 60px; button type=submit class=positive ?php echo $html-image('tick.png') ? ?php echo ucfirst(__('save', true)) ? /button /div /p div class=clr/div /form Can some one please teach me how to do this in CAKE and not get any error. THANKS chris 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: admin edit points featured videos, groups, etc...
Hi Chris, You need to adjust the way you update in controller function admin_points() { if($this-data) { $this-FocikiUser-id = 'id which you want to update'; $this- FocikiUser-setField('featured_video_points ',$this-data['User']['featured_video_points']); } $result=$this-FeaturedVideoPoint-find('list',array('fields'=array( featured_video_points''))); $this-set('points', $result); } Enjoy Amit 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: HELP NEEDED with Auth Component in Views; Fatal error: (While using Auth component inside a helper)
Hi John, you want to setup cake so you can use it from commandline bake is one part of cakes commandline also acl too: (output from commandline) $ cake acl Available ACL commands: - create - delete - setParent - getPath - check - grant - deny - inherit - view - initdb - help so `cake acl initdb` would setup the db structure which you previously posted you don't have to, setup cake to run from commandline, but it is an advantage if you do also checkout the ACL tutorial by Mark Story (end to end acl parts 1 2); it covers populating the tables and setting up controllers models etc - its the least confusing acl tutorial out there :) additionally acl_extras a shell plugin is truly useful (also by Mark Story) hth - S On 29 December 2010 10:42, John Maxim goog...@gmail.com wrote: Is Bake continued from scaffolding ? can I jump straight to learn Bake ? Must we use Bake to populate the Acl tables ? Regards, Maxim On Dec 29, 6:12 pm, Amit Badkas amit.sanis...@gmail.com wrote: Hi, My question was 'are the ACL tables (aros, acos and aros_acos) populated correctly?', please refer tohttp:// book.cakephp.org/view/1543/Simple-Acl-controlled-Applicationto understand how to populate ACL tables. Amit Badkas PHP Applications for E-Biz:http://www.sanisoft.com On Wed, Dec 29, 2010 at 3:35 PM, John Maxim goog...@gmail.com wrote: Thanks Amit, Yes, the first undefined: is solved, I posted a post before yours. I ran the DB sql scripts with no error. The sql is as follow: CREATE TABLE acos ( id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT, parent_id INTEGER(10) DEFAULT NULL, model VARCHAR(255) DEFAULT '', foreign_key INTEGER(10) UNSIGNED DEFAULT NULL, alias VARCHAR(255) DEFAULT '', lft INTEGER(10) DEFAULT NULL, rght INTEGER(10) DEFAULT NULL, PRIMARY KEY (id) ); CREATE TABLE aros_acos ( id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT, aro_id INTEGER(10) UNSIGNED NOT NULL, aco_id INTEGER(10) UNSIGNED NOT NULL, _create CHAR(2) NOT NULL DEFAULT 0, _read CHAR(2) NOT NULL DEFAULT 0, _update CHAR(2) NOT NULL DEFAULT 0, _delete CHAR(2) NOT NULL DEFAULT 0, PRIMARY KEY(id) ); CREATE TABLE aros ( id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT, parent_id INTEGER(10) DEFAULT NULL, model VARCHAR(255) DEFAULT '', foreign_key INTEGER(10) UNSIGNED DEFAULT NULL, alias VARCHAR(255) DEFAULT '', lft INTEGER(10) DEFAULT NULL, rght INTEGER(10) DEFAULT NULL, PRIMARY KEY (id) ); ~~~ On Dec 29, 5:56 pm, Amit Badkas amit.sanis...@gmail.com wrote: Hi, About 'Undefined index: content' error, you should already know how to fix it. About 'DbAcl::check() - Failed ARO/ACO node lookup in permissions check' error, are the ACL tables (aros, acos and aros_acos) populated correctly? Amit Badkas PHP Applications for E-Biz:http://www.sanisoft.com On Wed, Dec 29, 2010 at 2:56 PM, John Maxim goog...@gmail.com wrote: Hi Amit, Thanks...! I just put it in the controllers components--access.php: -- ? class AccessComponent extends Object{ var $components = array('Acl', 'Auth'); var $user; function startup(){ $this-user = $this-Auth-user(); } function check($aco, $action='*'){ if(!empty($this-user) $this-Acl-check('User::'.$this- user['User']['id'], $aco, $action)){ return true; } else { return false; } } function checkHelper($aro, $aco, $action = *){ App::import('Component', 'Acl'); $acl = new AclComponent(); return $acl-check($aro, $aco, $action); } } ? -- Now the errors are: ~~ Notice (8): Undefined index: content [APP\views\posts\index.ctp, line 7] ~~ Warning (512): DbAcl::check() - Failed ARO/ACO node lookup in permissions check. Node references: Aro: User::44 Aco: Post [CORE\cake\libs\controller\components\acl.php, line 273] ~~ Regards, Maxim On Dec 29, 4:43 pm, Amit Badkas amit.sanis...@gmail.com wrote: Hi, Have you had AccessComponent class defined in app/controllers/components/access.php? Amit Badkas PHP Applications for E-Biz:http://www.sanisoft.com On Wed, Dec 29, 2010 at 1:30 PM, John Maxim goog...@gmail.com wrote: ?php class AccessHelper extends Helper{ var $helpers = array(Session); var $Access; var $Auth; var $user; function beforeRender(){
Re: HELP NEEDED with Auth Component in Views; Fatal error: (While using Auth component inside a helper)
Thanks Sam, it's clearer now...but still struggling with Acl; I was confused when I hear the word populate a general term. In oracle, I populated db/tables/sql scripts in a batch file, last time. So it brought me a meaning of the same when I hear it again. Now I know it could mean using command line and here it's Bake. But I created the tables already, is there a measurement to check if the tables are correctly populated ? I may have to drop the 3 tables I created earlier..and re-do starting from tutorial Acl(cookbook tutorial) again/ the link you've sent to me. Will check on it, now. Regards, Maxim On Dec 29, 8:53 pm, Sam Sherlock sam.sherl...@gmail.com wrote: Hi John, you want to setup cake so you can use it from commandline bake is one part of cakes commandline also acl too: (output from commandline) $ cake acl Available ACL commands: - create - delete - setParent - getPath - check - grant - deny - inherit - view - initdb - help so `cake acl initdb` would setup the db structure which you previously posted you don't have to, setup cake to run from commandline, but it is an advantage if you do also checkout the ACL tutorial by Mark Story (end to end acl parts 1 2); it covers populating the tables and setting up controllers models etc - its the least confusing acl tutorial out there :) additionally acl_extras a shell plugin is truly useful (also by Mark Story) hth - S On 29 December 2010 10:42, John Maxim goog...@gmail.com wrote: Is Bake continued from scaffolding ? can I jump straight to learn Bake ? Must we use Bake to populate the Acl tables ? Regards, Maxim On Dec 29, 6:12 pm, Amit Badkas amit.sanis...@gmail.com wrote: Hi, My question was 'are the ACL tables (aros, acos and aros_acos) populated correctly?', please refer tohttp:// book.cakephp.org/view/1543/Simple-Acl-controlled-Applicationto understand how to populate ACL tables. Amit Badkas PHP Applications for E-Biz:http://www.sanisoft.com On Wed, Dec 29, 2010 at 3:35 PM, John Maxim goog...@gmail.com wrote: Thanks Amit, Yes, the first undefined: is solved, I posted a post before yours. I ran the DB sql scripts with no error. The sql is as follow: CREATE TABLE acos ( id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT, parent_id INTEGER(10) DEFAULT NULL, model VARCHAR(255) DEFAULT '', foreign_key INTEGER(10) UNSIGNED DEFAULT NULL, alias VARCHAR(255) DEFAULT '', lft INTEGER(10) DEFAULT NULL, rght INTEGER(10) DEFAULT NULL, PRIMARY KEY (id) ); CREATE TABLE aros_acos ( id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT, aro_id INTEGER(10) UNSIGNED NOT NULL, aco_id INTEGER(10) UNSIGNED NOT NULL, _create CHAR(2) NOT NULL DEFAULT 0, _read CHAR(2) NOT NULL DEFAULT 0, _update CHAR(2) NOT NULL DEFAULT 0, _delete CHAR(2) NOT NULL DEFAULT 0, PRIMARY KEY(id) ); CREATE TABLE aros ( id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT, parent_id INTEGER(10) DEFAULT NULL, model VARCHAR(255) DEFAULT '', foreign_key INTEGER(10) UNSIGNED DEFAULT NULL, alias VARCHAR(255) DEFAULT '', lft INTEGER(10) DEFAULT NULL, rght INTEGER(10) DEFAULT NULL, PRIMARY KEY (id) ); ~~~ On Dec 29, 5:56 pm, Amit Badkas amit.sanis...@gmail.com wrote: Hi, About 'Undefined index: content' error, you should already know how to fix it. About 'DbAcl::check() - Failed ARO/ACO node lookup in permissions check' error, are the ACL tables (aros, acos and aros_acos) populated correctly? Amit Badkas PHP Applications for E-Biz:http://www.sanisoft.com On Wed, Dec 29, 2010 at 2:56 PM, John Maxim goog...@gmail.com wrote: Hi Amit, Thanks...! I just put it in the controllers components--access.php: -- ? class AccessComponent extends Object{ var $components = array('Acl', 'Auth'); var $user; function startup(){ $this-user = $this-Auth-user(); } function check($aco, $action='*'){ if(!empty($this-user) $this-Acl-check('User::'.$this- user['User']['id'], $aco, $action)){ return true; } else { return false; } } function checkHelper($aro, $aco, $action = *){ App::import('Component', 'Acl'); $acl = new AclComponent(); return $acl-check($aro, $aco, $action); } } ? -- Now the errors are: ~~ Notice (8): Undefined index: content [APP\views\posts\index.ctp, line 7] ~~ Warning (512):
Re: HELP NEEDED with Auth Component in Views; Fatal error: (While using Auth component inside a helper)
you'll find that ACL is a heavy task. setting up a dummy application (own db files etc) -- deleting and reinstating things over and over will make things clearer trail and error extremely useful when learning ACL. if you back up the db in between and compare what differences after doing things bake creates models, controllers views (you can scaffold but I don't -- or have'nt found it useful to me personally) bake is not ACL - both ACL and bake have commandline access in cake your on the right track by the souds of what your doing. being prepared to redo various tutorials will really help you out; The cookbook tutorial is good - but Marks end to end really hammered it home for me see the buildAcl function in the tutorial there are an awful lot of different terms involved with ACL and variations on setup to - auth is easy to set up ACL not so much (at all); also lots of tla's (three letter acronyms :) and this can be overwhelming) stick with it - and keep pens and paper handy = coffee or whatever your choice beverage in plentiful supply also if you use IRC you'll find lots of helpful people there - S On 29 December 2010 13:09, John Maxim goog...@gmail.com wrote: Thanks Sam, it's clearer now...but still struggling with Acl; I was confused when I hear the word populate a general term. In oracle, I populated db/tables/sql scripts in a batch file, last time. So it brought me a meaning of the same when I hear it again. Now I know it could mean using command line and here it's Bake. But I created the tables already, is there a measurement to check if the tables are correctly populated ? I may have to drop the 3 tables I created earlier..and re-do starting from tutorial Acl(cookbook tutorial) again/ the link you've sent to me. Will check on it, now. Regards, Maxim On Dec 29, 8:53 pm, Sam Sherlock sam.sherl...@gmail.com wrote: Hi John, you want to setup cake so you can use it from commandline bake is one part of cakes commandline also acl too: (output from commandline) $ cake acl Available ACL commands: - create - delete - setParent - getPath - check - grant - deny - inherit - view - initdb - help so `cake acl initdb` would setup the db structure which you previously posted you don't have to, setup cake to run from commandline, but it is an advantage if you do also checkout the ACL tutorial by Mark Story (end to end acl parts 1 2); it covers populating the tables and setting up controllers models etc - its the least confusing acl tutorial out there :) additionally acl_extras a shell plugin is truly useful (also by Mark Story) hth - S On 29 December 2010 10:42, John Maxim goog...@gmail.com wrote: Is Bake continued from scaffolding ? can I jump straight to learn Bake ? Must we use Bake to populate the Acl tables ? Regards, Maxim On Dec 29, 6:12 pm, Amit Badkas amit.sanis...@gmail.com wrote: Hi, My question was 'are the ACL tables (aros, acos and aros_acos) populated correctly?', please refer tohttp:// book.cakephp.org/view/1543/Simple-Acl-controlled-Applicationto understand how to populate ACL tables. Amit Badkas PHP Applications for E-Biz:http://www.sanisoft.com On Wed, Dec 29, 2010 at 3:35 PM, John Maxim goog...@gmail.com wrote: Thanks Amit, Yes, the first undefined: is solved, I posted a post before yours. I ran the DB sql scripts with no error. The sql is as follow: CREATE TABLE acos ( id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT, parent_id INTEGER(10) DEFAULT NULL, model VARCHAR(255) DEFAULT '', foreign_key INTEGER(10) UNSIGNED DEFAULT NULL, alias VARCHAR(255) DEFAULT '', lft INTEGER(10) DEFAULT NULL, rght INTEGER(10) DEFAULT NULL, PRIMARY KEY (id) ); CREATE TABLE aros_acos ( id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT, aro_id INTEGER(10) UNSIGNED NOT NULL, aco_id INTEGER(10) UNSIGNED NOT NULL, _create CHAR(2) NOT NULL DEFAULT 0, _read CHAR(2) NOT NULL DEFAULT 0, _update CHAR(2) NOT NULL DEFAULT 0, _delete CHAR(2) NOT NULL DEFAULT 0, PRIMARY KEY(id) ); CREATE TABLE aros ( id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT, parent_id INTEGER(10) DEFAULT NULL, model VARCHAR(255) DEFAULT '', foreign_key INTEGER(10) UNSIGNED DEFAULT NULL, alias VARCHAR(255) DEFAULT '', lft INTEGER(10) DEFAULT NULL, rght INTEGER(10) DEFAULT NULL, PRIMARY KEY (id) ); ~~~ On Dec 29, 5:56 pm, Amit Badkas amit.sanis...@gmail.com wrote: Hi, About 'Undefined index: content' error, you should already know how to fix it. About 'DbAcl::check() - Failed ARO/ACO node lookup in permissions check'
Scaffolding vs Bake
Hi, I used scaffolding.. it was quite easy and fast. But I learned that Bake is a better way... Any comment why there is scaffold in the first place since it would be replaced with Bake later on when developing a programme? Regards, Maxim 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: HELP NEEDED with Auth Component in Views; Fatal error: (While using Auth component inside a helper)
Hi Sam, I tried quite a number of times logging in IRC on cake but there were always connection failure or something..given up and use googlegroup as of now.. I can't carry on with the link you recommended; it asks me to be familiar with console, I'm not, I don't know what/how exactly to begin with the console, going through the cookbook simultaneously.. I'm aging. see the buildAcl function in the tutorial do you mean from cookbook?, yes, I'm viewing it now.. What's the secret to log in to IRC cake ? something I'm missing .. Thanks for the explanation I thought Acl and Bake is one thing. Regards, Maxim On Dec 29, 9:36 pm, Sam Sherlock sam.sherl...@gmail.com wrote: you'll find that ACL is a heavy task. setting up a dummy application (own db files etc) -- deleting and reinstating things over and over will make things clearer trail and error extremely useful when learning ACL. if you back up the db in between and compare what differences after doing things bake creates models, controllers views (you can scaffold but I don't -- or have'nt found it useful to me personally) bake is not ACL - both ACL and bake have commandline access in cake your on the right track by the souds of what your doing. being prepared to redo various tutorials will really help you out; The cookbook tutorial is good - but Marks end to end really hammered it home for me see the buildAcl function in the tutorial there are an awful lot of different terms involved with ACL and variations on setup to - auth is easy to set up ACL not so much (at all); also lots of tla's (three letter acronyms :) and this can be overwhelming) stick with it - and keep pens and paper handy = coffee or whatever your choice beverage in plentiful supply also if you use IRC you'll find lots of helpful people there - S On 29 December 2010 13:09, John Maxim goog...@gmail.com wrote: Thanks Sam, it's clearer now...but still struggling with Acl; I was confused when I hear the word populate a general term. In oracle, I populated db/tables/sql scripts in a batch file, last time. So it brought me a meaning of the same when I hear it again. Now I know it could mean using command line and here it's Bake. But I created the tables already, is there a measurement to check if the tables are correctly populated ? I may have to drop the 3 tables I created earlier..and re-do starting from tutorial Acl(cookbook tutorial) again/ the link you've sent to me. Will check on it, now. Regards, Maxim On Dec 29, 8:53 pm, Sam Sherlock sam.sherl...@gmail.com wrote: Hi John, you want to setup cake so you can use it from commandline bake is one part of cakes commandline also acl too: (output from commandline) $ cake acl Available ACL commands: - create - delete - setParent - getPath - check - grant - deny - inherit - view - initdb - help so `cake acl initdb` would setup the db structure which you previously posted you don't have to, setup cake to run from commandline, but it is an advantage if you do also checkout the ACL tutorial by Mark Story (end to end acl parts 1 2); it covers populating the tables and setting up controllers models etc - its the least confusing acl tutorial out there :) additionally acl_extras a shell plugin is truly useful (also by Mark Story) hth - S On 29 December 2010 10:42, John Maxim goog...@gmail.com wrote: Is Bake continued from scaffolding ? can I jump straight to learn Bake ? Must we use Bake to populate the Acl tables ? Regards, Maxim On Dec 29, 6:12 pm, Amit Badkas amit.sanis...@gmail.com wrote: Hi, My question was 'are the ACL tables (aros, acos and aros_acos) populated correctly?', please refer tohttp:// book.cakephp.org/view/1543/Simple-Acl-controlled-Applicationto understand how to populate ACL tables. Amit Badkas PHP Applications for E-Biz:http://www.sanisoft.com On Wed, Dec 29, 2010 at 3:35 PM, John Maxim goog...@gmail.com wrote: Thanks Amit, Yes, the first undefined: is solved, I posted a post before yours. I ran the DB sql scripts with no error. The sql is as follow: CREATE TABLE acos ( id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT, parent_id INTEGER(10) DEFAULT NULL, model VARCHAR(255) DEFAULT '', foreign_key INTEGER(10) UNSIGNED DEFAULT NULL, alias VARCHAR(255) DEFAULT '', lft INTEGER(10) DEFAULT NULL, rght INTEGER(10) DEFAULT NULL, PRIMARY KEY (id) ); CREATE TABLE aros_acos ( id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT, aro_id INTEGER(10) UNSIGNED NOT NULL, aco_id INTEGER(10) UNSIGNED NOT NULL, _create CHAR(2) NOT NULL DEFAULT 0, _read CHAR(2) NOT NULL
Re: HELP NEEDED with Auth Component in Views; Fatal error: (While using Auth component inside a helper)
setting cake for commandline is easy - don't be put off it take minutes windows or *nix (these require quicktime - I think) http://cakephp.org/screencasts or (windows setup on youtube) http://www.youtube.com/watch?v=21Rt9HgITigfeature=related you won't regret setting this up - it opens so many new options :) - S On 29 December 2010 13:46, John Maxim goog...@gmail.com wrote: Hi Sam, I tried quite a number of times logging in IRC on cake but there were always connection failure or something..given up and use googlegroup as of now.. I can't carry on with the link you recommended; it asks me to be familiar with console, I'm not, I don't know what/how exactly to begin with the console, going through the cookbook simultaneously.. I'm aging. see the buildAcl function in the tutorial do you mean from cookbook?, yes, I'm viewing it now.. What's the secret to log in to IRC cake ? something I'm missing .. Thanks for the explanation I thought Acl and Bake is one thing. Regards, Maxim On Dec 29, 9:36 pm, Sam Sherlock sam.sherl...@gmail.com wrote: you'll find that ACL is a heavy task. setting up a dummy application (own db files etc) -- deleting and reinstating things over and over will make things clearer trail and error extremely useful when learning ACL. if you back up the db in between and compare what differences after doing things bake creates models, controllers views (you can scaffold but I don't -- or have'nt found it useful to me personally) bake is not ACL - both ACL and bake have commandline access in cake your on the right track by the souds of what your doing. being prepared to redo various tutorials will really help you out; The cookbook tutorial is good - but Marks end to end really hammered it home for me see the buildAcl function in the tutorial there are an awful lot of different terms involved with ACL and variations on setup to - auth is easy to set up ACL not so much (at all); also lots of tla's (three letter acronyms :) and this can be overwhelming) stick with it - and keep pens and paper handy = coffee or whatever your choice beverage in plentiful supply also if you use IRC you'll find lots of helpful people there - S On 29 December 2010 13:09, John Maxim goog...@gmail.com wrote: Thanks Sam, it's clearer now...but still struggling with Acl; I was confused when I hear the word populate a general term. In oracle, I populated db/tables/sql scripts in a batch file, last time. So it brought me a meaning of the same when I hear it again. Now I know it could mean using command line and here it's Bake. But I created the tables already, is there a measurement to check if the tables are correctly populated ? I may have to drop the 3 tables I created earlier..and re-do starting from tutorial Acl(cookbook tutorial) again/ the link you've sent to me. Will check on it, now. Regards, Maxim On Dec 29, 8:53 pm, Sam Sherlock sam.sherl...@gmail.com wrote: Hi John, you want to setup cake so you can use it from commandline bake is one part of cakes commandline also acl too: (output from commandline) $ cake acl Available ACL commands: - create - delete - setParent - getPath - check - grant - deny - inherit - view - initdb - help so `cake acl initdb` would setup the db structure which you previously posted you don't have to, setup cake to run from commandline, but it is an advantage if you do also checkout the ACL tutorial by Mark Story (end to end acl parts 1 2); it covers populating the tables and setting up controllers models etc - its the least confusing acl tutorial out there :) additionally acl_extras a shell plugin is truly useful (also by Mark Story) hth - S On 29 December 2010 10:42, John Maxim goog...@gmail.com wrote: Is Bake continued from scaffolding ? can I jump straight to learn Bake ? Must we use Bake to populate the Acl tables ? Regards, Maxim On Dec 29, 6:12 pm, Amit Badkas amit.sanis...@gmail.com wrote: Hi, My question was 'are the ACL tables (aros, acos and aros_acos) populated correctly?', please refer tohttp:// book.cakephp.org/view/1543/Simple-Acl-controlled-Applicationto understand how to populate ACL tables. Amit Badkas PHP Applications for E-Biz:http://www.sanisoft.com On Wed, Dec 29, 2010 at 3:35 PM, John Maxim goog...@gmail.com wrote: Thanks Amit, Yes, the first undefined: is solved, I posted a post before yours. I ran the DB sql scripts with no error. The sql is as follow: CREATE TABLE acos ( id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT,
Re: Can we mix plain php,html and cakephp?
E point is: Cakephp IS PHP. Of course you can use cake + php. There is no meaning your question. Did you even tried to do what you are asking? You have the full power of your application in your hands. If you want to write some specific code (html or php), just do it! Got it? On Wednesday, December 29, 2010, Sam Sherlock sam.sherl...@gmail.com wrote: Another reason to use the form helper is the error handling if your marking the form yourself you'd lose this. Taking the time to learn to use the form helper really pays off. - S On 29 December 2010 04:08, cricket zijn.digi...@gmail.com wrote: On Tue, Dec 28, 2010 at 3:27 PM, euromark dereurom...@googlemail.com wrote: no, you can do that sometimes it is cleaner to use cake, sometimes you want the speedier html. you have to decide whats best for you. i usually use the helper for forms etc but tables and p/div blocks are easier with plain html - in my opinion in general, the helper syntax keeps your code up to date it wraps it, so in case the syntax changes, it can be switched automatically if you hard-code it, you need to do those things yourself. I'll add that the only really important thing is that the form element's name corresponds to what Cake would expect. If you're ever unsure of what to use, have FormHelper create the element for you and view source. Then use your HTML version using that name. 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 -- -- Renato de Freitas Freire ren...@morfer.org 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: Scaffolding vs Bake
Scaffold was implemented before bake was added to the core so it has stayed. There are cases when you might add a new table to your database, it is easier to create the controller/model combination while you are creating all of the fields in your new table and see how it is working instead of going to the command line every change you make. Hope that helps, -- Larry E. Masters On Wed, Dec 29, 2010 at 7:36 AM, John Maxim goog...@gmail.com wrote: Hi, I used scaffolding.. it was quite easy and fast. But I learned that Bake is a better way... Any comment why there is scaffold in the first place since it would be replaced with Bake later on when developing a programme? Regards, Maxim 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 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: Scaffolding vs Bake
Hi John, The main difference between scaffold and bake is bake will generate the PHP code (model, controller,view) and you can customize it how you want. When I'm developing I start using bake to generate all CRUD and after I start to change the generated code. If the scaffolding is OK for you (work for all your requirements) I guess you can continue using it. I've read in some place that scaffolding is not recommended to use in production application (I don't remember the reason is unstable or insecure...) but I don't know in the latest cake version. -- Best Regards, Felipe Roman Phone 55 51 8454 8110 LinkedIn http://au.linkedin.com/in/feliperoman 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: Can we mix plain php,html and cakephp?
yes sir. i got it... The bottm line is.. The naming CONVENTIONS must be kept in mind... I got errors about undefined variables in my view. And when i Corrected some variable names in the controller, it worked fine!!! On Wed, Dec 29, 2010 at 7:58 PM, Renato de Freitas Freire renat...@gmail.com wrote: E point is: Cakephp IS PHP. Of course you can use cake + php. There is no meaning your question. Did you even tried to do what you are asking? You have the full power of your application in your hands. If you want to write some specific code (html or php), just do it! Got it? On Wednesday, December 29, 2010, Sam Sherlock sam.sherl...@gmail.com wrote: Another reason to use the form helper is the error handling if your marking the form yourself you'd lose this. Taking the time to learn to use the form helper really pays off. - S On 29 December 2010 04:08, cricket zijn.digi...@gmail.com wrote: On Tue, Dec 28, 2010 at 3:27 PM, euromark dereurom...@googlemail.com wrote: no, you can do that sometimes it is cleaner to use cake, sometimes you want the speedier html. you have to decide whats best for you. i usually use the helper for forms etc but tables and p/div blocks are easier with plain html - in my opinion in general, the helper syntax keeps your code up to date it wraps it, so in case the syntax changes, it can be switched automatically if you hard-code it, you need to do those things yourself. I'll add that the only really important thing is that the form element's name corresponds to what Cake would expect. If you're ever unsure of what to use, have FormHelper create the element for you and view source. Then use your HTML version using that name. 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 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 -- -- Renato de Freitas Freire ren...@morfer.org 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 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: HELP NEEDED with Auth Component in Views; Fatal error: (While using Auth component inside a helper)
Thanks Sam, that youtube tutorial helped. I'm continuing with the link you sent earlier, right after finishing the cookbook soon..hopefully. Regards, Maxim On Dec 29, 10:07 pm, Sam Sherlock sam.sherl...@gmail.com wrote: setting cake for commandline is easy - don't be put off it take minutes windows or *nix (these require quicktime - I think)http://cakephp.org/screencasts or (windows setup on youtube)http://www.youtube.com/watch?v=21Rt9HgITigfeature=related you won't regret setting this up - it opens so many new options :) - S On 29 December 2010 13:46, John Maxim goog...@gmail.com wrote: Hi Sam, I tried quite a number of times logging in IRC on cake but there were always connection failure or something..given up and use googlegroup as of now.. I can't carry on with the link you recommended; it asks me to be familiar with console, I'm not, I don't know what/how exactly to begin with the console, going through the cookbook simultaneously.. I'm aging. see the buildAcl function in the tutorial do you mean from cookbook?, yes, I'm viewing it now.. What's the secret to log in to IRC cake ? something I'm missing .. Thanks for the explanation I thought Acl and Bake is one thing. Regards, Maxim On Dec 29, 9:36 pm, Sam Sherlock sam.sherl...@gmail.com wrote: you'll find that ACL is a heavy task. setting up a dummy application (own db files etc) -- deleting and reinstating things over and over will make things clearer trail and error extremely useful when learning ACL. if you back up the db in between and compare what differences after doing things bake creates models, controllers views (you can scaffold but I don't -- or have'nt found it useful to me personally) bake is not ACL - both ACL and bake have commandline access in cake your on the right track by the souds of what your doing. being prepared to redo various tutorials will really help you out; The cookbook tutorial is good - but Marks end to end really hammered it home for me see the buildAcl function in the tutorial there are an awful lot of different terms involved with ACL and variations on setup to - auth is easy to set up ACL not so much (at all); also lots of tla's (three letter acronyms :) and this can be overwhelming) stick with it - and keep pens and paper handy = coffee or whatever your choice beverage in plentiful supply also if you use IRC you'll find lots of helpful people there - S On 29 December 2010 13:09, John Maxim goog...@gmail.com wrote: Thanks Sam, it's clearer now...but still struggling with Acl; I was confused when I hear the word populate a general term. In oracle, I populated db/tables/sql scripts in a batch file, last time. So it brought me a meaning of the same when I hear it again. Now I know it could mean using command line and here it's Bake. But I created the tables already, is there a measurement to check if the tables are correctly populated ? I may have to drop the 3 tables I created earlier..and re-do starting from tutorial Acl(cookbook tutorial) again/ the link you've sent to me. Will check on it, now. Regards, Maxim On Dec 29, 8:53 pm, Sam Sherlock sam.sherl...@gmail.com wrote: Hi John, you want to setup cake so you can use it from commandline bake is one part of cakes commandline also acl too: (output from commandline) $ cake acl Available ACL commands: - create - delete - setParent - getPath - check - grant - deny - inherit - view - initdb - help so `cake acl initdb` would setup the db structure which you previously posted you don't have to, setup cake to run from commandline, but it is an advantage if you do also checkout the ACL tutorial by Mark Story (end to end acl parts 1 2); it covers populating the tables and setting up controllers models etc - its the least confusing acl tutorial out there :) additionally acl_extras a shell plugin is truly useful (also by Mark Story) hth - S On 29 December 2010 10:42, John Maxim goog...@gmail.com wrote: Is Bake continued from scaffolding ? can I jump straight to learn Bake ? Must we use Bake to populate the Acl tables ? Regards, Maxim On Dec 29, 6:12 pm, Amit Badkas amit.sanis...@gmail.com wrote: Hi, My question was 'are the ACL tables (aros, acos and aros_acos) populated correctly?', please refer tohttp:// book.cakephp.org/view/1543/Simple-Acl-controlled-Applicationto understand how to populate ACL tables. Amit Badkas PHP Applications for E-Biz:http://www.sanisoft.com On Wed, Dec 29, 2010 at 3:35 PM, John Maxim
Setflash change background color
Hello, I want to change the appearance of the default message (edit success). I have put the following code in the standard layout: style type=text/css .message { position:absolute; top:0px; left:100px; width:300px; font-size:14px; background-color:green; } /style It works but the background color is still red. What can I do to make the color green. I tried also different colors (#fff9d9 ) nothing works. Regards, Leo 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
is it possible to include the failed input string in the validation message?
Hi, I'm trying to make my validation messages a little more meaningful. I would like to include the failed input in the validation message itself. So rather than a message like That username is already taken I would like to show The username user is already taken Is this possible? 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: Scaffolding vs Bake
I would not use scaffolding in production, it was never intended for that purpose. It has nothing to do with security or being unstable. The only purpose for scaffolding is to prototype and develop your models/database. Bake is used to get you closer to a production code base. You can customize your bake templates and even use them if you like. -- Larry E. Masters On Wed, Dec 29, 2010 at 8:20 AM, Felipe Roman roman.fel...@gmail.comwrote: Hi John, The main difference between scaffold and bake is bake will generate the PHP code (model, controller,view) and you can customize it how you want. When I'm developing I start using bake to generate all CRUD and after I start to change the generated code. If the scaffolding is OK for you (work for all your requirements) I guess you can continue using it. I've read in some place that scaffolding is not recommended to use in production application (I don't remember the reason is unstable or insecure...) but I don't know in the latest cake version. -- Best Regards, Felipe Roman Phone 55 51 8454 8110 LinkedIn http://au.linkedin.com/in/feliperoman 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 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
Problems Creating Shells (Tutorial)
http://book.cakephp.org/view/1107/Creating-Shells-Tasks Hi, While going through the tutorial above, as I run cake report Error: Missing database table 'orders' for model 'Order' - Do we need to create one ? I created one but just to find out more errors after running the second time cake report PHP Warning:SQL Error: 1054: Unknown column 'Order.shipped' in 'where clause'/span in C:\wamp\www\cakephp\cake\libs\model\datasources \dbo_source.php on line 684 Warning: bSQL Error:/b 1054: Unknown column 'Order.shipped' in 'where clause'/span in C:\wamp\www\cakephp\cake\libs\model \datasources\dbo_source.php on line 684 prep style=text-align:leftbQuery:/b SELECT `Order`.`order_date`, `Order`.`amount` FROM `orders` AS `Order` WHERE `Order`.`shipped` = '2010-11-29 16:13:53'/p/prePHP Warning: Invalid argument supplied for foreach() in C:\wamp\www \cakephp\app\vendors\shells\report.php on line 10 Warning: Invalid argument supplied for foreach() in C:\wamp\www\cakephp \app\vendors\shells\report.php on line 10 PHP Notice: Undefined variable: total in C:\wamp\www\cakephp\app \vendors\shells\report.php on line 19 Notice: Undefined variable: total in C:\wamp\www\cakephp\app\vendors \shells\report.php on line 19 Total: $0.00 - Is my console set up correctly ? something I left out ? Thanks, Maxim 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: Scaffolding vs Bake
Hi everyone, Thanks I'm learning Bake at the moment. I thought scaffolding can be used for production. Anyway thanks for clarifying. Regards, Maxim On Dec 30, 12:12 am, Larry E. Masters php...@gmail.com wrote: I would not use scaffolding in production, it was never intended for that purpose. It has nothing to do with security or being unstable. The only purpose for scaffolding is to prototype and develop your models/database. Bake is used to get you closer to a production code base. You can customize your bake templates and even use them if you like. -- Larry E. Masters On Wed, Dec 29, 2010 at 8:20 AM, Felipe Roman roman.fel...@gmail.comwrote: Hi John, The main difference between scaffold and bake is bake will generate the PHP code (model, controller,view) and you can customize it how you want. When I'm developing I start using bake to generate all CRUD and after I start to change the generated code. If the scaffolding is OK for you (work for all your requirements) I guess you can continue using it. I've read in some place that scaffolding is not recommended to use in production application (I don't remember the reason is unstable or insecure...) but I don't know in the latest cake version. -- Best Regards, Felipe Roman Phone 55 51 8454 8110 LinkedInhttp://au.linkedin.com/in/feliperoman 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.comcake-php%2bunsubscr...@googlegroups.comFor 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: Problems Creating Shells (Tutorial)
I'm suspecting something's wrong with my paths: ~~~ ♀ Welcome to CakePHP v1.3.6 Console --- Current Paths: -app: app -working: C:\wamp\www\cakephp\app -root: C:\wamp\www\cakephp -core: C:\wamp\www\cakephp Changing Paths: your working path should be the same as your application path to change your path use the '-app' param. Example: -app relative/path/to/myapp or -app /absolute/path/to/myapp Available Shells: acl [CORE] i18n [CORE] api [CORE] report [app] bake [CORE] schema [CORE] console [CORE] testsuite [CORE] To run a command, type 'cake shell_name [args]' To get help on a specific command, type 'cake shell_name help' C:\wamp\www\cakephp ~~ The cakephp is my root. I read we got to make the application and working path be the same, I don't understand from the turorial in cookbook, can someone point the correction so I may fix it? Thanks, Maxim On Dec 30, 12:23 am, John Maxim goog...@gmail.com wrote: http://book.cakephp.org/view/1107/Creating-Shells-Tasks Hi, While going through the tutorial above, as I run cake report Error: Missing database table 'orders' for model 'Order' - Do we need to create one ? I created one but just to find out more errors after running the second time cake report PHP Warning:SQL Error: 1054: Unknown column 'Order.shipped' in 'where clause'/span in C:\wamp\www\cakephp\cake\libs\model\datasources \dbo_source.php on line 684 Warning: bSQL Error:/b 1054: Unknown column 'Order.shipped' in 'where clause'/span in C:\wamp\www\cakephp\cake\libs\model \datasources\dbo_source.php on line 684 prep style=text-align:leftbQuery:/b SELECT `Order`.`order_date`, `Order`.`amount` FROM `orders` AS `Order` WHERE `Order`.`shipped` = '2010-11-29 16:13:53' /p/prePHP Warning: Invalid argument supplied for foreach() in C:\wamp\www \cakephp\app\vendors\shells\report.php on line 10 Warning: Invalid argument supplied for foreach() in C:\wamp\www\cakephp \app\vendors\shells\report.php on line 10 PHP Notice: Undefined variable: total in C:\wamp\www\cakephp\app \vendors\shells\report.php on line 19 Notice: Undefined variable: total in C:\wamp\www\cakephp\app\vendors \shells\report.php on line 19 Total: $0.00 - Is my console set up correctly ? something I left out ? Thanks, Maxim 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: Setflash change background color
You are not telling it to look in the right place. You are giving a location of .message but in fact it is located at div.message, the div in this case being div id=content. Remove this div and then .message would make sense. It also matters if you put your styles before or after you include the external css. If you put it after you load cake.generic.css then it should work. But if you put it before cake.generic.css it will not work. And it would be best just to change it inside the .css On Dec 29, 10:30 am, lvdb lj.vandenb...@kpnplanet.nl wrote: Hello, I want to change the appearance of the default message (edit success). I have put the following code in the standard layout: style type=text/css .message { position:absolute; top:0px; left:100px; width:300px; font-size:14px; background-color:green; } /style It works but the background color is still red. What can I do to make the color green. I tried also different colors (#fff9d9 ) nothing works. Regards, Leo 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: Scaffolding vs Bake
I find scaffold is useful when mucking about with the data model... once i'm happy with that i go back and bake out the basic CRUD and go from there. On Thu, Dec 30, 2010 at 2:26 AM, John Maxim goog...@gmail.com wrote: Hi everyone, Thanks I'm learning Bake at the moment. I thought scaffolding can be used for production. Anyway thanks for clarifying. Regards, Maxim On Dec 30, 12:12 am, Larry E. Masters php...@gmail.com wrote: I would not use scaffolding in production, it was never intended for that purpose. It has nothing to do with security or being unstable. The only purpose for scaffolding is to prototype and develop your models/database. Bake is used to get you closer to a production code base. You can customize your bake templates and even use them if you like. -- Larry E. Masters On Wed, Dec 29, 2010 at 8:20 AM, Felipe Roman roman.fel...@gmail.com wrote: Hi John, The main difference between scaffold and bake is bake will generate the PHP code (model, controller,view) and you can customize it how you want. When I'm developing I start using bake to generate all CRUD and after I start to change the generated code. If the scaffolding is OK for you (work for all your requirements) I guess you can continue using it. I've read in some place that scaffolding is not recommended to use in production application (I don't remember the reason is unstable or insecure...) but I don't know in the latest cake version. -- Best Regards, Felipe Roman Phone 55 51 8454 8110 LinkedInhttp://au.linkedin.com/in/feliperoman 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.comcake-php%2bunsubscr...@googlegroups.com cake-php%2bunsubscr...@googlegroups.comcake-php%252bunsubscr...@googlegroups.comFor 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.comcake-php%2bunsubscr...@googlegroups.comFor 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: is it possible to include the failed input string in the validation message?
You can override the error message using FormHelper :http:// book.cakephp.org/view/1401/options-error If your form looked something like this you would get the result you are looking for: echo $this-Form-input('username', array('error' = $this- data['User']['username'] . ' is taken')); On Dec 29, 11:07 am, Greg Skerman gsker...@gmail.com wrote: Hi, I'm trying to make my validation messages a little more meaningful. I would like to include the failed input in the validation message itself. So rather than a message like That username is already taken I would like to show The username user is already taken Is this possible? 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: Problems Creating Shells (Tutorial)
Is your app called 'app' ? Also if you do only the first step of the tutorial, this part, ?php class ReportShell extends Shell {function main() {}}? and then do: cake report, what happens then? On Dec 29, 11:33 am, John Maxim goog...@gmail.com wrote: I'm suspecting something's wrong with my paths: ~~~ ♀ Welcome to CakePHP v1.3.6 Console --- Current Paths: -app: app -working: C:\wamp\www\cakephp\app -root: C:\wamp\www\cakephp -core: C:\wamp\www\cakephp Changing Paths: your working path should be the same as your application path to change your path use the '-app' param. Example: -app relative/path/to/myapp or -app /absolute/path/to/myapp Available Shells: acl [CORE] i18n [CORE] api [CORE] report [app] bake [CORE] schema [CORE] console [CORE] testsuite [CORE] To run a command, type 'cake shell_name [args]' To get help on a specific command, type 'cake shell_name help' C:\wamp\www\cakephp ~~ The cakephp is my root. I read we got to make the application and working path be the same, I don't understand from the turorial in cookbook, can someone point the correction so I may fix it? Thanks, Maxim On Dec 30, 12:23 am, John Maxim goog...@gmail.com wrote: http://book.cakephp.org/view/1107/Creating-Shells-Tasks Hi, While going through the tutorial above, as I run cake report Error: Missing database table 'orders' for model 'Order' - Do we need to create one ? I created one but just to find out more errors after running the second time cake report PHP Warning:SQL Error: 1054: Unknown column 'Order.shipped' in 'where clause'/span in C:\wamp\www\cakephp\cake\libs\model\datasources \dbo_source.php on line 684 Warning: bSQL Error:/b 1054: Unknown column 'Order.shipped' in 'where clause'/span in C:\wamp\www\cakephp\cake\libs\model \datasources\dbo_source.php on line 684 prep style=text-align:leftbQuery:/b SELECT `Order`.`order_date`, `Order`.`amount` FROM `orders` AS `Order` WHERE `Order`.`shipped` = '2010-11-29 16:13:53' /p/prePHP Warning: Invalid argument supplied for foreach() in C:\wamp\www \cakephp\app\vendors\shells\report.php on line 10 Warning: Invalid argument supplied for foreach() in C:\wamp\www\cakephp \app\vendors\shells\report.php on line 10 PHP Notice: Undefined variable: total in C:\wamp\www\cakephp\app \vendors\shells\report.php on line 19 Notice: Undefined variable: total in C:\wamp\www\cakephp\app\vendors \shells\report.php on line 19 Total: $0.00 - Is my console set up correctly ? something I left out ? Thanks, Maxim 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: Problems Creating Shells (Tutorial)
Do you have a model called Order and a database table called orders? And if you do, does your table have the fields the error message says are missing. The tutorial doesn't say (but maybe it should this stuff needs to exist). On Dec 29, 12:36 pm, john lyles confidentia...@gmail.com wrote: Is your app called 'app' ? Also if you do only the first step of the tutorial, this part, ?php class ReportShell extends Shell { function main() {}}? and then do: cake report, what happens then? On Dec 29, 11:33 am, John Maxim goog...@gmail.com wrote: I'm suspecting something's wrong with my paths: ~~~ ♀ Welcome to CakePHP v1.3.6 Console --- Current Paths: -app: app -working: C:\wamp\www\cakephp\app -root: C:\wamp\www\cakephp -core: C:\wamp\www\cakephp Changing Paths: your working path should be the same as your application path to change your path use the '-app' param. Example: -app relative/path/to/myapp or -app /absolute/path/to/myapp Available Shells: acl [CORE] i18n [CORE] api [CORE] report [app] bake [CORE] schema [CORE] console [CORE] testsuite [CORE] To run a command, type 'cake shell_name [args]' To get help on a specific command, type 'cake shell_name help' C:\wamp\www\cakephp ~~ The cakephp is my root. I read we got to make the application and working path be the same, I don't understand from the turorial in cookbook, can someone point the correction so I may fix it? Thanks, Maxim On Dec 30, 12:23 am, John Maxim goog...@gmail.com wrote: http://book.cakephp.org/view/1107/Creating-Shells-Tasks Hi, While going through the tutorial above, as I run cake report Error: Missing database table 'orders' for model 'Order' - Do we need to create one ? I created one but just to find out more errors after running the second time cake report PHP Warning:SQL Error: 1054: Unknown column 'Order.shipped' in 'where clause'/span in C:\wamp\www\cakephp\cake\libs\model\datasources \dbo_source.php on line 684 Warning: bSQL Error:/b 1054: Unknown column 'Order.shipped' in 'where clause'/span in C:\wamp\www\cakephp\cake\libs\model \datasources\dbo_source.php on line 684 prep style=text-align:leftbQuery:/b SELECT `Order`.`order_date`, `Order`.`amount` FROM `orders` AS `Order` WHERE `Order`.`shipped` = '2010-11-29 16:13:53' /p/prePHP Warning: Invalid argument supplied for foreach() in C:\wamp\www \cakephp\app\vendors\shells\report.php on line 10 Warning: Invalid argument supplied for foreach() in C:\wamp\www\cakephp \app\vendors\shells\report.php on line 10 PHP Notice: Undefined variable: total in C:\wamp\www\cakephp\app \vendors\shells\report.php on line 19 Notice: Undefined variable: total in C:\wamp\www\cakephp\app\vendors \shells\report.php on line 19 Total: $0.00 - Is my console set up correctly ? something I left out ? Thanks, Maxim 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: Problems Creating Shells (Tutorial)
This table works for the tutorial: CREATE TABLE orders( id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, amount DEC(5,2), created DATETIME, shipped DATETIME ); Then bake the model, controller and views. Go to /orders/add and add some orders to the database. Assuming the cake command is in your PATH, cake report should now work. Well with one exception (maybe). I was getting this error: Notice undefined variable: total in C:\...\vendors\shells\report.php on line 17 This line is the problem: $total += $order['Order']['amount']; PHP won't accept this line if $total is not set So my simple solution is: if(!isset($total)){ $total = $order['Order']['amount']; } else { $total += $order['Order']['amount']; } 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: Scaffolding vs Bake
Why is scaffolding an option when baking since baking when CRUD actions and views is so easy? This I never understood 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: Scaffolding vs Bake
Why is scaffolding an option when baking since baking CRUD actions and views is so easy? This I never understood 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: Owner Check
On Wed, Dec 29, 2010 at 12:23 AM, Dave Maharaj m...@davemaharaj.com wrote: Because in the first example the $id will read from the db no matter what as long as $id is passed and $id is in the db so your going to the db no matter what and reading the data. In my way with $data = $this-Model-someFunction( $id, $this-Auth-User('id)); your only reading / finding / retrieving data if the conditions exist. In my head I think why pull the data if its not the owner with read? So pull the data using a find and if anything is found then continue on with the request. So how does this someFunction method magically tell you that the User in question is the correct one? You have to pull the data from the DB in any case. I don't think it's a big deal to pull it based on Record.id and then check user_id. But, if you'd rather have both conditions in the find() then there's no harm in that either. Which is the *correct* way? I dunno. 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: Help with function Login()--using Auth (Redirecting issue)
On Tue, Dec 28, 2010 at 11:58 PM, John Maxim goog...@gmail.com wrote: Users_controllers.php: var $name = 'Users'; /*some codes in between*/ function login() { if(!empty($this-data)) { // If the username/password match if($this-Auth-login($this-data)) { $this-redirect(array('action' = 'index'), null, true); } else { $this-User-invalidate('username', 'Username and password combination is incorrect!'); } } } The code in your login method does basically what Auth would do if left to its own devices. You could get the same functionality as above by setting the following in AppController's beforeFilter method: // this tells Auth to handle redirects $this-Auth-autoRedirect = true; // this tells Auth where to send the user $this-Auth-loginRedirect = array( 'controller' = 'posts', 'action' = 'index' ); $this-Auth-loginError = 'Username and password combination is incorrect!'; if (!$this-Session-read('Auth.User')) { $this-Auth-authError = 'Please log in'; } You set the first one to false when you need to do some routines during login--like record the login time, set a session var, etc. Otherwise, you can leave login() empty and allow Auth to sort it all out. 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: is it possible to include the failed input string in the validation message?
thanks! On Thu, Dec 30, 2010 at 3:24 AM, john lyles confidentia...@gmail.comwrote: You can override the error message using FormHelper :http:// book.cakephp.org/view/1401/options-error If your form looked something like this you would get the result you are looking for: echo $this-Form-input('username', array('error' = $this- data['User']['username'] . ' is taken')); On Dec 29, 11:07 am, Greg Skerman gsker...@gmail.com wrote: Hi, I'm trying to make my validation messages a little more meaningful. I would like to include the failed input in the validation message itself. So rather than a message like That username is already taken I would like to show The username user is already taken Is this possible? 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 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
JS Helper - getting value of a select
Ok, so i'm trying to break old habits of putting all my javascript in a file, and have decided to try out the JS helper. Basic rundown is a form with a select, that loads other elements of the form via Js-request based on the selection in the select box. is there a way to get the value of the select box after the event is fired? Basically I want to pass a parameter to add, the parameter being the value of the select. ?php $this-Js-get('#NodeResourceType')-event('change','$(#indicator).show();'. $this-Js-request( array( 'action' = 'add', 'admin' = 1, ), array( 'update' = '#indicator') )); ? Is this possible? if so how? the documentation doesn't make it clear. 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: Owner Check - FORGET IT
Ok well if someFunction is getting the $id of being asked and the conditions are getting the record where $id = Model.id and Model.user_id = Auth then is that not checking? How is that different than read id then compare the data? If there is no match with id and auth nothing is pulled correct... but just forget the question all together I only added somefunction as a way to represent me getting the $data it was not meant to be picked into parts and turned into a huge deal. Just assume its either getting a record or not, was what it was supposed to be not if auth id record are you using contain caching queries 100 other million possibilities. And I was asking how YOU YOU do it...put a snip of how YOU OR ANYONE OUT THERE DOES IT. That was all. I thought it seemed pretty easy to ask how do you I'm not asking if my way is correct as in I have no clue please show me how to tie my shoes...im asking let me see how you do it so I can see your way. Nothing to do with functions data records. Code how its writted down. Step 1 you do what...step 2 then what.. But thanks anyways for giving the fingers a work out -Original Message- From: cricket [mailto:zijn.digi...@gmail.com] Sent: Wednesday, December 29, 2010 3:19 PM To: cake-php@googlegroups.com Subject: Re: Owner Check On Wed, Dec 29, 2010 at 12:23 AM, Dave Maharaj m...@davemaharaj.com wrote: Because in the first example the $id will read from the db no matter what as long as $id is passed and $id is in the db so your going to the db no matter what and reading the data. In my way with $data = $this-Model-someFunction( $id, $this-Auth-User('id)); your only reading / finding / retrieving data if the conditions exist. In my head I think why pull the data if its not the owner with read? So pull the data using a find and if anything is found then continue on with the request. So how does this someFunction method magically tell you that the User in question is the correct one? You have to pull the data from the DB in any case. I don't think it's a big deal to pull it based on Record.id and then check user_id. But, if you'd rather have both conditions in the find() then there's no harm in that either. Which is the *correct* way? I dunno. 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: Owner Check - FORGET IT
On Wed, Dec 29, 2010 at 2:46 PM, Dave Maharaj m...@davemaharaj.com wrote: Ok well if someFunction is getting the $id of being asked and the conditions are getting the record where $id = Model.id and Model.user_id = Auth then is that not checking? How is that different than read id then compare the data? If there is no match with id and auth nothing is pulled correct... but just forget the question all together I only added somefunction as a way to represent me getting the $data it was not meant to be picked into parts and turned into a huge deal. Just assume its either getting a record or not, was what it was supposed to be not if auth id record are you using contain caching queries 100 other million possibilities. And I was asking how YOU YOU do it...put a snip of how YOU OR ANYONE OUT THERE DOES IT. That was all. I thought it seemed pretty easy to ask how do you I'm not asking if my way is correct as in I have no clue please show me how to tie my shoes...im asking let me see how you do it so I can see your way. Nothing to do with functions data records. Code how its writted down. Step 1 you do what...step 2 then what.. I explained how I do it. I don't bother passing the User.id at all. However, in your case, User hasMany Record, so you're passing Record.id I don't have any handy examples of that but have weighed in on howI would do it. Which is what I understood you were asking. No need to shout. 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: Scaffolding vs Bake
Larry pointed this out earlier you might add a new table to your database, it is easier to create the controller/model combination while you are creating all of the fields in your new table and see how it is working instead of going to the command line every change you make. scaffolding is use for rough prototyping and is not for actual use; in architectural terms you use the scaffolding erect the initial structure your still deciding upon the final structure of the database. Perhaps early alpha stages of you app - never goes live for public to interact with. whereas baking is for when you have pretty much finalised your db and do not need to remodel. This is beta phaze of you app, closer to final but tweaks need to be made still. whilst scaffolding dealing with views would be a burden. - S On 29 December 2010 18:31, John L confidentia...@gmail.com wrote: Why is scaffolding an option when baking since baking CRUD actions and views is so easy? This I never understood 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 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: Scaffolding vs Bake
Larry pointed this out earlier you might add a new table to your database, it is easier to create the controller/model combination while you are creating all of the fields in your new table and see how it is working instead of going to the command line every change you make. scaffolding is use for rough prototyping and is not for actual use; in architectural terms you use the scaffolding erect the initial structure your still deciding upon the final structure of the database. Perhaps early alpha stages of you app - never goes live for public to interact with. whereas baking is for when you have pretty much finalised your db and do not need to remodel. This is beta phaze of you app, closer to final but tweaks need to be made still. whilst scaffolding dealing with views would be a burden. When I added the scaffold code to the core CakePHP did not even have the shell scripts. I left it in the core because I am lazy and because of the reasons you repeated above. -- Larry E. Masters 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
Where to store email configuration
hey, I want to send mail from different controllers in my application, and I wondering how to do that without declare the Email component data ( smtpOptions, from, etc ) in any method I want to send mail from. The app_controller is not an option because the Email component is use only in few controllers. I thought about using configuration::write('email',array('from'='b...@bla.com', 'smtpOptions' = array('...')) and store it in core.php, is it the right solution ? and how I load this data to the Email component ( $this-Email = Configuration::read('email') is fine ? ) tnx, Gil. 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
Save and Loops
Hi everyone, I just need some help on inserting records using loops. To give you an overview, I have programs that run for a certain number of days and this code will insert a separate row for each appointment record. The problem is that the loop fails at the first iteration. Another weird thing is that when the number of appointments is 20+, it will fail both the first and the 20th+ iterations. (rows 2-19 get inserted just fine). I've tried looking for other topics involving save and loops, but still couldn't find a solution. I'm placing here the code for your reference. Thank you in advance, Mark //PHP Code Starts Here $program = $this-Enrollment-Program-read(null, $this- data['Enrollment']['program_id']); for($i=1;$i=$program['Program']['no_of_appointments'];$i++) { $appointment = array( 'appointment_no' = $i, 'appointment_date' = array('month' = date('m'), 'day' = date('d'), 'year' = date('Y')), 'employee_id' = $this-data['Enrollment']['employee_id'], 'enrollment_id' = $enrollment_id ); $this-Enrollment-Appointment-create(false); if($this-Enrollment-Appointment-save($appointment)) { debug(Saved #$i); } else { debug(Failed #$i); } } 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
Unable to get Template in my first page(configure problem)
Hi, I need to work in an existing project developed in cake PHP 1.2. I am trying to configure my project in my local system. But i am unable to see the template in my first page. when i submit my first page form, it says Object not found! The project was in the server like : http://sitename.com:777/ i made my local URL: http://localhost/projectfolder/ any one can help me Thanks Aniruddh 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
URGENT - Help needed - Model Association
I have created a Blog Application using a base table as 'Posts'. Later Model-Associated with another table 'Users' with 'belongsTo' relationship like below in the MODEL var $belongsTo = array( 'User' = array( 'className' = 'User', 'foreignKey' = 'user_id', 'conditions' = '', 'fields' = '', 'order' = '' ) ); But still I am not able to store the UserId in the Posts Table ??? What's the Problem Plus what does the following lines of code mean :: I saw the comments_controller.php which got generated using the BAKE command when MODEL ASSOCIATED the 'Posts' table with the 'Comments' Table : $posts = $this-Comment-Post-find('list'); $this-set(compact('posts')); If not above ; is there anyway I can store the UserId in the Posts Table using Model Associated cakePHP application ? 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
MAX() in query
I have a table of a number of issues id, number, year, user_id 1 | 1 | 2009 | 1 2 | 2 | 2009 | 1 3 | 3 | 2009 | 1 4 | 1 | 2010 | 1 5 | 2 | 2010 | 1 and for each user_id I want to retrieve the greatest number grouped by year. I could solve my problem with the following query: SELECT `Issue`.`id` AS `id`, `Issue`.`number` AS `number, `Issue`.`year` AS `year, `Issue`.`user_id` AS `user_id` FROM `issues` AS `Issue` INNER JOIN ( SELECT MAX(`Issue`.`number`) AS `number`, `Issue`.`year` AS `year` FROM `issues` AS `Issue` WHERE `Issue`.`user_id` = 1 GROUP BY `Issue`.`year` ) AS `JoinedTable` ON ( `Issue`.`number` = `JoinedTable`.`number` AND `Issue`.`year` = `JoinedTable`.`year` ); But I'm having some trouble translating that sql to cakephp so it integrates with paginator() and find() Could anybody give me some hints on how to solve this? 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
pagination SELECT COUNT(*) query slow
So i have a relationship table that has 6 tables the primary id is indexed as well as the models that paginate is using . The problem i am having with pagination is when i edit a row or add a row the SELECT COUNT(*) query takes forever around 11956MS it also maxes out my CPU for about 8 seconds. I only have 92K records, if i edit a row or add a row via phpmyadmin it only takes about 7ms. any suggestions ? Can i turn off the or get rid of the SELECT COUNT(*) 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
using select onmouseup to update database
I have a selectoption drop down menu in a view and I'm wondering if i can send data based on the selected result to my database when it is selected onmouseup. the options are populated from the optional_share_products table. I'd like to send data about the selected product (actually Item.id) to the optional_share_users table to record the choice for that user. this is what I have so far [code]div id=shares ? foreach ($optional_shares as $optional_share){ foreach($share_users as $user){ if ($user['OptionalShareUser']['user_id'] == $this-Session- read('Auth.User.id') $user['OptionalShareUser']['share_id'] == $optional_share['OptionalShare']['id']){ echo ('pYour ' . $optional_share['OptionalShare']['name'] . ' share this week is');? select ? foreach ($share_products as $product){ if ($optional_share['OptionalShare']['id'] == $product['OptionalShareProduct']['share_id']){ echo ('option '. $product['Item']['name'] . '/option'); } } ? /select ? } else continue; } }?/p /div[/code] 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: is it possible to include the failed input string in the validation message?
On Dec 29, 2010, at 11:24, john lyles wrote: If your form looked something like this you would get the result you are looking for: echo $this-Form-input('username', array('error' = $this-data['User']['username'] . ' is taken')); And of course if you wanted that to be localizable: echo $this-Form-input('username', array('error' = sprintf(__('%s is taken', true), $this-data['User']['username']))); But wouldn't this error message be displayed when *any* validation error with the username field occurs? What if I also have validation checks for whether it's empty, whether it's too short, whether it includes invalid characters? Anyway, wouldn't I want to specify validation errors in the controller, not in the view? 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: pagination SELECT COUNT(*) query slow
On Dec 29, 2010, at 13:00, arron wrote: So i have a relationship table that has 6 tables the primary id is indexed as well as the models that paginate is using . The problem i am having with pagination is when i edit a row or add a row the SELECT COUNT(*) query takes forever around 11956MS it also maxes out my CPU for about 8 seconds. I only have 92K records, if i edit a row or add a row via phpmyadmin it only takes about 7ms. any suggestions ? Can i turn off the or get rid of the SELECT COUNT(*) query ? Have you asked your database server why the query is slow? Perhaps using EXPLAIN? That might point out a missing index or something. 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: Unable to get Template in my first page(configure problem)
On Dec 29, 2010, at 05:32, Aniruddh wrote: I need to work in an existing project developed in cake PHP 1.2. I am trying to configure my project in my local system. But i am unable to see the template in my first page. when i submit my first page form, it says Object not found! The project was in the server like : http://sitename.com:777/ i made my local URL: http://localhost/projectfolder/ any one can help me Provide more information. Show us the relevant part of your web server configuration file. Tell us where on disk your project is and what its directory layout looks like. 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: pagination SELECT COUNT(*) query slow
Hello, Indexing the foreign keys would be ideal too.. Also you could override the core paginateCount, so its will not join 6 tables at the count(*) query http://book.cakephp.org/view/1237/Custom-Query-Pagination I did it this way, its handled by the 'extra': controller: $this-paginate = array( 'extra' = array('recursive' = -1), 'limit' = 50, 'contain' = array( 'ForumCategory', 'UserProfile', 'LastUserProfile', ), 'order' = array('ForumTopic.modified' = 'DESC'), 'conditions' = array('ForumTopic.is_active' = 1), 'fields' = array( 'ForumCategory.name', 'ForumTopic.id', 'ForumTopic.name', 'ForumTopic.forum_post_count', 'ForumTopic.modified', 'UserProfile.first_name', 'UserProfile.last_name', 'LastUserProfile.first_name', 'LastUserProfile.last_name', ) ); $this-set('topics', $this-paginate('ForumTopic')); model: public function PaginateCount($conditions = null, $recursive = 0, $extra = array()) { $rec = empty($extra['extra']['recursive']) ? $recursive : $extra['extra']['recursive']; return $this-find('count', array( 'conditions' = $conditions, 'recursive' = $rec, )); } Andras Kende http://www.kende.comn On Dec 29, 2010, at 2:00 PM, arron wrote: So i have a relationship table that has 6 tables the primary id is indexed as well as the models that paginate is using . The problem i am having with pagination is when i edit a row or add a row the SELECT COUNT(*) query takes forever around 11956MS it also maxes out my CPU for about 8 seconds. I only have 92K records, if i edit a row or add a row via phpmyadmin it only takes about 7ms. any suggestions ? Can i turn off the or get rid of the SELECT COUNT(*) 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 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: is it possible to include the failed input string in the validation message?
But wouldn't this error message be displayed when *any* validation error with the username field occurs? What if I also have validation checks for whether it's empty, whether it's too short, whether it includes invalid characters? Anyway, wouldn't I want to specify validation errors in the controller, not in the view? Ryan, good point about the error message being displayed for any error. I hadn't thought that far ahead. The solution would be to specify the keyname of the validation rule. The example in the manual not fixed for this situation is: $this-Form-input('Model.field', array('error' = array('tooShort' = __('This is not long enough', true) ))); As for the second point about handling this in the controller. It's the manual itself that says this should be handled with FormHelper. From this page here: http://book.cakephp.org/view/1143/Data-Validation , it says: For more information about how to handle the displaying of validation errors, check out the section covering FormHelper. On Dec 29, 4:40 pm, Ryan Schmidt google-2...@ryandesign.com wrote: On Dec 29, 2010, at 11:24, john lyles wrote: If your form looked something like this you would get the result you are looking for: echo $this-Form-input('username', array('error' = $this-data['User']['username'] . ' is taken')); And of course if you wanted that to be localizable: echo $this-Form-input('username', array('error' = sprintf(__('%s is taken', true), $this-data['User']['username']))); But wouldn't this error message be displayed when *any* validation error with the username field occurs? What if I also have validation checks for whether it's empty, whether it's too short, whether it includes invalid characters? Anyway, wouldn't I want to specify validation errors in the controller, not in the view? 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: URGENT - Help needed - Model Association
If the model names are Post and User then the table names should be 'posts' and 'users' lowercased. The field name is 'user_id' not 'UserId'. Model 'Comment' has a 'comments' table, not a 'Comments' table. You have to respect CakePHP's File and Classname conventions, see section 2.4.1 in the manual. On Dec 29, 11:19 am, pinastro pkaarthike...@gmail.com wrote: I have created a Blog Application using a base table as 'Posts'. Later Model-Associated with another table 'Users' with 'belongsTo' relationship like below in the MODEL var $belongsTo = array( 'User' = array( 'className' = 'User', 'foreignKey' = 'user_id', 'conditions' = '', 'fields' = '', 'order' = '' ) ); But still I am not able to store the UserId in the Posts Table ??? What's the Problem Plus what does the following lines of code mean :: I saw the comments_controller.php which got generated using the BAKE command when MODEL ASSOCIATED the 'Posts' table with the 'Comments' Table : $posts = $this-Comment-Post-find('list'); $this-set(compact('posts')); If not above ; is there anyway I can store the UserId in the Posts Table using Model Associated cakePHP application ? 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: MAX() in query
http://book.cakephp.org/view/1030/Complex-Find-Conditions That should help you, read through how to build complex conditions with subqueries and build the conditions array described. Once you have your conditions array just pass it to $this- paginate($conditions); You should be all set. Hope that helps, Nick On Dec 29, 10:38 am, vasquinho jvrodrig...@gmail.com wrote: I have a table of a number of issues id, number, year, user_id 1 | 1 | 2009 | 1 2 | 2 | 2009 | 1 3 | 3 | 2009 | 1 4 | 1 | 2010 | 1 5 | 2 | 2010 | 1 and for each user_id I want to retrieve the greatest number grouped by year. I could solve my problem with the following query: SELECT `Issue`.`id` AS `id`, `Issue`.`number` AS `number, `Issue`.`year` AS `year, `Issue`.`user_id` AS `user_id` FROM `issues` AS `Issue` INNER JOIN ( SELECT MAX(`Issue`.`number`) AS `number`, `Issue`.`year` AS `year` FROM `issues` AS `Issue` WHERE `Issue`.`user_id` = 1 GROUP BY `Issue`.`year` ) AS `JoinedTable` ON ( `Issue`.`number` = `JoinedTable`.`number` AND `Issue`.`year` = `JoinedTable`.`year` ); But I'm having some trouble translating that sql to cakephp so it integrates with paginator() and find() Could anybody give me some hints on how to solve this? 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
post form data from URL
Hi, How do I pass data to a Form from the URL? I have add.ctp: ?php echo $this-Form-input('url', array( 'type' = 'text', 'value' = $this-params['url'] )); ? Hitting localhost/links/add?url=http://cakephp.org produces the following error: Notice (8): Undefined index: action [CORE/cake/dispatcher.php, line 269] -and- Notice (8): Undefined index: controller [CORE/cake/dispatcher.php, line 121] Thanks. Steve 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: Problems Creating Shells (Tutorial)
Hi John L and John lyles, Fixed it by simply creating the table following John L's table's description. After that I got undefined PHP error which I placed what John L's fix in his last post. I ran cake report and I got empty results: C:\wamp\www\cakephpcake report ♀ Welcome to CakePHP v1.3.6 Console --- App : app Path: C:\wamp\www\cakephp\app --- ~~~Above is First attempt with Orders table no records~~~ ~~~Below is Second attempt with Orders table 2 records~~~ C:\wamp\www\cakephpcake report ♀ Welcome to CakePHP v1.3.6 Console --- App : app Path: C:\wamp\www\cakephp\app --- Order date: 2010-12-02 12:16:06 Amount: $100.50 Total: $100.50(this shouldn't be printed)//Maxim's comment Order date: 2010-12-09 12:16:38 Amount: $50.30 Total: $150.80(correct)//Maxim's comment ~~~ I think my initial problem is solved thanks to both John L and lyles. When look at the first record, it printed the total as well, which it shouldn't. That is just php script logical error..not the batch settings' problem. When looking at the second record its total is sum of the previous one. So we need to insert some records before we do cake report to see results in cmd ?(I know this is common sense but I'd like to confirm). I didn't create any model for this report but it worked ? Thanks again John L and Lyles. Regards, Maxim On Dec 30, 2:26 am, John L confidentia...@gmail.com wrote: This table works for the tutorial: CREATE TABLE orders( id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, amount DEC(5,2), created DATETIME, shipped DATETIME ); Then bake the model, controller and views. Go to /orders/add and add some orders to the database. Assuming the cake command is in your PATH, cake report should now work. Well with one exception (maybe). I was getting this error: Notice undefined variable: total in C:\...\vendors\shells\report.php on line 17 This line is the problem: $total += $order['Order']['amount']; PHP won't accept this line if $total is not set So my simple solution is: if(!isset($total)){ $total = $order['Order']['amount'];} else { $total += $order['Order']['amount']; } 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: Problems Creating Shells (Tutorial)
Go to /orders/add and add some orders to the database. Hi, may I know does it mean going to app/views/orders/add.ctp which is a file we need to manually create or does it auto-create ? Is your app called 'app' ? I'm not sure what you mean, my root folder is named cakephp, in there I have: app (folder) --here's where I put my codes cake (folder) plugins (folder) vendors (folder) .gitignore .htaccess index.php README(FILE) Maybe could you clarify if now my app folder is called app ? Is that what you mean ? Thans. Regards, Maxim On Dec 30, 2:26 am, John L confidentia...@gmail.com wrote: This table works for the tutorial: CREATE TABLE orders( id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, amount DEC(5,2), created DATETIME, shipped DATETIME ); Then bake the model, controller and views. Go to /orders/add and add some orders to the database. Assuming the cake command is in your PATH, cake report should now work. Well with one exception (maybe). I was getting this error: Notice undefined variable: total in C:\...\vendors\shells\report.php on line 17 This line is the problem: $total += $order['Order']['amount']; PHP won't accept this line if $total is not set So my simple solution is: if(!isset($total)){ $total = $order['Order']['amount'];} else { $total += $order['Order']['amount']; } 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: Help with function Login()--using Auth (Redirecting issue)
Hi, By default, Auth component redirects to referrer page (if set) otherwise to the page set in loginRedirect. So you may need to overwrite 'Auth.redirect' session parameter. FYI, please have a look at http://book.cakephp.org/view/1270/loginRedirect Amit Badkas PHP Applications for E-Biz: http://www.sanisoft.com On Thu, Dec 30, 2010 at 12:29 AM, cricket zijn.digi...@gmail.com wrote: On Tue, Dec 28, 2010 at 11:58 PM, John Maxim goog...@gmail.com wrote: Users_controllers.php: var $name = 'Users'; /*some codes in between*/ function login() { if(!empty($this-data)) { // If the username/password match if($this-Auth-login($this-data)) { $this-redirect(array('action' = 'index'), null, true); } else { $this-User-invalidate('username', 'Username and password combination is incorrect!'); } } } The code in your login method does basically what Auth would do if left to its own devices. You could get the same functionality as above by setting the following in AppController's beforeFilter method: // this tells Auth to handle redirects $this-Auth-autoRedirect = true; // this tells Auth where to send the user $this-Auth-loginRedirect = array( 'controller' = 'posts', 'action' = 'index' ); $this-Auth-loginError = 'Username and password combination is incorrect!'; if (!$this-Session-read('Auth.User')) { $this-Auth-authError = 'Please log in'; } You set the first one to false when you need to do some routines during login--like record the login time, set a session var, etc. Otherwise, you can leave login() empty and allow Auth to sort it all out. 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 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: URGENT - Help needed - Model Association
John I think the class name conventions are correct as the code is a generated one ..I didn't write the code.It was generated by cake bake command . * Model 'Comment' has a 'comments' table, not a 'Comments' table. * I have not defined anywhere as *Comments* Table..I have done as *comments*only I guess the problem is in the relationship type during the model association ? Not sure though Thanks Karthikeyan P On Thu, Dec 30, 2010 at 4:08 AM, john lyles confidentia...@gmail.comwrote: If the model names are Post and User then the table names should be 'posts' and 'users' lowercased. The field name is 'user_id' not 'UserId'. Model 'Comment' has a 'comments' table, not a 'Comments' table. You have to respect CakePHP's File and Classname conventions, see section 2.4.1 in the manual. On Dec 29, 11:19 am, pinastro pkaarthike...@gmail.com wrote: I have created a Blog Application using a base table as 'Posts'. Later Model-Associated with another table 'Users' with 'belongsTo' relationship like below in the MODEL var $belongsTo = array( 'User' = array( 'className' = 'User', 'foreignKey' = 'user_id', 'conditions' = '', 'fields' = '', 'order' = '' ) ); But still I am not able to store the UserId in the Posts Table ??? What's the Problem Plus what does the following lines of code mean :: I saw the comments_controller.php which got generated using the BAKE command when MODEL ASSOCIATED the 'Posts' table with the 'Comments' Table : $posts = $this-Comment-Post-find('list'); $this-set(compact('posts')); If not above ; is there anyway I can store the UserId in the Posts Table using Model Associated cakePHP application ? 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 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: post form data from URL
I guess I got your question correctly, what u want to do is Pre-Populate the form on loading I think you have to see the EDIT function in the BLOG tutorial of cakePHP. There we actually PRE-POPULATE the data on the EDIT page . Thanks Karthikeyan P On Thu, Dec 30, 2010 at 8:14 AM, Steve Mallett steve.mall...@gmail.comwrote: Hi, How do I pass data to a Form from the URL? I have add.ctp: ?php echo $this-Form-input('url', array( 'type' = 'text', 'value' = $this-params['url'] )); ? Hitting localhost/links/add?url=http://cakephp.org produces the following error: Notice (8): Undefined index: action [CORE/cake/dispatcher.php, line 269] -and- Notice (8): Undefined index: controller [CORE/cake/dispatcher.php, line 121] Thanks. Steve 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 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: Save and Loops
Hi, You said that first and last iterations failed to insert. Was there any errors outputted? Try to output $this-Enrollment-Appointment-validationErrors array for failed data. Please remember to test this with debug level 2 so that it will output errors (if any) as well as SQL queries. Amit Badkas PHP Applications for E-Biz: http://www.sanisoft.com On Wed, Dec 29, 2010 at 2:44 PM, Mark mark.anthony.e.san...@gmail.comwrote: Hi everyone, I just need some help on inserting records using loops. To give you an overview, I have programs that run for a certain number of days and this code will insert a separate row for each appointment record. The problem is that the loop fails at the first iteration. Another weird thing is that when the number of appointments is 20+, it will fail both the first and the 20th+ iterations. (rows 2-19 get inserted just fine). I've tried looking for other topics involving save and loops, but still couldn't find a solution. I'm placing here the code for your reference. Thank you in advance, Mark //PHP Code Starts Here $program = $this-Enrollment-Program-read(null, $this- data['Enrollment']['program_id']); for($i=1;$i=$program['Program']['no_of_appointments'];$i++) { $appointment = array( 'appointment_no' = $i, 'appointment_date' = array('month' = date('m'), 'day' = date('d'), 'year' = date('Y')), 'employee_id' = $this-data['Enrollment']['employee_id'], 'enrollment_id' = $enrollment_id ); $this-Enrollment-Appointment-create(false); if($this-Enrollment-Appointment-save($appointment)) { debug(Saved #$i); } else { debug(Failed #$i); } } 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 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: is it possible to include the failed input string in the validation message?
Bit of a moot point for me... was using Username as an example, but its actually not a username, so the only validation rule I have on the field is isUnique... also not using localization... having said that, would be nice if the model validation rules supported returning the input string in the message On Thu, Dec 30, 2010 at 8:19 AM, john lyles confidentia...@gmail.comwrote: But wouldn't this error message be displayed when *any* validation error with the username field occurs? What if I also have validation checks for whether it's empty, whether it's too short, whether it includes invalid characters? Anyway, wouldn't I want to specify validation errors in the controller, not in the view? Ryan, good point about the error message being displayed for any error. I hadn't thought that far ahead. The solution would be to specify the keyname of the validation rule. The example in the manual not fixed for this situation is: $this-Form-input('Model.field', array('error' = array('tooShort' = __('This is not long enough', true) ))); As for the second point about handling this in the controller. It's the manual itself that says this should be handled with FormHelper. From this page here: http://book.cakephp.org/view/1143/Data-Validation , it says: For more information about how to handle the displaying of validation errors, check out the section covering FormHelper. On Dec 29, 4:40 pm, Ryan Schmidt google-2...@ryandesign.com wrote: On Dec 29, 2010, at 11:24, john lyles wrote: If your form looked something like this you would get the result you are looking for: echo $this-Form-input('username', array('error' = $this-data['User']['username'] . ' is taken')); And of course if you wanted that to be localizable: echo $this-Form-input('username', array('error' = sprintf(__('%s is taken', true), $this-data['User']['username']))); But wouldn't this error message be displayed when *any* validation error with the username field occurs? What if I also have validation checks for whether it's empty, whether it's too short, whether it includes invalid characters? Anyway, wouldn't I want to specify validation errors in the controller, not in the view? 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 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: using select onmouseup to update database
Hi, The code doesn't seem to be as per CakePHP standard. However, you need to handle onchange event of a select to save the selected option (probably using an AJAX request). Amit Badkas PHP Applications for E-Biz: http://www.sanisoft.com On Thu, Dec 30, 2010 at 12:58 AM, roundrightfarm roundrightf...@gmail.comwrote: I have a selectoption drop down menu in a view and I'm wondering if i can send data based on the selected result to my database when it is selected onmouseup. the options are populated from the optional_share_products table. I'd like to send data about the selected product (actually Item.id) to the optional_share_users table to record the choice for that user. this is what I have so far [code]div id=shares ? foreach ($optional_shares as $optional_share){ foreach($share_users as $user){ if ($user['OptionalShareUser']['user_id'] == $this-Session- read('Auth.User.id') $user['OptionalShareUser']['share_id'] == $optional_share['OptionalShare']['id']){ echo ('pYour ' . $optional_share['OptionalShare']['name'] . ' share this week is');? select ? foreach ($share_products as $product){ if ($optional_share['OptionalShare']['id'] == $product['OptionalShareProduct']['share_id']){ echo ('option '. $product['Item']['name'] . '/option'); } } ? /select ? } else continue; } }?/p /div[/code] 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 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: Help with function Login()--using Auth (Redirecting issue)
Hi cricket ! you're awesome, thanks your working and explanation solved the puzzle I had.. Amit, I will check that link out..thanks too. Regards, Maxim On Dec 30, 12:54 pm, Amit Badkas amit.sanis...@gmail.com wrote: Hi, By default, Auth component redirects to referrer page (if set) otherwise to the page set in loginRedirect. So you may need to overwrite 'Auth.redirect' session parameter. FYI, please have a look athttp://book.cakephp.org/view/1270/loginRedirect Amit Badkas PHP Applications for E-Biz:http://www.sanisoft.com On Thu, Dec 30, 2010 at 12:29 AM, cricket zijn.digi...@gmail.com wrote: On Tue, Dec 28, 2010 at 11:58 PM, John Maxim goog...@gmail.com wrote: Users_controllers.php: var $name = 'Users'; /*some codes in between*/ function login() { if(!empty($this-data)) { // If the username/password match if($this-Auth-login($this-data)) { $this-redirect(array('action' = 'index'), null, true); } else { $this-User-invalidate('username', 'Username and password combination is incorrect!'); } } } The code in your login method does basically what Auth would do if left to its own devices. You could get the same functionality as above by setting the following in AppController's beforeFilter method: // this tells Auth to handle redirects $this-Auth-autoRedirect = true; // this tells Auth where to send the user $this-Auth-loginRedirect = array( 'controller' = 'posts', 'action' = 'index' ); $this-Auth-loginError = 'Username and password combination is incorrect!'; if (!$this-Session-read('Auth.User')) { $this-Auth-authError = 'Please log in'; } You set the first one to false when you need to do some routines during login--like record the login time, set a session var, etc. Otherwise, you can leave login() empty and allow Auth to sort it all out. 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.comcake-php%2bunsubscr...@googlegroups.comFor 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
DbAcl Failed ARO/ACO node lookup (SOLVED accidentally)
~~ERROR msg~~ Warning (512): DbAcl::check() - Failed ARO/ACO node lookup in permissions check. Node references: Aro: User::44 Aco: Post [CORE\cake\libs\controller\components\acl.php, line 273] ~~ The error is shown above. I solved this accidentally, maybe someone could rectify if my solution is correct? The full story how I ended up with this error can be read here: http://groups.google.com/group/cake-php/browse_thread/thread/478daa30a5c26e18 Suggestion to repopulate the Acl tables was not attempted before I could, I solved it when reading cookbook here: http://book.cakephp.org/view/1244/Defining-Permissions-Cake-s-INI-based-ACL Extracted from cookbook: ~~ //Change these lines: Configure::write('Acl.classname', 'DbAcl'); Configure::write('Acl.database', 'default'); //To look like this: Configure::write('Acl.classname', 'IniAcl'); //Configure::write('Acl.database', 'default'); ~~ Suggestion(s) ? Regards, Maxim 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