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 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
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( 'id' = '4', 'a_resource_id' = '4', 'b_resource_id' = '5' ) ), 'ResourcesResource' = array( 'id' = '3',
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 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.' .
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.
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.
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 Routinghttp://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 RESThttp://book.cakephp.org/2.0/en/development/rest.html#the-simple-setupaccess to your controllers. If you want a more fine grade setup you should consider using custom REST routinghttp://book.cakephp.org/2.0/en/development/rest.html#custom-rest-routingwhich 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 RequestHandlerhttp://book.cakephp.org/2.0/en/core-libraries/components/request-handling.htmlcomponent. 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 classeshttp://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 -
Re: How to do a REST WS?
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 Routinghttp://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 RESThttp://book.cakephp.org/2.0/en/development/rest.html#the-simple-setupaccess to your controllers. If you want a more fine grade setup you should consider using custom REST routinghttp://book.cakephp.org/2.0/en/development/rest.html#custom-rest-routingwhich 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 RequestHandlerhttp://book.cakephp.org/2.0/en/core-libraries/components/request-handling.htmlcomponent. 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 classeshttp://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
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 strong Error 404: / strong strong The requested address '/ ws_billings/generate_extract_consolidated/1/01-06-2012/21-06-2012/a.json' / strong was not found on server. / P / div br / 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 Routinghttp://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 RESThttp://book.cakephp.org/2.0/en/development/rest.html#the-simple-setupaccess to your controllers. If you want a more fine grade setup you should consider using custom REST routinghttp://book.cakephp.org/2.0/en/development/rest.html#custom-rest-routingwhich 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 RequestHandlerhttp://book.cakephp.org/2.0/en/core-libraries/components/request-handling.htmlcomponent. 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(
Re: How to do a REST WS?
Yes! I am aware. :) I didn't want to use the strict REST model in this application - yes some of this is actually copy/paste from an WebService I did. As you can see all requests are POST - I wanted to avoid PUT and DELETE requests and implement strong authentication. Anyhow you're right, I didn't mention this in the reply. On Friday, 22 June 2012 13:56:55 UTC+3, the_woodsman wrote: 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 Routinghttp://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 RESThttp://book.cakephp.org/2.0/en/development/rest.html#the-simple-setupaccess to your controllers. If you want a more fine grade setup you should consider using custom REST routinghttp://book.cakephp.org/2.0/en/development/rest.html#custom-rest-routingwhich 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 RequestHandlerhttp://book.cakephp.org/2.0/en/core-libraries/components/request-handling.htmlcomponent. 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 classeshttp://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
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 sanjibdhar...@gmail.com 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 jeremybu...@classoutfit.com 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 sanjibdhar...@gmail.com 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: 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.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
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 dereurom...@googlemail.comwrote: 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 sanjibdhar...@gmail.com 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 jeremybu...@classoutfit.com 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 sanjibdhar...@gmail.com 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 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.organdhelp others with their CakePHP related questions. To unsubscribe from this group, send email to
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 dereurom...@googlemail.com 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 sanjibdhar...@gmail.com 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 jeremybu...@classoutfit.com 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 sanjibdhar...@gmail.com 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 item_name A 12 2112 Sjgj A 14.. --- --- sum(price) B ... ... B ... ... B ... ... --- --- sum(price) C ... ... C ... ... C ... ... ---
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 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
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 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 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.
HOW TO DO THIS is not an appropriate title for your thread! by the way On 11 Feb., 18:27, sanjib dhar sanjibdhar...@gmail.com 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: 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.
*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.comwrote: HOW TO DO THIS is not an appropriate title for your thread! by the way On 11 Feb., 18:27, sanjib dhar sanjibdhar...@gmail.com 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 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.
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.
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 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 sanjibdhar...@gmail.com 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 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.
OK sorry. On Feb 12, 9:58 am, Jeremy Burns | Class Outfit jeremybu...@classoutfit.com 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 sanjibdhar...@gmail.com 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: 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.
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 jeremybu...@classoutfit.com 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 sanjibdhar...@gmail.com 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 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.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 -- 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
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
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 ale...@gmail.com 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
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
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 ale...@gmail.com 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 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. tmpan...@gmail.com 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 -~--~~~~--~~--~--~---
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 veoemp...@gmail.com 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 -~--~~~~--~~--~--~---
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 yogeshmo...@gmail.com 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 mileswjohn...@gmail.com 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 -~--~~~~--~~--~--~---
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 mileswjohn...@gmail.com 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 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
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 poojapinj...@gmail.com 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 ?php 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); 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' =
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 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 -~--~~~~--~~--~--~---
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 -~--~~~~--~~--~--~---
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 -~--~~~~--~~--~--~---
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 -~--~~~~--~~--~--~---
Re: How i do date validation?
It's 1.2 Yes, i've looked. The documentation for data validation isnt good, i didnt figure it how to validate date. ;~~ On 9 jun, 14:23, Chris Hartjes [EMAIL PROTECTED] wrote: On Mon, Jun 9, 2008 at 12:56 PM, GreyWolf [EMAIL PROTECTED] wrote: What's wrong? Thanks. What version of CakePHP are you using? If you're using 1.2, have you looked at this: http://book.cakephp.org/view/125/data-validation -- Chris Hartjes Internet Loudmouth Motto for 2008: Moving from herding elephants to handling snakes... @TheKeyBoard:http://www.littlehart.net/atthekeyboard --~--~-~--~~~---~--~~ 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 i do date validation?
On Jun 10, 2008, at 12:01 PM, GreyWolf wrote: It's 1.2 Yes, i've looked. The documentation for data validation isnt good, i didnt figure it how to validate date. ;~~ Look in the date section: http://book.cakephp.org/view/140/date ? -- John On 9 jun, 14:23, Chris Hartjes [EMAIL PROTECTED] wrote: On Mon, Jun 9, 2008 at 12:56 PM, GreyWolf [EMAIL PROTECTED] wrote: What's wrong? Thanks. What version of CakePHP are you using? If you're using 1.2, have you looked at this: http://book.cakephp.org/view/125/data-validation -- Chris Hartjes Internet Loudmouth Motto for 2008: Moving from herding elephants to handling snakes... @TheKeyBoard:http://www.littlehart.net/atthekeyboard --~--~-~--~~~---~--~~ 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 i do date validation?
I've alread looked. I dont want do allow empty. The validation dont work. On 10 jun, 15:30, John David Anderson [EMAIL PROTECTED] wrote: On Jun 10, 2008, at 12:01 PM, GreyWolf wrote: It's 1.2 Yes, i've looked. The documentation for datavalidationisnt good, i didnt figure it how to validatedate. ;~~ Look in the date section: http://book.cakephp.org/view/140/date ? -- John On 9 jun, 14:23, Chris Hartjes [EMAIL PROTECTED] wrote: On Mon, Jun 9, 2008 at 12:56 PM, GreyWolf [EMAIL PROTECTED] wrote: What's wrong? Thanks. What version of CakePHP are you using? If you're using 1.2, have you looked at this: http://book.cakephp.org/view/125/data-validation -- Chris Hartjes Internet Loudmouth Motto for 2008: Moving from herding elephants to handling snakes... @TheKeyBoard:http://www.littlehart.net/atthekeyboard --~--~-~--~~~---~--~~ 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 i do date validation?
I dont want do allow empty. Then put 'allowEmpty' = false and please read the documentation. The validation dont work. On 10 jun, 15:30, John David Anderson [EMAIL PROTECTED] wrote: On Jun 10, 2008, at 12:01 PM, GreyWolf wrote: It's 1.2 Yes, i've looked. The documentation for datavalidationisnt good, i didnt figure it how to validatedate. ;~~ Look in the date section: http://book.cakephp.org/view/140/date ? -- John On 9 jun, 14:23, Chris Hartjes [EMAIL PROTECTED] wrote: On Mon, Jun 9, 2008 at 12:56 PM, GreyWolf [EMAIL PROTECTED] wrote: What's wrong? Thanks. What version of CakePHP are you using? If you're using 1.2, have you looked at this: http://book.cakephp.org/view/125/data-validation -- Chris Hartjes Internet Loudmouth Motto for 2008: Moving from herding elephants to handling snakes... @TheKeyBoard:http://www.littlehart.net/atthekeyboard --~--~-~--~~~---~--~~ 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 i do date validation?
I told you i already read the documentation and still isnt working. 'data_create' = array( 'rule' = 'date', 'message' = 'Enter a valid date in YY-MM-DD format.', 'allowEmpty' = false ), The script returns the 'Enter a valid date in YY-MM-DD format.' On 10 jun, 16:18, Dardo Sordi Bogado [EMAIL PROTECTED] wrote: I dont want do allow empty. Then put 'allowEmpty' = false and please read the documentation. Thevalidationdont work. On 10 jun, 15:30, John David Anderson [EMAIL PROTECTED] wrote: On Jun 10, 2008, at 12:01 PM, GreyWolf wrote: It's 1.2 Yes, i've looked. The documentation for datavalidationisnt good, i didnt figure it how to validatedate. ;~~ Look in the date section: http://book.cakephp.org/view/140/date ? -- John On 9 jun, 14:23, Chris Hartjes [EMAIL PROTECTED] wrote: On Mon, Jun 9, 2008 at 12:56 PM, GreyWolf [EMAIL PROTECTED] wrote: What's wrong? Thanks. What version of CakePHP are you using? If you're using 1.2, have you looked at this: http://book.cakephp.org/view/125/data-validation -- Chris Hartjes Internet Loudmouth Motto for 2008: Moving from herding elephants to handling snakes... @TheKeyBoard:http://www.littlehart.net/atthekeyboard --~--~-~--~~~---~--~~ 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 i do date validation?
On Mon, Jun 9, 2008 at 12:56 PM, GreyWolf [EMAIL PROTECTED] wrote: What's wrong? Thanks. What version of CakePHP are you using? If you're using 1.2, have you looked at this: http://book.cakephp.org/view/125/data-validation -- Chris Hartjes Internet Loudmouth Motto for 2008: Moving from herding elephants to handling snakes... @TheKeyBoard: http://www.littlehart.net/atthekeyboard --~--~-~--~~~---~--~~ 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 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 ?
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 -~--~~~~--~~--~--~---
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 mod_rewrite????
Hi, not sure what version of Cake you use, but when I installed the latest stable version of cakePHP, I was also very confused, mod_rewriting was obviously working on my apache (tested it seperatly), but no matter what I tried, I didn't come to see any css effects on the cake site. Well I could'nt solve the problem, but all looked nice after installing Cake 1.2, so maybe thats an option for you too. Michael SIXS schrieb: How do you actually set the mod rewrite. I set it in sthe system httpd.conf, but I don't see the color in the cakephp page. Is there another issue. I have installed it several times and hve installed it in another system, both XP OS. I am going to install it on a Ubuntu system. Jim --~--~-~--~~~---~--~~ 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 mod_rewrite????
Hi, Make sure all .htaccess files are in place, also, in some cases you have to set RewriteBase to get mod_rewrite to work. schneimi wrote: Hi, not sure what version of Cake you use, but when I installed the latest stable version of cakePHP, I was also very confused, mod_rewriting was obviously working on my apache (tested it seperatly), but no matter what I tried, I didn't come to see any css effects on the cake site. Well I could'nt solve the problem, but all looked nice after installing Cake 1.2, so maybe thats an option for you too. Michael SIXS schrieb: How do you actually set the mod rewrite. I set it in sthe system httpd.conf, but I don't see the color in the cakephp page. Is there another issue. I have installed it several times and hve installed it in another system, both XP OS. I am going to install it on a Ubuntu system. Jim --~--~-~--~~~---~--~~ 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 mod_rewrite????
On ubuntu http://bakery.cakephp.org/articles/view/installing-cakephp-on-ubuntu . For me it worked! On Oct 8, 8:01 pm, SIXS [EMAIL PROTECTED] wrote: How do you actually set the mod rewrite. I set it in sthe system httpd.conf, but I don't see the color in the cakephp page. Is there another issue. I have installed it several times and hve installed it in another system, both XP OS. I am going to install it on a Ubuntu system. Jim --~--~-~--~~~---~--~~ 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 mod_rewrite????
Hey guys, I was having the same issue as val with the mod_rewrite not generating the CSS on the Cake Install page. That works now, but I am still getting 404s when I try to go http://localhost/posts/index. Am I pointing to the wrong address, or is it something else. My setup is: Ubuntu Feisty Fawn CakePHP v1.1.17.5612 Apache2 PHP5 MySQL 5.1 Any help would be much appreciated. Thanks, Jeff. On Oct 8, 4:27 pm, val [EMAIL PROTECTED] wrote: On ubuntuhttp://bakery.cakephp.org/articles/view/installing-cakephp-on-ubuntu . For me it worked! On Oct 8, 8:01 pm, SIXS [EMAIL PROTECTED] wrote: How do you actually set the mod rewrite. I set it in sthe system httpd.conf, but I don't see the color in the cakephp page. Is there another issue. I have installed it several times and hve installed it in another system, both XP OS. I am going to install it on a Ubuntu system. Jim --~--~-~--~~~---~--~~ 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 mod_rewrite????
Ok, I finally got it...I used the same link val used to get the mod_rewrite working for the CSS on the cakephp page and placed the following into my /etc/apache2/sites-available/default file: Directory /var/www/cake AllowOverride All /Directory This worked for the cakephp page, but I was still receiving 404 File Not Found errors everywhere else, including http://localhost/posts/index. In order to fix this, I adjusted the above entry to: Directory /var/www AllowOverride All /Directory I no longer receive 404s, and as of right now, it looks like it's working as it should. Hope this helps anyone else who is currently pulling out their hair :). Thanks, Jeff. On Oct 8, 5:00 pm, jeffkwiat [EMAIL PROTECTED] wrote: Hey guys, I was having the same issue as val with the mod_rewrite not generating the CSS on the Cake Install page. That works now, but I am still getting 404s when I try to gohttp://localhost/posts/index. Am I pointing to the wrong address, or is it something else. My setup is: Ubuntu Feisty Fawn CakePHP v1.1.17.5612 Apache2 PHP5 MySQL 5.1 Any help would be much appreciated. Thanks, Jeff. On Oct 8, 4:27 pm, val [EMAIL PROTECTED] wrote: On ubuntuhttp://bakery.cakephp.org/articles/view/installing-cakephp-on-ubuntu . For me it worked! On Oct 8, 8:01 pm, SIXS [EMAIL PROTECTED] wrote: How do you actually set the mod rewrite. I set it in sthe system httpd.conf, but I don't see the color in the cakephp page. Is there another issue. I have installed it several times and hve installed it in another system, both XP OS. I am going to install it on a Ubuntu system. Jim --~--~-~--~~~---~--~~ 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 Multi-Row Edit ?
Update: I've managed to get this article submitted to the Bakery - but I have no idea how long it will take for them to review and publish it. I will wait a week, and if I don't hear anything by then, I'll post it here. Steve T. On Mar 26, 2:36 pm, digital spaghetti [EMAIL PROTECTED] wrote: Absolutly steve, get posting so we can get baking :). I haven't had to do this yet but I know it'll be coming soon. Tane On 3/26/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Another method that was referenced in this group a while back was to use tags like ['model0']['Name'] ['model1']['Name'] Then in your controller, dynamically create a new model for each 'modelX' that you have and validate() it and then save() it. This way you also get the proper validation messages passed back from the model to the view fields. I created a component to automatically convert the findAll() results array to this format for the view, and back to the multiple models and did the saves automatically. All you have to do is a multiModel-get() before your view and then a multModel-save() call to do your saves. I also created a helper to take this model and create the form fields needed to make an editable grid in the view. I tried to create an article in the Bakery for it, but I could not submit it because of the bugs in the Bakery. I may try again - or just post it here if there is interest. Steve Truesdale On Mar 26, 8:57 am, francky06l [EMAIL PROTECTED] wrote: You can use a hack to format the tags using an indice ... such as ['model'][0]['Name'], ['model'][1]['Name] etc ... You can use : 'Model/'.$indice.'][fieldname' into the tag name to produce the above format .. On Mar 26, 5:37 am, cc96ai [EMAIL PROTECTED] wrote: I know how to do in PHP, but I have no idea how to work it on cakePHP e.g. I have a table of products, and I will list all the products in one form , one page, -Name, Desc, Qty, Price, Total -Name, Desc, Qty, Price, Total -Name, Desc, Qty, Price, Total -Name, Desc, Qty, Price, Total user will input the Qty in the form, and once he submitted into server it will save into invoice database BUt how can cake handle the name in Multi-Row and direction will help . Thanks --~--~-~--~~~---~--~~ 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 Multi-Row Edit ?
You can use a hack to format the tags using an indice ... such as ['model'][0]['Name'], ['model'][1]['Name] etc ... You can use : 'Model/'.$indice.'][fieldname' into the tag name to produce the above format .. On Mar 26, 5:37 am, cc96ai [EMAIL PROTECTED] wrote: I know how to do in PHP, but I have no idea how to work it on cakePHP e.g. I have a table of products, and I will list all the products in one form , one page, -Name, Desc, Qty, Price, Total -Name, Desc, Qty, Price, Total -Name, Desc, Qty, Price, Total -Name, Desc, Qty, Price, Total user will input the Qty in the form, and once he submitted into server it will save into invoice database BUt how can cake handle the name in Multi-Row and direction will help . Thanks --~--~-~--~~~---~--~~ 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 Multi-Row Edit ?
What a timely post! I'm doing the same thing...showing a table of data and allowing the user to edit it. By using this 'hack' will CakePHP handle the insert without any additional considerations? --~--~-~--~~~---~--~~ 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 Multi-Row Edit ?
You would have to use a custom model to overwrite some functionality (cake 1.x): E.g class MyHtml extends Html { ... function setFormTag($tagValue) { $parts = explode(/, $tagValue); $this-model = $parts[0]; $this-field= array_pop($parts); // We add a class attribute to indicate the index of the model if (count($parts) 1) $this-modelIndex = $parts[1]; else $this-modelIndex = null; } ... function tagValue($fieldName) { $this-setFormTag($fieldName); if ($this-modelIndex !== null) { // This assumes that your data is like so: // data = array('Model'=array(array('Model'=array(/* data */; // Default cake // which can be obtained with $this-data['Model'] = $this- Model-findAll(); if (isset($this-params['data'][$this-model][$this- modelIndex][$this-model][$this-field])) { return h($this-params['data'][$this-model][$this- modelIndex][$this-model][$this-field]); } elseif(isset($this-data[$this-model][$this-modelIndex] [$this-model][$this-field])) { return h($this-data[$this-model][$this-modelIndex] [$this-model][$this-field]); } } else { return parent::tagValue($fieldName); } } ... } In your view, you can then do the following: ?php foreach ($this-data['Product'] as $i = $rec) : ? tr td?= $rec['Product']['name'] ?/td td?= $myhtml-input(Product/$i/qty) ?/td /tr ?php endforeach; ? Please note that this code was not tested. Also, the id of your input will become Product0Qty, Product1Qty, etc. Please contribute your final solution. There are many with the same issue :S. Thanks. Dimitry Z --~--~-~--~~~---~--~~ 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 Multi-Row Edit ?
I cant generate this kind of format ['model'][0]['Name'], ['model'][1] ['Name] but I m trying to put the id into tag name $html-input(product/qty.$product['Product']['id']); --~--~-~--~~~---~--~~ 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 Multi-Row Edit ?
Another method that was referenced in this group a while back was to use tags like ['model0']['Name'] ['model1']['Name'] Then in your controller, dynamically create a new model for each 'modelX' that you have and validate() it and then save() it. This way you also get the proper validation messages passed back from the model to the view fields. I created a component to automatically convert the findAll() results array to this format for the view, and back to the multiple models and did the saves automatically. All you have to do is a multiModel-get() before your view and then a multModel-save() call to do your saves. I also created a helper to take this model and create the form fields needed to make an editable grid in the view. I tried to create an article in the Bakery for it, but I could not submit it because of the bugs in the Bakery. I may try again - or just post it here if there is interest. Steve Truesdale On Mar 26, 8:57 am, francky06l [EMAIL PROTECTED] wrote: You can use a hack to format the tags using an indice ... such as ['model'][0]['Name'], ['model'][1]['Name] etc ... You can use : 'Model/'.$indice.'][fieldname' into the tag name to produce the above format .. On Mar 26, 5:37 am, cc96ai [EMAIL PROTECTED] wrote: I know how to do in PHP, but I have no idea how to work it on cakePHP e.g. I have a table of products, and I will list all the products in one form , one page, -Name, Desc, Qty, Price, Total -Name, Desc, Qty, Price, Total -Name, Desc, Qty, Price, Total -Name, Desc, Qty, Price, Total user will input the Qty in the form, and once he submitted into server it will save into invoice database BUt how can cake handle the name in Multi-Row and direction will help . Thanks --~--~-~--~~~---~--~~ 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 Multi-Row Edit ?
Absolutly steve, get posting so we can get baking :). I haven't had to do this yet but I know it'll be coming soon. Tane On 3/26/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Another method that was referenced in this group a while back was to use tags like ['model0']['Name'] ['model1']['Name'] Then in your controller, dynamically create a new model for each 'modelX' that you have and validate() it and then save() it. This way you also get the proper validation messages passed back from the model to the view fields. I created a component to automatically convert the findAll() results array to this format for the view, and back to the multiple models and did the saves automatically. All you have to do is a multiModel-get() before your view and then a multModel-save() call to do your saves. I also created a helper to take this model and create the form fields needed to make an editable grid in the view. I tried to create an article in the Bakery for it, but I could not submit it because of the bugs in the Bakery. I may try again - or just post it here if there is interest. Steve Truesdale On Mar 26, 8:57 am, francky06l [EMAIL PROTECTED] wrote: You can use a hack to format the tags using an indice ... such as ['model'][0]['Name'], ['model'][1]['Name] etc ... You can use : 'Model/'.$indice.'][fieldname' into the tag name to produce the above format .. On Mar 26, 5:37 am, cc96ai [EMAIL PROTECTED] wrote: I know how to do in PHP, but I have no idea how to work it on cakePHP e.g. I have a table of products, and I will list all the products in one form , one page, -Name, Desc, Qty, Price, Total -Name, Desc, Qty, Price, Total -Name, Desc, Qty, Price, Total -Name, Desc, Qty, Price, Total user will input the Qty in the form, and once he submitted into server it will save into invoice database BUt how can cake handle the name in Multi-Row and direction will help . Thanks --~--~-~--~~~---~--~~ 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 Multi-Row Edit ?
in your provided code, we might to update helper.php var $tags = array('link' = 'a href=%s %s%s/a', 'mailto' = 'a href=mailto:%s; %s%s/a', 'form' = 'form %s', 'input' = 'input name=data[%s][%s] %s/', 'hidden' = 'input type=hidden name=data[%s][%s] %s/', I m not sure thats good idea or not --~--~-~--~~~---~--~~ 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 Multi-Row Edit ?
CC96AI, You're right about modifying the tag templates. There would have to be more changes than the ones i mentioned above. However, it's a starting point :). As for it being a good idea, you can implement your own tags. Since you're subclassing HtmlHelper you can redefine the $tags class attribute to have your own templates. Also, you would need to modify the rendering of those templates. Dim On Mar 26, 3:57 pm, cc96ai [EMAIL PROTECTED] wrote: in your provided code, we might to update helper.php var $tags = array('link' = 'a href=%s %s%s/a', 'mailto' = 'a href=mailto:%s; %s%s/a', 'form' = 'form %s', 'input' = 'input name=data[%s][%s] %s/', 'hidden' = 'input type=hidden name=data[%s][%s] %s/', I m not sure thats good idea or not --~--~-~--~~~---~--~~ 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 dynamic includes of controllers
Use elements. Put your requestAction calls in the elements. Do not return the view from requestAction. Just return the data and have the element display it. --~--~-~--~~~---~--~~ 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 dynamic includes of controllers
I just wanted to make sure I understood you. I found this link on cakephp groups: http://groups.google.com/group/cake-php/browse_frm/thread/6dab044365132bdf/02ffb077f9ebf389?lnk=gstq=elementsrnum=14#02ffb077f9ebf389 Is that what you had in mind? --~--~-~--~~~---~--~~ 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 arguments before Controller/Action in a URL?
I did something similar before. In bootstrap.php or routes.php (better in my book, do it before all the $Route-connect) you can extract the section from the variable $from_url, which contains the url after the host. From the top of my head: $url = explode('/', $from_url); $section = $url[0]; unset($url[0]); $from_url = implode('/', $url); Now you have the section string in $section and out of the url and Cake will dispatch '/posts/view' action. You can save $section on a global or session var to access it from the controller. Dont know what happens if mod_rewrite is off, though. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---