How to do CSRF protection in cakephp
Hi, I am new to cakephp and now I am working on a new project with cakephp by studying. My current doing task is to do CSRF protection for overall project.I have read official cakephp 2 cookbook and I did as explained in that book. But, now I am facing The request has been black-holed *Error: *The requested address *'/admin/accounts/add'* was not found on this server. every time the new user add form is submitted. My code is : // public $components = array( 'Security' => array( 'csrfExpires' => '+1 hour' ), 'Search.Prg' => array( 'commonProcess' => array( 'paramType' => 'named', 'filterEmpty' => true )) ); /// public function beforeFilter() { parent::beforeFilter(); $this->layout = 'admin'; $this->Security->blackHoleCallback = '_blackHole'; } public function _blackHole($error) { die($error); } / By doing so, 'auth' error has appeared. How should I do? Please help me.I have googled but it was just the waste of time.I have no way to do. Please help me. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at https://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: Subqueries, how to do this correctly?
You should make a belongsTo association between Submits and Categories. If you do this, Cake will automatically retrieve the data you are looking for when you do a find() on Submits. To learn more about this go to: http://book.cakephp.org/2.0/en/models/associations-linking-models-together.html -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Subqueries, how to do this correctly?
Hi, I have two tables, one Submits, the other Categories. Submits has a column called category_id which is linked to the id of Categories. I want to access the name field from Category and return it, all in one query. how can I do this in CakePHP. Normally I'd make a virtual table and select all from there. I'm new to CakePHP, first project and liking it so far! :) ./cake bake all (is the shizz) Cheers. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: How to do recursion more than 2 levels deep using the one table?
Maybe, what you want is to use the TreeBehavior with hasAndBelongsToMany, isnt it? Em quinta-feira, 23 de maio de 2013 02h54min48s UTC-3, DJ escreveu: > > Hi > > I am trying to set up a generic data structure that we can use to map > objects, attributes and relationships. As such I have one table with a id > and name, and a join table with a "parent" id and a "child" id. > > Data... > > mysql> select * from resources; > ++---+ > | id | name | > ++---+ > | 1 | top | > | 2 | 2nd_1 | > | 3 | 3rd_1 | > | 4 | 2nd_2 | > | 5 | 3rd_2 | > | 6 | 4th | > | 7 | 5th | > ++---+ > > mysql> select * from resources_resources; > ++---+---+ > | id | a_resource_id | b_resource_id | > ++---+---+ > | 1 | 1 | 2 | > | 2 | 2 | 3 | > | 3 | 1 | 4 | > | 4 | 4 | 5 | > | 5 | 3 | 6 | > | 6 | 5 | 6 | > | 7 | 6 | 7 | > ++---+---+ > > > Below is my model definition. > > // Model/Resource.php > > public $hasAndBelongsToMany = array( > 'Children' => array( > 'className' => 'Resource', > 'joinTable' => 'resources_resources', > 'foreignKey' => 'a_resource_id', > 'associationForeignKey' => 'b_resource_id', > 'unique' => 'keepExisting', > 'conditions' => '', > 'fields' => '', > 'order' => '', > 'limit' => '', > 'offset' => '', > 'finderQuery' => '', > 'deleteQuery' => '', > 'insertQuery' => '' > ), > ); > > Controller > > // Controller/ResourceController.php > > public function view($id = null) { > if (!$this->Resource->exists($id)) { > throw new NotFoundException(__('Invalid > resource')); > } > $options = array('conditions' => array('Resource.' . > $this->Resource->primaryKey => $id),'recursive' => 5); > $data = $this->Resource->find('first', $options); > debug($data); > > This outputs as below... > > array( > 'Resource' => array( > 'id' => '1', > 'name' => 'top' > ), > 'Children' => array( > (int) 0 => array( > 'id' => '2', > 'name' => '2nd_1', > (int) 0 => array( > 'id' => '3', > 'name' => '3rd_1', > 'ResourcesResource' => array( > 'id' => '2', > 'a_resource_id' => '2', > 'b_resource_id' => '3' > ) > ), > 'ResourcesResource' => array( > 'id' => '1', > 'a_resource_id' => '1', > 'b_resource_id' => '2' > ) > ), > (int) 1 => array( > 'id' => '4', > 'name' => '2nd_2', > (int) 0 => array( > 'id' => '5', > 'name' => '3rd_2', > 'ResourcesResource' => array( > 'id' => '4', > 'a_resource_id' => '4', > 'b_resource_id' => '5' > ) > ), > 'ResourcesResource' => array( > 'id' => '3', > 'a_resource_id' => '1', > 'b_resource_id' => '4' > ) > ) > ) > ) > > > Is it because I'm using the one table? (I'm about to prove that for > myself). I have tried things like using contain and specifying multiple > levels as below with same result as below. > > $options = array('conditions' => array('Resource.' . > $this->Resource->primaryKey => $id),'contain' => array( 'Children' => > array( 'Children' => array ( 'Children'; > > Is this 2 levels deep recursion by design? Can anybody suggest a > workaround? > > Thanks! > > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to c
Re: How to do recursion more than 2 levels deep using the one table?
Thanks Andre Unfortunately tree behaviour doesn't really work for my situation as I need the ability for a node/resource/object to have multiple parents. I believe the problem is related to using the one model. For eample if I set up a data model like Country->State->City->Suburb->Street with join tables the recursion works fine. On Saturday, May 25, 2013 5:52:30 AM UTC+10, André Luis wrote: > > I didnt really understand what you really want, but it seems that it´s a > work for TreeBehavior > > In TreeBehavior you have id, parent_id, lft and rght fields... lft and > rght are automatically filled by the behavior... The parent_id is the ID of > the parent object, them you can use $this->Model->find('threaded'); will > return the structure with it´s children. > > array( > [0]=>array( > 'Model'=>array( > [id]=>5, > [parent_id]=>1, > [something]=>'somevalue', > [children]=>array( > [0]=>array( > 'Model'=>array( > [id]=>6, > [parent_id]=>5, > [something]=>'somevalue' > ) > ) > ) > ) > ) > ) > > Em quinta-feira, 23 de maio de 2013 02h54min48s UTC-3, DJ escreveu: >> >> Hi >> >> I am trying to set up a generic data structure that we can use to map >> objects, attributes and relationships. As such I have one table with a id >> and name, and a join table with a "parent" id and a "child" id. >> >> Data... >> >> mysql> select * from resources; >> ++---+ >> | id | name | >> ++---+ >> | 1 | top | >> | 2 | 2nd_1 | >> | 3 | 3rd_1 | >> | 4 | 2nd_2 | >> | 5 | 3rd_2 | >> | 6 | 4th | >> | 7 | 5th | >> ++---+ >> >> mysql> select * from resources_resources; >> ++---+---+ >> | id | a_resource_id | b_resource_id | >> ++---+---+ >> | 1 | 1 | 2 | >> | 2 | 2 | 3 | >> | 3 | 1 | 4 | >> | 4 | 4 | 5 | >> | 5 | 3 | 6 | >> | 6 | 5 | 6 | >> | 7 | 6 | 7 | >> ++---+---+ >> >> >> Below is my model definition. >> >> // Model/Resource.php >> >> public $hasAndBelongsToMany = array( >> 'Children' => array( >> 'className' => 'Resource', >> 'joinTable' => 'resources_resources', >> 'foreignKey' => 'a_resource_id', >> 'associationForeignKey' => 'b_resource_id', >> 'unique' => 'keepExisting', >> 'conditions' => '', >> 'fields' => '', >> 'order' => '', >> 'limit' => '', >> 'offset' => '', >> 'finderQuery' => '', >> 'deleteQuery' => '', >> 'insertQuery' => '' >> ), >> ); >> >> Controller >> >> // Controller/ResourceController.php >> >> public function view($id = null) { >> if (!$this->Resource->exists($id)) { >> throw new NotFoundException(__('Invalid >> resource')); >> } >> $options = array('conditions' => array('Resource.' . >> $this->Resource->primaryKey => $id),'recursive' => 5); >> $data = $this->Resource->find('first', $options); >> debug($data); >> >> This outputs as below... >> >> array( >> 'Resource' => array( >> 'id' => '1', >> 'name' => 'top' >> ), >> 'Children' => array( >> (int) 0 => array( >> 'id' => '2', >> 'name' => '2nd_1', >> (int) 0 => array( >> 'id' => '3', >> 'name' => '3rd_1', >> 'ResourcesResource' => array( >> 'id' => '2', >> 'a_resource_id' => '2', >> 'b_resource_id' => '3' >> ) >> ), >> 'ResourcesResource' => array( >> 'id' => '1', >> 'a_resource_id' => '1', >> 'b_resource_id' => '2' >> ) >> ), >> (int) 1 => array( >> 'id' => '4', >> 'name' => '2nd_2', >> (int) 0 => array( >> 'id' => '5', >> 'name' => '3rd_2', >> 'ResourcesResource' => array( >>
Re: How to do recursion more than 2 levels deep using the one table?
I didnt really understand what you really want, but it seems that it´s a work for TreeBehavior In TreeBehavior you have id, parent_id, lft and rght fields... lft and rght are automatically filled by the behavior... The parent_id is the ID of the parent object, them you can use $this->Model->find('threaded'); will return the structure with it´s children. array( [0]=>array( 'Model'=>array( [id]=>5, [parent_id]=>1, [something]=>'somevalue', [children]=>array( [0]=>array( 'Model'=>array( [id]=>6, [parent_id]=>5, [something]=>'somevalue' ) ) ) ) ) ) Em quinta-feira, 23 de maio de 2013 02h54min48s UTC-3, DJ escreveu: > > Hi > > I am trying to set up a generic data structure that we can use to map > objects, attributes and relationships. As such I have one table with a id > and name, and a join table with a "parent" id and a "child" id. > > Data... > > mysql> select * from resources; > ++---+ > | id | name | > ++---+ > | 1 | top | > | 2 | 2nd_1 | > | 3 | 3rd_1 | > | 4 | 2nd_2 | > | 5 | 3rd_2 | > | 6 | 4th | > | 7 | 5th | > ++---+ > > mysql> select * from resources_resources; > ++---+---+ > | id | a_resource_id | b_resource_id | > ++---+---+ > | 1 | 1 | 2 | > | 2 | 2 | 3 | > | 3 | 1 | 4 | > | 4 | 4 | 5 | > | 5 | 3 | 6 | > | 6 | 5 | 6 | > | 7 | 6 | 7 | > ++---+---+ > > > Below is my model definition. > > // Model/Resource.php > > public $hasAndBelongsToMany = array( > 'Children' => array( > 'className' => 'Resource', > 'joinTable' => 'resources_resources', > 'foreignKey' => 'a_resource_id', > 'associationForeignKey' => 'b_resource_id', > 'unique' => 'keepExisting', > 'conditions' => '', > 'fields' => '', > 'order' => '', > 'limit' => '', > 'offset' => '', > 'finderQuery' => '', > 'deleteQuery' => '', > 'insertQuery' => '' > ), > ); > > Controller > > // Controller/ResourceController.php > > public function view($id = null) { > if (!$this->Resource->exists($id)) { > throw new NotFoundException(__('Invalid > resource')); > } > $options = array('conditions' => array('Resource.' . > $this->Resource->primaryKey => $id),'recursive' => 5); > $data = $this->Resource->find('first', $options); > debug($data); > > This outputs as below... > > array( > 'Resource' => array( > 'id' => '1', > 'name' => 'top' > ), > 'Children' => array( > (int) 0 => array( > 'id' => '2', > 'name' => '2nd_1', > (int) 0 => array( > 'id' => '3', > 'name' => '3rd_1', > 'ResourcesResource' => array( > 'id' => '2', > 'a_resource_id' => '2', > 'b_resource_id' => '3' > ) > ), > 'ResourcesResource' => array( > 'id' => '1', > 'a_resource_id' => '1', > 'b_resource_id' => '2' > ) > ), > (int) 1 => array( > 'id' => '4', > 'name' => '2nd_2', > (int) 0 => array( > 'id' => '5', > 'name' => '3rd_2', > 'ResourcesResource' => array( > 'id' => '4', > 'a_resource_id' => '4', > 'b_resource_id' => '5' > ) > ), > 'ResourcesResource' => array( > 'id' => '3', > 'a_resource_id' => '1', > 'b_resource_id' => '4' > ) > ) > ) > ) > > > Is it because I'm using the one table? (I'm about to p
How to do recursion more than 2 levels deep using the one table?
Hi I am trying to set up a generic data structure that we can use to map objects, attributes and relationships. As such I have one table with a id and name, and a join table with a "parent" id and a "child" id. Data... mysql> select * from resources; ++---+ | id | name | ++---+ | 1 | top | | 2 | 2nd_1 | | 3 | 3rd_1 | | 4 | 2nd_2 | | 5 | 3rd_2 | | 6 | 4th | | 7 | 5th | ++---+ mysql> select * from resources_resources; ++---+---+ | id | a_resource_id | b_resource_id | ++---+---+ | 1 | 1 | 2 | | 2 | 2 | 3 | | 3 | 1 | 4 | | 4 | 4 | 5 | | 5 | 3 | 6 | | 6 | 5 | 6 | | 7 | 6 | 7 | ++---+---+ Below is my model definition. // Model/Resource.php public $hasAndBelongsToMany = array( 'Children' => array( 'className' => 'Resource', 'joinTable' => 'resources_resources', 'foreignKey' => 'a_resource_id', 'associationForeignKey' => 'b_resource_id', 'unique' => 'keepExisting', 'conditions' => '', 'fields' => '', 'order' => '', 'limit' => '', 'offset' => '', 'finderQuery' => '', 'deleteQuery' => '', 'insertQuery' => '' ), ); Controller // Controller/ResourceController.php public function view($id = null) { if (!$this->Resource->exists($id)) { throw new NotFoundException(__('Invalid resource')); } $options = array('conditions' => array('Resource.' . $this->Resource->primaryKey => $id),'recursive' => 5); $data = $this->Resource->find('first', $options); debug($data); This outputs as below... array( 'Resource' => array( 'id' => '1', 'name' => 'top' ), 'Children' => array( (int) 0 => array( 'id' => '2', 'name' => '2nd_1', (int) 0 => array( 'id' => '3', 'name' => '3rd_1', 'ResourcesResource' => array( 'id' => '2', 'a_resource_id' => '2', 'b_resource_id' => '3' ) ), 'ResourcesResource' => array( 'id' => '1', 'a_resource_id' => '1', 'b_resource_id' => '2' ) ), (int) 1 => array( 'id' => '4', 'name' => '2nd_2', (int) 0 => array( 'id' => '5', 'name' => '3rd_2', 'ResourcesResource' => array( 'id' => '4', 'a_resource_id' => '4', 'b_resource_id' => '5' ) ), 'ResourcesResource' => array( 'id' => '3', 'a_resource_id' => '1', 'b_resource_id' => '4' ) ) ) ) Is it because I'm using the one table? (I'm about to prove that for myself). I have tried things like using contain and specifying multiple levels as below with same result as below. $options = array('conditions' => array('Resource.' . $this->Resource->primaryKey => $id),'contain' => array( 'Children' => array( 'Children' => array ( 'Children'; Is this 2 levels deep recursion by design? Can anybody suggest a workaround? Thanks! -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: how to do cascading combobox
Hello, you can try and achieve that by following this: http://www.willis-owen.co.uk/2011/11/dynamic-select-box-with-cakephp-2-0/ On Saturday, 20 April 2013 06:49:56 UTC-4, di wrote: > > I'm using cakephp 2.1 > in my application I have 5 tables that are related: Provinces, Districts, > Towns, Neighborhoods and block. > In my form AddParticipant, have five combobox, Provinces, Districts, Towns > , Neighborhoods and block. > wanted when the user selects the Province, the District combobox shows up > Districts Related to this Province, > District combobox shows up the locations, Location combobox shows up > theNeighborhoods > . > > Any help please. > > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
how to do cascading combobox
I'm using cakephp 2.1 in my application I have 5 tables that are related: Provinces, Districts, Towns, Neighborhoods and block. In my form AddParticipant, have five combobox, Provinces, Districts, Towns, Neighborhoods and block. wanted when the user selects the Province, the District combobox shows up Districts Related to this Province, District combobox shows up the locations, Location combobox shows up theNeighborhoods . Any help please. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
how to do multiple joins
Good afternoon, I`m new using cakephp and I got some questions that I couldn`t figure how to solve. Let me introduce an example: i have the following tables USERS hasmany MASTERS MASTERS hasmany CLIENTS and belongs to USERS CLIENTS has many GROUPS and belongs to MASTERS Now in the add page of GROUPSI have a dropdown that I can select MASTERS records and CLIENTSrecords. With this how can I filter the dropdown to show just the TABLE1 that are from the logged user? I tried like this to the index, it works but I think that must be a more intelligent form of doing it $this->User->unbindModel(array('belongsTo'=>array('Client'))); $options = array( 'joins' => array( array( 'table' => 'clients', 'alias' => 'Client', 'type' => 'LEFT', 'conditions' => array( 'client.id = group.client_id' ) ), array( 'table' => 'masters', 'alias' => 'master', 'type' => 'LEFT', 'conditions' => array( 'master.id = client.master_id' ) ) ), 'fields' => array( 'group.id', 'group.nome', 'Client.id', 'Client.cliente', ), 'conditions' => array( 'master.user_id' => $this->Session->read('Auth.User.id') ) ); $groups = $this->Group->find('all', $options); $this->set(compact('groups')); Or simply should I put user_id in all tables??? Thanks for the support guys Augusto -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
How to do the dos mode printing in cakephp2.3?
I am doing POS(billing) in cakephp. So I need to do the dos mode printing.Kindly help me. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: How to do a DISTINCT find but also return more than 1 field
I thought I'd post back with my solution. I seem to magically figure it out 2 minutes after posting, but never before hand haha. I just used the 'group' key instead and that seemed to do the trick returning only distinct IP rows while bringing back data for all fields that I needed: $DistinctIp = $this->Log->find('all', array( 'conditions'=>array( 'last_usage_human >'=>date('Y-m-d H:i:s', strtotime('-15 minutes')) ), 'fields'=>array('Log.ip', 'Log.user_agent', 'Log.ip_name', 'Log.last_usage_human'), 'limit'=>333, 'group'=>'Log.ip' )); On Friday, August 31, 2012 6:32:20 PM UTC-7, andrewperk wrote: > > Hello, > > When trying to do a DISTINCT find with only 1 field being returned > everything works fine. But if I want more than just that 1 field of data > returned it's no longer distinct. How can I do this? > > $DistinctIp = $this->Log->find('all', array( > 'conditions'=>array( > 'last_usage_human >'=>date('Y-m-d H:i:s', strtotime('-15 minutes')) > ), > 'fields'=>array('DISTINCT Log.ip', 'Log.user_agent', 'Log.ip_name', > 'Log.last_usage_human'), > 'limit'=>333 > )); > > This does not work, it's returning everything, it's no longer DISTINCT. > > Here you can see I want only rows with the DISTINCT ip field to be > returned. But I want the data that's returned from more than just that > field such as the: ip_name, last_usage_human fields as well. But when I do > this it returns everything and doesn't constrain it to the DISTINCT. > > Thanks, > > > Andrew > -- You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
How to do a DISTINCT find but also return more than 1 field
Hello, When trying to do a DISTINCT find with only 1 field being returned everything works fine. But if I want more than just that 1 field of data returned it's no longer distinct. How can I do this? $DistinctIp = $this->Log->find('all', array( 'conditions'=>array( 'last_usage_human >'=>date('Y-m-d H:i:s', strtotime('-15 minutes')) ), 'fields'=>array('DISTINCT Log.ip', 'Log.user_agent', 'Log.ip_name', 'Log.last_usage_human'), 'limit'=>333 )); This does not work, it's returning everything, it's no longer DISTINCT. Here you can see I want only rows with the DISTINCT ip field to be returned. But I want the data that's returned from more than just that field such as the: ip_name, last_usage_human fields as well. But when I do this it returns everything and doesn't constrain it to the DISTINCT. Thanks, Andrew -- You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
Re: How to do a REST WS?
gt;> >> *public $components = array( >> 'DebugKit.Toolbar', >> 'Session', >> 'Auth' => array( >> 'loginRedirect' => array('controller' => 'users', >> 'action' => 'index'), >> 'logoutRedirect' => array('controller' => 'users', >> 'action' => 'login') >> ), >> 'RequestHandler' >> ); >> * >> When the application receives a request for e.g. on: * >> http://www.example.com/records.xml* by default this will call* >> RecordsController::**index()*. >> Here's an example structure of a add method: >> * >> public function addRecord() { >> if ($this->request->is('post')) { >> //Authentication ? >> //Validate incoming data >> if ($this->RecorisXmld->saveAll($data)){ >> if($this->RequestHandler->isXml()){ >> //Serve a Xml responce >> } >> if($this->RequestHandler->isRss()){ >> //Serve RSS >> } >> } >> } >> }* >> >> CakePHP now (since 2.1) has Json and Xml view >> classes<http://book.cakephp.org/2.0/en/views/json-and-xml-views.html>. >> What this will do is that for e.g. "After adding 'json' to >> Router::parseExtensions() in your routes file, CakePHP will automatically >> switch view classes when a request is done with the .json extension, or the >> Accept header is application/json." >> >> So this basically is it. By enabling Cake's core features you could be >> able to easily manage a REST service. Hope this helped. >> >> Cheers, >>Borislav. >> >> On Thursday, 21 June 2012 20:26:28 UTC+3, Lucas Simon Rodrigues Magalhaes >> wrote: >>> >>> Hello I need to build an application in Webservice to return data for a >>> particular billing. >>> >>> First I'm using cakePHP version 1.3, and following the cake book [1]. >>> According to according to the book I should map the model which give >>> permission to access REST. >>> I thought about using REST to provide data json / xml instead of nusoap, >>> but I'm sure how to do it. >>> >>> First I'm using cakePHP version 1.3, and following the cake book [1]. >>> According to according to the book I should map the model which give >>> permission to access REST. >>> >>> The problem: >>> In this case I need to perform a find in various tables and perform an >>> operation with her results in a foreach, and then send the answer to this >>> operation via JSON / XML. >>> >>> What I did: >>> I created a controller called ws_billing_controller.php that will manage >>> the requests get to the rest. >>> routes.php -> Router :: mapResources ('') / / empty do not know what to >>> put here >>> routes.php -> Router :: parseExtensions ('json', 'xml'); >>> ws_billing_controller.php -> [2] >>> >>> I wonder if the path I'm following this right, or should I change? >>> [1] http://book.cakephp.org/1.3/pt/view/1239/Configura% C3% A7% C3% >>> A3o-Simple >>> [2] http://dpaste.com/hold/762069/ >>> >> -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: How to do a REST WS?
thanks guys to help. Here I am with another problem. I can not serve the content through a file, for example, when I call the url: http://.../ws_billings/generate_extract_consolidated/1/01-06-2012/21-06-2012/ First parameter, validating a Token. Not implemented yet. Second parameter and third parameter is the start date and end date The browser renders the json by json_encode and displays on the screen. {"0": {"Company": {"id": "47", "name": "ASDASDASDASd"}} How to do this action make this type GET, display the file in companyXYZ-ddmmyy.json? For the software consumer read this feature the file and I want to do the manipulation. And besides it can not generate the XML, it generates an error: Error processing XML: characters useless after a document element Position: http://.../ws_billings/generate_extract_consolidated/1/01-06-2012/21-06-2012/xml/a.xml Number of line 1, column 446: And when I generate JSON Error 404: The requested address '/ ws_billings/generate_extract_consolidated/1/01-06-2012/21-06-2012/a.json' was not found on server. The array that I send to the view is correct. Another detail and doubt that there is a need to specify the type generated, it seems to me that the cake is that through the past extensions. But how to pass an extension of a get method? I left the source code on gist [1] [1] https://gist.github.com/2973381 Em sexta-feira, 22 de junho de 2012 07h56min55s UTC-3, the_woodsman escreveu: > > Sorry to be pedantic, but unless I don't understand these routes, it's > worth mentioning that this example isn't strictly REST: > > *Router::connect('/:candidates/addrecord', array('controller'=> > 'candidates', 'action' => 'addRecord', '[method]' => 'POST')); > Router::connect('/:candidates/editrecord', array('controller'=> > 'candidates', 'action' => 'editRecord', '[method]' => 'POST')); > Router::connect('/:candidates/deleterecord', array('controller'=> > 'candidates', 'action' => 'deleteRecord', '[method]' => 'POST'));* > * > * > REST URLs shouldn't contain any verbs, like add, edit, delete, etc, only > nouns. The verbs are implicit in the method, ie. POST vs PUT vs GET vs > DELETE, rather than all using POST. > > This is an HTTP based API, and there's nothing wrong with that! But just > to be clear about REST vs HTTP, I thought I should mention... > > > On Friday, 22 June 2012 10:14:42 UTC+1, Борислав Събев wrote: >> >> Hi, Lucas. >> >> Firstly if you're developing a REST service it's best to use Cake 2.x and >> higher - you can just use the latest stable version. The new Cake version >> has a lot of improvements which will come in handy when you're doing a REST >> service.Then how would you go about building your REST sevice? I will try >> to describe this as >> a general overview of how things should all work together: >> >> Firstly you should set up some of the aspects of >> Routing<http://book.cakephp.org/2.0/en/development/routing.html> >> . >> Concerning *Router**::mapResources(**);* is the fast way to go - it "is >> used to setup a number of default routes for >> REST<http://book.cakephp.org/2.0/en/development/rest.html#the-simple-setup>access >> to your controllers". >> If you want a more fine grade setup you should consider using custom >> REST >> routing<http://book.cakephp.org/2.0/en/development/rest.html#custom-rest-routing>which >> is what I personally prefer using: >> >> *Router::connect('/:candidates/addrecord', array('controller'=> >> 'candidates', 'action' => 'addRecord', '[method]' => 'POST')); >> Router::connect('/:candidates/editrecord', array('controller'=> >> 'candidates', 'action' => 'editRecord', '[method]' => 'POST')); >> Router::connect('/:candidates/deleterecord', array('controller'=> >> 'candidates', 'action' => 'deleteRecord', '[method]' => 'POST')); >> * >> Once you've configured the routes you can proceed to identifying >> requests. Nevertheless this is still part of the initial Router >> configuration: >> * Router::parseExtensions('xml','json','rss'); *- This wil
Re: How to do a REST WS?
e's an example structure of a add method: > * > public function addRecord() { > if ($this->request->is('post')) { > //Authentication ? > //Validate incoming data > if ($this->RecorisXmld->saveAll($data)){ > if($this->RequestHandler->isXml()){ > //Serve a Xml responce > } > if($this->RequestHandler->isRss()){ > //Serve RSS > } > } > } > }* > > CakePHP now (since 2.1) has Json and Xml view > classes<http://book.cakephp.org/2.0/en/views/json-and-xml-views.html>. > What this will do is that for e.g. "After adding 'json' to > Router::parseExtensions() in your routes file, CakePHP will automatically > switch view classes when a request is done with the .json extension, or the > Accept header is application/json." > > So this basically is it. By enabling Cake's core features you could be > able to easily manage a REST service. Hope this helped. > > Cheers, >Borislav. > > On Thursday, 21 June 2012 20:26:28 UTC+3, Lucas Simon Rodrigues Magalhaes > wrote: >> >> Hello I need to build an application in Webservice to return data for a >> particular billing. >> >> First I'm using cakePHP version 1.3, and following the cake book [1]. >> According to according to the book I should map the model which give >> permission to access REST. >> I thought about using REST to provide data json / xml instead of nusoap, >> but I'm sure how to do it. >> >> First I'm using cakePHP version 1.3, and following the cake book [1]. >> According to according to the book I should map the model which give >> permission to access REST. >> >> The problem: >> In this case I need to perform a find in various tables and perform an >> operation with her results in a foreach, and then send the answer to this >> operation via JSON / XML. >> >> What I did: >> I created a controller called ws_billing_controller.php that will manage >> the requests get to the rest. >> routes.php -> Router :: mapResources ('') / / empty do not know what to >> put here >> routes.php -> Router :: parseExtensions ('json', 'xml'); >> ws_billing_controller.php -> [2] >> >> I wonder if the path I'm following this right, or should I change? >> [1] http://book.cakephp.org/1.3/pt/view/1239/Configura% C3% A7% C3% >> A3o-Simple >> [2] http://dpaste.com/hold/762069/ >> > -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: How to do a REST WS?
Hi, Lucas. Firstly if you're developing a REST service it's best to use Cake 2.x and higher - you can just use the latest stable version. The new Cake version has a lot of improvements which will come in handy when you're doing a REST service.Then how would you go about building your REST sevice? I will try to describe this as a general overview of how things should all work together: Firstly you should set up some of the aspects of Routing<http://book.cakephp.org/2.0/en/development/routing.html> . Concerning *Router**::mapResources(**);* is the fast way to go - it "is used to setup a number of default routes for REST<http://book.cakephp.org/2.0/en/development/rest.html#the-simple-setup>access to your controllers". If you want a more fine grade setup you should consider using custom REST routing<http://book.cakephp.org/2.0/en/development/rest.html#custom-rest-routing>which is what I personally prefer using: *Router::connect('/:candidates/addrecord', array('controller'=> 'candidates', 'action' => 'addRecord', '[method]' => 'POST')); Router::connect('/:candidates/editrecord', array('controller'=> 'candidates', 'action' => 'editRecord', '[method]' => 'POST')); Router::connect('/:candidates/deleterecord', array('controller'=> 'candidates', 'action' => 'deleteRecord', '[method]' => 'POST')); * Once you've configured the routes you can proceed to identifying requests. Nevertheless this is still part of the initial Router configuration: * Router::parseExtensions('xml','json','rss'); *- This will instruct the router to parse out file extensions from the URL for e.g.: *http://www.example.com/articles.xml* would parse a file extension of "xml". What this will yield is that the parsed file extension will become available in the Controller's $params property (in *$this->params['ext']*). This property is used (runtime) by the RequestHandler component to automatically switch to alternate layouts and templates, and load helpers corresponding to the given content. So this will greatly help you in the development of a REST service, if you set all your layouts/views by the conventions. So what about handling and serving responses to requests? Firstly you should add the RequestHandler<http://book.cakephp.org/2.0/en/core-libraries/components/request-handling.html>component. If you will be using it in all controllers (which should be the case :) ) you should add it the AppController's $components property: *public $components = array( 'DebugKit.Toolbar', 'Session', 'Auth' => array( 'loginRedirect' => array('controller' => 'users', 'action' => 'index'), 'logoutRedirect' => array('controller' => 'users', 'action' => 'login') ), 'RequestHandler' ); * When the application receives a request for e.g. on: * http://www.example.com/records.xml* by default this will call* RecordsController::**index()*. Here's an example structure of a add method: * public function addRecord() { if ($this->request->is('post')) { //Authentication ? //Validate incoming data if ($this->RecorisXmld->saveAll($data)){ if($this->RequestHandler->isXml()){ //Serve a Xml responce } if($this->RequestHandler->isRss()){ //Serve RSS } } } }* CakePHP now (since 2.1) has Json and Xml view classes<http://book.cakephp.org/2.0/en/views/json-and-xml-views.html>. What this will do is that for e.g. "After adding 'json' to Router::parseExtensions() in your routes file, CakePHP will automatically switch view classes when a request is done with the .json extension, or the Accept header is application/json." So this basically is it. By enabling Cake's core features you could be able to easily manage a REST service. Hope this helped. Cheers, Borislav. On Thursday, 21 June 2012 20:26:28 UTC+3, Lucas Simon Rodrigues Magalhaes wrote: > > Hello I need to build an application in Webservice to return data for a > particular billing. > > First I'm using cakePHP version 1.3, and following the cake book [1]. > According to according to the book I should map the model which give > permission to access REST. > I thought about using REST to provide data json / xml instead of nusoap, > but I'm
How to do a REST WS?
Hello I need to build an application in Webservice to return data for a particular billing. I thought about using REST to provide data json / xml instead of nusoap, but I'm sure how to do it. First I'm using cakePHP version 1.3, and following the cake book [1]. According to according to the book I should map the model which give permission to access REST. The problem: In this case I need to perform a find in various tables and perform an operation with her results in a foreach, and then send the answer to this operation via JSON / XML. What I did: I created a controller called ws_billing_controller.php that will manage the requests get to the rest. routes.php -> Router :: mapResources ('') / / empty do not know what to put here routes.php -> Router :: parseExtensions ('json', 'xml'); ws_billing_controller.php -> [2] I wonder if the path I'm following this right, or should I change? [1] http://book.cakephp.org/1.3/pt/view/1239/Configura% C3% A7% C3% A3o-Simple [2] http://dpaste.com/hold/762069/ -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: I'm coming from Rails 3.2. There are some specific things I'd know how to do in CakePHP 2.0. Can someone help me?
Hi stork! Thanks for your feedback. I'll take a look! On Jun 6, 6:01 pm, stork wrote: > One more thing about migrations - yes, CakePHP does have builtin shell for > database schema > dump/restorehttp://book.cakephp.org/2.0/en/console-and-shells/schema-management-a... > but mentioned CakeDC migrations plugin is better. > > And - welcome in CakePHP community! :-) -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: I'm coming from Rails 3.2. There are some specific things I'd know how to do in CakePHP 2.0. Can someone help me?
Thank you Randy! Surely I'll take a look on these suggestions. On Jun 6, 3:46 pm, randy wrote: > Hey Bruno, > > I can answer some of these with some of my experience. I don't have much > experience in Rails but I try to keep up with what's happening in that camp. > > Packages: Personally, for plugins and libs, I use git submodules. There are > pitfalls there, but it works and since I'm the only one that owns the code, > I just work through them. > > Migrations: I believe Cake supports migrations but have not used them much. > I believe it works similar to Rails. > > Automated Deploys: I've read that people use Cap for PHP deployments. Cap > seems pretty flexible and can be used outside the Rails domain. There's > also things like ant and Phing but haven't looked into this just yet (but > seriously need to) > > Asset Compression: Yes. Via plugin written Mark Story > (https://github.com/markstory/asset_compress) It works pretty well and > supports CDNs. Also supports things like coffee script and lesscss. > > Workers, etc: Cake has a Task/Shell framework that allows you create, well, > tasks and shell programs you can run from cron or wherever. Beyond that, > you can add event handlers/listeners to respond to custom events in Cake's > Event system (http://book.cakephp.org/2.0/en/core-libraries/events.html) > which is new in 2.1. Then there's things like Gearman and Beanstalkd > (neither of which I have exposure to but the concept sounds interesting) > > Skipping some points... Testing: PHPUnit is the framework used by CakePHP > 2+http://book.cakephp.org/2.0/en/development/testing.html > > Like you said, there's many ways to skin a cat, but these are some off the > top of my head. > > Cheers! > randy > > > > > > > > On Wed, Jun 6, 2012 at 8:19 AM, Bruno Dias wrote: > > Hi guys. My intention is not to make comparisons or discuss which > > framework is better. I know the power from both CakePHP and Rails. I'm > > sure that there's a way to do similar things in both of them. > > > So, this is the situation: in Rails framework, I'm used to do > > somethings that I'd like to do on CakePHP (some of them I haven't > > found on the documentation). > > > They are: > > > - Package management > > In Rails, I have the "Gemfile" file, where I write the version of each > > "gem" used in the application. If I want to upgrade or downgrade, I > > change the version and run the "bundle update" command. How do you > > update plugins? Do you use tools like GIT to checkout each one to > > newer versions? > > > - Migrations > > When I need to change the database, I create a empty "migration" file > > through the console command "rails generate migration". Then, in the > > generated file, I add the changes, like > > "rename_column :users, :address, :location". After that, I run "rake > > db:migrate" and the database is migrated. How to do that on CakePHP? > > > - Automated Deployment > > Deployment in Rails can be made automated using the "Capistrano" ruby > > gem. Basically, I run "cap production deploy" in the command line. > > Then, based on the instructions on the "deploy.rb" file, it logs into > > the server(s), clone the newest version of the code from the git > > repository, and backups the current release, so I can rollback. It > > also can create symlinks for "shared" folders (like user uploads), > > recompile the assets, run pending migrations, install new > > dependencies, restart some server processes, restart the application > > itself, and can execute other command line tasks. Is there something > > similar on CakePHP? > > > - Assets compression > > In Rails, when I'm in production mode, the CSS and JS assets are > > automatically compiled into single files, and regenerated after each > > deployment. That's a native feature in Rails 3.1+. Is that possible on > > CakePHP? > > > - Workers and Background Jobs > > Rails can use a gem called "delayed_job" to enqueue tasks to be > > executed in background by "workers", like sending an e-mail after user > > signup, for example. How do you do that? > > > - Namespaces for controllers > > If I want to create an admin interface, or a web service (using the > > "api" namespace, for example), or a "mobile" namespace, I just create > > the respective folders on the "controllers" folder. Then, I put the > > controllers
Re: I'm coming from Rails 3.2. There are some specific things I'd know how to do in CakePHP 2.0. Can someone help me?
One more thing about migrations - yes, CakePHP does have builtin shell for database schema dump/restore http://book.cakephp.org/2.0/en/console-and-shells/schema-management-and-migrations.html but mentioned CakeDC migrations plugin is better. And - welcome in CakePHP community! :-) -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: I'm coming from Rails 3.2. There are some specific things I'd know how to do in CakePHP 2.0. Can someone help me?
- Package management - for libs/vendors/plugins - git submodules - Migrations - mainly for database schema/content changes, but also for filesystem changes dependent on application version (migration does have before() and after() callbacks) - https://github.com/CakeDC/migrations - Automated Deployment - whatever is required (Capistrano, Ant, make...), but I prefer pure git & console shells/tasks executed from git hooks - Assets compression - https://github.com/markstory/asset_compress - Workers and Background Jobs - http://book.cakephp.org/2.0/en/console-and-shells.html - Namespaces for controllers - http://book.cakephp.org/2.0/en/development/routing.html#prefix-routing - Access model methods from view - combination of helpers, http://book.cakephp.org/2.0/en/models/retrieving-your-data.html#creating-custom-find-types and http://book.cakephp.org/2.0/en/models/virtual-fields.html I prefer to not call models from views/elements/layouts/helpers, but it is easy to obtain model instance from ClassRegistry anywhere in application code. - Chaining model scopes - either build $options (conditions, fields, order, recursive, contains...) dynamically, or custom find() type - Tests - http://book.cakephp.org/2.0/en/development/testing.html - mostly through web interface, sometimes also from git hooks and TestShell http://book.cakephp.org/2.0/en/development/testing.html#running-tests-from-command-line -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: I'm coming from Rails 3.2. There are some specific things I'd know how to do in CakePHP 2.0. Can someone help me?
Hey Bruno, I can answer some of these with some of my experience. I don't have much experience in Rails but I try to keep up with what's happening in that camp. Packages: Personally, for plugins and libs, I use git submodules. There are pitfalls there, but it works and since I'm the only one that owns the code, I just work through them. Migrations: I believe Cake supports migrations but have not used them much. I believe it works similar to Rails. Automated Deploys: I've read that people use Cap for PHP deployments. Cap seems pretty flexible and can be used outside the Rails domain. There's also things like ant and Phing but haven't looked into this just yet (but seriously need to) Asset Compression: Yes. Via plugin written Mark Story ( https://github.com/markstory/asset_compress) It works pretty well and supports CDNs. Also supports things like coffee script and lesscss. Workers, etc: Cake has a Task/Shell framework that allows you create, well, tasks and shell programs you can run from cron or wherever. Beyond that, you can add event handlers/listeners to respond to custom events in Cake's Event system (http://book.cakephp.org/2.0/en/core-libraries/events.html) which is new in 2.1. Then there's things like Gearman and Beanstalkd (neither of which I have exposure to but the concept sounds interesting) Skipping some points... Testing: PHPUnit is the framework used by CakePHP 2+ http://book.cakephp.org/2.0/en/development/testing.html Like you said, there's many ways to skin a cat, but these are some off the top of my head. Cheers! randy On Wed, Jun 6, 2012 at 8:19 AM, Bruno Dias wrote: > Hi guys. My intention is not to make comparisons or discuss which > framework is better. I know the power from both CakePHP and Rails. I'm > sure that there's a way to do similar things in both of them. > > So, this is the situation: in Rails framework, I'm used to do > somethings that I'd like to do on CakePHP (some of them I haven't > found on the documentation). > > They are: > > - Package management > In Rails, I have the "Gemfile" file, where I write the version of each > "gem" used in the application. If I want to upgrade or downgrade, I > change the version and run the "bundle update" command. How do you > update plugins? Do you use tools like GIT to checkout each one to > newer versions? > > - Migrations > When I need to change the database, I create a empty "migration" file > through the console command "rails generate migration". Then, in the > generated file, I add the changes, like > "rename_column :users, :address, :location". After that, I run "rake > db:migrate" and the database is migrated. How to do that on CakePHP? > > - Automated Deployment > Deployment in Rails can be made automated using the "Capistrano" ruby > gem. Basically, I run "cap production deploy" in the command line. > Then, based on the instructions on the "deploy.rb" file, it logs into > the server(s), clone the newest version of the code from the git > repository, and backups the current release, so I can rollback. It > also can create symlinks for "shared" folders (like user uploads), > recompile the assets, run pending migrations, install new > dependencies, restart some server processes, restart the application > itself, and can execute other command line tasks. Is there something > similar on CakePHP? > > - Assets compression > In Rails, when I'm in production mode, the CSS and JS assets are > automatically compiled into single files, and regenerated after each > deployment. That's a native feature in Rails 3.1+. Is that possible on > CakePHP? > > - Workers and Background Jobs > Rails can use a gem called "delayed_job" to enqueue tasks to be > executed in background by "workers", like sending an e-mail after user > signup, for example. How do you do that? > > - Namespaces for controllers > If I want to create an admin interface, or a web service (using the > "api" namespace, for example), or a "mobile" namespace, I just create > the respective folders on the "controllers" folder. Then, I put the > controllers there and create the routes to access them. What's the > best way to do that on Cake? > > - Access model methods from view > It seems that CakePHP return an associative array when I grab data > from the database, and not the true "objects". So, I can not access > the model methods. > Let's suppose my UserModel class provides a method called "age" that > calculates the user current age based on his birthday. In Rails, I > could do this on the view: <%= @user.age %>.
I'm coming from Rails 3.2. There are some specific things I'd know how to do in CakePHP 2.0. Can someone help me?
Hi guys. My intention is not to make comparisons or discuss which framework is better. I know the power from both CakePHP and Rails. I'm sure that there's a way to do similar things in both of them. So, this is the situation: in Rails framework, I'm used to do somethings that I'd like to do on CakePHP (some of them I haven't found on the documentation). They are: - Package management In Rails, I have the "Gemfile" file, where I write the version of each "gem" used in the application. If I want to upgrade or downgrade, I change the version and run the "bundle update" command. How do you update plugins? Do you use tools like GIT to checkout each one to newer versions? - Migrations When I need to change the database, I create a empty "migration" file through the console command "rails generate migration". Then, in the generated file, I add the changes, like "rename_column :users, :address, :location". After that, I run "rake db:migrate" and the database is migrated. How to do that on CakePHP? - Automated Deployment Deployment in Rails can be made automated using the "Capistrano" ruby gem. Basically, I run "cap production deploy" in the command line. Then, based on the instructions on the "deploy.rb" file, it logs into the server(s), clone the newest version of the code from the git repository, and backups the current release, so I can rollback. It also can create symlinks for "shared" folders (like user uploads), recompile the assets, run pending migrations, install new dependencies, restart some server processes, restart the application itself, and can execute other command line tasks. Is there something similar on CakePHP? - Assets compression In Rails, when I'm in production mode, the CSS and JS assets are automatically compiled into single files, and regenerated after each deployment. That's a native feature in Rails 3.1+. Is that possible on CakePHP? - Workers and Background Jobs Rails can use a gem called "delayed_job" to enqueue tasks to be executed in background by "workers", like sending an e-mail after user signup, for example. How do you do that? - Namespaces for controllers If I want to create an admin interface, or a web service (using the "api" namespace, for example), or a "mobile" namespace, I just create the respective folders on the "controllers" folder. Then, I put the controllers there and create the routes to access them. What's the best way to do that on Cake? - Access model methods from view It seems that CakePHP return an associative array when I grab data from the database, and not the true "objects". So, I can not access the model methods. Let's suppose my UserModel class provides a method called "age" that calculates the user current age based on his birthday. In Rails, I could do this on the view: <%= @user.age %>. I need to create a view helper for doing that on Cake? Like calc_user_age($user); ?> (or something like that) ? Another situation: Let's suppose I want to get the last comment from a user, and within the comment, insert a link to the related post using the post title. In Rails I would do something like @user.comments.last.post.title to get the post title. How could I do that in Cake, without using that "recursive=3" feature that gets lots of unnecessary data? - Chaining model scopes Let's suppose I have a model called Post. In Rails, I can create scopes on models and mix them the way I want. If I want to the get the "5 last published posts from the category Programming ordered by the most accessed", for example, I would call them this way: "Post.published.from_category("programming").most_accessed.limit(5)". If I want only the draft posts ordered by recent, integrated with pagination, I would call "Post.drafts.recent.page(2)". What is the best way to create and chain scopes on CakePHP? Build dynamically an array of conditions and send it as the parameter for "find"? - Tests What are the testing tools adopted by the CakePHP community? I need to test the models and its methods, test the controllers and its responses and variables, and test the views content (also Javascript interaction), create fixtures, etc. I also would know if there is a way to create something like autotest, that run the tests after file saves. Well, basically these are the points. Sorry for the long post, and for my error-prone and redundant english (i'm not a native speaker). Hope we can have a good conversation. Thank you! -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Infinite scroll, anyone knows how to do it using Paginator?
I used infinite scroll jQuery plugin by Paul Irish. http://www.infinite-scroll.com/ Currently its working fine. :) -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Infinite scroll, anyone knows how to do it using Paginator?
You probably will need to forego using JsHelper and instead write some javascript yourself. On Wed, May 30, 2012 at 7:54 AM, Afif Abu Bakar wrote: > Hi, > > I'm trying to achieve infinite scroll in my project. Currently I'm not using > any jQuery plugin. I just using JsHelper and Paginator available in CakePHP > 2.0 > Right now I managed to do the paginator thingy but it will only triggered > when I click the page numbers. Is there any possible way to achieve it by > using scroll method instead of click? > > Thank you. > > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group at > http://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Infinite scroll, anyone knows how to do it using Paginator?
Hi, I'm trying to achieve infinite scroll in my project. Currently I'm not using any jQuery plugin. I just using JsHelper and Paginator available in CakePHP 2.0 Right now I managed to do the paginator thingy but it will only triggered when I click the page numbers. Is there any possible way to achieve it by using scroll method instead of click? Thank you. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Convert UTF-8 Problem , but i don't know how to do .
Thanks a lot, i used AD7six's shell . All work , now. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Convert UTF-8 Problem , but i don't know how to do .
thanks for answer my question. I will tried it . -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Convert UTF-8 Problem , but i don't know how to do .
On Nov 4, 9:53 am, Điển vũ wrote: > Convert UTF-8 Problem with php , but i don't know how to do . > I want to ask cakephp about this because i use cakephp . > > In cakePHP 1.3 i use 'encoding' => 'UTF-8', it is my mistake. Now i known > it must be 'encoding'=>'uft8' when update to update to cakephp 2.0 > But i end up submit a lot Japanese character , and now it show like this:" > –ルーアã > " > > How can i convert it compatible with 'encoding'=>'utf8' . My database is > utf8_general_ci > from 1.3. You either do it directly on the db (dump, convert, import. OR. dump forceing charset, import) OR You need something like this: https://gist.github.com/05d1f3a4cdf53e110930 AD -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Convert UTF-8 Problem , but i don't know how to do .
well, it should have been utf8 in the first place (even in 1.3 - it shouldnt even work with utf-8). maybe this is the problem? is it possible that the encoding is already messed up in the database? take a look at some utf8 content is the text scrambled or visible? that would be my guess. try running converting tools then on the dump of the db file. On 4 Nov., 09:53, Điển vũ wrote: > Convert UTF-8 Problem with php , but i don't know how to do . > I want to ask cakephp about this because i use cakephp . > > In cakePHP 1.3 i use 'encoding' => 'UTF-8', it is my mistake. Now i known > it must be 'encoding'=>'uft8' when update to update to cakephp 2.0 > But i end up submit a lot Japanese character , and now it show like this:" > –ルーアã > " > > How can i convert it compatible with 'encoding'=>'utf8' . My database is > utf8_general_ci > from 1.3. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Convert UTF-8 Problem , but i don't know how to do .
Convert UTF-8 Problem with php , but i don't know how to do . I want to ask cakephp about this because i use cakephp . In cakePHP 1.3 i use 'encoding' => 'UTF-8', it is my mistake. Now i known it must be 'encoding'=>'uft8' when update to update to cakephp 2.0 But i end up submit a lot Japanese character , and now it show like this:" –ルーアã " How can i convert it compatible with 'encoding'=>'utf8' . My database is utf8_general_ci from 1.3. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
How to do validation
Hi guys, I am new to cakephp i want to know how to do the validation in the cakephp, if i use the $options = array( 'Mr' => 'Mr', 'Mrs' => 'Mrs', 'Ms' => 'Ms', 'Miss' => 'Miss' ); echo $this->Form->input('title', array('type' => 'select', 'options' => $options, 'empty' => 'Please select')); then the server side validation is working fine, but if i use this code, $options = array( 'Mr' => 'Mr', 'Mrs' => 'Mrs', 'Ms' => 'Ms', 'Miss' => 'Miss' ); echo $this->Form->select('title', $options,null,array('empty' => 'Please select')); my server side validation is not working. Same thing is happing if i use the following code for the textbox e.g. echo $this->Form->input('forename', array('class' => 'text')); but works fine for the following echo $this->Form->input('forename', array('class' => 'text')); Can anybody can tell why its not working. tanks in advance. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: "Keep me logged in" feature - how to do this?
Hey Miles, I stumbled upon your component in the bakery and I used version 1.6. After changing the line with $this->Cookie->del() to $this->Cookie- >destroy() the component works perfectly with Cake 1.3.7! There's no error, no problem and everything is working just out of the box! Thanks for this great component, this is a really nice feature! Regards, DD On 12 Mrz., 02:17, Miles J wrote: > https://github.com/milesj/cake-auto_login > > On Mar 11, 2:53 pm, Alejandro Gómez Fernández > wrote: > > > -BEGIN PGP SIGNED MESSAGE- > > Hash: SHA1 > > > Depends on your requirements, you can do this simply with a cookie, or > > implement something more secure, using for example, a dyndns client, > > some data stored in your database, time to live stored in the cookie, > > some hash stored in the cookie and the database ... Posibly you need to > > check or force the connection by ssl. There are many posibilities ... > > > Please, tell us what are you needed and we maybe can provide some ideas. > > > Regards, > > > Alejandro G mez. > > > El 11/03/2011 16:13, DigitalDude escribi : > > > > Hey, > > > > I'm going to need a function called "Keep me logged in" in my app, and > > > I'm not sure how to do this. You've all probably seen such a feature, > > > I'm assuming it means that a cookie or sth else is stored on the > > > user's machine that will tell the browser or the cake app that a user > > > is still logged in with his/her data. > > > > I know some users delete all cookies when they close their browsers > > > (as I do) and this feature will have no effect for them, but for all > > > other users I want this feature to work. > > > > Does any one of you ever coded such a feature or has any idea where to > > > get information on this? > > > > Regards, > > > > DD > > > -BEGIN PGP SIGNATURE- > > Version: GnuPG v1.4.11 (MingW32) > > Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org/ > > > iQEcBAEBAgAGBQJNeqfkAAoJEHQn9CmeN9DJAusH/1BBaIwv74hsBJgL9LWmezaq > > k7+k5jSKY+dF12Oyk2nNF36sbRQ0M0JtS3k3k2SHdVfCuKjiFcqFIyMjl3PWwgaj > > DbNDTJY6Lle7zqy4RYdoza1yIFVTkgpJ4IPtw1LpU9H8pw40Ep+nEOTK8NGaQP+i > > e+vIvkM3Y9zQmlNIAPINuBkzVIjD054iCgEe3YVt7GV4TMmXuu9oDc1U8O+J/1Lf > > 1tUD4uxR8ZI+aWbDuFX7ENrcBnTKav6ldpGfQJtkglEUW16D48DTgR8g7P/QLuiP > > b8uqdjYWKmkqBcGOokldbwpd+mtb9v+qEl9KA5uJOmo2M1FAcPu79YE1745DRgc= > > =KIWV > > -END PGP SIGNATURE- -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: "Keep me logged in" feature - how to do this?
https://github.com/milesj/cake-auto_login On Mar 11, 2:53 pm, Alejandro Gómez Fernández wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Depends on your requirements, you can do this simply with a cookie, or > implement something more secure, using for example, a dyndns client, > some data stored in your database, time to live stored in the cookie, > some hash stored in the cookie and the database ... Posibly you need to > check or force the connection by ssl. There are many posibilities ... > > Please, tell us what are you needed and we maybe can provide some ideas. > > Regards, > > Alejandro G mez. > > El 11/03/2011 16:13, DigitalDude escribi : > > > > > Hey, > > > I'm going to need a function called "Keep me logged in" in my app, and > > I'm not sure how to do this. You've all probably seen such a feature, > > I'm assuming it means that a cookie or sth else is stored on the > > user's machine that will tell the browser or the cake app that a user > > is still logged in with his/her data. > > > I know some users delete all cookies when they close their browsers > > (as I do) and this feature will have no effect for them, but for all > > other users I want this feature to work. > > > Does any one of you ever coded such a feature or has any idea where to > > get information on this? > > > Regards, > > > DD > > -BEGIN PGP SIGNATURE- > Version: GnuPG v1.4.11 (MingW32) > Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org/ > > iQEcBAEBAgAGBQJNeqfkAAoJEHQn9CmeN9DJAusH/1BBaIwv74hsBJgL9LWmezaq > k7+k5jSKY+dF12Oyk2nNF36sbRQ0M0JtS3k3k2SHdVfCuKjiFcqFIyMjl3PWwgaj > DbNDTJY6Lle7zqy4RYdoza1yIFVTkgpJ4IPtw1LpU9H8pw40Ep+nEOTK8NGaQP+i > e+vIvkM3Y9zQmlNIAPINuBkzVIjD054iCgEe3YVt7GV4TMmXuu9oDc1U8O+J/1Lf > 1tUD4uxR8ZI+aWbDuFX7ENrcBnTKav6ldpGfQJtkglEUW16D48DTgR8g7P/QLuiP > b8uqdjYWKmkqBcGOokldbwpd+mtb9v+qEl9KA5uJOmo2M1FAcPu79YE1745DRgc= > =KIWV > -END PGP SIGNATURE- -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: "Keep me logged in" feature - how to do this?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Depends on your requirements, you can do this simply with a cookie, or implement something more secure, using for example, a dyndns client, some data stored in your database, time to live stored in the cookie, some hash stored in the cookie and the database ... Posibly you need to check or force the connection by ssl. There are many posibilities ... Please, tell us what are you needed and we maybe can provide some ideas. Regards, Alejandro Gómez. El 11/03/2011 16:13, DigitalDude escribió: > Hey, > > > I'm going to need a function called "Keep me logged in" in my app, and > I'm not sure how to do this. You've all probably seen such a feature, > I'm assuming it means that a cookie or sth else is stored on the > user's machine that will tell the browser or the cake app that a user > is still logged in with his/her data. > > I know some users delete all cookies when they close their browsers > (as I do) and this feature will have no effect for them, but for all > other users I want this feature to work. > > Does any one of you ever coded such a feature or has any idea where to > get information on this? > > Regards, > > DD > -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJNeqfkAAoJEHQn9CmeN9DJAusH/1BBaIwv74hsBJgL9LWmezaq k7+k5jSKY+dF12Oyk2nNF36sbRQ0M0JtS3k3k2SHdVfCuKjiFcqFIyMjl3PWwgaj DbNDTJY6Lle7zqy4RYdoza1yIFVTkgpJ4IPtw1LpU9H8pw40Ep+nEOTK8NGaQP+i e+vIvkM3Y9zQmlNIAPINuBkzVIjD054iCgEe3YVt7GV4TMmXuu9oDc1U8O+J/1Lf 1tUD4uxR8ZI+aWbDuFX7ENrcBnTKav6ldpGfQJtkglEUW16D48DTgR8g7P/QLuiP b8uqdjYWKmkqBcGOokldbwpd+mtb9v+qEl9KA5uJOmo2M1FAcPu79YE1745DRgc= =KIWV -END PGP SIGNATURE- -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: "Keep me logged in" feature - how to do this?
There are some 'Remember Me' add ons in the bakery. I tried one in that past that worked fairly well. On Mar 11, 2:36 pm, Ryan Schmidt wrote: > On Mar 11, 2011, at 13:13, DigitalDude wrote: > > > I'm going to need a function called "Keep me logged in" in my app, and > > I'm not sure how to do this. You've all probably seen such a feature, > > I'm assuming it means that a cookie or sth else is stored on the > > user's machine that will tell the browser or the cake app that a user > > is still logged in with his/her data. > > > I know some users delete all cookies when they close their browsers > > (as I do) and this feature will have no effect for them, but for all > > other users I want this feature to work. > > > Does any one of you ever coded such a feature or has any idea where to > > get information on this? > > Yup, sounds like a cookie to me. You'll probably store the username and some > form of encrypted password in the cookie. When accessing your login page, or > maybe every page of your site that differs based on the logged-in user, > you'll check if logged in; if not, you'll check if this remember-me cookie > exists. If it does, you'll hand that information off to the login process and > log them in. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: "Keep me logged in" feature - how to do this?
On Mar 11, 2011, at 13:13, DigitalDude wrote: > I'm going to need a function called "Keep me logged in" in my app, and > I'm not sure how to do this. You've all probably seen such a feature, > I'm assuming it means that a cookie or sth else is stored on the > user's machine that will tell the browser or the cake app that a user > is still logged in with his/her data. > > I know some users delete all cookies when they close their browsers > (as I do) and this feature will have no effect for them, but for all > other users I want this feature to work. > > Does any one of you ever coded such a feature or has any idea where to > get information on this? Yup, sounds like a cookie to me. You'll probably store the username and some form of encrypted password in the cookie. When accessing your login page, or maybe every page of your site that differs based on the logged-in user, you'll check if logged in; if not, you'll check if this remember-me cookie exists. If it does, you'll hand that information off to the login process and log them in. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
"Keep me logged in" feature - how to do this?
Hey, I'm going to need a function called "Keep me logged in" in my app, and I'm not sure how to do this. You've all probably seen such a feature, I'm assuming it means that a cookie or sth else is stored on the user's machine that will tell the browser or the cake app that a user is still logged in with his/her data. I know some users delete all cookies when they close their browsers (as I do) and this feature will have no effect for them, but for all other users I want this feature to work. Does any one of you ever coded such a feature or has any idea where to get information on this? Regards, DD -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: HOW TO DO THIS.
No-one will give out their Skype id as that opens the channels for being a help desk. Fine if you want to pay, but is bound to offend when you are declined. This forum is a really, really good place to get help. Stick with it - you will get everything you need from here. Jeremy Burns Class Outfit jeremybu...@classoutfit.com http://www.classoutfit.com On 12 Feb 2011, at 16:20, sanjib dhar wrote: > Ok,thanks for your great advice.I will try to maintain all the jeremy's > step.If possible can u give me u'r skype id.I had opened a company with > kolkata,India clients.I want to work.But the problem is nobody help me out > locally because I am senior most.I often search in internet and get help.I > previously work in ror.If possible give me some advice.again thanks for u'r > great advice. > > > On Sat, Feb 12, 2011 at 9:03 PM, euromark wrote: > when i go through the list of new messages in the group and i read > "HOW TO DO THIS" or "PLEASE HELP" > it just freaks me out > > every other person on this group manages to summarize the problem in a > short sentence > this way you as a reader know right away what the problem is about > you are not getting more help my SHOUTING (thats what capital letters > are for, by the way) > around cries of help... > and THEN - only then - i will not feel offended and probably try to > help you. > > kinda ironic that just a few days ago a thread regarding this subject > has been started: > http://groups.google.com/group/cake-php/browse_thread/thread/c7bc0bb2a530ec08/c047cad1a7fcf0ec > I like jeremy's etiquette guide :) > > sincerely > mark > > > On 12 Feb., 07:22, sanjib dhar wrote: > > solved by view sln. > > > > On Sat, Feb 12, 2011 at 10:43 AM, sanjibdhar...@gmail.com < > > > > > > > > > > > > > > > > sanjibdhar...@gmail.com> wrote: > > > OK sorry. > > > > > On Feb 12, 9:58 am, Jeremy Burns | Class Outfit > > > wrote: > > > > Very respectful. Well done. I suspect he does know the answer. > > > > > > Jeremy Burns > > > > Class Outfit > > > > > > jeremybu...@classoutfit.comhttp://www.classoutfit.com > > > > > > On 12 Feb 2011, at 04:24, sanjib dhar wrote: > > > > > > > "HOW TO DO THIS" is not an appropriate title for your thread! > > > > > by the way > > > > > this means u don't know the answer right. > > > > > On Sat, Feb 12, 2011 at 5:10 AM, euromark > > > wrote: > > > > > "HOW TO DO THIS" is not an appropriate title for your thread! > > > > > by the way > > > > > > > On 11 Feb., 18:27, sanjib dhar wrote: > > > > > > What will be the function like?Can you please send me.I am new in > > > cakephp. > > > > > > > > On Fri, Feb 11, 2011 at 6:55 PM, Mattijs > > > > > > > > > wrote: > > > > > > > Well, > > > > > > > > > You can't sum price directly in your query since you are showing > > > each > > > > > > > record individually as well, so I guess you'll need a combination. > > > > > > > > > a) in your controller: find('all', array('order' => > > > 'Contractor.name, > > > > > > > Table.dt')) > > > > > > > b) in your view: sum up price while iterating. Whenever you get a > > > new > > > > > > > contractor: display sum and reset > > > > > > > > > Alternatively, you could create a function in your Contractor > > > model, > > > > > > > retrieving all contractors with contained items and have that > > > function > > > > > > > calculate the sum into the contractor results. > > > > > > > > > On 11 feb, 13:56, "sanjibdhar...@gmail.com" < > > > sanjibdhar...@gmail.com> > > > > > > > wrote: > > > > > > > > I have a table > > > > > > > > id > > > > > > > > buyer_id > > > > > > > > item_code > > > > > > > > contractor_id > > > > > > > > price > > > > > > > > dt > > > > > > > > item_name > > > > > > > > > > Now
Re: HOW TO DO THIS.
Ok,thanks for your great advice.I will try to maintain all the jeremy's step.If possible can u give me u'r skype id.I had opened a company with kolkata,India clients.I want to work.But the problem is nobody help me out locally because I am senior most.I often search in internet and get help.I previously work in ror.If possible give me some advice.again thanks for u'r great advice. On Sat, Feb 12, 2011 at 9:03 PM, euromark wrote: > when i go through the list of new messages in the group and i read > "HOW TO DO THIS" or "PLEASE HELP" > it just freaks me out > > every other person on this group manages to summarize the problem in a > short sentence > this way you as a reader know right away what the problem is about > you are not getting more help my SHOUTING (thats what capital letters > are for, by the way) > around cries of help... > and THEN - only then - i will not feel offended and probably try to > help you. > > kinda ironic that just a few days ago a thread regarding this subject > has been started: > > http://groups.google.com/group/cake-php/browse_thread/thread/c7bc0bb2a530ec08/c047cad1a7fcf0ec > I like jeremy's etiquette guide :) > > sincerely > mark > > > On 12 Feb., 07:22, sanjib dhar wrote: > > solved by view sln. > > > > On Sat, Feb 12, 2011 at 10:43 AM, sanjibdhar...@gmail.com < > > > > > > > > > > > > > > > > sanjibdhar...@gmail.com> wrote: > > > OK sorry. > > > > > On Feb 12, 9:58 am, Jeremy Burns | Class Outfit > > > wrote: > > > > Very respectful. Well done. I suspect he does know the answer. > > > > > > Jeremy Burns > > > > Class Outfit > > > > > > jeremybu...@classoutfit.comhttp://www.classoutfit.com > > > > > > On 12 Feb 2011, at 04:24, sanjib dhar wrote: > > > > > > > "HOW TO DO THIS" is not an appropriate title for your thread! > > > > > by the way > > > > > this means u don't know the answer right. > > > > > On Sat, Feb 12, 2011 at 5:10 AM, euromark < > dereurom...@googlemail.com> > > > wrote: > > > > > "HOW TO DO THIS" is not an appropriate title for your thread! > > > > > by the way > > > > > > > On 11 Feb., 18:27, sanjib dhar wrote: > > > > > > What will be the function like?Can you please send me.I am new in > > > cakephp. > > > > > > > > On Fri, Feb 11, 2011 at 6:55 PM, Mattijs < > mattijsmeib...@hotmail.com> > > > wrote: > > > > > > > Well, > > > > > > > > > You can't sum price directly in your query since you are > showing > > > each > > > > > > > record individually as well, so I guess you'll need a > combination. > > > > > > > > > a) in your controller: find('all', array('order' => > > > 'Contractor.name, > > > > > > > Table.dt')) > > > > > > > b) in your view: sum up price while iterating. Whenever you get > a > > > new > > > > > > > contractor: display sum and reset > > > > > > > > > Alternatively, you could create a function in your Contractor > > > model, > > > > > > > retrieving all contractors with contained items and have that > > > function > > > > > > > calculate the sum into the contractor results. > > > > > > > > > On 11 feb, 13:56, "sanjibdhar...@gmail.com" < > > > sanjibdhar...@gmail.com> > > > > > > > wrote: > > > > > > > > I have a table > > > > > > > > id > > > > > > > > buyer_id > > > > > > > > item_code > > > > > > > > contractor_id > > > > > > > > price > > > > > > > > dt > > > > > > > > item_name > > > > > > > > > > Now I want display dt(date) wise billing but contactor also > will > > > be in > > > > > > > > sequence like this: > > > > > > > > > > Contractorbuyer_id item_code price > > > >
Re: HOW TO DO THIS.
when i go through the list of new messages in the group and i read "HOW TO DO THIS" or "PLEASE HELP" it just freaks me out every other person on this group manages to summarize the problem in a short sentence this way you as a reader know right away what the problem is about you are not getting more help my SHOUTING (thats what capital letters are for, by the way) around cries of help... and THEN - only then - i will not feel offended and probably try to help you. kinda ironic that just a few days ago a thread regarding this subject has been started: http://groups.google.com/group/cake-php/browse_thread/thread/c7bc0bb2a530ec08/c047cad1a7fcf0ec I like jeremy's etiquette guide :) sincerely mark On 12 Feb., 07:22, sanjib dhar wrote: > solved by view sln. > > On Sat, Feb 12, 2011 at 10:43 AM, sanjibdhar...@gmail.com < > > > > > > > > sanjibdhar...@gmail.com> wrote: > > OK sorry. > > > On Feb 12, 9:58 am, Jeremy Burns | Class Outfit > > wrote: > > > Very respectful. Well done. I suspect he does know the answer. > > > > Jeremy Burns > > > Class Outfit > > > > jeremybu...@classoutfit.comhttp://www.classoutfit.com > > > > On 12 Feb 2011, at 04:24, sanjib dhar wrote: > > > > > "HOW TO DO THIS" is not an appropriate title for your thread! > > > > by the way > > > > this means u don't know the answer right. > > > > On Sat, Feb 12, 2011 at 5:10 AM, euromark > > wrote: > > > > "HOW TO DO THIS" is not an appropriate title for your thread! > > > > by the way > > > > > On 11 Feb., 18:27, sanjib dhar wrote: > > > > > What will be the function like?Can you please send me.I am new in > > cakephp. > > > > > > On Fri, Feb 11, 2011 at 6:55 PM, Mattijs > > wrote: > > > > > > Well, > > > > > > > You can't sum price directly in your query since you are showing > > each > > > > > > record individually as well, so I guess you'll need a combination. > > > > > > > a) in your controller: find('all', array('order' => > > 'Contractor.name, > > > > > > Table.dt')) > > > > > > b) in your view: sum up price while iterating. Whenever you get a > > new > > > > > > contractor: display sum and reset > > > > > > > Alternatively, you could create a function in your Contractor > > model, > > > > > > retrieving all contractors with contained items and have that > > function > > > > > > calculate the sum into the contractor results. > > > > > > > On 11 feb, 13:56, "sanjibdhar...@gmail.com" < > > sanjibdhar...@gmail.com> > > > > > > wrote: > > > > > > > I have a table > > > > > > > id > > > > > > > buyer_id > > > > > > > item_code > > > > > > > contractor_id > > > > > > > price > > > > > > > dt > > > > > > > item_name > > > > > > > > Now I want display dt(date) wise billing but contactor also will > > be in > > > > > > > sequence like this: > > > > > > > > Contractor buyer_id item_code price > > > > > > > item_name > > > > > > > A 12 2112 > > > > > > > S jgj > > > > > > > A > > > > > > > 14 .. > > > --- > > --- > > > > > > > sum(price) > > > > > > > > B > > > ... > > ... > > > > > > > B > > > ... > > ... > > > > > > > B > > > ... > > ... > > > --- > > --- > > > > > > > sum(price) > > > >
Re: HOW TO DO THIS.
solved by view sln. On Sat, Feb 12, 2011 at 10:43 AM, sanjibdhar...@gmail.com < sanjibdhar...@gmail.com> wrote: > OK sorry. > > On Feb 12, 9:58 am, Jeremy Burns | Class Outfit > wrote: > > Very respectful. Well done. I suspect he does know the answer. > > > > Jeremy Burns > > Class Outfit > > > > jeremybu...@classoutfit.comhttp://www.classoutfit.com > > > > On 12 Feb 2011, at 04:24, sanjib dhar wrote: > > > > > > > > > > > > > > > > > "HOW TO DO THIS" is not an appropriate title for your thread! > > > by the way > > > this means u don't know the answer right. > > > On Sat, Feb 12, 2011 at 5:10 AM, euromark > wrote: > > > "HOW TO DO THIS" is not an appropriate title for your thread! > > > by the way > > > > > On 11 Feb., 18:27, sanjib dhar wrote: > > > > What will be the function like?Can you please send me.I am new in > cakephp. > > > > > > On Fri, Feb 11, 2011 at 6:55 PM, Mattijs > wrote: > > > > > Well, > > > > > > > You can't sum price directly in your query since you are showing > each > > > > > record individually as well, so I guess you'll need a combination. > > > > > > > a) in your controller: find('all', array('order' => > 'Contractor.name, > > > > > Table.dt')) > > > > > b) in your view: sum up price while iterating. Whenever you get a > new > > > > > contractor: display sum and reset > > > > > > > Alternatively, you could create a function in your Contractor > model, > > > > > retrieving all contractors with contained items and have that > function > > > > > calculate the sum into the contractor results. > > > > > > > On 11 feb, 13:56, "sanjibdhar...@gmail.com" < > sanjibdhar...@gmail.com> > > > > > wrote: > > > > > > I have a table > > > > > > id > > > > > > buyer_id > > > > > > item_code > > > > > > contractor_id > > > > > > price > > > > > > dt > > > > > > item_name > > > > > > > > Now I want display dt(date) wise billing but contactor also will > be in > > > > > > sequence like this: > > > > > > > > Contractorbuyer_id item_code price > > > > > > item_name > > > > > > A 12 2112 > > > > > > Sjgj > > > > > > A > > > > > > 14.. > > > > > > > > --- > --- > > > > > > sum(price) > > > > > > > > B > > > > > > ... > ... > > > > > > B > > > > > > ... > ... > > > > > > B > > > > > > ... > ... > > > > > > > > --- > --- > > > > > > sum(price) > > > > > > C > > > > > > ... > ... > > > > > > C > > > > > > ... > ... > > > > > > C > > > > > > ... > ... > > > > > > > > --- > --- > > > > > > sum(price) > > > > > > > > how to write the query. > > > > > > > -- > > > > > Our newest site for the community: CakePHP Video Tutorials > > > > >http://tv.cakephp.org > > > > > Check out
Re: HOW TO DO THIS.
OK sorry. On Feb 12, 9:58 am, Jeremy Burns | Class Outfit wrote: > Very respectful. Well done. I suspect he does know the answer. > > Jeremy Burns > Class Outfit > > jeremybu...@classoutfit.comhttp://www.classoutfit.com > > On 12 Feb 2011, at 04:24, sanjib dhar wrote: > > > > > > > > > "HOW TO DO THIS" is not an appropriate title for your thread! > > by the way > > this means u don't know the answer right. > > On Sat, Feb 12, 2011 at 5:10 AM, euromark > > wrote: > > "HOW TO DO THIS" is not an appropriate title for your thread! > > by the way > > > On 11 Feb., 18:27, sanjib dhar wrote: > > > What will be the function like?Can you please send me.I am new in cakephp. > > > > On Fri, Feb 11, 2011 at 6:55 PM, Mattijs > > > wrote: > > > > Well, > > > > > You can't sum price directly in your query since you are showing each > > > > record individually as well, so I guess you'll need a combination. > > > > > a) in your controller: find('all', array('order' => 'Contractor.name, > > > > Table.dt')) > > > > b) in your view: sum up price while iterating. Whenever you get a new > > > > contractor: display sum and reset > > > > > Alternatively, you could create a function in your Contractor model, > > > > retrieving all contractors with contained items and have that function > > > > calculate the sum into the contractor results. > > > > > On 11 feb, 13:56, "sanjibdhar...@gmail.com" > > > > wrote: > > > > > I have a table > > > > > id > > > > > buyer_id > > > > > item_code > > > > > contractor_id > > > > > price > > > > > dt > > > > > item_name > > > > > > Now I want display dt(date) wise billing but contactor also will be in > > > > > sequence like this: > > > > > > Contractor buyer_id item_code price > > > > > item_name > > > > > A 12 2112 > > > > > S jgj > > > > > A > > > > > 14 .. > > > > > --- > > > > --- > > > > > sum(price) > > > > > > B > > > > ... > > > > ... > > > > > B > > > > ... > > > > ... > > > > > B > > > > ... > > > > ... > > > > > --- > > > > --- > > > > > sum(price) > > > > > C > > > > ... > > > > ... > > > > > C > > > > ... > > > > ... > > > > > C > > > > ... > > > > ... > > > > > --- > > > > --- > > > > > sum(price) > > > > > > how to write the query. > > > > > -- > > > > Our newest site for the community: CakePHP Video Tutorials > > > >http://tv.cakephp.org > > > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp > > > > others with their CakePHP related questions. > > > > > To unsubscribe from this group, send email to > > > > cake-php+unsubscr...@googlegroups.com For more options, visit this group > > > > athttp://groups.google.com/group/cake-php > > > -- > > Our newest site for the community: CakePHP Video > > Tutorialshttp://tv.cakephp.org > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help > > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > > cake-php+unsubscr...@googlegroups.com For more options, visit this group > > athttp://groups.google.com/group/cake-php > > > -- > > Our newest site for the community: CakePHP Video > > Tutorialshttp://tv.cakephp.org > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help > > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > > cake-php+unsubscr...@googlegroups.com For more options, visit this group > > athttp://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: HOW TO DO THIS.
Very respectful. Well done. I suspect he does know the answer. Jeremy Burns Class Outfit jeremybu...@classoutfit.com http://www.classoutfit.com On 12 Feb 2011, at 04:24, sanjib dhar wrote: > "HOW TO DO THIS" is not an appropriate title for your thread! > by the way > this means u don't know the answer right. > On Sat, Feb 12, 2011 at 5:10 AM, euromark wrote: > "HOW TO DO THIS" is not an appropriate title for your thread! > by the way > > On 11 Feb., 18:27, sanjib dhar wrote: > > What will be the function like?Can you please send me.I am new in cakephp. > > > > > > > > > > > > > > > > On Fri, Feb 11, 2011 at 6:55 PM, Mattijs wrote: > > > Well, > > > > > You can't sum price directly in your query since you are showing each > > > record individually as well, so I guess you'll need a combination. > > > > > a) in your controller: find('all', array('order' => 'Contractor.name, > > > Table.dt')) > > > b) in your view: sum up price while iterating. Whenever you get a new > > > contractor: display sum and reset > > > > > Alternatively, you could create a function in your Contractor model, > > > retrieving all contractors with contained items and have that function > > > calculate the sum into the contractor results. > > > > > On 11 feb, 13:56, "sanjibdhar...@gmail.com" > > > wrote: > > > > I have a table > > > > id > > > > buyer_id > > > > item_code > > > > contractor_id > > > > price > > > > dt > > > > item_name > > > > > > Now I want display dt(date) wise billing but contactor also will be in > > > > sequence like this: > > > > > > Contractorbuyer_id item_code price > > > > item_name > > > > A 12 2112 > > > > Sjgj > > > > A > > > > 14.. > > > > > --- > > > --- > > > > sum(price) > > > > > > B > > > ... > > > ... > > > > B > > > > > > ... > > > ... > > > > B > > > ... > > > ... > > > > > --- > > > --- > > > > sum(price) > > > > C > > > ... > > > ... > > > > C > > > ... > > > ... > > > > C > > > ... > > > ... > > > > > --- > > > --- > > > > sum(price) > > > > > > how to write the query. > > > > > -- > > > Our newest site for the community: CakePHP Video Tutorials > > >http://tv.cakephp.org > > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help > > > others with their CakePHP related questions. > > > > > To unsubscribe from this group, send email to > > > cake-php+unsubscr...@googlegroups.com For more options, visit this group > > > athttp://groups.google.com/group/cake-php > > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group at > http://groups.google.com/group/cake-php > > > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group at > http://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
RE: HOW TO DO THIS.
Seriously? Euromark is a name I look for in responses because he knows what he is talking about! But after that comment I doubt you will see many responses to any of your questions. From SanJib => delete message. Also if you knew how to ask a question then maybe someone could answer it. K -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: HOW TO DO THIS.
*"HOW TO DO THIS" is not an appropriate title for your thread! by the way *this means u don't know the answer right. On Sat, Feb 12, 2011 at 5:10 AM, euromark wrote: > "HOW TO DO THIS" is not an appropriate title for your thread! > by the way > > On 11 Feb., 18:27, sanjib dhar wrote: > > What will be the function like?Can you please send me.I am new in > cakephp. > > > > > > > > > > > > > > > > On Fri, Feb 11, 2011 at 6:55 PM, Mattijs > wrote: > > > Well, > > > > > You can't sum price directly in your query since you are showing each > > > record individually as well, so I guess you'll need a combination. > > > > > a) in your controller: find('all', array('order' => 'Contractor.name, > > > Table.dt')) > > > b) in your view: sum up price while iterating. Whenever you get a new > > > contractor: display sum and reset > > > > > Alternatively, you could create a function in your Contractor model, > > > retrieving all contractors with contained items and have that function > > > calculate the sum into the contractor results. > > > > > On 11 feb, 13:56, "sanjibdhar...@gmail.com" > > > wrote: > > > > I have a table > > > > id > > > > buyer_id > > > > item_code > > > > contractor_id > > > > price > > > > dt > > > > item_name > > > > > > Now I want display dt(date) wise billing but contactor also will be > in > > > > sequence like this: > > > > > > Contractorbuyer_id item_code price > > > > item_name > > > > A 12 2112 > > > > Sjgj > > > > A > > > > 14.. > > > > > > --- > --- > > > > sum(price) > > > > > > B > > > > ... > ... > > > > B > > > > ... > ... > > > > B > > > > ... > ... > > > > > > --- > --- > > > > sum(price) > > > > C > > > > ... > ... > > > > C > > > > ... > ... > > > > C > > > > ... > ... > > > > > > --- > --- > > > > sum(price) > > > > > > how to write the query. > > > > > -- > > > Our newest site for the community: CakePHP Video Tutorials > > >http://tv.cakephp.org > > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help > > > others with their CakePHP related questions. > > > > > To unsubscribe from this group, send email to > > > cake-php+unsubscr...@googlegroups.com For more options, visit this > group > > > athttp://groups.google.com/group/cake-php > > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group > at http://groups.google.com/group/cake-php > -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: HOW TO DO THIS.
"HOW TO DO THIS" is not an appropriate title for your thread! by the way On 11 Feb., 18:27, sanjib dhar wrote: > What will be the function like?Can you please send me.I am new in cakephp. > > > > > > > > On Fri, Feb 11, 2011 at 6:55 PM, Mattijs wrote: > > Well, > > > You can't sum price directly in your query since you are showing each > > record individually as well, so I guess you'll need a combination. > > > a) in your controller: find('all', array('order' => 'Contractor.name, > > Table.dt')) > > b) in your view: sum up price while iterating. Whenever you get a new > > contractor: display sum and reset > > > Alternatively, you could create a function in your Contractor model, > > retrieving all contractors with contained items and have that function > > calculate the sum into the contractor results. > > > On 11 feb, 13:56, "sanjibdhar...@gmail.com" > > wrote: > > > I have a table > > > id > > > buyer_id > > > item_code > > > contractor_id > > > price > > > dt > > > item_name > > > > Now I want display dt(date) wise billing but contactor also will be in > > > sequence like this: > > > > Contractor buyer_id item_code price > > > item_name > > > A 12 2112 > > > S jgj > > > A > > > 14 .. > > > --- > > --- > > > sum(price) > > > > B > > ... > > ... > > > B > > ... > > ... > > > B > > ... > > ... > > > --- > > --- > > > sum(price) > > > C > > ... > > ... > > > C > > ... > > ... > > > C > > ... > > ... > > > --- > > --- > > > sum(price) > > > > how to write the query. > > > -- > > Our newest site for the community: CakePHP Video Tutorials > >http://tv.cakephp.org > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help > > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > > cake-php+unsubscr...@googlegroups.com For more options, visit this group > > athttp://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: HOW TO DO THIS.
What will be the function like?Can you please send me.I am new in cakephp. On Fri, Feb 11, 2011 at 6:55 PM, Mattijs wrote: > Well, > > You can't sum price directly in your query since you are showing each > record individually as well, so I guess you'll need a combination. > > a) in your controller: find('all', array('order' => 'Contractor.name, > Table.dt')) > b) in your view: sum up price while iterating. Whenever you get a new > contractor: display sum and reset > > Alternatively, you could create a function in your Contractor model, > retrieving all contractors with contained items and have that function > calculate the sum into the contractor results. > > On 11 feb, 13:56, "sanjibdhar...@gmail.com" > wrote: > > I have a table > > id > > buyer_id > > item_code > > contractor_id > > price > > dt > > item_name > > > > Now I want display dt(date) wise billing but contactor also will be in > > sequence like this: > > > > Contractorbuyer_id item_code price > > item_name > > A 12 2112 > > Sjgj > > A > > 14.. > > > -- > > sum(price) > > > > B > .. > > B > > .. > > B > .. > > > -- > > sum(price) > > C > .. > > C > .. > > C > .. > > > -- > > sum(price) > > > > how to write the query. > > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group > at http://groups.google.com/group/cake-php > -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: HOW TO DO THIS.
Well, You can't sum price directly in your query since you are showing each record individually as well, so I guess you'll need a combination. a) in your controller: find('all', array('order' => 'Contractor.name, Table.dt')) b) in your view: sum up price while iterating. Whenever you get a new contractor: display sum and reset Alternatively, you could create a function in your Contractor model, retrieving all contractors with contained items and have that function calculate the sum into the contractor results. On 11 feb, 13:56, "sanjibdhar...@gmail.com" wrote: > I have a table > id > buyer_id > item_code > contractor_id > price > dt > item_name > > Now I want display dt(date) wise billing but contactor also will be in > sequence like this: > > Contractor buyer_id item_code price > item_name > A 12 2112 > S jgj > A > 14 .. > -- > sum(price) > > B > .. > B > .. > B > .. > -- > sum(price) > C > .. > C > .. > C > .. > -- > sum(price) > > how to write the query. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
HOW TO DO THIS.
I have a table id buyer_id item_code contractor_id price dt item_name Now I want display dt(date) wise billing but contactor also will be in sequence like this: Contractorbuyer_id item_code price item_name A 12 2112 Sjgj A 14.. -- sum(price) B .. B .. B .. -- sum(price) C .. C .. C .. -- sum(price) how to write the query. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: HOw to do a Simple search form in CakePHP
Thats true clarify a lot !!! LOL My post sound like a young developer (brrr brrr..) Thanks for your time. I´ll do it. God bless you. 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: HOw to do a Simple search form in CakePHP
Well, it certainly clarifies a lot :) "My app is not working" Turn on debug in the config/core.php file, set it to 2. Use debug in your code, as described in the CakePHP book at: http://book.cakephp.org/view/1190/Basic-Debugging and see what kind of data you are working with, whether or not they conform to what you expect. You are the developer, so please develop, use debug, and tell us what is wrong, what error messages you get, what you don't get! Not just sentences saying "... is wrong, ... is not working, etc." It doesn't give us any information with which to work on your issue! Enjoy, John On Jun 18, 12:05 am, Alejo wrote: > My app is not working. > I need some example working for try to understand what is wrong with > this code. > > The pagination is not working. > > I think that should be some other way to do it, but I dont know. > > Thanks. > > Alejus 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: HOw to do a Simple search form in CakePHP
My app is not working. I need some example working for try to understand what is wrong with this code. The pagination is not working. I think that should be some other way to do it, but I dont know. Thanks. Alejus 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: HOw to do a Simple search form in CakePHP
Please provide more information! What is not working? Is the paginate not returning anything? Is the searchConditions method not returning the correct condition? Or is your problem something else? Enjoy, John On Jun 17, 4:02 pm, Alejo wrote: > Hi I want to use a simple search form, but I cant do it.can someone > help me? > My idea is use it with differents tables, models and parameters too. > > I´m trying this code: > > in controller: > > function search($word = null){ > if($word !== null){ > $this->paginate = array( > 'YourModel' => array( > 'conditions' => $this->YourModel->searchConditions($word), > > ), > ); > $this->set('result',$this->paginate()); > } > > } > > in Model: > > function searchConditions($word){ > // your search for colmuns > $searchFor = array( > 'colmun1', > 'colmun2', > 'colmun3', > ); > > $word = trim($word); > $conditions = array('OR' => array()); > foreach($searchFor as $colmun){ > $conditions['OR']["$colmun like"] = "%$word%"; > } > return $conditions; > > } > > And the view > echo $form->create('Posts', array('action' => 'search')); > > echo $form->input('query'); > > echo $form->end('Search Post'); > > ?> > > But its not working. > > Thanks a lot. God bless you. > > Alejus Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
HOw to do a Simple search form in CakePHP
Hi I want to use a simple search form, but I cant do it.can someone help me? My idea is use it with differents tables, models and parameters too. I´m trying this code: in controller: function search($word = null){ if($word !== null){ $this->paginate = array( 'YourModel' => array( 'conditions' => $this->YourModel- >searchConditions($word), ), ); $this->set('result',$this->paginate()); } } in Model: function searchConditions($word){ // your search for colmuns $searchFor = array( 'colmun1', 'colmun2', 'colmun3', ); $word = trim($word); $conditions = array('OR' => array()); foreach($searchFor as $colmun){ $conditions['OR']["$colmun like"] = "%$word%"; } return $conditions; } And the view create('Posts', array('action' => 'search')); echo $form->input('query'); echo $form->end('Search Post'); ?> But its not working. Thanks a lot. God bless you. Alejus 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: How to do "shipping address same as billing" in Cake?
Anything like that--a user interface feature--should be handled with JavaScript. Save the server-side for the server-side. On Oct 19, 10:06 pm, "Tamim A." wrote: > Hi All, > > I am working on a project that requires one of those options where you check > "Shipping address is same as billing address" and then the shipping form > fields are automatically filled in. I've seen some Javascript functions out > there that do the trick, but is there a 'proper' or preferred way of doing > this with Cake? Thanks much. > > Best Regards, > > Tamim > > www.OtherUsesFor.com > Find and share other uses for ... everything! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
How to do "shipping address same as billing" in Cake?
Hi All, I am working on a project that requires one of those options where you check "Shipping address is same as billing address" and then the shipping form fields are automatically filled in. I've seen some Javascript functions out there that do the trick, but is there a 'proper' or preferred way of doing this with Cake? Thanks much. Best Regards, Tamim www.OtherUsesFor.com Find and share other uses for ... everything! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the 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: Still no answer on how to do this...
Dear Kyte sorry for the delay, I forgot! Solution just add this code in the beginning of the app\config\routes.php file $singleton_router =& Router::getInstance(); if(!in_array('q',$singleton_router->named['default'])) $singleton_router->named['default'][]='q'; the problem is that the default named parameters in CakePHP routing are 'page', 'fields', 'order', 'limit', 'recursive', 'sort', 'direction', 'step' that's why we need to add this 'q' named parameter otherwise cakePHP will not detect the route you have defined have a nice baking day On Oct 11, 12:34 am, Kyle Decot wrote: > I'm using $html->link() not $html->url(); I don't know why I typed > that. > > I don't know what you mean by the first part of your response > > On Oct 10, 5:29 pm, robust solution wrote: > > > > > Dear Kyle Decot > > > I think whenever you define a route in the routes.php you should not > > repeat the route parameters in every url you want to show... the > > shortcut is enough > > > this is first... > > > secondly > > > ->url is for url > > > for hyperlink use ->link > > > On Oct 10, 11:21 pm, Kyle Decot wrote: > > > > Can someone please help me with this? I've tried posting on here and > > > on the IRC channel and no one can seem to figure this out...it this > > > just not possible with cake? All I am trying to do is creating a link > > > using reverse routing and having named params in the URL. > > > > On Oct 9, 10:38 pm, Kyle Decot wrote: > > > > > I want to set up my website so I can have urls like: > > > > > sample.com/search/ > > > > sample.com/search/q:search+terms/ > > > > sample.com/search/country:us/region:oh/ > > > > ..etc.. > > > > > I also want to be able to do reverse routing w/ my links. I have my > > > > routes.php set up like: > > > > > Router::connect('/search/*', array('controller' => 'model', 'action' > > > > => 'index')); > > > > > and then I print a link like: > > > > > echo $html->url("search",array > > > > ("controller"=>"model","action"=>"index","q"=>"search terms go > > > > here")); > > > > > but the link comes out as: > > > > > /model/index/q:search/ > > > > > What am I doing wrong? I have tried to get an answer to this question > > > > before but nobody can seem to tell me the correct way of doing this. > > > > Any help you can give me is EXTREMELY appreciated!- Hide quoted text - > > > > - Show quoted text -- Hide quoted text - > > - Show quoted text - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Still no answer on how to do this...
I'm using $html->link() not $html->url(); I don't know why I typed that. I don't know what you mean by the first part of your response On Oct 10, 5:29 pm, robust solution wrote: > Dear Kyle Decot > > I think whenever you define a route in the routes.php you should not > repeat the route parameters in every url you want to show... the > shortcut is enough > > this is first... > > secondly > > ->url is for url > > for hyperlink use ->link > > On Oct 10, 11:21 pm, Kyle Decot wrote: > > > > > Can someone please help me with this? I've tried posting on here and > > on the IRC channel and no one can seem to figure this out...it this > > just not possible with cake? All I am trying to do is creating a link > > using reverse routing and having named params in the URL. > > > On Oct 9, 10:38 pm, Kyle Decot wrote: > > > > I want to set up my website so I can have urls like: > > > > sample.com/search/ > > > sample.com/search/q:search+terms/ > > > sample.com/search/country:us/region:oh/ > > > ..etc.. > > > > I also want to be able to do reverse routing w/ my links. I have my > > > routes.php set up like: > > > > Router::connect('/search/*', array('controller' => 'model', 'action' > > > => 'index')); > > > > and then I print a link like: > > > > echo $html->url("search",array > > > ("controller"=>"model","action"=>"index","q"=>"search terms go > > > here")); > > > > but the link comes out as: > > > > /model/index/q:search/ > > > > What am I doing wrong? I have tried to get an answer to this question > > > before but nobody can seem to tell me the correct way of doing this. > > > Any help you can give me is EXTREMELY appreciated!- Hide quoted text - > > > - Show quoted text - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Still no answer on how to do this...
Dear Kyle Decot I think whenever you define a route in the routes.php you should not repeat the route parameters in every url you want to show... the shortcut is enough this is first... secondly ->url is for url for hyperlink use ->link On Oct 10, 11:21 pm, Kyle Decot wrote: > Can someone please help me with this? I've tried posting on here and > on the IRC channel and no one can seem to figure this out...it this > just not possible with cake? All I am trying to do is creating a link > using reverse routing and having named params in the URL. > > On Oct 9, 10:38 pm, Kyle Decot wrote: > > > > > I want to set up my website so I can have urls like: > > > sample.com/search/ > > sample.com/search/q:search+terms/ > > sample.com/search/country:us/region:oh/ > > ..etc.. > > > I also want to be able to do reverse routing w/ my links. I have my > > routes.php set up like: > > > Router::connect('/search/*', array('controller' => 'model', 'action' > > => 'index')); > > > and then I print a link like: > > > echo $html->url("search",array > > ("controller"=>"model","action"=>"index","q"=>"search terms go > > here")); > > > but the link comes out as: > > > /model/index/q:search/ > > > What am I doing wrong? I have tried to get an answer to this question > > before but nobody can seem to tell me the correct way of doing this. > > Any help you can give me is EXTREMELY appreciated!- Hide quoted text - > > - Show quoted text - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Still no answer on how to do this...
Can someone please help me with this? I've tried posting on here and on the IRC channel and no one can seem to figure this out...it this just not possible with cake? All I am trying to do is creating a link using reverse routing and having named params in the URL. On Oct 9, 10:38 pm, Kyle Decot wrote: > I want to set up my website so I can have urls like: > > sample.com/search/ > sample.com/search/q:search+terms/ > sample.com/search/country:us/region:oh/ > ..etc.. > > I also want to be able to do reverse routing w/ my links. I have my > routes.php set up like: > > Router::connect('/search/*', array('controller' => 'model', 'action' > => 'index')); > > and then I print a link like: > > echo $html->url("search",array > ("controller"=>"model","action"=>"index","q"=>"search terms go > here")); > > but the link comes out as: > > /model/index/q:search/ > > What am I doing wrong? I have tried to get an answer to this question > before but nobody can seem to tell me the correct way of doing this. > Any help you can give me is EXTREMELY appreciated! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the 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 -~--~~~~--~~--~--~---
Still no answer on how to do this...
I want to set up my website so I can have urls like: sample.com/search/ sample.com/search/q:search+terms/ sample.com/search/country:us/region:oh/ ..etc.. I also want to be able to do reverse routing w/ my links. I have my routes.php set up like: Router::connect('/search/*', array('controller' => 'model', 'action' => 'index')); and then I print a link like: echo $html->url("search",array ("controller"=>"model","action"=>"index","q"=>"search terms go here")); but the link comes out as: /model/index/q:search/ What am I doing wrong? I have tried to get an answer to this question before but nobody can seem to tell me the correct way of doing this. Any help you can give me is EXTREMELY appreciated! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How to do ...
Dear Veoempleo, All you have to do is to define a custom routes in the routes.php file in the app/config folder but be aware so that this new custom route dosent overwite any of the the 7 default routes of the core and the custom routes that are already in the routes.php file I recommend you to use this route Router::connect('/:username',array ('controller'=>'an_existing_users_controller_or_a_new_one','action'=>'the_action_that_displays_what_you_want_to_display')); so in the 'an_existing_users_controller_or_a_new_one' controller you define|reuse 'the_action_that_displays_what_you_want_to_display' that recognize the :username slug as $this->params['username'] On Oct 2, 10:43 pm, Veoempleo wrote: > Hi, > > I'd like to have a personal link for everyuser, for example: > > http://mysite.com/presentation/user_xx > > How Could I do that? Do I have to create presentation controller? > > params doesn't catch user_xx whitout ":" symbol, how Could I get > user_xx from controller? > > Thank you very much --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
How to do ...
Hi, I'd like to have a personal link for everyuser, for example: http://mysite.com/presentation/user_xx How Could I do that? Do I have to create presentation controller? params doesn't catch user_xx whitout ":" symbol, how Could I get user_xx from controller? Thank you very much --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How to do "English to Japanese" ?
please, do not spam for me. 2009/7/24 ghostjackyo > > Excuse me ! > I want to do English to Japanese , but I don't know how to write it > from PHP ! > Because I don't know Japanese , so I need make it auto ! > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
How to do "English to Japanese" ?
Excuse me ! I want to do English to Japanese , but I don't know how to write it from PHP ! Because I don't know Japanese , so I need make it auto ! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the 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: HABTM with only two tables... How to do that..?
I think you can create a HABTM onto "itself" by aliasing. Look at the full definition of the relationship in the cookbook and you will find that you can call the related table something other than it's real name. I don't really get what you want to achieve. At first glance I think I would have done something quite different. Partly because of the headache I get from building a mental picture of this kind of data- structure. E.g. a relationship that is only relevant for half the possible values in that emun field. What about a teacher that has a child in school... that sort of thing. On Feb 19, 8:24 pm, ggcakephp wrote: > Hi.. I have a problem with HABTM relation... > I have two types of users "parent" and "student"(child of the parent) > stored in one table named "users". Field in this table named "type" > defines which type of user it is. > > Fields in table "users": > `id` int(11) > `type` enum('a','t','p','s') //a - admin, t - teacher, p - parent, s > - student(child) > `name` varchar(60) > `surname` varchar(60) > `login` varchar(16) > `password` char(40) > > Fields in table used to join named "childrensparents" > `id` int(11) auto_increment, > `parent_id` int(11) // foreign key identifying unique user from > table "users" (which has "type" field set as 'p') > `child_id` int(11) // foreign key identifying unique user from table > "users" (which has "type" field set as 's') > > ...so both foreign keys are "linked" to the same table ("user") > > I have to define parent-child relation in "User" model, assuming that > one parent can have many children(students) and one child(student) > belongs to one or more parents > > I have no idea how to define "$hasAndBelongsToMany" relation in this > case (being honest i never used this type of ralation before, i'm > working with cakePHP since two months, so many things are new to my) > > I'll be grateful for any help > Thankyou to all in advance --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
HABTM with only two tables... How to do that..?
Hi.. I have a problem with HABTM relation... I have two types of users "parent" and "student"(child of the parent) stored in one table named "users". Field in this table named "type" defines which type of user it is. Fields in table "users": `id` int(11) `type` enum('a','t','p','s') //a - admin, t - teacher, p - parent, s - student(child) `name` varchar(60) `surname` varchar(60) `login` varchar(16) `password` char(40) Fields in table used to join named "childrensparents" `id` int(11) auto_increment, `parent_id` int(11) // foreign key identifying unique user from table "users" (which has "type" field set as 'p') `child_id` int(11) // foreign key identifying unique user from table "users" (which has "type" field set as 's') ...so both foreign keys are "linked" to the same table ("user") I have to define parent-child relation in "User" model, assuming that one parent can have many children(students) and one child(student) belongs to one or more parents I have no idea how to define "$hasAndBelongsToMany" relation in this case (being honest i never used this type of ralation before, i'm working with cakePHP since two months, so many things are new to my) I'll be grateful for any help Thankyou to all in advance --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How to do Data Sanitization in CakePHP 1.2.9?
What you need is XSS cleanup. Try with http://bakery.cakephp.org/articles/view/brita-component-with-html-purifier You can use Sanitize::stripScripts(), but htmlpurifier is much better. On Feb 11, 7:13 am, Yogesh wrote: > Hi, > I want to avoid the script tag so that no one do the hack or insert > the records using script tag. > I don't know what it should be called exactly, but in my database some > times records get inserted automatically and continuously about 100 to > 150 records, these are seems to be inserted using some script and all > the records are like some javascript code or some links. and if Model > does this automatically how can these records get inserted. or I am > understanding the Data sanitization meaning in wrong way. > > On Feb 10, 2:20 pm, Miles J wrote: > > > The model automatically sanitizesdatawhen inserting and selecting > > queries. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How to do Data Sanitization in CakePHP 1.2.9?
Hi, I want to avoid the script tag so that no one do the hack or insert the records using script tag. I don't know what it should be called exactly, but in my database some times records get inserted automatically and continuously about 100 to 150 records, these are seems to be inserted using some script and all the records are like some javascript code or some links. and if Model does this automatically how can these records get inserted. or I am understanding the Data sanitization meaning in wrong way. On Feb 10, 2:20 pm, Miles J wrote: > The model automatically sanitizesdatawhen inserting and selecting > queries. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How to do Data Sanitization in CakePHP 1.2.9?
The model automatically sanitizes data when inserting and selecting queries. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
How to do Data Sanitization in CakePHP 1.2.9?
Hi All Can any one please tell how I can do the data sanitization for the users submitted data? and which is better place to write it, is it in Controller or in Model? I don't know anything about reagarding data sanitization. I need it from start to end means which helper or libraries i need to include for this Please help me out !! Thanks in advance --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
How to do this in cakephp
I have two dropdown boxes if value of one dropdown changes then according to that value of second dropdown changes i doing that using ajax my problem is that in my edit view only one dropdown box is displaying value from database not second one it is displaying blank my controller code is as follows: set('co',$co); $name=$this->Session->read('User'); $query1=mysql_query("select id from users where username='$name'"); $row1=mysql_fetch_array($query1); $user_id=$row1[0]; $this->set('user_id',$user_id); $this->Entry->recursive = 1; $this->set('entries', $this->Entry->findAll(null, null, array ('Section.id' => 'ASC','Submenu.submenu' => 'ASC'))); } function view($id = null){ if (!$id){ $this->Session->setFlash('Invalid id for Entry.'); $this->redirect('/entries/index'); } $this->set('entry', $this->Entry->read(null, $id)); } function add() { $this->set('sections', $this->Entry->Section->find('list',array ('fields'=>'Section.section','Section.id'))); if (empty($this->data)) { $this->render(); } else { $this->data['Entry']['name'] = $this->data['Entry']['File']['name']; $this->data['Entry']['type'] = $this->data['Entry']['File']['type']; $this->data['Entry']['size'] = $this->data['Entry']['File']['size']; if ($this->Entry->save($this->data)) { $id=mysql_insert_id(); $query=mysql_query("select max(counter) from entries"); $row=mysql_fetch_array($query); $co=$row[0]+1; $q=mysql_query("update entries set counter=$co where id=$id"); if (move_uploaded_file($this->data['Entry']['File']['tmp_name'], WWW_ROOT.'/files/' .$this->data['Entry']['File']['name'])) { $this->Session->setFlash('The Entry has been saved'); $this->redirect('/entries/index'); } else { echo "There was an error uploading the file, please try again!"; } //{ //echo "File uploaded successfully"; //} } else { $this->Session->setFlash('Please correct errors below.'); $this->redirect('/entries/add'); } } } --this is my edit function--- function edit($id = null){ $this->set('sections', $this->Entry->Section->find('list',array ('fields'=>'Section.section','Section.id','recursive' => 1,'page' => 1,))); if (empty($this->data)){ if (!$id){ $this->Session->setFlash('Invalid id for Entry'); $this->redirect('/entries/index'); } $this->data = $this->Entry->read(null, $id); } else{ $query=mysql_query("select max(counter) from entries"); $row=mysql_fetch_array($query); $co=$row[0]+1; $q=mysql_query("update entries set counter=$co where id=$id"); if ($this->Entry->save($this->data)){ $this->Session->setFlash('The Entry has been saved'); $this->redirect('/entries/index'); } else{ $this->Session->setFlash('Please correct errors below.'); } } } --i m using ajax here- function update_select(){ if(!empty($this->data['Entry']['section_id'])){ $section_id = (int)$this->data['Entry']['section_id']; $options = $this->Entry->Submenu->find('list',array('section_id'=> $section_id,'recursive' => 1,'conditions'=>array('section_id'=> $section_id),'page' => 1,'fields'=>'Submenu.submenu')); $this->set('options',$options); } } }?> --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How to do this in cakephp
this will help me but it is not returning value it is returning only Array as value please help me how to solve this porblem ---see this -- Counter : Array function index(){ $count = $this->Entry->find('all', array('fields' => array('(max (Entry.counter)) as max_counter'))); $this->set('count',$count); $name=$this->Session->read('User'); $query1=mysql_query("select id from users where username='$name'"); $row1=mysql_fetch_array($query1); $user_id=$row1[0]; $this->set('user_id',$user_id); $this->Entry->recursive = 1; $this->set('entries', $this->Entry->findAll(null, null, array ('Section.id' => 'ASC','Submenu.submenu' => 'ASC'))); } It is returning value as counter --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How to do this in cakephp
$count = $this->Entry->find('all', array('fields' => array('(max (Entries.counter)) as max_counter')); Will return an array with the max_counter value in it. On Jan 8, 8:29 am, mona wrote: > I know how to handle queries but i don't know how to fetch values of > variables for example > i wan't to fetch max(counter) so i know how to write query but how to > store value of this in some variable and print them in my index view > for eg > $query=mysql_query("select max(counter) from entries"); > how to fetch max value from database of some field in cakephp how to > write this query in cakephp > $row=mysql_fetch_array($query); > $co=$row[0]+1; ' > what to use instead of mysql_fetch_array in cakephp --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How to do this in cakephp
I know how to handle queries but i don't know how to fetch values of variables for example i wan't to fetch max(counter) so i know how to write query but how to store value of this in some variable and print them in my index view for eg $query=mysql_query("select max(counter) from entries"); how to fetch max value from database of some field in cakephp how to write this query in cakephp $row=mysql_fetch_array($query); $co=$row[0]+1; ' what to use instead of mysql_fetch_array in cakephp --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How to do this in cakephp
I'm not sure I understand your question, but if you have a field you want to save a counter in, you can do this in the model using countCache: http://book.cakephp.org/view/445/cacheQueries If on the other hand you need to find the count from some set of values, you can simply use find('count'): http://book.cakephp.org/view/73/Retrieving-Your-Data On Jan 8, 4:46 am, mona wrote: > I have code of my controller in which i use normal php codes to fetch > data from a database and update counter how to do this in cakephp > > class EntriesController extends AppController > { > var $name = 'Entries'; > var $helpers = array('Html','Form','Javascript','Ajax'); > var $components = array('RequestHandler'); > //var $uses=array('Entry','User'); > function index(){ > > -please consider it > - > $query=mysql_query("select max(counter) from entries"); > $row=mysql_fetch_array($query); > $co=$row[0]; > $this->set('co',$co); > $name=$this->Session->read('User'); > $query1=mysql_query("select id from users where username='$name'"); > $row1=mysql_fetch_array($query1); > $user_id=$row1[0]; > $this->set('user_id',$user_id); > > > $this->Entry->recursive = 1; > $this->set('entries', $this->Entry->findAll(null, null, array > ('Section.id' => 'ASC','Submenu.submenu' => 'ASC'))); > } > > function view($id = null){ > if (!$id){ > $this->Session->setFlash('Invalid id for Entry.'); > $this->redirect('/entries/index'); > } > $this->set('entry', $this->Entry->read(null, $id)); > } > > function add(){ > $this->set('sections', $this->Entry->Section->find('list',array > ('fields'=>'Section.section','Section.id'))); > if (empty($this->data)){ > $this->render(); > } > else{ > $this->data['Entry']['name'] = $this->data['Entry']['File']['name']; > $this->data['Entry']['type'] = $this->data['Entry']['File'] > ['type']; > $this->data['Entry']['size'] = $this->data['Entry']['File'] > ['size']; > if ($this->Entry->save($this->data)){ > -please check it from > here--- > $id=mysql_insert_id(); > $query=mysql_query("select max(counter) from entries"); > $row=mysql_fetch_array($query); > $co=$row[0]+1; > $q=mysql_query("update entries set counter=$co where id=$id"); > -- > $this->Session->setFlash('The Entry has been saved'); > } > else{ > $this->Session->setFlash('Please correct errors below.'); > $this->redirect('/entries/add'); > } > if (move_uploaded_file($this->data['Entry']['File']['tmp_name'], > WWW_ROOT.'/files/' .$this->data['Entry']['File']['name'])) > { > echo "File uploaded successfully"; > } > else{ > echo "There was an error uploading the file, please try again!"; > } > $this->redirect('/entries/index'); > } > } > > function edit($id = null){ > $this->set('sections', $this->Entry->Section->find('list',array > ('fields'=>'Section.section','Section.id','recursive' => 1,'page' => > 1,))); > if (empty($this->data)){ > if (!$id){ > $this->Session->setFlash('Invalid id for Entry'); > $this->redirect('/entries/index'); > } > $this->data = $this->Entry->read(null, $id); > } > else{ > ---please
Re: How to do this in cakephp
You can use Model->query('any sql statement') to execute arbitrary sql code. Bear in mind, however, that what you're trying to do can be done with cake's built in methods in a much cleaner way. Model->query() should really be used as a last resort when cake can't handle what you're trying to do natively. Please do take some time to read the docs (http://book.cakephp.org/) you'll find answers to 90% of your problemas in the first 4 chapters. mona wrote: > I have code of my controller in which i use normal php codes to fetch > data from a database and update counter how to do this in cakephp > > > class EntriesController extends AppController > { > var $name = 'Entries'; > var $helpers = array('Html','Form','Javascript','Ajax'); > var $components = array('RequestHandler'); > //var $uses=array('Entry','User'); > function index(){ > > -please consider it > - > $query=mysql_query("select max(counter) from entries"); > $row=mysql_fetch_array($query); > $co=$row[0]; > $this->set('co',$co); > $name=$this->Session->read('User'); > $query1=mysql_query("select id from users where username='$name'"); > $row1=mysql_fetch_array($query1); > $user_id=$row1[0]; > $this->set('user_id',$user_id); > > > > $this->Entry->recursive = 1; > $this->set('entries', $this->Entry->findAll(null, null, array > ('Section.id' => 'ASC','Submenu.submenu' => 'ASC'))); > } > >function view($id = null){ >if (!$id){ >$this->Session->setFlash('Invalid id for Entry.'); >$this->redirect('/entries/index'); >} >$this->set('entry', $this->Entry->read(null, $id)); >} > > function add(){ > $this->set('sections', $this->Entry->Section->find('list',array > ('fields'=>'Section.section','Section.id'))); > if (empty($this->data)){ > $this->render(); > } > else{ > $this->data['Entry']['name'] = $this->data['Entry']['File']['name']; > $this->data['Entry']['type'] = $this->data['Entry']['File'] > ['type']; > $this->data['Entry']['size'] = $this->data['Entry']['File'] > ['size']; > if ($this->Entry->save($this->data)){ > -please check it from > here--- > $id=mysql_insert_id(); > $query=mysql_query("select max(counter) from entries"); > $row=mysql_fetch_array($query); > $co=$row[0]+1; > $q=mysql_query("update entries set counter=$co where id=$id"); > -- > $this->Session->setFlash('The Entry has been saved'); > } > else{ > $this->Session->setFlash('Please correct errors below.'); > $this->redirect('/entries/add'); > } > if (move_uploaded_file($this->data['Entry']['File']['tmp_name'], > WWW_ROOT.'/files/' .$this->data['Entry']['File']['name'])) > { > echo "File uploaded successfully"; > } > else{ > echo "There was an error uploading the file, please try again!"; > } > $this->redirect('/entries/index'); > } > } > > function edit($id = null){ > $this->set('sections', $this->Entry->Section->find('list',array > ('fields'=>'Section.section','Section.id','recursive' => 1,'page' => > 1,))); > if (empty($this->data)){ > if (!$id){ > $this->Session->setFlash('Invalid id for Entry'); > $this->redirect('/entries/index'); > } > $this->data = $this->Entry->read(null, $id); > } > else{ > -
Re: How to do this in cakephp
How to do what in CakePHP? Thomas On Jan 8, 7:46 am, mona wrote: > I have code of my controller in which i use normal php codes to fetch > data from a database and update counter how to do this in cakephp > > class EntriesController extends AppController > { > var $name = 'Entries'; > var $helpers = array('Html','Form','Javascript','Ajax'); > var $components = array('RequestHandler'); > //var $uses=array('Entry','User'); > function index(){ > > -please consider it > - > $query=mysql_query("select max(counter) from entries"); > $row=mysql_fetch_array($query); > $co=$row[0]; > $this->set('co',$co); > $name=$this->Session->read('User'); > $query1=mysql_query("select id from users where username='$name'"); > $row1=mysql_fetch_array($query1); > $user_id=$row1[0]; > $this->set('user_id',$user_id); > > > $this->Entry->recursive = 1; > $this->set('entries', $this->Entry->findAll(null, null, array > ('Section.id' => 'ASC','Submenu.submenu' => 'ASC'))); > } > > function view($id = null){ > if (!$id){ > $this->Session->setFlash('Invalid id for Entry.'); > $this->redirect('/entries/index'); > } > $this->set('entry', $this->Entry->read(null, $id)); > } > > function add(){ > $this->set('sections', $this->Entry->Section->find('list',array > ('fields'=>'Section.section','Section.id'))); > if (empty($this->data)){ > $this->render(); > } > else{ > $this->data['Entry']['name'] = $this->data['Entry']['File']['name']; > $this->data['Entry']['type'] = $this->data['Entry']['File'] > ['type']; > $this->data['Entry']['size'] = $this->data['Entry']['File'] > ['size']; > if ($this->Entry->save($this->data)){ > -please check it from > here--- > $id=mysql_insert_id(); > $query=mysql_query("select max(counter) from entries"); > $row=mysql_fetch_array($query); > $co=$row[0]+1; > $q=mysql_query("update entries set counter=$co where id=$id"); > -- > $this->Session->setFlash('The Entry has been saved'); > } > else{ > $this->Session->setFlash('Please correct errors below.'); > $this->redirect('/entries/add'); > } > if (move_uploaded_file($this->data['Entry']['File']['tmp_name'], > WWW_ROOT.'/files/' .$this->data['Entry']['File']['name'])) > { > echo "File uploaded successfully"; > } > else{ > echo "There was an error uploading the file, please try again!"; > } > $this->redirect('/entries/index'); > } > } > > function edit($id = null){ > $this->set('sections', $this->Entry->Section->find('list',array > ('fields'=>'Section.section','Section.id','recursive' => 1,'page' => > 1,))); > if (empty($this->data)){ > if (!$id){ > $this->Session->setFlash('Invalid id for Entry'); > $this->redirect('/entries/index'); > } > $this->data = $this->Entry->read(null, $id); > } > else{ > ---please > check-- > $query=mysql_query("select max(counter) from entries"); > $row=mysql_fetch_array($query); > $co=$row[0]+1; > $q=mysql_query("update entries set counter=$co where id=$id"); > -
How to do this in cakephp
I have code of my controller in which i use normal php codes to fetch data from a database and update counter how to do this in cakephp set('co',$co); $name=$this->Session->read('User'); $query1=mysql_query("select id from users where username='$name'"); $row1=mysql_fetch_array($query1); $user_id=$row1[0]; $this->set('user_id',$user_id); $this->Entry->recursive = 1; $this->set('entries', $this->Entry->findAll(null, null, array ('Section.id' => 'ASC','Submenu.submenu' => 'ASC'))); } function view($id = null){ if (!$id){ $this->Session->setFlash('Invalid id for Entry.'); $this->redirect('/entries/index'); } $this->set('entry', $this->Entry->read(null, $id)); } function add(){ $this->set('sections', $this->Entry->Section->find('list',array ('fields'=>'Section.section','Section.id'))); if (empty($this->data)){ $this->render(); } else{ $this->data['Entry']['name'] = $this->data['Entry']['File']['name']; $this->data['Entry']['type'] = $this->data['Entry']['File'] ['type']; $this->data['Entry']['size'] = $this->data['Entry']['File'] ['size']; if ($this->Entry->save($this->data)){ -please check it from here--- $id=mysql_insert_id(); $query=mysql_query("select max(counter) from entries"); $row=mysql_fetch_array($query); $co=$row[0]+1; $q=mysql_query("update entries set counter=$co where id=$id"); -- $this->Session->setFlash('The Entry has been saved'); } else{ $this->Session->setFlash('Please correct errors below.'); $this->redirect('/entries/add'); } if (move_uploaded_file($this->data['Entry']['File']['tmp_name'], WWW_ROOT.'/files/' .$this->data['Entry']['File']['name'])) { echo "File uploaded successfully"; } else{ echo "There was an error uploading the file, please try again!"; } $this->redirect('/entries/index'); } } function edit($id = null){ $this->set('sections', $this->Entry->Section->find('list',array ('fields'=>'Section.section','Section.id','recursive' => 1,'page' => 1,))); if (empty($this->data)){ if (!$id){ $this->Session->setFlash('Invalid id for Entry'); $this->redirect('/entries/index'); } $this->data = $this->Entry->read(null, $id); } else{ ---please check-- $query=mysql_query("select max(counter) from entries"); $row=mysql_fetch_array($query); $co=$row[0]+1; $q=mysql_query("update entries set counter=$co where id=$id"); if ($this->Entry->save($this->data)){ $this->Session->setFlash('The Entry has been saved'); $this->redirect('/entries/index'); } else{ $this->Session->setFlash('Please correct errors below.'); } } } function delete($id = null){ if (!$id){ $this->Session->setFlash('Invalid id for Entry'); $this->redirect('/entries/index'); } if ($this->Entry->del($id)){ $this->Session->setFlash('Record deleted successfully'); $this->redirect('/entries/index'); } } function update_select(){ if(!empty($this->data['Entry']['section_id'])){ $section_id = (int)$this->data['Entry']['section_id']; $options = $this->Entry->Submenu->find('list',array('section_id'=> $section_id,'recursive' => 1,'conditions'=>array('section_id'=> $section_id),'page' => 1,'fields'=>'Submenu.submenu')); $this->set('options',$options); } } } ?> --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How to do this SQL query in Cake way - use one column twice in the same query.
>From your original SQL, it looks like you want to AND two LIKE statements (which is guaranteed to be very slow), but that said, why not just do that in your conditions: $whereArray = array('conditions' => array( 'AND' => array( 'referer like %google%', 'referer like %\%E6\%B5\%81\%E7\%A8\%8B \%E5\%9B\%BE%', 'request_path like /blog/posts/view/ flowchart-howtos%' ) ) On Dec 22, 12:01 am, "felixd...@gmail.com" wrote: > Hi all, I have such a SQL statement to query: > SELECT * FROM `mytable` WHERE `referer` LIKE '%google%' AND `referer` > LIKE '%\%E6\%B5\%81\%E7\%A8\%8B\%E5\%9B\%BE%' AND `request_path` LIKE > '/blog/posts/view/flowchart-howtos%' > > I use the column `referer` twice in the same SQL query. > > I tried with > > $this->LogParser->find(array('referer LIKE'=>array('%google%', '%\%E6\ > %B5\%81\%E7\%A8\%8B\%E5\%9B\%BE%'), 'request_path LIKE'=>'/blog/posts/ > view/flowchart-howtos%')); > > which gave me > > ... WHERE `referer LIKE` IN ('%google%', '%E6%B5%81%E7%A8%8B%E5%9B > %BE') ... > > apparently that is not correct. > > Any can kindly help me? Thanks! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
How to do this SQL query in Cake way - use one column twice in the same query.
Hi all, I have such a SQL statement to query: SELECT * FROM `mytable` WHERE `referer` LIKE '%google%' AND `referer` LIKE '%\%E6\%B5\%81\%E7\%A8\%8B\%E5\%9B\%BE%' AND `request_path` LIKE '/blog/posts/view/flowchart-howtos%' I use the column `referer` twice in the same SQL query. I tried with $this->LogParser->find(array('referer LIKE'=>array('%google%', '%\%E6\ %B5\%81\%E7\%A8\%8B\%E5\%9B\%BE%'), 'request_path LIKE'=>'/blog/posts/ view/flowchart-howtos%')); which gave me ... WHERE `referer LIKE` IN ('%google%', '%E6%B5%81%E7%A8%8B%E5%9B %BE') ... apparently that is not correct. Any can kindly help me? Thanks! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How to do a migration? Database schemas are driving me mad.
I'll answer my own rant for future reference on the subject. I ended up doing it this way: Got the majority of the schema migration queries from Navicat (a gui for MySQL). Got a more complete list of collation and charset changes by using this little script I found and modified a bit: http://bogdan.org.ua/2008/02/08/convert-mysql-database-from-one-encodingcollation-into-another.html I now had an sql-file that would put everything into an application default charset and collaton. I still had to manually check and enter the collation and charset data for fields and tables that for one reason of another had to use a different setting than the "application default". It was a bit of a mess and not a lot of fun, but it worked. /Martin On Oct 7, 11:09 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hi, > I am about to go grey-haired from trying to migrate our database > schema. How on earth can this be done without screwing it all up > royally? A part from tedious, manual creation of many many alter > statements, what do you use? How do you do it? > That is the short question... > > ...here is the longer explaining rant: > > The problem is character sets and collations. They can be ignored for > smaller, english applications but are a necessity for larger and > especially non-english language applications. > > Typical affected parts of my data: > Any character-field used as a "keyword" or as a unique index. Things > of that sort MUST bave the correct collation to work. > Any list of names that should be sorted. Names of files, folders, > people... whatever. Without the correct collation a portion of the > data will be sorted the wrong way. > Any texts that should be searchable. The wrong collation means the > search feature will find too many or too few results in some cases. > > So what's the problem? > Cake's schema support ignores these thing completely. (which is better > than partial support IMHO) > mysqldiff.org and most reasonably priced software I have tried for > creating diffs or migrations have only partial support. Ignoring field- > level settings while altering table-level defaults... but keeping all > settings when creating new tables. > MySQL (at least v5) applies the current default table-level settings > to any field without its own specification. Which makes the support of > the software I have tried even more treacherous to use. They will > implement a new table default but that will have no effect on any > existing field. > > All this makes for a high-risk situation where a migration is almost > more likely to cause problems than not. > > Leaving character set and collation out will write the current > defaults (of a higher "level") to the created table or field. That > means that the only level where a migration tool absolutely must > support this is on the fields. Any change to anything else will have > no effect at all on existing fields or tables... I have found no > software that support this. :) > > My problem is finding a way of modifying my schema this once so that > the next time I can use an "automated" diff or migration. > > Martin - feeling screwier than sql --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
How to do a migration? Database schemas are driving me mad.
Hi, I am about to go grey-haired from trying to migrate our database schema. How on earth can this be done without screwing it all up royally? A part from tedious, manual creation of many many alter statements, what do you use? How do you do it? That is the short question... ...here is the longer explaining rant: The problem is character sets and collations. They can be ignored for smaller, english applications but are a necessity for larger and especially non-english language applications. Typical affected parts of my data: Any character-field used as a "keyword" or as a unique index. Things of that sort MUST bave the correct collation to work. Any list of names that should be sorted. Names of files, folders, people... whatever. Without the correct collation a portion of the data will be sorted the wrong way. Any texts that should be searchable. The wrong collation means the search feature will find too many or too few results in some cases. So what's the problem? Cake's schema support ignores these thing completely. (which is better than partial support IMHO) mysqldiff.org and most reasonably priced software I have tried for creating diffs or migrations have only partial support. Ignoring field- level settings while altering table-level defaults... but keeping all settings when creating new tables. MySQL (at least v5) applies the current default table-level settings to any field without its own specification. Which makes the support of the software I have tried even more treacherous to use. They will implement a new table default but that will have no effect on any existing field. All this makes for a high-risk situation where a migration is almost more likely to cause problems than not. Leaving character set and collation out will write the current defaults (of a higher "level") to the created table or field. That means that the only level where a migration tool absolutely must support this is on the fields. Any change to anything else will have no effect at all on existing fields or tables... I have found no software that support this. :) My problem is finding a way of modifying my schema this once so that the next time I can use an "automated" diff or migration. Martin - feeling screwier than sql --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: how to do multiple hasmany
You need to combine them both into 1 hasMany array: var $hasMany = array( 'Childclass1' => array( 'className' => 'Childclass1' ), 'Childclass2' => array( 'className' => 'Childclass2' ) ); On Aug 22, 12:43 am, robert123 <[EMAIL PROTECTED]> wrote: > i have parent model, it has two hasmany child model, > > in the model class, I tried to model this relation by writing two time > in the parent model class > > var $hasMany = array('Childclass1' => >array('className' => > 'Childclass1'); > > var $hasMany = array('Childclass2' => >array('className' => > 'Childclass2'); > > but it giving me the below error > Cannot redeclare Childclass2::$hasMany > > anyone can let me know, how to solve this, thank you > > http://www.generics.ws/jpn/レビトラ(塩酸バルデナフィルHCL_)に20_MGについて-p-115.htmlhttp://www.generics.ws/jpn/プロペシア(フィナステライド)-p-4.htmlhttp://www.generics.ws/jpn/バイアグラ(クエン酸シルデナフィル)-p-2.html --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
how to do multiple hasmany
i have parent model, it has two hasmany child model, in the model class, I tried to model this relation by writing two time in the parent model class var $hasMany = array('Childclass1' => array('className' => 'Childclass1'); var $hasMany = array('Childclass2' => array('className' => 'Childclass2'); but it giving me the below error Cannot redeclare Childclass2::$hasMany anyone can let me know, how to solve this, thank you http://www.generics.ws/jpn/レビトラ(塩酸バルデナフィルHCL_)に20_MGについて-p-115.html http://www.generics.ws/jpn/プロペシア(フィナステライド)-p-4.html http://www.generics.ws/jpn/バイアグラ(クエン酸シルデナフィル)-p-2.html --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
How to do two deep sorting on paginator?
I want to sort on a two deep related table. I have immoble [n:1] zona [n:1] localitat >From the immobles controller, in the view I can do: $paginator->sort(__('LOCALITAT_ID_GI_IMMOBLES',true), 'Zona.nom') But what I want to do is: $paginator->sort(__('LOCALITAT_ID_GI_IMMOBLES',true), 'Zona.Localitat.nom') TIA Leo --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: how to do custom exception handling
Hi, As for me, I create my own DB driver class (extends of DboMysql) that I used in database.php This class contains a showQuery methode, which is called by Cake to display any DB errors. I use an array ( ErrNumber => function_to_call) initialized in each model. If an error occurs and it's in this array, I call the function associated to. Otherwise, I call the parent:showQuery(). The function associated is as well declare in each model. If it can help you SajjadRaza a écrit : > hi > can any one tell me abt the built in mechanism of > exception handling in cake php > thanks. > > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
how to do custom exception handling
hi can any one tell me abt the built in mechanism of exception handling in cake php thanks. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Content Modules? How to do that?
Hi all :) I'm currently working on a CMS-Like webapp. You're able to add an arbitary amount of content-elements to a page - which are sortable. Everyhtings workin fine. Now i want these content-elements to be some sort of modules. So that i can have several different content-element- types like Text, Headline, HTML, Image and so on. You get the idea? This of course should be easily extendable to any needs. Every Module needs its own Admin-Form and output-routine. So how to design that? I have the DB-Table 'contents' which as among others the fields "content" and "module_id". And i thought of using vendors which offer functions like: createForm() - for the Input-Form parseContent() - for the output. And the content is then saved serialized in the DB. Are there any better patterns? Were could i get into trouble with this? Thanks in advance, Nils --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How to do just a view ?
Ola Juan ! Thanks a lot : you gave me the keywords I didn't had that prevent me for searching more ! ($uses and _javascript_ helper) Thanks again. Juan F. Gimenez Silva wrote: El lun, 04-02-2008 a las 02:21 -0800, zeugme escribió: Hi, Hello (also, hello to all bakers!), I'm new in CakePHP, amazingly, I choose CakePHP for the power of MVC, SQL mapping ... It's nice to hear that, I'm pretty much a newbie too. but I need to deal with my home page witch have no model. This page however is not purely static, it contains PHP, SQL ... Where do I put such files ? /app/webroot ? or /app/view.pages ? I think the easiest way to do that would be to create a controller with a home() action that uses (see the $uses variables) the models where you need to get the data for the home page. That way you can create methods on the models involved to return the data, so, no need for SQL at all. What are the differences between those 2 folders ? This page also rely on some _javascript_ framework (JQuery). Where do I put my jquery.js file ? If I put it inside app/webroot/js it doesn't appears to be taken into account ... It's like if I had to put that general js files at the physical root, the folder that contains /app. No, you have to put it in app/webroot/js, and load it using the _javascript_ Helper, remember to load the helper on the appropiate controller. Maybe there is some doc I should read ? I read the manual, tuto, browse the bakery and did not found, but that do not mean it doesn't exists :-) Thanks for your help ! I hope that helps! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How to do just a view ?
Put your static pages in /view/pages/ (ex. /view/pages/mypage.ctp). Then browse it from http://.../pages/ (ex. http://.../pages/mypage) And read the doc like said Thrilller ;) Jakecake --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How to do just a view ?
El lun, 04-02-2008 a las 02:21 -0800, zeugme escribió: > Hi, > Hello (also, hello to all bakers!), > I'm new in CakePHP, amazingly, I choose CakePHP for the power of MVC, > SQL mapping ... It's nice to hear that, I'm pretty much a newbie too. > but I need to deal with my home page witch have no model. > This page however is not purely static, it contains PHP, SQL ... > > Where do I put such files ? > /app/webroot ? > or > /app/view.pages ? > I think the easiest way to do that would be to create a controller with a home() action that uses (see the $uses variables) the models where you need to get the data for the home page. That way you can create methods on the models involved to return the data, so, no need for SQL at all. > What are the differences between those 2 folders ? > > This page also rely on some javascript framework (JQuery). > Where do I put my jquery.js file ? > If I put it inside app/webroot/js it doesn't appears to be taken into > account ... > It's like if I had to put that general js files at the physical root, > the folder that contains /app. No, you have to put it in app/webroot/js, and load it using the JavaScript Helper, remember to load the helper on the appropiate controller. > > Maybe there is some doc I should read ? I read the manual, tuto, > browse the bakery and did not found, but that do not mean it doesn't > exists :-) > > Thanks for your help ! > I hope that helps! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How to do just a view ?
Dear. answers of all you question are there in cakephp manual. you need to study it properly http://manual.cakephp.org/ practics a bit by making sample applications Blog,Auth etc there in manual and then try to switch you exiting code to cakephp. On Feb 4, 3:21 pm, zeugme <[EMAIL PROTECTED]> wrote: > Hi, > > I'm new in CakePHP, amazingly, I choose CakePHP for the power of MVC, > SQL mapping ... > but I need to deal with my home page witch have no model. > This page however is not purely static, it contains PHP, SQL ... > > Where do I put such files ? > /app/webroot ? > or > /app/view.pages ? > > What are the differences between those 2 folders ? > > This page also rely on some javascript framework (JQuery). > Where do I put my jquery.js file ? > If I put it inside app/webroot/js it doesn't appears to be taken into > account ... > It's like if I had to put that general js files at the physical root, > the folder that contains /app. > > Maybe there is some doc I should read ? I read the manual, tuto, > browse the bakery and did not found, but that do not mean it doesn't > exists :-) > > Thanks for your help ! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
How to do just a view ?
Hi, I'm new in CakePHP, amazingly, I choose CakePHP for the power of MVC, SQL mapping ... but I need to deal with my home page witch have no model. This page however is not purely static, it contains PHP, SQL ... Where do I put such files ? /app/webroot ? or /app/view.pages ? What are the differences between those 2 folders ? This page also rely on some javascript framework (JQuery). Where do I put my jquery.js file ? If I put it inside app/webroot/js it doesn't appears to be taken into account ... It's like if I had to put that general js files at the physical root, the folder that contains /app. Maybe there is some doc I should read ? I read the manual, tuto, browse the bakery and did not found, but that do not mean it doesn't exists :-) Thanks for your help ! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Model with no data source / database - how to do this in CakePHP 1.2?
Thanks for pointing out the schema function - I was not aware of this new function. duRqoo in my haste I didn't notice that my database configuration was lacking a default connection. Thank you for your help. On Jan 22, 11:35 am, grigri <[EMAIL PROTECTED]> wrote: > Have you tried implementing YourModel::schema()? > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Model with no data source / database - how to do this in CakePHP 1.2?
It just so happens that I've just had to do this, and I've found a (straightforward) way that works perfectly. Here's a cut-down version with the necessary stuff: -- /app/models/contact.ctp --- class Contact extends AppModel { var $name = "Contact"; var $useTable = false; function schema() { return array( 'id' => array('type' => 'integer', 'null' => '', 'default' => '1', 'length' => '8', 'key'=>'primary'), 'name' => array('type' => 'string' , 'null' => '', 'default' => '', 'length' => '255'), 'email'=> array('type' => 'string' , 'null' => '', 'default' => '', 'length' => '155'), 'address' => array('type' => 'string' , 'null' => '', 'default' => '', 'length' => '255'), 'enquiry' => array('type' => 'string' , 'null' => '', 'default' => '', 'length' => '255') ); } var $validate = array( 'email' => array( 'rule' => 'email', 'allowEmpty' => false, 'required' => true, 'message' => 'You must specify a valid email address' ) ) } --- /app/controllers/contact_us_controller.php --- class ContactUsController extends AppController { var $name = "ContactUs"; var $uses = array('Contact'); var $components = array('Email'); function index() { if (!empty($this->data)) { $this->Contact->set($this->data); if ($this->Contact->validates()) { // Email details omitted $this->set('title', "Contact form was sent"); } else { $this->Session->setFlash('Please correct errors below'); $this->set('title', "Could not sent form"); } } } --- /app/views/contact_us/index.ctp --- (excerpt) create('Contact', array('url' => '/contact-us/', 'class' => 'contact')); ?> label('email'); ?> text('email', array('class' => 'txt', 'size' => 26)); ?> error('email'); ?> end('Submit'); ?> On Jan 22, 11:35 am, grigri <[EMAIL PROTECTED]> wrote: > Have you tried implementing YourModel::schema()? > > I think you need to when the database is not available. > > On Jan 22, 10:22 am, Matt <[EMAIL PROTECTED]> wrote: > > > I've got a working database configuration as the other models use the > > database. > > > This model doesn't use the database because I am just using its > > validation methods to validate a form. > > > On Jan 21, 6:00 pm, duRqoo <[EMAIL PROTECTED]> wrote: > > > > You still have to have database.php file in your /app/config. Content > > > of the file is list of data sources u will use in your app. Default > > > one must be there, otherwise it will throw you those fatal errors. So > > > your database.php file should at least look like this (copied from > > > database.php.default). > > > > class DATABASE_CONFIG { > > > var $default = array( > > > 'driver' => 'mysql', > > > 'persistent' => false, > > > 'host' => 'localhost', > > > 'port' => '', > > > 'login' => 'user', > > > 'password' => 'password', > > > 'database' => 'database_name', > > > 'schema' => '', > > > 'prefix' => '', > > > 'encoding' => '' > > > ); > > > > } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Model with no data source / database - how to do this in CakePHP 1.2?
Have you tried implementing YourModel::schema()? I think you need to when the database is not available. On Jan 22, 10:22 am, Matt <[EMAIL PROTECTED]> wrote: > I've got a working database configuration as the other models use the > database. > > This model doesn't use the database because I am just using its > validation methods to validate a form. > > On Jan 21, 6:00 pm, duRqoo <[EMAIL PROTECTED]> wrote: > > > You still have to have database.php file in your /app/config. Content > > of the file is list of data sources u will use in your app. Default > > one must be there, otherwise it will throw you those fatal errors. So > > your database.php file should at least look like this (copied from > > database.php.default). > > > class DATABASE_CONFIG { > > var $default = array( > > 'driver' => 'mysql', > > 'persistent' => false, > > 'host' => 'localhost', > > 'port' => '', > > 'login' => 'user', > > 'password' => 'password', > > 'database' => 'database_name', > > 'schema' => '', > > 'prefix' => '', > > 'encoding' => '' > > ); > > > } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Model with no data source / database - how to do this in CakePHP 1.2?
I've got a working database configuration as the other models use the database. This model doesn't use the database because I am just using its validation methods to validate a form. On Jan 21, 6:00 pm, duRqoo <[EMAIL PROTECTED]> wrote: > You still have to have database.php file in your /app/config. Content > of the file is list of data sources u will use in your app. Default > one must be there, otherwise it will throw you those fatal errors. So > your database.php file should at least look like this (copied from > database.php.default). > > class DATABASE_CONFIG { > var $default = array( > 'driver' => 'mysql', > 'persistent' => false, > 'host' => 'localhost', > 'port' => '', > 'login' => 'user', > 'password' => 'password', > 'database' => 'database_name', > 'schema' => '', > 'prefix' => '', > 'encoding' => '' > ); > > } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---