Re: Best way to setup my comments system
I'm using just one table: comments with fields: id, model, model_id... Post hasMany Comment conditions=array('Comment.model'='Post') --~--~-~--~~~---~--~~ 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: Any idea how re-index results?
$data = array ('Fuelprice' = Set::combine($data, 'Fuelprice.{n}.id', 'Fuelprice.{n}')); On Jun 21, 12:18 am, Petr Vytlačil petr.vytla...@gmail.com wrote: Hi, does anybody idea how reindexing results? Now output from CakePHP: [Fuelprice] = Array ( [0] = Array ( [id] = 1 [yearsetting_id] = 2 [fueltype_id] = 1 [price] = 26.3 ) [1] = Array ( [id] = 2 [yearsetting_id] = 2 [fueltype_id] = 2 [price] = 26.3 ) [2] = Array ( [id] = 3 [yearsetting_id] = 2 [fueltype_id] = 4 [price] = 26.8 ) ) I wish: - [Fuelprice] = Array ( [id_item] = Array ( [id] = 1 [yearsetting_id] = 2 [fueltype_id] = 1 [price] = 26.3 ) Example: - [Fuelprice] = Array ( [1] = Array ( [id] = 1 [yearsetting_id] = 2 [fueltype_id] = 1 [price] = 26.3 ) [2] = Array ( [id] = 2 [yearsetting_id] = 2 [fueltype_id] = 2 [price] = 26.3 ) [3] = Array ( [id] = 3 [yearsetting_id] = 2 [fueltype_id] = 4 [price] = 26.8 ) ) THX. --~--~-~--~~~---~--~~ 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: Any idea how re-index results?
find('list') with multiple fields defined should also work, I think. On Jun 21, 11:50 am, Dr. Loboto drlob...@gmail.com wrote: $data = array ('Fuelprice' = Set::combine($data, 'Fuelprice.{n}.id', 'Fuelprice.{n}')); On Jun 21, 12:18 am, Petr Vytlačil petr.vytla...@gmail.com wrote: Hi, does anybody idea how reindexing results? Now output from CakePHP: [Fuelprice] = Array ( [0] = Array ( [id] = 1 [yearsetting_id] = 2 [fueltype_id] = 1 [price] = 26.3 ) [1] = Array ( [id] = 2 [yearsetting_id] = 2 [fueltype_id] = 2 [price] = 26.3 ) [2] = Array ( [id] = 3 [yearsetting_id] = 2 [fueltype_id] = 4 [price] = 26.8 ) ) I wish: - [Fuelprice] = Array ( [id_item] = Array ( [id] = 1 [yearsetting_id] = 2 [fueltype_id] = 1 [price] = 26.3 ) Example: - [Fuelprice] = Array ( [1] = Array ( [id] = 1 [yearsetting_id] = 2 [fueltype_id] = 1 [price] = 26.3 ) [2] = Array ( [id] = 2 [yearsetting_id] = 2 [fueltype_id] = 2 [price] = 26.3 ) [3] = Array ( [id] = 3 [yearsetting_id] = 2 [fueltype_id] = 4 [price] = 26.8 ) ) THX. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Array Help
How can I edit this array: Array ( [Test] = Array ( [Post] = Array ( [0] = 3 [1] = 4 [2] = 5 [3] = 6 [4] = 7 [5] = 8 [6] = 9 ) [Percent] = Array ( [0] = 28 [1] = 39 [2] = 17 [3] = 28 [4] = 23 [5] = 17 [6] = 17 ) ) ) Into something like : take each key from POST and PERCENT, and pair them up Array ( [Test] = Array ( [0] = Array ( [Post] = 3 [Percent] = 28 ) ) ) Thanks, Dave --~--~-~--~~~---~--~~ 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: Array Help
hi dave On 21 Jun 2009, at 13:35, Dave Maharaj :: WidePixels.com wrote: How can I edit this array: Array ( [Test] = Array ( [Post] = Array ( [0] = 3 [1] = 4 [2] = 5 [3] = 6 [4] = 7 [5] = 8 [6] = 9 ) [Percent] = Array ( [0] = 28 [1] = 39 [2] = 17 [3] = 28 [4] = 23 [5] = 17 [6] = 17 ) ) ) Into something like : take each key from POST and PERCENT, and pair them up Array ( [Test] = Array ( [0] = Array ( [Post] = 3 [Percent] = 28 ) ) ) by using set::extract http://debuggable.com/posts/cake-12s-set-class-eats-arrays-for-breakfast YMMV regards mikek -- Mike Karthäuser Managing Director - Brightstorm Ltd Email: mi...@brightstorm.co.uk Web: http://www.brightstorm.co.uk Tel: 07939 252144 (mobile) Fax: 0870 1320560 Address: 1 Brewery Court, North Street, Bristol, BS3 1JS --~--~-~--~~~---~--~~ 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: Array Help
Still no luck. I think I merged the 2 arrays too soon. I get a list of Posts from a search. Then run a function to determine the percentage match for the results based which spits out a $percentage array for each of the $posts array So I have 2 separate arrays to work with, and stuck on combine / merge them into 1 array matching up the keys so originally i have the lists of Post id's Array ( [Posts] = Array ( [0] = 3 [1] = 4 [2] = 5 [3] = 6 [4] = 7 [5] = 8 ) ) Then a Percentage for each of the Posts Array ( [Percent] = Array ( [0] = 36 [1] = 85 [2] = 25 [3] = 17 [4] = 85 [5] = 17 ) ) And end up with 1 array where the keys are matched up for each as every Post will have a partner Percentage From: mike karthauser [mailto:mi...@brightstorm.co.uk] Sent: June-21-09 10:08 AM To: cake-php@googlegroups.com Subject: Re: Array Help hi dave On 21 Jun 2009, at 13:35, Dave Maharaj :: WidePixels.com wrote: How can I edit this array: Array ( [Test] = Array ( [Post] = Array ( [0] = 3 [1] = 4 [2] = 5 [3] = 6 [4] = 7 [5] = 8 [6] = 9 ) [Percent] = Array ( [0] = 28 [1] = 39 [2] = 17 [3] = 28 [4] = 23 [5] = 17 [6] = 17 ) ) ) Into something like : take each key from POST and PERCENT, and pair them up Array ( [Test] = Array ( [0] = Array ( [Post] = 3 [Percent] = 28 ) ) ) by using set::extract http://debuggable.com/posts/cake-12s-set-class-eats-arrays-for-breakfast YMMV regards mikek -- Mike Karthäuser Managing Director - Brightstorm Ltd Email: mi...@brightstorm.co.uk Web: http://www.brightstorm.co.uk http://www.brightstorm.co.uk/ Tel: 07939 252144 (mobile) Fax: 0870 1320560 Address: 1 Brewery Court, North Street, Bristol, BS3 1JS --~--~-~--~~~---~--~~ 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: File uploads - getting an undefined index.
OK, so I have solved the undefined index problem - the view file was wrong, it should have been Tip.image instead of just image. However, I changed it to Img.pic so as not to clash with image. I'm now getting the following error when trying to add: Notice (8): Array to string conversion [APP\controllers\components \image.php, line 50] Warning (2): strrpos() expects parameter 1 to be string, array given [APP\controllers\components\image.php, line 145] I've done some searching, and I understand that the error means an array is being given as opposed to a string, but I didn't really come across a fix? Has anybody got any ideas? Thanks in advance! On Jun 20, 6:19 pm, number9 xpozit...@gmail.com wrote: I'm trying to add the ability to upload files on an existing add method within a controller, but no matter which method I use to try and upload files I get an undefined index error on the name of the field within the view and I cannot understand why. I thought it may have been a problem with the components I was trying, but after stripping back to a simple bit of code found here (http://www.davidgolding.net/cakephp/using-the-file-functions-in-cakephp.html) - I am still getting the error. Code looks like this: // Controller: if ($this-data['Tip']['image']) { $file = new File($this-data['Tip']['image']); $ext = $file-ext(); if ($ext != 'jpg' $ext != 'jpeg' $ext != 'gif' $ext != 'png') { $this-Session-setFlash('You may only upload image files.'); $this-render(); } else { $date = $this-data['Tip']['created']; $filename = $date['year'].'-'.$date['month'].'-'.$date['day'].'- post-image.'.$ext; $data = $file-read(); $file-close(); $file = new File(WWW_ROOT.'/img/'.$filename,true); $file-write($data); $file-close(); } } // View file: ?php echo $form-create('Tip',array('type'='file')); ? fieldset legend?php __('Add Tip');?/legend ?php echo $form-input('comment_count'); echo $form-input('name'); echo $form-input('slug'); echo $form-input('description'); echo $form-input('image',array('type'='file')); echo $form-input('expires'); echo $form-input('rating'); echo $form-select('Tip.category_id', $cat_list, null, array(), true); echo $form-input('site_id'); echo $form-input('user_id'); echo $form-input('Tag.name',array( 'type' = 'text', 'label' = __('Add Tags',true), 'after' = __('Seperate each tag with a comma. Eg: family, sports, icecream',true) )); ? /fieldset ?php echo $form-end('Submit');? There is more in the controller file, but I thought I would include just the relevant information for the time being. Is it possible that something else in there is conflicting with the code? I tried also adding ['tmp_name'] but no joy... Any insight would be appreciated. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
German Umlaut in form-end
Hi, how can I use a German Umlaut in form-end('Löschen')? --~--~-~--~~~---~--~~ 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: File uploads - getting an undefined index.
What does the controller code look like now? Specifically, where it interacts with your ImageComponent. On Sun, Jun 21, 2009 at 11:46 AM, number9xpozit...@gmail.com wrote: OK, so I have solved the undefined index problem - the view file was wrong, it should have been Tip.image instead of just image. However, I changed it to Img.pic so as not to clash with image. I'm now getting the following error when trying to add: Notice (8): Array to string conversion [APP\controllers\components \image.php, line 50] Warning (2): strrpos() expects parameter 1 to be string, array given [APP\controllers\components\image.php, line 145] I've done some searching, and I understand that the error means an array is being given as opposed to a string, but I didn't really come across a fix? Has anybody got any ideas? Thanks in advance! On Jun 20, 6:19 pm, number9 xpozit...@gmail.com wrote: I'm trying to add the ability to upload files on an existing add method within a controller, but no matter which method I use to try and upload files I get an undefined index error on the name of the field within the view and I cannot understand why. I thought it may have been a problem with the components I was trying, but after stripping back to a simple bit of code found here (http://www.davidgolding.net/cakephp/using-the-file-functions-in-cakephp.html) - I am still getting the error. Code looks like this: // Controller: if ($this-data['Tip']['image']) { $file = new File($this-data['Tip']['image']); $ext = $file-ext(); if ($ext != 'jpg' $ext != 'jpeg' $ext != 'gif' $ext != 'png') { $this-Session-setFlash('You may only upload image files.'); $this-render(); } else { $date = $this-data['Tip']['created']; $filename = $date['year'].'-'.$date['month'].'-'.$date['day'].'- post-image.'.$ext; $data = $file-read(); $file-close(); $file = new File(WWW_ROOT.'/img/'.$filename,true); $file-write($data); $file-close(); } } // View file: ?php echo $form-create('Tip',array('type'='file')); ? fieldset legend?php __('Add Tip');?/legend ?php echo $form-input('comment_count'); echo $form-input('name'); echo $form-input('slug'); echo $form-input('description'); echo $form-input('image',array('type'='file')); echo $form-input('expires'); echo $form-input('rating'); echo $form-select('Tip.category_id', $cat_list, null, array(), true); echo $form-input('site_id'); echo $form-input('user_id'); echo $form-input('Tag.name',array( 'type' = 'text', 'label' = __('Add Tags',true), 'after' = __('Seperate each tag with a comma. Eg: family, sports, icecream',true) )); ? /fieldset ?php echo $form-end('Submit');? There is more in the controller file, but I thought I would include just the relevant information for the time being. Is it possible that something else in there is conflicting with the code? I tried also adding ['tmp_name'] but no joy... Any insight would be appreciated. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
view not echoing
i have done some tutorials the scaffold works fine when i want to create my own view nothing is echoed here is the controller: ?php class ProductsController extends AppController { var $name = 'Products'; //var $scaffold; function index() { $this-set('products',$this-Product-find('all')); } } ? and the products/index.ctp view i get the hello and nothing blank screen with the default cake layout the code: ?php echo'hello';? html head titletest title/title /head body div id=container div id=content ?=$content_for_layout;? ?php echo $product['Product']['id']; ? /div /div /body /html i get this error Notice (8): Undefined variable: product [APP\views\products\index.ctp, line 11] --~--~-~--~~~---~--~~ 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: view not echoing
The problem isn't related to echo. Your variable is name products in the controller $this-set('products',$this-Product-find('all')); So, in the view you should use $products. Try doing ?debug($products)? in your view. HTH, Pablo Viojo pvi...@gmail.com http://pviojo.net (#260 y creciendo!) Ayudar nos hace felices! http://needish.com - http://helperman.org On Sun, Jun 21, 2009 at 1:20 PM, dflow deeepf...@gmail.com wrote: i have done some tutorials the scaffold works fine when i want to create my own view nothing is echoed here is the controller: ?php class ProductsController extends AppController { var $name = 'Products'; //var $scaffold; function index() { $this-set('products',$this-Product-find('all')); } } ? and the products/index.ctp view i get the hello and nothing blank screen with the default cake layout the code: ?php echo'hello';? html head titletest title/title /head body div id=container div id=content ?=$content_for_layout;? ?php echo $product['Product']['id']; ? /div /div /body /html i get this error Notice (8): Undefined variable: product [APP\views\products\index.ctp, line 11] --~--~-~--~~~---~--~~ 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 contribute sri lankakan sinhala language for tutorial of CakePHP
On Jun 20, 8:10 am, srilanka hotelsrila...@gmail.com wrote: HI, Currently i have maintain cakephp sinhala version. Could any one can say how am i publish this with cakePHP site? http://computerlanguage.inetlanka.com/?q=node/9 thanks srilanka cakephp team Please follow the instructions here: http://book.cakephp.org/#Translations-527 to discuss adding a new language to the book. May I ask why you've made a copy of the manual? Since you're asking here I assume you're unaware that you cannot do that (http://creativecommons.org/licenses/by-nc-nd/3.0/). You can and should have just asked for a new langauge to be added to the book - and join the cool crowd here: http://book.cakephp.org/stats i.e. http://book.cakephp.org/ http://book.cakephp.org/ja http://book.cakephp.org/fr http://book.cakephp.org/es ... http://book.cakephp.org/Iemailedjohnandheaddedthis Regards, AD --~--~-~--~~~---~--~~ 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 to something after successful login (like callback) ?
UsersController: // this is the stripped-down version public function login() { if ($user = $this-Auth-user()) { $this-User-Login-create(); $this-User-Login-save( array( 'Login' = array( 'user_id' = $user['User']['id'] ) ) ); } } that won't work for me, i don't know why. first I inserted your IF with the db update, but nothing happend. then I tested the IF: if ($user = $this-Auth-user()) { exit(); } but no effects. --~--~-~--~~~---~--~~ 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 to something after successful login (like callback) ?
On Jun 21, 7:15 pm, u2ix demian.gempe...@gmail.com wrote: UsersController: // this is the stripped-down version public function login() { if ($user = $this-Auth-user()) { $this-User-Login-create(); $this-User-Login-save( array( 'Login' = array( 'user_id' = $user['User']['id'] ) ) ); } } that won't work for me, i don't know why. first I inserted your IF with the db update, but nothing happend. then I tested the IF: if ($user = $this-Auth-user()) { exit(); } but no effects. see http://book.cakephp.org/view/395/autoRedirect regards, AD --~--~-~--~~~---~--~~ 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: German Umlaut in form-end
On Jun 21, 5:50 pm, Braindead markus.he...@gmail.com wrote: Hi, how can I use a German Umlaut in form-end('Löschen')? You've accidentally pasted the answer in your question --~--~-~--~~~---~--~~ 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: Versioned Routing to a css or js file in webroot
On Jun 20, 3:20 pm, Rob r...@eroh.me wrote: I want to version my css/js files: /23/css/style.css routes to /css/style.css where 23 can be any number (specifically the current svn version id) Is this possible? I've seen a lot of advanced routing to controllers, but I can't find anywhere to reroute to something in webroot. Thanks in advance! what's wrong with /css/style.css?23 or similar. if you do what you've asked with (cake)php your making the requests for your assets unnecessarly slow - and not in a trivial way. compare how long it takes to get your file with /css/ thisisinthewebroot.css and /css/thisisinvendorscss.css and /css/ Iroutedthistoacontrolleraction.css hth, AD --~--~-~--~~~---~--~~ 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: Versioned Routing to a css or js file in webroot
On Jun 21, 7:47 pm, AD7six andydawso...@gmail.com wrote: On Jun 20, 3:20 pm, Rob r...@eroh.me wrote: I want to version my css/js files: /23/css/style.css routes to /css/style.css where 23 can be any number (specifically the current svn version id) Is this possible? I've seen a lot of advanced routing to controllers, but I can't find anywhere to reroute to something in webroot. Thanks in advance! what's wrong with /css/style.css?23 or similar. if you do what you've asked with (cake)php your making the requests for your assets unnecessarly slow - and not in a trivial way. compare how long it takes to get your file with /css/ thisisinthewebroot.css and /css/thisisinvendorscss.css and /css/ Iroutedthistoacontrolleraction.css hth, AD Ps forgot to mention that you /could/ do it with a htaccess redirect --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
how to make gridview (as in asp.net) in cakephp
hi all, i wanna to ask how to get a multi row edit or (table edit) as a grid view in asp.net ?? tanks for all --~--~-~--~~~---~--~~ 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: Best way to setup my comments system
I thought of an idea if I use multiple tables. I can create my base model class of Comment. And then I can have the other tables extend that class to inherit their functions and that should work. class CommentsArticle extends Comment {} --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Association problems
Hello, I'm new to cakePHP and I don't know why my associations aren't working. I'm trying to associate a game with a genre. Each game has a genre_id column which corresponds to a genre in a table named genres. My game model looks like this: ?php class Game extends AppModel { var $name = 'Game'; var $hasOne = 'Genre'; } ? Genre model: ?php class Genre extends AppModel { var $name = 'Genre'; } ? Games controller: ?php class GamesController extends AppController { var $name = 'Games'; function index() { $this-set('game', $this-Game-find()); } } ? Now in my games view when I call I try to access $game['Genre'] I get an undefined index error. Is there something I'm missing here? --~--~-~--~~~---~--~~ 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: view not echoing
i still get the error undefined index: Product [APP\views\products\index.ctp, line 12] On Jun 21, 8:24 pm, Pablo Viojo pvi...@gmail.com wrote: The problem isn't related to echo. Your variable is name products in the controller $this-set('products',$this-Product-find('all')); So, in the view you should use $products. Try doing ?debug($products)? in your view. HTH, Pablo Viojo pvi...@gmail.comhttp://pviojo.net (#260 y creciendo!) Ayudar nos hace felices!http://needish.com -http://helperman.org On Sun, Jun 21, 2009 at 1:20 PM, dflow deeepf...@gmail.com wrote: i have done some tutorials the scaffold works fine when i want to create my own view nothing is echoed here is the controller: ?php class ProductsController extends AppController { var $name = 'Products'; //var $scaffold; function index() { $this-set('products',$this-Product-find('all')); } } ? and the products/index.ctp view i get the hello and nothing blank screen with the default cake layout the code: ?php echo'hello';? html head titletest title/title /head body div id=container div id=content ?=$content_for_layout;? ?php echo $product['Product']['id']; ? /div /div /body /html i get this error Notice (8): Undefined variable: product [APP\views\products\index.ctp, line 11] --~--~-~--~~~---~--~~ 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: TreeBehavior across different models
Thanks for the reply. I actually did kind of what you said. I abstracted my objects into a chainable object and then extended that. It worked quite nicely and now I can use the useful methods in TreeBehavior to get the data I need easily. On Jun 18, 9:40 am, delocalizer conrad.leon...@hotmail.com wrote: Hi Greg; Yes my experience is that if it's not easily implemented with the core Tree behaviour then there is probably a better or at least alternative way to do it. Once (and only once) was I determined (desperate?) enough to have a heterogeneous model tree, and in that case I used a separate model with Tree behaviour just for the structure, with fields for the class name UUID of the model object referred to by each node. Worked quite well but had to be careful to keep the the structure tree in sync with its models using callbacks so that adding/ editing/deleting a model did likewise to the tree and vice versa Sounds like it all worked out for you anyway. cheers mate. On Jun 17, 8:28 pm, Greg Baker greg.baker@gmail.com wrote: Basically I wanted to create a chain of alternating objects. For example: document-comment-document-comment-document-comment Not really a tree I guess but I thought I could make use of some of the tree behaviour to help me. I've since come up with my own solution so I don't have to use tree. On Jun 9, 7:52 am, delocalizer conrad.leon...@hotmail.com wrote: Can you describe the context of the problem? ie. what is it that you want to achieve? On Jun 6, 1:38 am, Greg Baker greg.baker@gmail.com wrote: Is it possible to use TreeBehavior where parent_id points to an id in another model, which also uses TreeBehavior? --~--~-~--~~~---~--~~ 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: view not echoing
Because Product does not exist. Its $products[0]['Product']; Its a multi array. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Paginate by way other than field
Is there a way to set a pagination order by something that does not exist in a the database? I have a $percent variable that ranks search requests so each Post is given a matching percentage and I want to then order the Posts by ranking percentage highest to lowest. How do I order the Posts by $percent when there is no percent field? Do i have to re-order that array the way I want then pass it to paginate and leave order out of the paginate var? Dave --~--~-~--~~~---~--~~ 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: Association problems
On Sun, Jun 21, 2009 at 3:05 PM, Davidda...@reflashed.com wrote: I'm new to cakePHP and I don't know why my associations aren't working. I'm trying to associate a game with a genre. Each game has a genre_id column (..) ?php class Game extends AppModel { var $name = 'Game'; var $hasOne = 'Genre'; } Your models are not correct. If Game has a genre_id column, in a CakePHP association you said that Game belongsTo Genre, so Genre hasOne (or hasMany, depending of your case) Game. http://book.cakephp.org/view/81/belongsTo Best regards. -- MARCELO DE F. ANDRADE Belem, PA, Amazonia, Brazil Linux User #221105 http://mfandrade.wordpress.com --~--~-~--~~~---~--~~ 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: Association problems
As marcelo said, it would be a belongsTo, not a hasOne. If the genre_id is in the games table, then its belongsTo. If the game_id is in the genre table, its a has One. --~--~-~--~~~---~--~~ 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: grr help with cron/shell tabs
I found out that my CLI was PHP 4, so I changed it to PHP 5. I can run the cron through SSH manually, but when I run through cron I now get this error: TERM environment variable not set. /home/mileswj/cake/console/cake: line 30: exec: php: not found --~--~-~--~~~---~--~~ 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: grr help with cron/shell tabs
Ensure that your environment variable PATH includes the path to the php executable. Cheers, Graham Weldon http://grahamweldon.com Miles J wrote: I found out that my CLI was PHP 4, so I changed it to PHP 5. I can run the cron through SSH manually, but when I run through cron I now get this error: TERM environment variable not set. /home/mileswj/cake/console/cake: line 30: exec: php: not found --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
set not working
When I use $this-set in my controller it doesn't seem to work, I think this could be due to my beforeFilter as I have it takes the current action, then checks the first variable to determine which view to show. function beforeFilter() { if (in_array($this-params['action'],$this-actions)) { if ( !( empty($this-params['pass'][0]) ) ) { $this-render(DS . 'admins' . DS . $this-params['action'] . DS . $this-params['pass'][0]); } else { $this-render(DS . 'admins' . DS . $this-params['action'] . DS . 'index'); } } } My controller action looks like this. When I echo it in the view it says undefined variable, so could this be due to the way I have my beforeFilter set up? function type($load = null,$id = null) { switch ($load) { Case 'add': if(!empty($this-data)) { if($this-Type-save($this-data)) { $this-Session-setFlash('Type has been saved.'); $this-redirect(array('controller'='admins','action'='type')); } else { $this-Session-setFlash('An error has occured in saving type.'); } } $this-set('test','test'); break; --~--~-~--~~~---~--~~ 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: Association problems
you also have to set $recursive = 1 in the model. On Jun 21, 9:21 pm, David da...@reflashed.com wrote: I've tried using both hasOne and belongsTo and neither works. I was initially using belongsTo but that didn't work so I switched to hasOne. I just tried it again to be sure, and it still isn't working. Do I need to set up foreign keys within mysql? --~--~-~--~~~---~--~~ 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: Array Help
I tried extract / merge / combine / tried regular array functions push and I just cant get this. Read the eat arrays for breakfast link but I am not extracting from a path, id's are already extracted thru a search and percent is a function run on each extracted id. Now I need to create an array to pass to pagination that has the percent and id Tried foreach loops and still nothing. Can someone point out how to exactly get the pairs for each key to create an array for each I have 2 separate arrays, one is just the id's the other is the percentage Id's: Array ( [0] = 3 [1] = 4 [2] = 5 [3] = 6 [4] = 7 } Percent array: Array ( [0] = 28 [1] = 39 [2] = 17 [3] = 28 [4] = 23 So it would end up like: Array ( [0] = Array ( [id] = 3 [percent] = 28 ) [1] = Array ( [id] = 4 [percent] = 39 ) [2] = Array ( [id] = 5 [percent] = 17 ) [3] = Array ( [id] = 6 [percent] = 28 ) [4] = Array ( [id] = 7 [percent] = 23 ) ) Thanks, Dave -Original Message- From: mike karthauser [mailto:mi...@brightstorm.co.uk] Sent: June-21-09 10:08 AM To: cake-php@googlegroups.com Subject: Re: Array Help hi dave On 21 Jun 2009, at 13:35, Dave Maharaj :: WidePixels.com wrote: How can I edit this array: Array ( [Test] = Array ( [Post] = Array ( [0] = 3 [1] = 4 [2] = 5 [3] = 6 [4] = 7 [5] = 8 [6] = 9 ) [Percent] = Array ( [0] = 28 [1] = 39 [2] = 17 [3] = 28 [4] = 23 [5] = 17 [6] = 17 ) ) ) Into something like : take each key from POST and PERCENT, and pair them up Array ( [Test] = Array ( [0] = Array ( [Post] = 3 [Percent] = 28 ) ) ) by using set::extract http://debuggable.com/posts/cake-12s-set-class-eats-arrays-for-breakfast YMMV regards mikek -- Mike Karthäuser Managing Director - Brightstorm Ltd Email: mi...@brightstorm.co.uk Web: http://www.brightstorm.co.uk http://www.brightstorm.co.uk/ Tel: 07939 252144 (mobile) Fax: 0870 1320560 Address: 1 Brewery Court, North Street, Bristol, BS3 1JS --~--~-~--~~~---~--~~ 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: Association problems
I've tried using both hasOne and belongsTo and neither works. I was initially using belongsTo but that didn't work so I switched to hasOne. I just tried it again to be sure, and it still isn't working. Do I need to set up foreign keys within mysql? --~--~-~--~~~---~--~~ 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: Association problems
That still isn't working :/ On Jun 21, 7:27 pm, iFeghali igor.fegh...@gmail.com wrote: you also have to set $recursive = 1 in the model. On Jun 21, 9:21 pm, David da...@reflashed.com wrote: I've tried using both hasOne and belongsTo and neither works. I was initially using belongsTo but that didn't work so I switched to hasOne. I just tried it again to be sure, and it still isn't working. Do I need to set up foreign keys within mysql? --~--~-~--~~~---~--~~ 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: Association problems
What appears when you put debug($products) in your view? --~--~-~--~~~---~--~~ 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: Versioned Routing to a css or js file in webroot
I would forget the versioned folder method and go with Matt Currys Asset Plugin - turning on timestamp checking. this way when you update any item in the array of files past to html-css or (js to the javascript helper) a new compressed single file is made in cjs ccss. Matt has samples of the .htaccess files you use with the helper. - S 2009/6/21 AD7six andydawso...@gmail.com On Jun 21, 7:47 pm, AD7six andydawso...@gmail.com wrote: On Jun 20, 3:20 pm, Rob r...@eroh.me wrote: I want to version my css/js files: /23/css/style.css routes to /css/style.css where 23 can be any number (specifically the current svn version id) Is this possible? I've seen a lot of advanced routing to controllers, but I can't find anywhere to reroute to something in webroot. Thanks in advance! what's wrong with /css/style.css?23 or similar. if you do what you've asked with (cake)php your making the requests for your assets unnecessarly slow - and not in a trivial way. compare how long it takes to get your file with /css/ thisisinthewebroot.css and /css/thisisinvendorscss.css and /css/ Iroutedthistoacontrolleraction.css hth, AD Ps forgot to mention that you /could/ do it with a htaccess redirect --~--~-~--~~~---~--~~ 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: Association problems
Array ( [0] = Array ( [Game] = Array ( [id] = 1 [user_id] = 1 [genre_id] = 1 [name] = Ball Surfer [width] = 500 [height] = 500 [short_description] = Keep your kitten afloat! [description] = Help your cat learn to surf, but without it ever getting wet! Use the arrow keys to balance your character and try for the highest score! [approved] = 1 [views] = 0 [average] = 0 [votes] = 0 [created] = 2009-06-19 12:43:46 [modified] = 2009-06-19 12:43:50 ) ) ) On Jun 21, 9:08 pm, Miles J mileswjohn...@gmail.com wrote: What appears when you put debug($products) in your view? --~--~-~--~~~---~--~~ 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: Association problems
Ok I was looking through the docs and found the bindModel funcion. When I add $this-Game-bindModel(array('belongsTo'=array ('Genre'=array('className'='Genre'; to my controller it successfully associates the models. Why is cakePHP not doing this implicitly? --~--~-~--~~~---~--~~ 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: Association problems
Are you using recursive or contain? Whats your find query. --~--~-~--~~~---~--~~ 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: Association problems
My find query is $this-Game-find('all'), but I think I've figured out the problem. I don't think that cakePHP is finding my game model, Game.php. I deleted everything inside the class and nothing happened. I even replaced it with gibberish to see if it would throw error but still nothing happened. Why wouldn't it locate this file? Game.php resides in app/models. Does this sound right to you? On Jun 21, 9:48 pm, Miles J mileswjohn...@gmail.com wrote: Are you using recursive or contain? Whats your find query. --~--~-~--~~~---~--~~ 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: Association problems
My G in Game.php is capitalized... I really feel like an idiot. I just saw in the docs that it has to be lowercase; It's now working perfectly. Shouldn't it throw a warning or something when something like this happens? Well anyways, thanks for all the help, David. On Jun 21, 10:01 pm, David da...@reflashed.com wrote: My find query is $this-Game-find('all'), but I think I've figured out the problem. I don't think that cakePHP is finding my game model, Game.php. I deleted everything inside the class and nothing happened. I even replaced it with gibberish to see if it would throw error but still nothing happened. Why wouldn't it locate this file? Game.php resides in app/models. Does this sound right to you? On Jun 21, 9:48 pm, Miles J mileswjohn...@gmail.com wrote: Are you using recursive or contain? Whats your find query. --~--~-~--~~~---~--~~ 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: Association problems
Yeah simple stuff like that is annoying. Also be sure to remove your tmp/cache/models --~--~-~--~~~---~--~~ 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: who is 'Cake' : some basic oop cake nonunderstanding
Yes, CakePHP explanations can be terse. However, there is a description of how a CakePHP app gets started in section one of the manual (see: http://book.cakephp.org/view/10/Understanding-Model-View-Controller). 1. Where are the objects ?? I see lots of classes but no instances of them.Yes, there is '$this', but it doesnt count since its a reference to an actual object, which, as far as i could see in all the tutorials, doesnt exist yet. It all starts with the Dispatcher. An instance of the Dispatcher gets created near the end of /app/webroot/index.php. From there, the app follows the conventions of CakePHP to know that the controller that it needs to create an instance of is contained in the URL. That's why URLs are in the form /app_name/controller_name/action/arguments. The instantiation of the controller class by the Dispatcher results in the instantiation of other classes like Helpers, Models, Components, etc. Some are instantiated by default, other you define with member variables like $uses and $helpers. The code that actually instantiates these classes is in the core CakePHP libraries. You don't really need to know the guts but the code is all there to follow if you want. The power if CakePHP is that you don't have to write a bunch of code to do things like instantiate classes, do input validation, render output etc.. Instead you follow the conventions and CakePHP library classes and methods do the trudgery. It is important to know the general control flow of CakePHP so you understand why functions like beforeFilter() and beforeRender() exist and why you would use them. Check out: http://book.cakephp.org/view/21/A-Typical-CakePHP-Request 2. I see of a static parent::method and variable, i see variables that are handled via arrays, but where are object references ?? As said in anohter post $this-Model-find IS a reference to am instantiated class. You define this either by following the convention and creating a Model class or by adding a model name to $uses. Again, the CakePHP libraries just follow the conventions to instantiate the classes you tel it to. 3. also havent come across a protected method in any tutorial yet. Why is that - just by chance ? or did i not look well enough. That's PHP4 syntax (as in another post). So. In order to use the structure it is essential to know whats actually going on. 'sentences like 'cake' does this or that dont help, btw. escpecially since i have no clue who the hell 'cake' is :). CakePHP is an instance of and MVC framework. Period. You might want to read up on what MVC is some more. Try: http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller Then again -there's nothing like experience - so, go through the motions, follow the conventions, implement a simple app or two or three and you will learn a bunch. I hope this helps, Ken --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
foreach question
I have my final array but having a prblem going thru foreach with it. Array ( [0] = Array ( [0] = 52 [1] = 67 ) [1] = Array ( [0] = 43 [1] = 67 ) [2] = Array ( [0] = 40 [1] = 67 ) [3] = Array ( [0] = 34 [1] = 67 ) ) I pass the data to the view as $this-set('final', $final); but how do I do a foreach when it's a [number] = array Dave --~--~-~--~~~---~--~~ 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: Bootstrap variable
I am setting variable like- Configure::write('site_new','/'.$_SERVER [HTTP_HOST].'/abc'); in bootstrap.php.. and accessing it in view as - echo $site_new. please reply On Jun 19, 8:49 am, Stu greenmushroo...@gmail.com wrote: Well, it seems that yourvariableisn't defined. Could you post yourbootstrapcode along with how you're reading your variables in the view? --~--~-~--~~~---~--~~ 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: foreach question
foreach ($final as $no = $data) --~--~-~--~~~---~--~~ 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: Global Variable
Hi Rick, Thanks for reply I have done it this way Declaring Global Variable: Configure::write('var_name','var_value'); Reading Global Variable:Configure::read('var_name'); Regards Anand On Jun 19, 5:54 pm, Rick will...@gmail.com wrote: You can write a new config value or you can define a variable or constant in bootstrap.php. Rick On Jun 19, 8:42 am, Anand anandprakashwankh...@gmail.com wrote: Hello All, How to define a global variable in CakePHP which i can use anywhere in the application. Please provide a code sample. Waiting for reply Anand --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
transactions + redirect doesn't work!
Hello I have this code: function A () { $this-query('BEGIN TRANSACTION A'); xxx xxx $this-redirect('/controller/B); } function B () { xxx xxx $this-query('COMMIT TRANSACTION A'); } doesn't work because there is a missing BEGIN TRANSACTION However, if I use instead $this-query('BEGIN TRANSACTION A'); xxx xxx $this-B(); } It works somehow. Any ideas about this? Does redirect automatically shuts down existing transaction? Thanks a lot --~--~-~--~~~---~--~~ 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: transactions + redirect doesn't work!
Please note, this doesn't work even if I put $this-redirect('/controller/B', null, false); Thanks On Jun 21, 11:49 pm, Mateo San Román sanroma...@gmail.com wrote: Hello I have this code: function A () { $this-query('BEGIN TRANSACTION A'); xxx xxx $this-redirect('/controller/B); } function B () { xxx xxx $this-query('COMMIT TRANSACTION A'); } doesn't work because there is a missing BEGIN TRANSACTION However, if I use instead $this-query('BEGIN TRANSACTION A'); xxx xxx $this-B(); } It works somehow. Any ideas about this? Does redirect automatically shuts down existing transaction? Thanks a lot --~--~-~--~~~---~--~~ 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: view not echoing
debug(...) is your friend! always! Saludos, Pablo Viojo pvi...@gmail.com http://pviojo.net (#260 y creciendo!) Ayudar nos hace felices! http://needish.com - http://helperman.org On Sun, Jun 21, 2009 at 6:23 PM, Miles J mileswjohn...@gmail.com wrote: Because Product does not exist. Its $products[0]['Product']; Its a multi array. --~--~-~--~~~---~--~~ 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: foreach question
Sorry1 final thing. How do I set pagination with this array also? Array ( [Final] = Array ( [0] = Array ( [0] = 52 - this is the Post ID [1] = 48 ) [1] = Array ( [0] = 37 - this is the Post ID [1] = 48 ) [2] = Array ( [0] = 49 - this is the Post ID [1] = 36 ) } Thanks, Dave -Original Message- From: Miles J [mailto:mileswjohn...@gmail.com] Sent: June-22-09 2:15 AM To: CakePHP Subject: Re: foreach question foreach ($final as $no = $data) --~--~-~--~~~---~--~~ 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: transactions + redirect doesn't work!
Yes. You must start and end a transaction with the same mysql connection. MySQL connections are automatically closed once the page has finished executing. A redirect stops the current page execution. Cheers, Adam - Original Message - From: Mateo San Román sanroma...@gmail.com To: CakePHP cake-php@googlegroups.com Sent: Monday, June 22, 2009 2:49 PM Subject: transactions + redirect doesn't work! Hello I have this code: function A () { $this-query('BEGIN TRANSACTION A'); xxx xxx $this-redirect('/controller/B); } function B () { xxx xxx $this-query('COMMIT TRANSACTION A'); } doesn't work because there is a missing BEGIN TRANSACTION However, if I use instead $this-query('BEGIN TRANSACTION A'); xxx xxx $this-B(); } It works somehow. Any ideas about this? Does redirect automatically shuts down existing transaction? Thanks a lot --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---