Testing in cakephp with Mocks
Hello all, I'm pretty new to testing using mocks in cakephp and I'm having trouble mocking models that have behavior objects. Is there a way when you create a mock object to let cake know that you don't want the model to load any behaviors? Perhaps with something passed into the constructor? I've been using something like this to make my mocks for models. $this-MyObject = $this-getMockBuilder( 'MyModelClass' )-othermockingfunctions()-getMock(); Any information or if someone can point me in the right direction would be great. And by the way before anyone says it I have been to the phpunit manual and read their section on mocking. Not exactly what you would call complete documentation. Richard -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Unit testing and redirects within an exception
Hi I have a unit test here, and it is failing. The headers['location'] key does not have a value in it when the Product-edit() method raises the exception, even though I still call redirect within the catch. Is this expected behavior? If I put the redirect before or after the try...catch blog, the headers['location'] has a value, this problem only seems to occur when inside the exception handler. Can anyone possibly tell me what I might be doing wrong here? Many thanks Richard The test: $postData = array( 'Product' = array( 'id' = ProductTest::TEST_PRODUCT_ONE, price' = 100 )); $this-testAction('/admin/products/update', array('data' = $postData)); $this-assertContains('/admin/products/edit', $this-headers['Location']); The controller: try { if ($this-Product-edit($this-request-data)) { return $this-redirect(array('action' = 'edit', $this-Product-id)); } } catch (DomainException $quotaException) { $this-Session-setFlash(); return $this-redirect(array('action' = 'edit', $this-Product-id)); } -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Setting HTTP 401 header from a component.
Hi All, Whats the right way to set a 401 header ? Im currently using if (empty($_SERVER['PHP_AUTH_DIGEST'])) { $this-controller-header('HTTP/1.1 401 Unauthorized'); $this-controller-header('WWW-Authenticate: Digest realm='.$realm.',qop=auth,nonce='.$realm.',opaque='.$realm.''); return $this-setStatus(ERRDIGEST); } Which fills my debug.log with 2013-07-06 14:09:46 Notice: Notice (8): Undefined offset: 1 in [/opt/hd-1983/lib/Cake/Network/CakeResponse.php, line 526] Trace: CakeResponse::header() - CORE/Cake/Network/CakeResponse.php, line 526 Controller::header() - CORE/Cake/Controller/Controller.php, line 821 [snip...] Cakephp : 2.2.3 Thanks. Cheers Richard -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
APC caching integer value 0 returns false on read
I'm having a problem with APC caching engine, when trying to cache the integer value 0 it returns as false when read back out? ?php Cache::write('stats', 0); Cache::read('stats'); // returns false? This is on cake 2.3.1 / php 5.4 -- 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.
saveAssociated validation not working
Hi, i have a problem with validation when using saveAssociated. Poll model validation works fine, but PollOptions model validation not... Controller public function admin_create() { if ($this-request-is('post')) { //$this-Poll-set($this-request-data); if ($this-Poll-saveAssociated($this-request-data)) { $this-Session-setFlash('Saved.', 'alerts/success'); $this-redirect(array('action' = 'admin_index'), null, true); } } } Poll model ?php App::uses('PollAppModel', 'Polls.Model'); class Poll extends PollAppModel { public $name = 'Poll'; public $useTable = 'polls'; public $hasMany = array( 'PollOptions' = array( 'className' = 'PollsOptions', 'foreignKey' = 'poll_id', 'dependent' = true ) ); public $validate = array( 'title' = array( array('rule' = 'notEmpty', 'message' = 'Enter title.' ), array( 'rule' = array('maxLength', 150), 'message' = 'Too long.' ) ) ); } ? PollOptions model ?php App::uses('PollAppModel', 'Polls.Model'); class PollOptions extends PollAppModel { public $name = 'PollOptions'; public $useTable = 'polls_options'; public $validate = array( 'title' = array( array('rule' = 'notEmpty', 'message' = 'Enter title.' ), array( 'rule' = array('maxLength', 150), 'message' = 'Too long.' ) ) ); } ? Form ?php echo $this-Html-css(array('/Polls/css/polls'), 'stylesheet', array('inline' = false)); ? script $(function() { $('#addOption').click(function(event) { event.preventDefault(); var newOption = $('.options:eq(0)').clone(); var optionNum = $('#options input').length+1; newOption.find('input').val('').attr('id', 'PollOptions'+optionNum+'Title').attr('name', 'data[PollOptions]['+optionNum+'][title]'); $('#options').append(newOption); }) }) /script div ?php echo $this-Form-create('Poll', array('class' = 'form-horizontal', 'novalidate' = true)); ? div class=control-group div class=required ?php echo $this-Form-label('Poll.title', 'Title:', array('class' = 'control-label')); ? /div div class=controls ?php echo $this-Form-input('Poll.title', array('type' = 'text', 'class' = 'input-block-level', 'maxlength' = 150, 'label' = false)); ? /div /div div class=control-group ?php echo $this-Form-label('Poll.active', 'Active:', array('class' = 'control-label')); ? div class=controls ?php echo $this-Form-checkbox('Poll.active', array('label' = false)); ? /div /div hr div id=options class=control-group div class=required ?php echo $this-Form-label('PollOptions.title', 'Options:', array('class' = 'control-label')); ? /div div class=controls options ?php echo $this-Form-input('PollOptions.0.title', array('type' = 'text', 'class' = 'input-block-level', 'maxlength' = 150, 'label' = false)); ? /div div class=controls options ?php echo $this-Form-input('PollOptions.1.title', array('type' = 'text', 'class' = 'input-block-level', 'maxlength' = 150, 'label' = false)); ? /div /div div align=right button class=btn small id=addOptioni class=icon-plus/i Add option/button /div div class=form-actions button type=submit class=btn btn-successSave/button button type=reset class=btnCancel/button /div ?php echo $this-Form-end(); ? /div -- 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: new site made with cakephp
thanks, yeah I just checked your site again, and it is working just fine now :-) On Wed, Oct 3, 2012 at 10:13 PM, Michael Connors michael.j.conn...@gmail.com wrote: Strange you got the server error, but checking the time of your post I think I was switching up servers at the time. There wasn't any real technical challenges other than interfacing with amazon web services. Right now registration emails are not reaching their destinations, but thats not exactly cakephp issue. Uploading I still am unclear, I upload through cake using amazon SDK and immediately respond with the cloudfront URL. I wasn't sure if I have to wait for it to show up on the CDN. Right now I am also looking into CPU usage, its twice as high, but I am going through and tweaking. Some of the things I thought would be nice to have and I had to add was compressing javascript/ css, I added minify. I had to hook into solr, but there is a php class that works easily, it should really be a data model. Also thumbnail processing I added phpthumbfactory. Other than that cake was great to work with. On Wednesday, October 3, 2012 5:51:01 PM UTC-4, Michael Connors wrote: New site made with cake. http://www.morguefile.com -- Like Us on FacekBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. -- Richard Joo -- Like Us on FacekBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: User and Password
You can create multiple validation rules in your model and choose different rule depending on what page or case scenario you need to apply. On Oct 4, 2012, at 8:42 AM, cosinusweb cosinus...@gmail.com wrote: Hello When I add a user in the database the password is cryped public function beforeSave($options = array()) { $this-data['User']['password'] = AuthComponent::password($this-data['User']['password']); return true; } But if I edit the user to change the email adresse for example the password is cryped again so it crypted an already cryped password. How can I avoid that. Thanks for your help -- Like Us on FacekBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. -- Like Us on FacekBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: new site made with cakephp
uh maybe working on something? I get 500 error... Server error The webpage at *http://www.morguefile.com/* is currently unavailable. It may be overloaded or down for maintenance. Here are some suggestions: - Reload http://www.morguefile.com/ this webpage later. HTTP Error 503 (Service Unavailable): The server is currently unable to handle the request. This code indicates this is a temporary condition, and the server will be up again after a delay. On Wed, Oct 3, 2012 at 8:21 PM, Dr. Tarique Sani tariques...@gmail.comwrote: On Thu, Oct 4, 2012 at 3:21 AM, Michael Connors michael.j.conn...@gmail.com wrote: New site made with cake. http://www.morguefile.com Nice looking site - you will get more traction here if you present some of the technical challenges you over came.. Cheers Tarique -- = Conference scheduling made simple http://shdlr.com PHP for E-Biz: http://sanisoft.com = -- Like Us on FacekBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. -- Richard Joo -- Like Us on FacekBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: cakephp 2.2.2
what kind of session issues are you having? do you have specific example(s) or test case scenarios? On Fri, Sep 21, 2012 at 2:21 AM, Pietro Brignola pietro.brign...@gmail.comwrote: Hi guys, i've been using (enjoying) cakephp here at UNIPA campus (Palermo, IT) since 2007. Many prod. applications still running, Robust, excellent, perfect for us. Never got problem... Now with 2.2.2 version no way to make cake Session to work correctly. I can't believe... 3 different server tested, all issues of the last 3 years (google) read and tried , a lot of time devasted... Please...sure no bugs pending? Please help me... -- Like Us on FacekBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. -- Richard Joo -- Like Us on FacekBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: How I can edit a user without changing the password?
I am sure there are a lot better solutions than this, and more brilliant coders can help you out, but at least this is what I did. I used password and password2 (or reEnterPassword however your call it) on edit.ctp and use two different rules from the User model on Model, you will need public $validation as your default rule, then create public $validationSets (you need a plugin for this. I think it is multivalidate) and you would create validation something like public $validationSets = array( 'edit' = array( YOU DO ADD PASSWORD SECTION HERE }, 'add' = array( whatever rule you want }, 'editWithOutPassword' = array( Rules WITHOUT PASSWORD HERE ) ); Then on UsersController.php, you would call it something like public function edit($id = null) { if edit with password { $this-User-setValidation('edit'); and do whatever your code here } else { $this-User-setValidation('editWithOutPassword'); And here, you will have to compile your own list of forms you need to save without password. something like $fieldsToUpdate = array(your field list here); $formValues = array(your form values here); $this-User-read($fieldsToUpdate, $id); $this-User-set($formValues); and rest of your save code here if($this-User-save()) { User has been saved } else { User could not be saved. } } } On Mon, May 28, 2012 at 12:20 PM, lsri8088 lsri8...@gmail.com wrote: Hello, I'm using cake 2.1 with AuthComponent and standard data modelusers. How I can edit a user without changing the password? For example, add a check I want to change the password. If thischeck is true then I make a hash of the password and keep it inserted.Otherwise I do not modify the password field. How do I add this check and then check it in my beforeSave() function? Another option I can think of is to leave the password field empty when I go to edit a user (unset ($ this- request- data ['User'] ['password']) ;)and then check if the password is empty or not. But when I insert a new user the password field should be mandatory Do you have any ideas? thanks -- 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 -- Richard Joo -- 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: CakePHP and TinyMCE
not clear without looking at all the codes, but I am wondering if Javascript Helper is loaded or not, and if you added writeToBuffer or not... On Mon, May 28, 2012 at 8:29 AM, damia...@gmail.com damia...@gmail.comwrote: Hi I've big problem. I want integrate TinyMCE with Cake 2.1. I use this tutorial http://bakery.cakephp.org/articles/galitul/2012/04/11/helper_tinymce_for_cakephp_2 but not working. JS add to textarea id but i see only empty textarea. What is wrong? Thanks for help. -- 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 -- Richard Joo -- 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: V2.1.2 Email Verification after registration
sorry if I read too quickly, but if you need to get the newly inserted id, it is very simple. here is the example code: if ($this-OrganizationAddress-save()) { // getting newly inserted OrganizationAddress.id $newId = $this-OrganizationAddress-id; } so, if SAVE was successful, then you just do $newId = $this-OrganizationAddress-id; that is all you need for newly inserted id. On Mon, May 21, 2012 at 1:07 PM, Cody Sortore rebel2noav...@gmail.comwrote: Okay, been working on this for a while, but I cannot figure out what in the world is going on! public function valid() { if (!empty($this-passedArgs[0]) !empty($this- passedArgs[1])){ $username = $this-passedArgs[0]; $validation = $this-passedArgs[1]; $results = $this-User-find(null, array('conditions' = array('User.username' = $this-passedArgs[0]))); if ($results['User']['usertype'] == 'valid') { if($results['User']['validation'] == $validation) { $results['User']['validation'] = md5(uniqid()); $results['User']['usertype'] = 'user'; $this-User-save($results); $this-Session-setFlash('Your registration is complete'); $this-redirect(array('action' = 'login')); } else { $this-Session-setFlash(__('The validation code does not match this users validation code. Please check your email and make sure you copied it correctly.')); $this-redirect(array('action' = 'login')); } } else { $this-Session-setFlash(__('This user has already been activated, please login to continue.')); $this-redirect(array('action' = 'login')); } } } There is no view, it's supposed to just go through the controller and redirect. If I could figure out how to retrieve the auto_increment user ID when the user is registered and send it in the auto generated email I wouldn't have this problem, or if I could retrieve the data based on the username. The SQL dump comes up properly formatted calls everything as I want, but all the data retrieved comes up null. Well, not exactly null, it somehow gets the proper user ID for all associated models... but no data is brought up to check and therefore fails the check for valid as usertype... So, if someone could tell me what is wrong with my formatting I would be most grateful! Thank you in advance for any tips :-D -- 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 -- Richard Joo -- 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
saveField with invalid ID creates a blank record
CakePHP 2: Not noticed this behaviour before, is it by design? (Seems odd if it is...) CREATE TABLE IF NOT EXISTS `users` ( `id` int(11) NOT NULL AUTO_INCREMENT, `username` varchar(32) NOT NULL, `password` varchar(64) NOT NULL, `is_active` tinyint(1) NOT NULL DEFAULT '0', PRIMARY KEY (`id`), UNIQUE KEY `username` (`username`), KEY `is_active` (`is_active`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=4 ; (Notice in particular the NOT NULL flags on username password: class User extends AppModel { public function activate($id) { $this-User-id = $id; $this-User-saveField('is_active', 1); } } With an empty table: $this-User-activate(1); Creates a new user with an id of 1, an empty string for username and password, and is_active = 1; I expected this to fail as User.id 1 doesn't exist. $this-User-activate(99); Creates a new user with an id of 2, an empty string for username and password, and is_active = 1; I expected this to fail as User.id 99 doesn't exist. Even if I disregard that user 99 doesn't exist, I'd expect the new record to be created with an id of 99 (not 2) -- 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: linked models and save
On Sun, Mar 4, 2012 at 9:58 AM, Cédric Chabert ced.chab...@gmail.com wrote: Hello there, I have one table User (used for the authentication) and linked with a Student table and Tutor tablea Can't comment on your code but I once had a job doing a database for an adult literacy program. We had multiple literacy providers in the area and I had to make it partition the data so each provider only had access to their own students. When the admin wants to create a tutor, it should add username and password on the user table. The tutor table has a foreign key 'iduser'. Therefore, on the add method in the TutorController, I tried to add an user at the same time as I add a tutor. But I don't succeed. Here is the source code : public function add() { if ($this-request-is('post')) { if ($this-Tutor-save($this-request-data)) { $dataUser = array('username' = $this-request- data('LOGINTUTOR'), 'password' = $this-request- data('PASSWORDTUTOR'), 'role' = 'tutor'); $this-Tutor-User-save($dataUser); $this-Tutor-iduser=$this-Tutor-User-id; $this-Tutor-save($this-request-data); $this-Session-setFlash('The student has been saved.'); $this-redirect(array('action' = 'index')); } else { $this-Session-setFlash('Unable to add the tutor.'); } } } -- 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 -- http://www.google.com/profiles/rssnow1 http://mypals.info -- 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: Using Join Tables in Cakephp - result in view.ctp
$post['SportsGroup']['title']? (it catches this one) ?php echo $post['SportsGroup']['name']? (but not this one) The database table are like: sports_groups: id | group_id | title groups_entity: guid | name Please help me, I used 2-3 days on this one.. /TheMuller -- 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 -- 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 -- Richard Joo -- 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: database concentions cake bake all
I am quite new to cakePHP as well, so, if I make mistakes here, please correct me. According to my experience, First, the quote from the cake book, the habtm naming convention would be: Join tables, used in hasAndBelongsToMany (HABTM) relationships between models should be named after the model tables they will join in alphabetical order (apples_zebras rather than zebras_apples). http://book.cakephp.org/2.0/en/getting-started/cakephp-conventions.html?highlight=habtm means, you would want to have table name to be groups_users and it will contain only three fields: id, group_id, user_id that way, when you bake all, hope you have configured your bake all configuration to suite your needs, the cake will create proper codes for you. And you will want to make sure to follow proper naming convention for Foreign Keys as well. If all of these names are properly followed, then cake will create absolutely stunningly beautiful codes for you. and then, you could have user_groups and have user_group_id inside of that table. But, if you are planning on using ACL, then you should make groups table independently and let the cake handle all the acl portion for you. For example, the site I am currently working on contains tables below: - users - groups - organizations - organizations_users (habtm) Try not to include roles to the database yet if you are not ready. If you are using mysql, perhaps using mysql workbench to analyze your table relations would be very helpful. -- Richard On Fri, Jan 27, 2012 at 2:57 AM, Dennis dr...@gmx.net wrote: hi, i am thinking that i misunderstood the cake conventions. i created a database with about 40 tables. every time i try to use cake bake all i get the error message, that some tables are missing. For example Table users (FK here is user_group_id) Table user_groups cake bake all tell me that table users_groups ist missing. I dont want to have a hbtm table construct here. For my understanding: If i use users_groups instead, do i have to set the FK as users_group_id or user_group_id? Thanks in advance Dennis -- 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 -- Richard Joo Director of Innovation Telelanguage, Inc. Support Options: Email your problem or question to tick...@telelanguage.com Submit a ticket to http://ticket.telelanguage.com Call 1.888.983.5352 and press 3 For best support please submit a ticket using the email or website method first and write down your ticket ID. You can track the progress of the ticket by using the ticket website. -- 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: jointable combined jointable
Usually cakePHP will complain when you have incorrectly formatted table names and foreign keys. if you have - users - jobs and made habtm - jobs_users { id, job_id, user_id } then those two tables will be baked properly. Assuming that you have FK named properly. You mentioned - Delivery Note - Positions I am not clear if you need deliverynotepositions or deliverynote and deliverynote_positions meaning, you can have either - deliverynotepositions or - deliverynote_positions and you could add user_id to the table and create FK hope I did not misunderstand your question... On Sat, Jan 28, 2012 at 12:39 AM, Dennis Reinert-Frerich dr...@gmx.netwrote: Maybe i should rename the table users in employees. For example: A company has 20 employees. The company gets a job from his customer. So i decied that 5 of my employees work on this job. There we got the habtm jobs_users. When the job is completed i will make a delivery note with positions for every work, which has been done. Every position could be done by one or more of the 5 teammembers from jobs_users. So i tried to make a jointable between positions and jobs_users and name this table jobs_users_positions. But it seems not to work. Best regards Dennis Am 27.01.2012 19:31, schrieb Kaupo Vana: Hi, I'm don't know the background of this task so the users habtm jobs looks a bit strange to me but if you want to keep the position concept then you can create a model for this. Table positions with fileds id, user_id, job_id and give habtm relationship to deliverynotes. Best regards, Kaupo -- Richard Joo Director of Innovation Telelanguage, Inc. Support Options: Email your problem or question to tick...@telelanguage.com Submit a ticket to http://ticket.telelanguage.com Call 1.888.983.5352 and press 3 For best support please submit a ticket using the email or website method first and write down your ticket ID. You can track the progress of the ticket by using the ticket website. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
How to paginate in HasAndBelongsToMany?(a liitle bit confused )
I do have a articles model and tags model. articles HABTM tags i use $this-set('articles', $this-Article-paginate()); and i can use paginator in index.ctp of Articles. I try to search articles by Tags, but the problem is it doesn't fit with the paginator. here's the code for showing of articles $articles = $this-paginate('Article', $condition); and here's when i try to search by tag name $condition = array('Tag.slug' = $this-passedArgs['tag']); $articles = $this-paginate('Article.Tag', $condition); But the come with different structure. How can i solve this one? -- 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: CakepHP 2.0 plugins no longer have a default controller?
Just in case anyone else is looking for the answer to this: I posted a ticket on CakePHP's issue tracker: http://cakephp.lighthouseapp.com/projects/42648/tickets/2237-20-plugins-dont-have-a-default-controller To which Mark responded and updated the migration guide: http://book.cakephp.org/2.0/en/appendices/2-0-migration-guide.html?highlight=migration#router On Oct 26, 7:33 pm, vaughany paulie...@gmail.com wrote: I thought this was just how plugins worked! Glad to hear it's (probably) not. Was linking to /users/users/view/id (as that was what worked) instead of the more preferable /users/view/id. Would dearly love to know how to use the preferable route. -- 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
Why do cake bake seems not to access my app folder?
Why do cake bake seems not to access my app folder? instead it shows the following and ask me the directory where i wanted to put my app Welcome to CakePHP v2.0.2 Console --- App : emr2.0 Path: /richardfiles/projects/php/xampproot/emr2.0/ --- What is the path to the project you want to bake? [/richardfiles/projects/php/xampproot/emr2.0/myapp] I do have an app folder at emr2.0 and actually i do have some i use bake previously and after i edit some of the views i decided to add again a model by using bake, but now bake seems to not work. thanks -- 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: Overriding form helper error messages in CakePHP 2.0
Shamless bump! On Oct 24, 3:44 pm, Richard@Home richardath...@gmail.com wrote: Hi all. I have the following $validate in my User model: var $validate = array( 'email'=array( 'required'=array( 'rule'='notEmpty', 'message'='cannot be blank' ), 'email'=array( 'rule'='email', 'message'='must be a valid email address' ), 'unique'=array( 'rule'='isUnique', 'message'='that email is already in use' ) ), 'password'=array( 'required'=array( 'rule'='notEmpty', 'message'='cannot be blank' ), 'length'=array( 'rule'=array('minLength', 6), 'message'='must be at least 6 letters, numbers or symbols' ), 'matches'=array( 'rule'='passwordsMatch', 'message'='passwords do not match' ) ) ); And I'm trying to override the 'unique' email address message in my form with: echo $this-Form-input('User.email', array( 'error'=array( 'unique' = 'That email is already in use. Have you ' . $this-Html-link('forgotten your password', array('action'='forgotten_password')) . '?' ) )); But it's still displaying the default validate message, not the custom one. What am I doing wrong? Thanks in advance. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: CakePHP 2.0 upgrade - benefit vs pain scale
I'm also upgrading a 1.3 app but it's proving to be problematic :-S I'd say if you aren't too far along in your project then upgrade, but If you're using custom plugins and behaviors prepare for a bit of hair pulling ;-) On Oct 27, 1:38 pm, Shukuboy shuku...@gmail.com wrote: Hi guys, I have already started my first project in Cake 1.3, and have managed to set everything up the way I want it, that includes the basics, authentication, unit testing, i18n and a few other things. I had a look at the change logs of Cake 2.0 and all the updates look like good stuff. However I'm not sure if upgrading at this point of time would be so wise as it'd mean upgrading a whole lot of components, behaviors, tests and may end up costing a lot of time in the future, due to lack of compatibility with existing plugins written for 1.3. Hence, I was wondering about your opinion on these : - Are the non-tangible benefits of Cake 2.0 (such as performance and code clean-ness) worth the pain of upgrading ? - How much effort was involved in upgrading all your stuff to 2.0 ? - What's your experience been like so far with the new framework ? Cheers, Shukuboy -- 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
CakePHP 2.0 - Using a different/unconnected model in a behavior
Hi all I'm currently re-writing a 1.3 behavior which handles custom routing In my 1.3 Routable behavior I could pull in a reference to the Route model in a method with: App::Import('Model', 'Route'); $Route = new Route(); And access it with: $data = $Route-find('all', ... ); I've tried the same thing in 2.0 but I get the following error: Fatal error: Class 'Route' not found on the $Route = new Route() line I've tried using: App::uses('Route', 'Model'); and that gives the same error. How do I load a model to use in a behavior method? Thanks in advance. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: CakePHP 2.0 - Using a different/unconnected model in a behavior
Found the solution myself: App::uses('Route', 'Model'); needs to go before the class definition in the Behavior, not inside a method. ie. App::uses('Route', 'Model'); class Routable extends ModelBehavior { public function foo() { $Route = new Route(); } } On Oct 27, 3:35 pm, Richard@Home richardath...@gmail.com wrote: Hi all I'm currently re-writing a 1.3 behavior which handles custom routing In my 1.3 Routable behavior I could pull in a reference to the Route model in a method with: App::Import('Model', 'Route'); $Route = new Route(); And access it with: $data = $Route-find('all', ... ); I've tried the same thing in 2.0 but I get the following error: Fatal error: Class 'Route' not found on the $Route = new Route() line I've tried using: App::uses('Route', 'Model'); and that gives the same error. How do I load a model to use in a behavior method? Thanks in advance. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Multiply foreign keys in one table.
Ah. sorry, i didn't post my question. I would like to ask on how would i implement HABTM relationship in the four tables? Looking like Staffs School #1 - Science Teacher 1 School #1 - Science Teacger 2 School #2 - Physic Professor Thanks On Oct 27, 1:53 pm, Richard Neil Roque roquerichardn...@gmail.com wrote: My program is consist of tables: staff schools positions positions_schools_staffs 1 staff can be in in different school 1 staff can have different position in every school. I do it using HABTM to hospital, So one staff can have many hospital But i dont know how to retrieve the positions. positions_schools_staffs structure: id int staff_id int school_id int position_id int created date modified date Thanks -- 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
CakepHP 2.0 plugins no longer have a default controller?
In CakePHP 1.3 you can have a default controller for your plugins. e.g. if you had a Users plugin, you could create a users_controller so that urls such as: /users/index /users/edit/2 mapped to the index/edit actions in the Users controller in the Users plugin In CakePHP 2.0 you no longer seem to be able to do this and now need to use urls such as: /users/users/index /users/users/edit/2 I've tried messing around with custom routing to mimic the 1.3 behavior but with no luck so far. Was this intentionally removed from 2.0 or am I missing something? Thanks in advance. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: CakepHP 2.0 plugins no longer have a default controller?
Thanks for the sanity check. Didn't change anything and it's working now :-o I'm putting it down to a temporary caching issue or lackOfCoffee exception! On Oct 26, 3:58 pm, designv...@gmail.com designv...@gmail.com wrote: I have an 'Accommodation' plugin with AccommodationController.php and it works fine..? d//t. On Oct 26, 3:52 pm, Richard@Home richardath...@gmail.com wrote: In CakePHP 1.3 you can have a default controller for your plugins. e.g. if you had a Users plugin, you could create a users_controller so that urls such as: /users/index /users/edit/2 mapped to the index/edit actions in the Users controller in the Users plugin In CakePHP 2.0 you no longer seem to be able to do this and now need to use urls such as: /users/users/index /users/users/edit/2 I've tried messing around with custom routing to mimic the 1.3 behavior but with no luck so far. Was this intentionally removed from 2.0 or am I missing something? Thanks in advance. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: CakepHP 2.0 plugins no longer have a default controller?
meh, no its not. Working for prefixed routes, but not for others E.g., I have a register() method in my users controller, Can't reach it with: /users/register gives: Error: Users.RegisterController could not be found. Error: Create the class RegisterController below in file: /home/ richarda/www/test/cake_zero/www/app/Plugin/Users/Controller/ RegisterController.php Can be reached at: /users/users/register /admin/users/index renders the users controller admin_index() method correctly. On Oct 26, 3:58 pm, designv...@gmail.com designv...@gmail.com wrote: I have an 'Accommodation' plugin with AccommodationController.php and it works fine..? d//t. On Oct 26, 3:52 pm, Richard@Home richardath...@gmail.com wrote: In CakePHP 1.3 you can have a default controller for your plugins. e.g. if you had a Users plugin, you could create a users_controller so that urls such as: /users/index /users/edit/2 mapped to the index/edit actions in the Users controller in the Users plugin In CakePHP 2.0 you no longer seem to be able to do this and now need to use urls such as: /users/users/index /users/users/edit/2 I've tried messing around with custom routing to mimic the 1.3 behavior but with no luck so far. Was this intentionally removed from 2.0 or am I missing something? Thanks in advance. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Multiply foreign keys in one table.
My program is consist of tables: staff schools positions positions_schools_staffs 1 staff can be in in different school 1 staff can have different position in every school. I do it using HABTM to hospital, So one staff can have many hospital But i dont know how to retrieve the positions. positions_schools_staffs structure: id int staff_id int school_id int position_idint createddate modified date Thanks -- 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
Overriding form helper error messages in CakePHP 2.0
Hi all. I have the following $validate in my User model: var $validate = array( 'email'=array( 'required'=array( 'rule'='notEmpty', 'message'='cannot be blank' ), 'email'=array( 'rule'='email', 'message'='must be a valid email address' ), 'unique'=array( 'rule'='isUnique', 'message'='that email is already in use' ) ), 'password'=array( 'required'=array( 'rule'='notEmpty', 'message'='cannot be blank' ), 'length'=array( 'rule'=array('minLength', 6), 'message'='must be at least 6 letters, numbers or symbols' ), 'matches'=array( 'rule'='passwordsMatch', 'message'='passwords do not match' ) ) ); And I'm trying to override the 'unique' email address message in my form with: echo $this-Form-input('User.email', array( 'error'=array( 'unique' = 'That email is already in use. Have you ' . $this-Html- link('forgotten your password', array('action'='forgotten_password')) . '?' ) )); But it's still displaying the default validate message, not the custom one. What am I doing wrong? Thanks in advance. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Is there any way to mimic cakephp password hasing using java?
I do create a cakephp application using mysql server. And now i'm trying to create a java application. Now what im having trouble is in adding a new user using java Many thanks!! -- 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: Is there any way to mimic cakephp password hasing using java?
Thanks, i already got how to do it, i search for the code of security and figure that it uses sha1 for hashing(default), many thanks again :D -- 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 can i update a field using a function
Thanks for your reply. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
How can i update a field using a function
Hi i'm a new developer using CakePHP. I would like to know How can i update a field using a function. Example is UPDATE Users SET AGE=AGE+2+3+4 WHERE id=1??? Currently i do have a code like this one. $this-User-id = $user['User']['id']; $this-User-saveField('count_login', 'count_login+1'); $this-User-saveField('last_login', date('Y-m-d H:i:s')); Thanks. -- 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: Swfuploader
What kind of issues are you getting? I use swfupload frequently outside of Cake - it has options to pass session information that should work if you read the right information (although I could see the high security level potentially interfering). On Jun 9, 3:31 pm, Niels steni...@gmail.com wrote: Hey everybody, I'm trying to implement the SwfUploader in my cakephp app. But I'm having a hardtime doing so. I trying to follow thehttp://bakery.cakephp.org/articles/jrevillini/2007/04/10/swfupload-an... In the bakery but the tutorial has been posted way back in the days and now the code isn't compliant with the new 1.3.10 release. I'm hoping the find a little help from you guys could anybody set me up in the right direction. -- 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: Undefined variable in view
Hello Milos, thanks for you reply! If I define the variable in the controller as follows it states again that it's undefined in the view. $this-set('categories', 'TestValue'); When I echo the variable in the controller everything looks alright: var_dump($this-viewVars['categories']); However it does not pass all of the viewVars for some reason to the view. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Undefined variable in view
Hello Anja, I also did that, returns also 'Undefined variable'. However I found a way, I added the following function to the controller: function beforeRender() { parent::beforeRender(); $this-set('categories', $this-Category-find('all', array('recursive'=0))); } This works now as expected, however I do not really understand why it didn't worked in the first place. greeting, Richard On 3 sep, 11:58, Anja Liebermann anja.lieberm...@schauinslandreisen.de wrote: And how about var_dump($categories); In the view? Anja -Ursprüngliche Nachricht- Von: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] Im Auftrag von Richard Gesendet: Freitag, 3. September 2010 09:25 An: CakePHP Betreff: Re: Undefined variable in view Hello Milos, thanks for you reply! If I define the variable in the controller as follows it states again that it's undefined in the view. $this-set('categories', 'TestValue'); When I echo the variable in the controller everything looks alright: var_dump($this-viewVars['categories']); However it does not pass all of the viewVars for some reason to the view. Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group cake-php+athttp://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Undefined variable in view
Hello all, somehow I can't get the pagescontroller to pass a variable to the view. I have in my pages_controller.php: class PagesController extends AppController { //some code cut out for better reading here var $uses = array('Category'); function display() { //some code cut out for better reading here $this-set('categories', $this-Category- find('list')); } And in my home.ctp I use just this: ?php echo $categories; ? This returns: Undefined variable: categories (from the debug info I can see that PagesController-display() is used) When using debug($this-viewVars); I get this: Array ( [page] = home [subpage] = [title_for_layout] = Home ) Can somebody give me advise on what to do? 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: Component code
Why not pass the Session object to the model? $this-doSomething($with_this_data, $store_it_here); On Fri, Sep 3, 2010 at 6:05 AM, Jeremy Burns | Class Outfit jeremybu...@classoutfit.com wrote: I should mention that I both read from and write to the session... Jeremy Burns Class Outfit jeremybu...@classoutfit.com (t) +44 (0) 208 123 3822 (m) +44 (0) 7973 481949 Skype: jeremy_burns http://www.classoutfit.com On 3 Sep 2010, at 06:00, Dave Maharaj wrote: Place the code in the model and pass the Session data as vars from the controller? -Original Message- From: Jeremy Burns [mailto:jeremybu...@classoutfit.com] Sent: September-03-10 2:24 AM To: CakePHP Subject: Component code I have a chunk of code that appears in two controllers (orders_controller and order_items_controller) that is virtually identical in each case. I'd like to move it to a single location, so this sounds like an ideal candidate for a component. Part of the code calls a function in the Order model, so whilst one calls it via $this-Order-function() the other calls it via $this- OrderItem-Order-function(); hence the difference. I could also consider moving the code into the Order model and calling it from both controllers, but unfortunately the code also refers to $this-Session, which is not allowed in models. So I'm stuck. I can't move it to a component because a component can't call a model function, and I can't move it to a model because a model can't talk to the Session. Any ideas? Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.comcake-php%2bunsubscr...@googlegroups.comFor more options, visit this group at http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.comcake-php%2bunsubscr...@googlegroups.comFor more options, visit this group at http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.comcake-php%2bunsubscr...@googlegroups.comFor more options, visit this group at http://groups.google.com/group/cake-php?hl=en -- Richard Claydon Director, UGR Works e: rich...@ugrworks.com w: http://www.ugrworks.com t: 0131 208 2398 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: Good SVN Deployment Plan for CakePHP
Hey, I have a CakePHP shell that does various things, though it integrates with Git. The script checks out, applies database migrations (using Ruckusing), and runs CakePHP unit tests. It does some other stuff, like backup databases before the migrations are applied too. This code is part of a proprietary system (see www.ugrworks.com, the core product is built on CakePHP), but I'm happy to release the deployment code into the public domain. Drop me a line if you're interested. Cheers! Richard On Sat, Oct 24, 2009 at 9:36 PM, JeremyL jeremylue...@gmail.com wrote: Can anyone point me to a good solid SVN deployment howto for CakePHP and a live app? Something along the lines of how simple WordpPress explains it (http://codex.wordpress.org/Installing/ Updating_WordPress_with_Subversion) but of course Cake has some additional complications since cake is only a framework and not the entire app. 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: Enumerate CakePHP Layouts
Well, to list the items in the directory, maybe use the ls method of the Folder class. http://api.cakephp.org/class/folder#method-Folderls To store names in the database, I'd create a table: layouts(id, name, template, created, updated); where template refers to the *.ctp file. I'd possibly goes as far as adding a text field to include the content of the *.ctp file, to enable revision history, and dump the contents in the afterSave calback. On Thu, Jul 16, 2009 at 8:58 AM, DatacenterHellas merianosni...@gmail.comwrote: Hello all. I like to create a CMS that will hold many layouts depeding on a page content. e.x. : If the page has a layout for the mane page and then the web site owner will deside to have another layout for the offers to be able to cage to new layout, and if after three months will need a new layout for another part of the web site to be able to change to this one for this part of tha web site. So, my main problem is how to enumerate the available layouts that are installed on the CakePHP layouts directory, to give the ability to the user to choose the one he prefer for the page that he creates ? ? ? Also I like to store the layout name in my database and then automaticly when the controller start generate the data for the View, to change the layout to the chosen one that is stored in the database ? ? ? Kind regards Merianos Nikos --~--~-~--~~~---~--~~ 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: Insert Query from another table in .ctp
You load the record in the controller, before you push the data to the view that you have in your link below. I would record the statistics at this point in the controller. I noticed in your view code, you have an array which you iterate. After the first iteration, you have a header(Location:) - so I wouldn't bother load an array of data, just the single record you wish to redirect from. Hope this helps, Richard On Thu, Jul 16, 2009 at 2:50 AM, ramzwatcher coolramz...@gmail.com wrote: Hi, I want to create a redirect function in cakephp while having cloak redirect (using iframe) or normal redirect, plus I want to records the statistics of views for every attempt. Here's the link that I want to redirect where it's cloaked. http://www.hoturl.im/recommends/url/testing Below are codes that i write: So where can I place a query to insert date for every views? I seriously don't have any idea to do this one. And i also attach my db structure for references and thanks a lot! This file is recommends/URL.CTP head meta content=text/html; charset=utf-8 http-equiv=Content- Type/ ?php e($html-css('empty')); ? /head ?php foreach ($recommends as $recommend): if($recommend['Recommend']['cloacked'] == 1){ $this-layout = 'empty'; ? iframe height=100% frameborder=0 width=100% marginwidth=0 marginheight=0 name=body src=?php echo $recommend['Recommend'] ['url'] ?/ /iframe ?php }else{ header(Location: .$recommend['Recommend']['url']); } endforeach; ? I want to insert hits to statistics table in this /recommends/url.ctp that contains: -id -click date -click counts -recommend_id Your comment is appreciated. 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: Security question
Hi Dave, In terms of security, my opinion is that your concern should be with how the data is protected rather than the profiles a person can have. I was responsible for the architecture of a major real estate application and we implemented it in a similar way that you mentioned. Each user had profiles which each one representing either property, sale, or rental. Each type of profile had their own table, with a one-to-many relationship from the user. Hope this helps, Richard On Sun, Jul 12, 2009 at 4:27 PM, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: What would be the security holes to watch for in a situation like this Everyone who registers is a user User is then broken up into one of 2 groups depending on what role they select (think of a real estate site where you maybe looking for a home or selling so your either a buyer or seller) There is nothing to really prevent a user from signing up as each as each side of the site is specific for the role they select and no interaction between the 2 really but once you logged in you cant not access the registration form again so sure you can logout and register again but get a new user id so i really do not see any security issues with the idea. But the user hasOne sellerProfile and user hasOne buyerProfile seems to worry me somewhat because the user can only have 1 or the other and not both. I split the profiles simply because the information is so different for each side. Are there issues with this approach? 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: what do you use to deploy?
I use git. git pull. I use an apache htaccess to prevent access to the .git folder. I'm now working on some automation, the idea being when I run this command: cake deploy the code unit tests are run and then deployed. I'll dump the code on github sometime this week for anyone who's interested. On Mon, Jul 13, 2009 at 10:50 AM, Bert Van den Brande cyr...@gmail.comwrote: Subversion is by far the easiest way to update imho, I'm not aware of any issues regarding SVN and .htaccess On Sun, Jul 12, 2009 at 9:28 AM, nurvzynur...@gmail.com wrote: I use http://www.xp-dev.com (free private SVN service). SVN works great for me. I work in SVN locally or on dev server and when ready to deploy I just ssh to my public server and svn update. Pretty happy with it. On Jul 11, 2:20 pm, GravyFace gravyf...@gmail.com wrote: rsync makes me feel funny where my bathing suit covers. On Sat, Jul 11, 2009 at 3:57 PM, nMacshosoieltiernodelage...@gmail.com wrote: Since a few days ago I'm using sitecopy, a linux script that uploads only the modified files since the last update. You can add exclusions and many other options. But works only in Linux! On Sat, May 16, 2009 at 7:29 PM, majna majna...@gmail.com wrote: Check out fredistranohttp://code.google.com/p/fredistrano/ SVN is compatible with all files... On May 16, 7:53 pm, adam abennett...@sbcglobal.net wrote: I currently use FileZilla and Windows Explorer. My IDE of choice is eclipse, but have never used any integrated features or plugins for deployment/synchronizing localhost and webhost. I use Dreamhost, and I know they offer SVN as a feature, but was scared away by SVN's incompatibility with .htaccess files. But I guess I could create the repository, and then manually drop in the .htaccess files in their appropriate places, and then just use SVN from then on. But that's six .htaccess files and a lot of work. Cronjob for the .htaccess files? Any advice or words of wisdom? Or at least share what tools you use to deploy! Adam --~--~-~--~~~---~--~~ 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: Execute a Shell Task on Background
Two possible approaches, if your responding to user requests to invoke report generation I've used 'exec' with 'nice. The request is made by the user, which then invokes the shell task, and then redirects to another page. This page is automatically reloaded, on each time it monitors the status of the shell task. I handled this by checking a running_tasks table, which has some data about the invoked task, and a potential return code. ?php exec(nice /path/to/cake shell); ? If you're talking about non-user invoked tasks, investigate cron tasks. Hope this helps, Richard On Mon, Jul 13, 2009 at 7:46 AM, gianpaulo gcbasa...@gmail.com wrote: Is it possible for CakePHP to execute a shell task on background for i.e running long reports. I would also want to report the current status back to the user either via updating a table during the report generation. Has anyone in this group done something like this? --~--~-~--~~~---~--~~ 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: Pass invalidation message through invalidate() method
Hi, Looking at your bespoke validation code there, you might want to simplify your code by using the built in rules, take a look at these two: http://book.cakephp.org/view/139/comparison http://book.cakephp.org/view/472/isUnique Hope this helps, Richard On Sun, Jul 12, 2009 at 8:24 PM, Burgos 4bur...@gmail.com wrote: OK. I found it: invalidate($fieldname, $message); I wonder why this doesn't exist in CutePHP API :-/. --~--~-~--~~~---~--~~ 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: Abstracting HTML/CSS
The problem your trying to solve - inconsistencies in supplied markup - is best by making the markup consistent in the first place. As a user of templates myself, I allocate up to 2 hours to modify any supplied HTML to match my systems standard. If I hire a sub-contractor to produce the HTML, I tell them the standard before the work commences too. I understand what your trying to achieve with the use of helpers, but my opinion is that is not an appropriate solution to your original problem. Hope this helps, Richard On Mon, Jul 13, 2009 at 6:12 AM, Sake e.delba...@gmail.com wrote: Yes, but I'm talking about the case where you're using someone else's code, be it a sub-contractor who's chopped up the image into html or a pre-made template. This seems to me a nice solution, no? On Jul 12, 11:28 pm, Dr. Loboto drlob...@gmail.com wrote: By my option much better write CSS based on cake default elements and classes for forms (cake markup there is extremely styleable). And changing your buttons from $html-submit to an image-based box link is initially bad idea as it breaks default form behavior. On Jul 13, 9:04 am, Sake e.delba...@gmail.com wrote: I write code in cakephp (although this question can apply to anything that uses HTML/CSS) and find the default skin very uninspiring. In a fit of depression I bought this : [http://themeforest.net/item/simpla- admin-flexible-user-friendly-admin-skin/46073] and tried to install it into the application I was working on. I quickly realized that the CSS/markup combo that cakePHP uses is not the same that the simpla writers had in mind, and had to go back and change all the markup on my forms, etc etc. My question is this; Is it a bad idea to abstract my HTML into common elements? I was thinking of doing something like this: ?php class InterfaceHelper extends AppHelper { var $name = 'Interface'; var $Theme = null; function beforeLayout() { parent::beforeLayout(); } function __loadTheme() { $theme = $this-getTheme(); App::import('Vendor','interface_themes/default'); App::import('Vendor','interface_themes/'.$theme); $className = Inflector::camelize($this-getTheme()).Theme; $d = new $className(); $this-Theme = $d; } function getTheme() { if(!Configure::read('edlib.theme')) { return default; } else { return Configure::read('edlib.theme'); } } public function __call( $method, $args ) { $this-__loadTheme(); return $this-Theme-$method($args); } } ? Now, all html elements for my theme would be defined in functions called ::open_table(), ::open_row(), ::open_cell() (for example) and would return table,tr and td respectively (for example) as follows : ?php class DefaultTheme { var $name = 'Default'; function open_box($args) { if(!$args) { $title = 'NONE'; } else { $title = $args[0]; } //print pr($title);die(); $text = 'div class=box' . 'h2'.$title.'/h2'. 'div class=block'; return $text; } function close_box() { return '/div'.\n\t\t.'/div'; } function page_heading($args) { if(!$args) { $title = 'NONE'; } else { $title = $args[0]; } return 'h2 id=page-heading'.$title.'/h2'; } // etc... } ? This has the following advantage; Need a different markup for forms? Just over-ride your DefaultTheme::open_form() function in a NewTheme class. Each theme has a demo file that allows you to both display and test all interace elements defined by DefaultTheme class. Let's say you're changing your buttons from $html-submit to an image-based box link, you could over-ride $interface-button() instead of changing every line of code that uses the button. My question
Re: IIS + CakePHP + ISAPI_Rewrite 3
No answer yet. :-( Is there anyone who has IIS + cakePHP + ISAPI_Rewrite working? On Jun 18, 12:36 pm, Richard Stroobach stroob...@gmail.com wrote: Hello, For a couple of days I'm trying to get CakePHP working on a Windows IIS machine with ISAPI_Rewrite 3. I've tried all the possible options I could find on the net, but can't get it to work. When I uncomment the line: Configure::write('App.encoding', 'UTF-8'); and delete any .htaccess files. Everything seems to work fine, but I would like to use rewriting, since all the books and tutorials I have assume I use rewriting. ISAPI_Rewrite 3 should work fine with Cake, since it should support .htaccess files in the same way as Apache would, but that's not my experience so far. Even if it looks like everything works, the css files would not get loaded. Is there anyone of you who has it working and kind enough to help me with this? I tried (among other things):http://thefinalsayontech.blogspot.com/2009/02/cakephp-on-iis-isapi-wi...http://bakery.cakephp.org/articles/view/clean-urls-with-isapi-rewrite...http://www.dustinweber.com/web-development/cakephp/cakephp-on-iis-tro... -Richard --~--~-~--~~~---~--~~ 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: handling MySql errors
Hi - IMO, the best approach is to check for child records before you attempt to delete the parent data. I would even go as far as doing this before even rendering the delete link, preventing your end user trying to do something they can't in the first place. For what its worth, I personally preferring to validate actions before they happen, rather than responding to errors as I've generally found this approach saves me time in the long run. I do however, still use constraints like this as a last-line of defense to protect against database corruption, just in case :) Hope this helps, Richard On Mon, Jun 22, 2009 at 1:35 PM, toka...@gmail.com toka...@gmail.comwrote: Hi, I am wondering how to handle and recognize MySQL type of errors...in cake. For EXAMPLE.. I have integrity checks (ON DELETE) designed on DB server - when I do delete on some item who has its childs...it is not allowed by DBso in debug mode in cake i get following.. SQL Error: 1451: Cannot delete or update a parent row: a foreign key constraint fails if i turn off debug mode, i get only 404 Not Found page. is cake able to recognize that error and display nice message like using setFlash?? I would rather tell user than he cannot delete item because it has childs connected to it instead of showing 404 page... which is more confusing... Thanks for help. Tomas --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
IIS + CakePHP + ISAPI_Rewrite 3
Hello, For a couple of days I'm trying to get CakePHP working on a Windows IIS machine with ISAPI_Rewrite 3. I've tried all the possible options I could find on the net, but can't get it to work. When I uncomment the line: Configure::write('App.encoding', 'UTF-8'); and delete any .htaccess files. Everything seems to work fine, but I would like to use rewriting, since all the books and tutorials I have assume I use rewriting. ISAPI_Rewrite 3 should work fine with Cake, since it should support .htaccess files in the same way as Apache would, but that's not my experience so far. Even if it looks like everything works, the css files would not get loaded. Is there anyone of you who has it working and kind enough to help me with this? I tried (among other things): http://thefinalsayontech.blogspot.com/2009/02/cakephp-on-iis-isapi-with-modrewrite.html http://bakery.cakephp.org/articles/view/clean-urls-with-isapi-rewrite-on-iis http://www.dustinweber.com/web-development/cakephp/cakephp-on-iis-troubleshooting-help-guide/ -Richard --~--~-~--~~~---~--~~ 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: geo-location database
Hi Bryan, On the bakery is also a CakePHP component to extract postcode to geo code information from google, at no cost. It's a fair age now, so may not work. Hope this helps, Richard On Wed, May 27, 2009 at 2:41 PM, Bryan Paddock bryanpadd...@gmail.comwrote: hey guys, not really a cake specific question but related nonetheless... have any of you worked with international location databases? know of any pay-for or free? busy working on a property site and the requirement is to have it be internationalized with country-state/suburb/county/etc selectable for the whole world... it's quite a requirement but it must have been done before... --~--~-~--~~~---~--~~ 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: passing arrays as arguments
CakePHP has the function a, which is an alias of array: http://api.cakephp.org/file/basics.php#function-a Is that along the lines of what you're looking at? On Sun, May 17, 2009 at 8:11 PM, Bysa amin...@gmail.com wrote: On May 17, 8:00 pm, Marcelo Andrade mfandr...@gmail.com wrote: On Sun, May 17, 2009 at 10:46 AM, Bysa amin...@gmail.com wrote: wasn't it a good way to have a small mark for it (like jquery)? for example making array(arg1,arg2) -- _(arg1,arg2)? This is not possible because the _() function already exists and is used to gettext i18n. Best regards. -- MARCELO DE F. ANDRADE Belem, PA, Amazonia, Brazil Linux User #221105 http://mfandrade.wordpress.com thanks for reply but i said that as an example. i know it used, the reason was just to clear my mean. there is a unused and small name in php and cake for sure so that we could use it for array passing, or for example make cake to parse a string like [arg1,arg2], i don't know look on it as an idea am i still wrong? thanks anyway --~--~-~--~~~---~--~~ 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: Launched a new cake app
Did you use signUpText as a msgid in your language files? I had this previously when using generic labels for language strings, and the corresponding language file for the environment set in the visitors web browser was not available. You can solve this problem by setting the default language - I've got the code to achieve this somewhere - ping me back if you would like it and I'll have a look for it. On Sun, May 17, 2009 at 6:52 PM, Miles J mileswjohn...@gmail.com wrote: @Faza - Yes I do the designs and code :p @Eber - Weird! My friend in austria had the same problem, I wonder how I can fix it. --~--~-~--~~~---~--~~ 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: Login form on index page
That's a reasonable approach to take; yes. On Tue, May 12, 2009 at 10:40 AM, dnoop dan...@gmail.com wrote: Hi sorry for making my question so obscure I had a home.ctp which should contain a login form ... Right now i just redirected the index to login ... is it posssible by making login.ctp as a element and including it in home.ctp ...? On May 9, 7:47 pm, brian bally.z...@gmail.com wrote: What are you trying to do? Include the form as an element? Redirect to the login form? On Sat, May 9, 2009 at 1:04 AM, dnoop dan...@gmail.com wrote: Hi, I am a newbie here and i was doing one user profile system .. seems almost everything is working fine .. in my but when i went to apply it to my design i just need a login form only ...no need of the original index page which shows list of users .. what should i do ..? $this-redirect(array('controller' = 'users', 'action' = 'login')); is this the correct way to do it ...? I just wanted to include login form along with registration form too ... should i put login as an element ..? Please help with regards Anoop --~--~-~--~~~---~--~~ 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: Poll: what do you hate about CakePHP?
PHP4 Support is a definite peeve. The Ajax helper being tied into prototype/scriptalicious - I've a preference for jQuery. Particularly like the extensive use of hashtables in cake; really, really like that. On Fri, May 8, 2009 at 5:55 AM, park park@gmail.com wrote: No HABTM counterCache Ignoring callbacks on associative queries On May 8, 6:29 am, Nate nate.ab...@gmail.com wrote: Well, maybe hate's a strong word. Let's say, what do you like the least? Kind of an odd question, I know, but since we've kick-started development of a new version, I'd like to know what the most frustrating things with the framework are, even if they're things we can't fix right away. I'll get us started: PHP 4 support. Who's next? TIA for the input. --~--~-~--~~~---~--~~ 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: What's the Cake-way to build a cms?
It really depends on why you are creating your CMS, as that would have a strong influence on your architecture. If you can provide more specific questions, maybe we/i can help :) To address your technical question, about plugins with requestAction - again, that depends on your architecture. I've never used requestAction before, keeping logic in the models and views where appropriate. Richard On Mon, Apr 20, 2009 at 9:09 AM, Evert compa...@gmail.com wrote: I've tried to think of several ways to build a cms in cake. But every system I could think of depended a lot on plugins. One system might use several plugins with one page load and that would be quite slow cause you needed to use requestAction() a lot. (In that system plugins weren't like mini-apps, but like code-blocks) And another system needed plugins to communicate with each other which isn't really possible in Cake. So that kinda failed. So my question to you is: What's the right way to build a cms in Cake? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: find('list') mit COUNT kombinieren
Sehr geehrter Herren - Ich glaube sie können dies mit GROUP BY. Zum Beispiel: array('fields'=array('Product.type','MIN(Product.price) as price'), 'group' = 'Product.type'); http://book.cakephp.org/view/74/Complex-Find-Conditions Mit freundlich Gruessen Richard Dear Günther, I think you can achieve what you're asking for with a GROUP BY query, for example: array('fields'=array('Product.type','MIN(Product.price) as price'), 'group' = 'Product.type'); http://book.cakephp.org/view/74/Complex-Find-Conditions All the best, Richard 2009/4/17 Günther Theilen thei...@eqi.de Moin, ist es möglich find('list') mit COUNT zu kombinieren? Ich möchte eine Liste erhalten mit dem Wert eines Feldes als key und der Häufigkeit des Auftretens als value. Geht das mit cake-Bordmitteln? Oder muss ich das Ergebnis einer find('list')-Abfrage in php auswerten (zählen)? Danke und Grüße Günther --~--~-~--~~~---~--~~ 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: Plugin architecture and plugin limitations
Hi all, How this would apply with the CakePHP framework I'm unsure, but I use interfaces extensively in modular platforms when defining classes. I've used CakePHP mainly as a presentation control layer, with the external work occuring in libraries. My CakePHP plugins provide an integration layer to software developed in PHP, which does use interfaces. This is for data processing, rather than extracting data for presentation, but that's the domain of the software being worked with at the moment. I've thought over ways to bring this approach to CakePHP and the plugin structure, and have experimented with this approach. Some routes simply resulted in bloat (interfaces to generate dynamic javascript was one genious piece of bloatware) Another thing that I found though, doing dependency matching in plugins was a complete nightmare, and it was simpler and less prone to error to to state in documentation This plugin requires X plugin, than create some code-driven platform to handle it. It could be that the dependency checking was over complicated in it's implementation. A CMS I've developed with CakePHP didn't use Plugins directly, but had a view was overridden to allow plugins intercept the generated output. It was a bit more involved than I'm detailing here, and wasn't the cleanest approach, but it might be a step in a direction worth investigating more. class PluginView extends View { ... function beforeRender() { foreach ($this-observed as $observed) { $observed-parse($this-__buffer, $this); } } } Hope this has been help, even if it rules out bad ideas :) Richard On Fri, Apr 17, 2009 at 9:42 AM, Grzegorz Pawlik grzegorzpaw...@gmail.comwrote: It's an idea that just came up. Probably You could set up some kind of PluginHandler, which will handle the plugins instalation process (which i describe below) and plugin interacting. Each plugin knows where it need to inject himself into (I'll just call it widgets for now). IE: - extend Dog with hasOne Kennel - add div to dog/edit with select tag that will allow to choose kennel for the dog I'll just stop here to keep it simple. So Installing KennelPlugin would mean that You need to save this widgets information into database. Now in Dog model contstructor You could ask PluginHandler if You have any relations to bind (You can bind Models on the fly in Cake), PluginHandler will answer You need to bind Kennel model with as hasOne relation In dog/edit view, You ask PluginHandler if there's any widget that You need to show? PluginHandler will answer, that You need to call (by requestAction I suppose) a kennels/show_select_tag in Kennel plugin (so it would be like echo $this-requestAction('kennel/kennels/ show_select_tags'). Probably You should force the convention that all plugin actions have model:ModelName parameter passed (model:Dog in our example) so the plugin could act differently when called by Dog model, and KennelShop model wich have HABTM Kennel(s). So in our example in kennel/kennels/show_select_tags view You would generate sth like $form-select('Dog.kennel_id', $kennelsList) when called by Dog and $form-select('Kennel.Kennel', $kennelsList, array('multiple' = true)) when caleld by KennelShop Ok. I'll stop here. I'm aware of that there's lots of stuff to think of (ie. how to handle some more complex activities than adding field to form and just save $this-data like file uploading and stuff). But it's just a glimpse of an idea. What do You think of that? On Apr 17, 7:38 am, John Andersen j.andersen...@gmail.com wrote: Thanks Jaime, As I understand it: 1) The user interface (UI) is completely managed in the browser environment. 2) The business logic (BL) is managed in a CakePHP application in the server environment. 3) The storage logic is managed partly by the CakePHP application and a database engine (MySQL). 4) Communication between UI and BL is messages with data only. The primary issue as I see it: 1) Is the communication (messages) definitions independent of both UI and BL? If this is not the case, then yes, it will be very difficult to add new functionality without having to rewire other parts. Possible solution idea (configurable message based framework): 1) UI: sends only informative messages (I have done this message) with data. 2) BL: processes informative messages in one controller only, using request action to inform other controllers. 3) BL: uses a configurable message handling, so that new message handling can be added when new functionality is implemented. Example (simple): Use case: The UI implements the presentation of a photo album with 10 thumbnails shown per page. The user can open the photo album, turn the pages and choose a thumbnail to see the full photo. Work flow: 1) User opens the photo album. 1.1) UI sends the message open photo album. 1.2) BL looks up the configuration
Re: What do you develop in (ide, text editor, etc.)?
Something I've not seen in the list that I use, and that's Aptana Studio, which is built on top of Eclipse. On Tue, Apr 14, 2009 at 8:23 AM, refused nathanaelk...@gmail.com wrote: Another vote for Komodo IDE/Edit - Fast (I've tried a lot and it's definitely up there) - Cross platform - Doesn't use java (nothing against java, just most apps seem sluggish on any system I've used) - Great addon/macro/snippet system (addons similar to Firefox) That said, will be interested to see how well E-Texteditor runs on Linux when that gets a released --~--~-~--~~~---~--~~ 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: Query question
You could possibly do a UNION query? If you need to know which table they came from, add a hard-coded value to the field list ('TableA' as which_table). SELECT id, firstname, lastname FROM tableA where email = 'a...@b.com' UNION SELECT id, firstname, lastname FROM tableB where email = 'a...@b.com' It's the same as doing two queries, but joining the result set might be faster in the DBMS than joining two arrays with PHP; I've not checked to see. Richard On Tue, Apr 14, 2009 at 4:47 AM, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: I have come into a situation where I need to find something that will be in either TableA or TableB. Is there an easy way to do this or do i need to query TableA if no results query TableB? 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: easy way to find out if onetomany record is used (before deleting it)?
Depending on your database, you may be able to use constraints on the foreign keys of your database (ON DELETE RESTRICT), however that's a responsive check rather than pro-active. In your situation, you may find creating a behavior would be beneficial. The behavior would run the checks on the beforeDelete callback and you can restrict it at that level instead of a database. Richard On Tue, Apr 14, 2009 at 3:41 PM, qwanta rgmic...@gmail.com wrote: In the case where If I have a one to many relationship like Authors- Books and I would like to delete an author - but only if this author has no books - is there a buiilt-in way to check? I find that I run into this situation a lot (every time a table has a foreign key), and at the moment manually write a function in the model to check this. eg. for the Books model a method with the author_id as parameter that returns true if the author has books, false otherwise. But it seems like cakephp should be able to check this based on the model relationships, so is there something built-in I am missing? 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 -~--~~~~--~~--~--~---
Double left join?
Hi, I'm fairly new to CakePHP so if this is a stupid mistake forgive me. A user will post a complaint against a company, so the complaint table has company_id. I use a left join to get the company data. Then the company has a field category_id which is simply the industry of the company (categories have id / name). When I load a complaint I want to grab the category name. I manage to get the category ID but cannot do another left join within this left join. Hope this makes sense. At the moment I have; company.php var $belongsTo = array('Category'); category.php var $hasMany = array('Company'); complaint.php var $belongsTo = array('Company', 'User'); view/complaints/view.thtml echo $complaint['Company']['category_id'] which i want it to grab Category.name Appreciate any help. 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: Using MySql DB instead of PO files
I have a basic table that allows me to have data-driven translations. As Mark mentioned, it's much slower to use the database, so I have a shell script to generate the .po files which is invoked when the table is updated. On Thu, Mar 26, 2009 at 3:15 PM, Sourabh sourabhmkulka...@gmail.com wrote: Hi I am developing a multilingual site with cakePHP. I need to use database instead of PO files to store language strings as a requirement. What can be the best way to do it ? Can I override __() function if yes ,then how ? Thanks in advance ! Sourabh --~--~-~--~~~---~--~~ 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: tutorial for webservice
Hi, I've written a number of REST services in Cake. It's not too difficult, but if you would like to contact me either on or off this list, I may be able to help you and then get a tutorial written for public consumption. Regards, Richard On Thu, Mar 26, 2009 at 7:03 AM, computing1...@gmail.com computing1...@gmail.com wrote: hi everyone, I am looking for tutorial for webservice in cakephp 1.2, I want my website to be become a webservice , I think in cakephp is REST but when I read I feel confusion. Please help me --~--~-~--~~~---~--~~ 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: Twist on multirecord forms.
Hi, $model-updateAll might be your friend in this case. You could do something like: $this-Task-updateAll(Task.date = $value); Richard On Mon, Mar 16, 2009 at 9:02 PM, gc1155 gc1...@gmail.com wrote: I've read up on multirecord forms and I think I have the basics down using Cake 1.2. However, what if I want to make one modification and have it apply to several records? For instance, given a Task model with a Day field. I'd like to be able to pick a day and submit the form. The day field would then be applied to all the records in the submit. Is there a cake way of doing this by convention? My hunch is that I'll have to manipulate the data in the controller to apply the change to all the records before calling save. 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: Syntax for find()
Untested, but this should do the trick: $this-Place-find(all, array(order = array(account_status, name)); On Mon, Mar 16, 2009 at 11:47 PM, Chris M cmcclel...@yahoo.com.au wrote: Can someone provide the syntax for the find if I want to accomplish this: select * from places order by account_status, name A very basic question, but I'm only a newbie Cheers :) -- Stay connected to the people that matter most with a smarter inbox. Take a lookhttp://au.rd.yahoo.com/galaxy/mail/tagline2/*http://au.docs.yahoo.com/mail/smarterinbox . --~--~-~--~~~---~--~~ 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: Why there are so many 'DESCRIBE' when I enable debug model?
My understanding is that this enables CakePHP Models to identify details about your schema. By extracting this metadata, the models can be further exploited by ohter areas in cake, such as the helpers. The form helper, for example uses the metadata to automatically set size and limits on fields in the generated HTML. As far as I'm aware, this information is cached, in tmp/models/*. This cache is used when not in debug mode. Hopefully someone else may be able to confirm or correct me if I'm wrong. Richard On Mon, Mar 16, 2009 at 12:35 PM, joshua josh...@gmail.com wrote: I find there is a sql which will took 17ms everytime when the action needs authentication in ACL model. That means if I use ACL database model in my application , there will always be 17ms was taken. Can someone give an explanation of this? //sql SELECT `Aco`.`id`, `Aco`.`parent_id`, `Aco`.`model`, `Aco`.`foreign_key`, `Aco`.`alias` FROM `acos` AS `Aco` LEFT JOIN `acos` AS `Aco0` ON (`Aco0`.`alias` = 'controllers') JOIN `acos` AS `Aco1` ON (`Aco1`.`lft` `Aco0`.`lft` AND `Aco1`.`rght` `Aco0`.`rght` `Aco1`.`alias` = 'Users') LEFT JOIN `acos` AS `Aco2` ON (`Aco2`.`lft` `Aco1`.`lft` AND `Aco2`.`rght` `Aco1`.`rght` AND `Aco2`.`alias` = 'activity') WHERE ((`Aco`.`lft` = `Aco0`.`lft` AND `Aco`.`rght` = `Aco0`.`rght`) OR (`Aco`.`lft` = `Aco2`.`lft` AND `Aco`.`rght` = `Aco2`.`rght`)) ORDER BY `Aco`.`lft` DESC //end On Mon, Mar 16, 2009 at 8:22 PM, Joshua josh...@gmail.com wrote: As you can see, the 'describe' sql took (7+17+17) ms! Why they are there? Can I disable it? 1 DESCRIBE `aros` 7 7 7 2 DESCRIBE `acos` 7 7 17 3 DESCRIBE `aros_acos`7 7 17 -- Thanks Joshua --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Unexpected Behaviour
Hi, Firstly let me say I'm reasonably new to CakePHP, but not the design patterns it uses (I'm a fast learner and have used frameworks before). I've recently been given a CakePHP project, it's got hundreds of bugs,is poorly designed and written, hard-coding access levels in / cake/libs/controller/app_controller.php, etc. All of the previous developers code in the /cake/ folder I've *moved* to respected 'parent' controllers in the /app/ folder. For example, /app/ app_helper.php, etc instead of /cake/libs/helpers/helper.php. Everything worked at this point. Secondly he uses constructs in every controller and to load models he uses $this-uses = array('discussion'), etc. I removed these constructs and changed it to var $uses = array('Discussion'); at top of each controller. However, now I'm getting errors. Here's one; ** CODE ** Warning (512): Controller::paginate() - can't find model Discussion in controller DiscussionsController [CORE/cake/libs/controller/ controller.php, line 947] ** /CODE ** Now, thats not all if I remove his construct (which has parent::Controller) in the app_controller.php, and use my no- constructor method when i try go to a controller it redirects me to / users/login (Missing Controller error in title). This is really unexpected behaviour because I've searched contents of every file no reference of /users/login. And I don't know why it doesn't load any of my models when I use the var $uses method. Does it have something to do with the construct, as he was doing parent::Controller in each of his constructs and extending each controller to the AppController. Here is a small extract of the way I am writing controllers. ** CODE ** class DiscussionsController extends AppController { /** * Name of the controller * * @var string */ var $name = 'Discussions'; /** * Specifies the models (or uses) used in this controller * * @var array */ var $uses = array('Action', 'Discussion', 'DiscussionComment'); /** * Specifies the components used in this controller * * @var array */ var $components = array('Upload'); /** * Specifies the helpers used in this controller * * @var array */ var $helpers = array('Time'); /** * Define the pagination defaults * * @var array */ var $paginate = array('Discussion', array( 'fields' = array('Discussion.id', 'Discussion.title', 'Discussion.description', 'Discussion.image', 'Discussion.created', 'User.id', 'User.name'), 'order' = array('Discussion.id' = 'DESC'), 'limit' = 10, 'recursive' = 0 )); ** /CODE ** And this is his method; ** CODE ** function __construct() { parent::__construct(); $this-name = 'Discussions'; $this-uses[] = 'Action'; $this-uses[] = 'Discussion'; $this-uses[] = 'DiscussionComment'; $this-components[] = 'Upload'; $this-helpers[] = 'Time'; $this-noAccess = array( -1 = array('start', 'add_comment', 'delete', 'edit'), 0 = array(), 1 = array(), 2= array() ); } ** /CODE ** --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Does Router::url understand mapResources?
Hello all, I'm a Rails developer stuck in CakePHP land for a while so if this question may have an obvious answer I'm not aware of. Feel free to scold me as needed. :) I'm trying to create a URL to a resource but Router::url doesn't produce correct URLs. As an example, if you have the following in routes.php: Router::mapResources( 'users' ); Then the a GET to the URL 'users/4962a0cd-5508-462b-9444-0b14fd383471' will correctly call the view action of the users controller. However, the following code in a view doesn't produce a URL in the right format: $html-link( $user['User']['id'], Array( 'controller' = 'users', 'action' = 'view', 'id' = $user['User']['id'] ) ) Instead you get 'users/view/4962a0ed-fba4-4085-93c7-0b14fd383471'. I was a little surprised to see this is mapped at all when using Router::mapResources. Can that also be avoided somehow? Cheers, Tobin Richard. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Vacancy Lead Developer cakephp And Senior Developer Cakephp
One of client in UK is looking to hire Lead Developer cakephp And Senior Developer Cakephp Type Permanent Location: London Salary Excellent 28 t0 50 K Experience dependent GPB Job Description: Lead Developer Cakephp 5 years+ experience with PHP My sql - Experienced with MVC frameworks such as CAKE - Experience with Agile development methodologies - Experience managing web-build team Senior Software Developer Cakephp Role will involve code level development, testing, documentation and ongoing maintenance Job Description: Senior Developer - 2 years+ experience with PHP My sql - Experienced with MVC frameworks such as CAKE - Experience with Agile development methodologies For both roles, you will need to be a PHP guru with experience of CAKE, ideally within the e-commerce sector. You'll be a really keen developer, happy to work under pressure, with a real passion to innovate. For further details contact me on the number given below and please reply to this email with your latest CV with examples of your work (port folio) and please let us know what is your current status Availability and Required Salary You Must be eligible to work in UK Richard King, Technical IT Recruiter Realskill Limited www.real-skill.co.uk [EMAIL PROTECTED] 44 (0)1274 900332 --~--~-~--~~~---~--~~ 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: redirecting users from domain.com to www.domain.com
I found this thread useful ...just thought I'd add to it incase anyone else needs this.This is how I have my .htaccess file setup in www/ IfModule mod_rewrite.c RewriteEngine on RewriteCond %{http_HOST} ^example\.com$ [NC] RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L] RewriteRule^$ app/webroot/[L] RewriteRule(.*) app/webroot/$1 [L] /IfModule On Feb 16, 7:20 pm, Manu0310 [EMAIL PROTECTED] wrote: Hey guys I finally solved this. Thanks Thiago for your help, you pointed me in the right direction, so here is the code to place in your .htaccess file: RewriteCond%{HTTP_HOST} ^dealque.com$ RewriteRule ^(.*)$http://www.dealque.com/$1[R=301,L] Basically the same code you gave me just added a $ at the end of first expression. Thanks again. On Feb 16, 10:10 am, Thiago Paes [EMAIL PROTECTED] wrote: Probably yes... On Feb 16, 2008 1:08 PM, Manu0310 [EMAIL PROTECTED] wrote: Looks good... but would I be able to put that in my .htaccess files?I don't have full access to the server with the hosting solution I am on. :) On Feb 16, 10:02 am, Thiago Paes [EMAIL PROTECTED] wrote: Hi, you can try put this lines in your Apache configuration, (ex.: /etc/apache/sites-enable/default): RewriteEngine on RewriteCond%{HTTP_HOST} ^mysite.com RewriteRule ^(.*)$http://www.mysite.com/$1[R=permanent,L] It's more fast than a function/method ;) []'s Thiago Paes On Feb 16, 2008 12:57 PM, Manu0310 [EMAIL PROTECTED] wrote: Hi, I want to be able to redirect users who hit my site from mysite.com to www.mysite.com. I know this can be achieved with a 301 redirect specified in the .htaccess file. I have tried a few techniques and nothing seems to work with cakePHP. Has anyone solved this problem or had a similar issue? I use a lot of ajax calls and it is important that users hit www.mysite.com when they try to access it without the www. Thanks -- Thiago Paes -www.thiagopaes.com.br-Linuxer:#224062 -- Thiago Paes -www.thiagopaes.com.br-Linuxer: #224062 --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
form-input label options
Hi all, How do you set the label options (valign) on a form-input tag generated through baking? I know how to change the label text: $form-input('Model.field', array('label' = 'labelText')); Is there some option setting or must I recode it to: $form-label('Model.field', 'labelText', array('valign' = 'top')); $form-input('Model.field'); Thanks, Richard --~--~-~--~~~---~--~~ 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: Caching and writing to sessions
anyone? On Feb 14, 4:40 pm, Richard [EMAIL PROTECTED] wrote: Hi, I have an entire view that I cache other than a phone number that is output based on the user's geographic location ...US visitors would see an 1-800 number, UK 0800 etc. Therefore I have cached the view using the $cacheAction array within the controller and written a helper that looks up the user's IP and outputs the correct phone number based on their location. The helper call within the view is wrapped with no cache tags cake:nocache?=$geoip-getSalesNumber()? /cake:nocache My problem is that within the helper class I read and write to sessions to prevent overhead with accessing an ip-lookup service, however you cannot write to sessions within helpers. I have worked around this by using PHP's session support. I would just like to know if there is a better way for me to do this other than the before mentioned hack? This is a public website so there is no opportunity in setting a session within a login script. Many 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 -~--~~~~--~~--~--~---
Caching and writing to sessions
Hi, I have an entire view that I cache other than a phone number that is output based on the user's geographic location ...US visitors would see an 1-800 number, UK 0800 etc. Therefore I have cached the view using the $cacheAction array within the controller and written a helper that looks up the user's IP and outputs the correct phone number based on their location. The helper call within the view is wrapped with no cache tags cake:nocache?=$geoip-getSalesNumber()? /cake:nocache My problem is that within the helper class I read and write to sessions to prevent overhead with accessing an ip-lookup service, however you cannot write to sessions within helpers. I have worked around this by using PHP's session support. I would just like to know if there is a better way for me to do this other than the before mentioned hack? This is a public website so there is no opportunity in setting a session within a login script. Many 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 -~--~~~~--~~--~--~---
highlighting form input fields on error (1.2)
hi, in earlier versions of cake an CSS error class was added to form fields when there was an error. This no longer seems to be the case now that I use $form-error(Model.field) ...has this functionality been deprecated? Thanks in advance, --~--~-~--~~~---~--~~ 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: start session problem in cakephp1.2 beta
I have the same problem since upgrading to 1.2 beta from alpha. I need to add @session_start(); to each action even though Session.start is set to true. Did you manage to find a fix? On Jan 7, 1:03 pm, phpcurious [EMAIL PROTECTED] wrote: I have almost the same problem as you do with regards to theSession.start. I do this in Cakephp 1.1.x when setting sessions: define('AUTO_SESSION', false); define('CAKE_SESSION_SAVE', 'database'); define('CAKE_SESSION_TABLE', 'cake_sessions'); define('CAKE_SESSION_TIMEOUT', '120'); but when I tried it in cakephp 1.2 beta with this settings: Configure::write('Session.save', 'database'); Configure::write('Session.table', 'cake_sessions'); Configure::write('Session.database', 'default'); Configure::write('Session.start', false); the same kind of error appears: Fatal error: Class 'ConnectionManager' not found in ... please tell me if I have done something wrong, or if I have forgotten something else... thanks... On Jan 7, 12:42 am, pravinda [EMAIL PROTECTED] wrote: Hi Everybody, It was my wrong manipulation. The actual problem is I want to get some sessiondata in routes.php itself, because my application is more than 99% ajax based and I don't want to change the url in the address bar. So, while login I set somesessionvariable for next action and then refresh the page, in routes.php I fetch the action fromsessionand then set the action in a variable then if(!isset($_SESSION)) // this I need to do because unless Istartthe sessionI can not usesessionvariable. @session_start(); $action = 'display'; if(isset(sessionvariable)) $action = getsessionvariable; Router::connect('/', array('controller' = 'pages', 'action' = $action, 'home')); If I use session_start(); here ( as I was using in prebeta) then after this I need to use session_start(); every where. if I don't use session_start(); here I cann't get thesessionvariable in routes.php and if I do I session_start(); here then in other pages like in controller this creates the problem --~--~-~--~~~---~--~~ 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: start session problem in cakephp1.2 beta
...okay installed the nightly and this now works. On Jan 30, 10:06 pm, Richard [EMAIL PROTECTED] wrote: I have the same problem since upgrading to 1.2 beta from alpha. I need to add @session_start(); to each action even though Session.start is set to true. Did you manage to find a fix? On Jan 7, 1:03 pm, phpcurious [EMAIL PROTECTED] wrote: I have almost the same problem as you do with regards to theSession.start. I do this in Cakephp 1.1.x when setting sessions: define('AUTO_SESSION', false); define('CAKE_SESSION_SAVE', 'database'); define('CAKE_SESSION_TABLE', 'cake_sessions'); define('CAKE_SESSION_TIMEOUT', '120'); but when I tried it in cakephp 1.2 beta with this settings: Configure::write('Session.save', 'database'); Configure::write('Session.table', 'cake_sessions'); Configure::write('Session.database', 'default'); Configure::write('Session.start', false); the same kind of error appears: Fatal error: Class 'ConnectionManager' not found in ... please tell me if I have done something wrong, or if I have forgotten something else... thanks... On Jan 7, 12:42 am, pravinda [EMAIL PROTECTED] wrote: Hi Everybody, It was my wrong manipulation. The actual problem is I want to get some sessiondata in routes.php itself, because my application is more than 99% ajax based and I don't want to change the url in the address bar. So, while login I set somesessionvariable for next action and then refresh the page, in routes.php I fetch the action fromsessionand then set the action in a variable then if(!isset($_SESSION)) // this I need to do because unless Istartthe sessionI can not usesessionvariable. @session_start(); $action = 'display'; if(isset(sessionvariable)) $action = getsessionvariable; Router::connect('/', array('controller' = 'pages', 'action' = $action, 'home')); If I use session_start(); here ( as I was using in prebeta) then after this I need to use session_start(); every where. if I don't use session_start(); here I cann't get thesessionvariable in routes.php and if I do I session_start(); here then in other pages like in controller this creates the problem --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Submit ajax form using image
Hi, I need to submit an Ajax form using an image opposed to a submit button. The roadmap suggests this is now possible: https://trac.cakephp.org/ticket/770 but I cannot find this functionality. I am using 1.2 -- can anyone help? Thanks in advance. --~--~-~--~~~---~--~~ 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: Submit ajax form using image
echo $ajax-submit('your-image-here.png'); I have already tried this but a standard submit button with the image path is output. Hmmm... tough one. Maybe work on your research skills? I suggest you work on your communication skills. On Jan 10, 7:38 pm, grigri [EMAIL PROTECTED] wrote: Hmmm... tough one echo $ajax-submit('your-image-here.png'); but I cannot find this functionality I'd just point out that I never use the Ajax helper [because I prefer mootools], and this took me all of 10 seconds to find out by browsing the source, although I'm sure you could find it on google too. Maybe work on your research skills? On Jan 10, 2:52 pm, Richard [EMAIL PROTECTED] wrote: Hi, I need to submit an Ajax form using an image opposed to a submit button. The roadmap suggests this is now possible:https://trac.cakephp.org/ticket/770 but I cannot find this functionality. I am using 1.2 -- can anyone help? Thanks in advance. --~--~-~--~~~---~--~~ 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: CakePHP and VBulletin
I'm interested also as I am trying to do this with phpbb and may consider switching to vbulletin. Please share! Rich On Dec 13, 2007, at 6:33 AM, Marcin Domanski aka kabturek wrote: As it happens, I have recently done this. I'll send an email off list for you to contact me. -Simon Hey Simon - don't be shy - share Your solution here:) not that i'm interested but many people would find it usefull. You can also get feedback about your solution. As for the integreation i see two possibilities the one suggested by Wayne and using the vb login system. ie either integrate cb into cake or integrate cake into vb ;) --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Setting Cookie path prevents cookie from being set
If I try either of the following: // beforeFilter() $this-Cookie-path = 'localhost'; or: var $cookieDomain = 'localhost'; The cookie is not set. I have to remove any reference to setting the cookie path for the Cookie component to work. Is this a bug? Or an issue with my development environment? Many 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: Setting Cookie path prevents cookie from being set
..sorry that was suppose to read: setting cookie domain prevents cookie from being set. The below will prevent a cookie from being set: // beforeFilter() $this-Cookie-domain = 'localhost'; or: var $cookieDomain = 'localhost'; On Dec 1, 8:51 pm, Richard [EMAIL PROTECTED] wrote: If I try either of the following: // beforeFilter() $this-Cookie-path = 'localhost'; or: var $cookieDomain = 'localhost'; The cookie is not set. I have to remove any reference to setting the cookie path for the Cookie component to work. Is this a bug? Or an issue with my development environment? Many 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: Components array used opposed to extends?
Thank you. On Nov 2, 3:10 pm, AD7six [EMAIL PROTECTED] wrote: On Nov 1, 2:46 pm, Richard [EMAIL PROTECTED] wrote: Hi, I have several component classes that need to extend a parent class. Which is the correct approach: class Availability extends Object { var $components = array('Parent'); OR: class Availability extends Parent { Thanks in advance. It's up to you, depending on whether you want to use the functionality of the component named Parent or inherit it with some modifications. ensure that the Parent component is loaded if you do the latter. hth, AD --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Components array used opposed to extends?
Hi, I have several component classes that need to extend a parent class. Which is the correct approach: class Availability extends Object { var $components = array('Parent'); OR: class Availability extends Parent { Thanks in advance. --~--~-~--~~~---~--~~ 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: renderElement not working in Ajax Updated div
Hi, thanks for your reply. The confirmation page is a seperate file and the thank you message is updated within the start and end divs. However renderElement does not work -- if I use PHPs native include the data is added but causes additional problems. On Sep 4, 9:37 am, francky06l [EMAIL PROTECTED] wrote: Well your ajax submit updates the contact_form, but your element is outside thediv/ divEnd. Try moving the divEnd after therenderElement. On Sep 4, 6:18 am, Richard [EMAIL PROTECTED] wrote: Hi, No I amnotusing requestAction. Here is the code: Any help would be gratefully appreciated. // FORM ?php e($ajax-div('contact_form')); ? form method=post action=?php e($html-url('/properties/ contact_us'));? onsubmit=return false; table cellpadding=10 cellspacing=0 tr td align=rightName: /td td ?php e($html-input('Enquire/name'));? /td /tr tr td align=rightEmail: /td td ?php e($html-input('Enquire/email'));? /td /tr tr td align=rightPhone (including country code): /td td ?php e($html-input('Enquire/phone')); ? /td /tr tr td align=rightMessage: /td td ?php echo $html-textarea('Enquire/message', array('cols'='60', 'rows'='10')); ? /td /tr tr td/td td /td /tr /table ?php echo $ajax-submit('Submit', array('url' = '/properties/ contact_us', 'update' = 'contact_form'));? /form ?php e($ajax-divEnd('contact_form')); ? // CONTROLLER SCRIPT $this-redirect('/confirmations/contact_us/'.$this-data['Enquire'] ['name'].'/'.$this-data['Enquire']['email']); // CONFIRMATION PAGE e('trtdh1Thank you for your email. You will be contacted shortly./h1/td/tr'); $this-renderElement('newsletter_prompt'); // -- this code isnot included into page On Sep 3, 8:14 pm, francky06l [EMAIL PROTECTED] wrote: Does your element calls a requestAction ? On Sep 3, 6:22 am, Richard [EMAIL PROTECTED] wrote: Hi, I have an Ajax form that posts some data and theupdateddivsection (confirmation page) callsrenderElement-- but for some reason does notwork. Any ideas? Many thanks, Richard --~--~-~--~~~---~--~~ 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: renderElement not working in Ajax Updated div
I've tried just about everything :-/ ...well and truly stumped. On Sep 4, 10:03 pm, francky06l [EMAIL PROTECTED] wrote: I had a similar problem once, caused by many blanks and also some trailing space after the ? into the element. Have you tried to simplify the element (for example just h1Hello/ h1) ? On Sep 4, 7:09 pm, Richard [EMAIL PROTECTED] wrote: Hi, thanks for your reply. The confirmation page is a seperate file and the thank you message is updated within the start and end divs. However renderElement does not work -- if I use PHPs native include the data is added but causes additional problems. On Sep 4, 9:37 am, francky06l [EMAIL PROTECTED] wrote: Well your ajax submit updates the contact_form, but your element is outside thediv/ divEnd. Try moving the divEnd after therenderElement. On Sep 4, 6:18 am, Richard [EMAIL PROTECTED] wrote: Hi, No I amnotusing requestAction. Here is the code: Any help would be gratefully appreciated. // FORM ?php e($ajax-div('contact_form')); ? form method=post action=?php e($html-url('/properties/ contact_us'));? onsubmit=return false; table cellpadding=10 cellspacing=0 tr td align=rightName: /td td ?php e($html-input('Enquire/name'));? /td /tr tr td align=rightEmail: /td td ?php e($html-input('Enquire/email'));? /td /tr tr td align=rightPhone (including country code): /td td ?php e($html-input('Enquire/phone')); ? /td /tr tr td align=rightMessage: /td td ?php echo $html-textarea('Enquire/message', array('cols'='60', 'rows'='10')); ? /td /tr tr td/td td /td /tr /table ?php echo $ajax-submit('Submit', array('url' = '/properties/ contact_us', 'update' = 'contact_form'));? /form ?php e($ajax-divEnd('contact_form')); ? // CONTROLLER SCRIPT $this-redirect('/confirmations/contact_us/'.$this-data['Enquire'] ['name'].'/'.$this-data['Enquire']['email']); // CONFIRMATION PAGE e('trtdh1Thank you for your email. You will be contacted shortly./h1/td/tr'); $this-renderElement('newsletter_prompt'); // -- this code isnot included into page On Sep 3, 8:14 pm, francky06l [EMAIL PROTECTED] wrote: Does your element calls a requestAction ? On Sep 3, 6:22 am, Richard [EMAIL PROTECTED] wrote: Hi, I have an Ajax form that posts some data and theupdateddivsection (confirmation page) callsrenderElement-- but for some reason does notwork. Any ideas? Many thanks, Richard --~--~-~--~~~---~--~~ 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: renderElement not working in Ajax Updated div
Hi, No I am not using requestAction. Here is the code: Any help would be gratefully appreciated. // FORM ?php e($ajax-div('contact_form')); ? form method=post action=?php e($html-url('/properties/ contact_us'));? onsubmit=return false; table cellpadding=10 cellspacing=0 tr td align=rightName: /td td ?php e($html-input('Enquire/name'));? /td /tr tr td align=rightEmail: /td td ?php e($html-input('Enquire/email'));? /td /tr tr td align=rightPhone (including country code): /td td ?php e($html-input('Enquire/phone')); ? /td /tr tr td align=rightMessage: /td td ?php echo $html-textarea('Enquire/message', array('cols'='60', 'rows'='10')); ? /td /tr tr td/td td /td /tr /table ?php echo $ajax-submit('Submit', array('url' = '/properties/ contact_us', 'update' = 'contact_form'));? /form ?php e($ajax-divEnd('contact_form')); ? // CONTROLLER SCRIPT $this-redirect('/confirmations/contact_us/'.$this-data['Enquire'] ['name'].'/'.$this-data['Enquire']['email']); // CONFIRMATION PAGE e('trtdh1Thank you for your email. You will be contacted shortly./h1/td/tr'); $this-renderElement('newsletter_prompt'); // -- this code is not included into page On Sep 3, 8:14 pm, francky06l [EMAIL PROTECTED] wrote: Does your element calls a requestAction ? On Sep 3, 6:22 am, Richard [EMAIL PROTECTED] wrote: Hi, I have an Ajax form that posts some data and the updated div section (confirmation page) calls renderElement -- but for some reason does not work. Any ideas? Many thanks, Richard --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
renderElement not working in Ajax Updated div
Hi, I have an Ajax form that posts some data and the updated div section (confirmation page) calls renderElement -- but for some reason does not work. Any ideas? Many thanks, Richard --~--~-~--~~~---~--~~ 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: Mambo to use CakePHP for V5
Hello everyone ! This is definitely exciting, kudos to CakePHP team and the rest of the gang... welcome! Chat Auld and the Mambo team Best regards, Richard O. Sentino InfoWeapons Inc. Cebu, Philippines http://www.infoweapons.com Blog : http://sentino.wordpress.com On Jul 25, 8:24 am, cauld [EMAIL PROTECTED] wrote: Hello everyone, My name is Chad Auld. I am the Project Leader for Mambo. Seemed appropriate to stop by this thread and introduce myself. We are excited about the decision and looking forward to forming a very close relationship with the CakePHP development team and community. Anyway, we are here and paying attention to current CakePHP developments and the Google Group discussions for now. More to come as it happens... Cheers! On Jul 23, 10:48 pm, Dr. Tarique Sani [EMAIL PROTECTED] wrote: Exciting news -http://www.source.mambo-foundation.org/content/view/126/1/ Will there be a corresponding announcement from CSF? What does it mean for future of CakePHP? T -- = Cheesecake-Photoblog:http://cheesecake-photoblog.org PHP for E-Biz:http://sanisoft.com = --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Securing a controller - best practice ?
Hi Bakers, First off let me say cake rocks. I've been baking for about 2 weeks now and I'm loving it. I've got a best practice question for y'all. Whats the _best_ way to secure my controller's public actions such that I can requestAction on them form other controllers but prevent users from calling those public actions directly (via URLs) ? Thanks. Cheers r --~--~-~--~~~---~--~~ 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: Securing a controller - best practice ?
On 3/26/07, Samuel DeVore [EMAIL PROTECTED] wrote: look at this thread http://groups.google.com/group/cake-php/browse_thread/thread/9b3106780fb861ec/9b2bd7e3c3597f8f?lnk=gstq=requestAction+controllerrnum=35#9b2bd7e3c3597f8f if($this-params['requested'] === true){ //do your thing here } Awesome ! Thanks. Cheers r --~--~-~--~~~---~--~~ 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: i18n 1.2 - database tables
Fantastic -- thanks. On Feb 4, 11:17 pm, Larry E. Masters aka PhpNut [EMAIL PROTECTED] wrote: Richard, Before 1.2.x.x is released stable I will have a CLI script that will generate the .pot files for an application. I have it working with all the possible translations functions now but need to refactor it a little more before I am ready to merge it into the core. It will work very much like our Bake script. https://trac.cakephp.org/browser/trunk/cake/1.2.x.x/cake/scripts/extr... On 2/4/07, Richard [EMAIL PROTECTED] wrote: Hi Mariano I have done some reading on gettext since your post and wondered if creating the pot files is possible using 'xgettext' command? since the strings that need translating in the cake views are not wrapped using PHP's gettext() function. I found this useful for anyone else that is researching this topic: http://www.onlamp.com/pub/a/php/2002/06/13/php.html?page=1 Thanks, Richard On Feb 4, 9:31 pm, Mariano Iglesias [EMAIL PROTECTED] wrote: CakePHP 1.2 uses gettext for i18n, which places the contents on text files, as you can read here: http://ar.php.net/gettext So if you need your text elements to be on a database (thus allowing your application to easily modify them) you'll need to implement i18n DB support by yourself, or better yet integrate an existing i18n DB based package on Cake. Since I needed i18n DB support on my app, which is currently running on CakePHP 1.1.12 I'm using PEAR::Translation2 available at: http://pear.php.net/package/Translation2 There may be better i18n packages (I've used others in the past) but I'm always inclined to use PEAR packages. Simply installing it as a PEAR library on your vendors dir, and then building a small component (so your controllers don't know about the internals of Translation2, making it easier to change the library in the future) to fetch the text elements will do the trick. -MI --- Remember, smart coders answer ten questions for every question they ask. So be smart, be cool, and share your knowledge. BAKE ON! -Mensaje original- De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre de Richard Enviado el: Domingo, 04 de Febrero de 2007 07:42 a.m. Para: Cake PHP Asunto: i18n 1.2 - database tables I would like to create a multi-lingual website with editable content through a CMS. Will this be possible with release of 1.2? -- /** * @author Larry E. Masters * @var string $userName * @param string $realName * @returns string aka PhpNut * @access public */ --~--~-~--~~~---~--~~ 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: i18n 1.2 - database tables
Hi Mariano I have done some reading on gettext since your post and wondered if creating the pot files is possible using 'xgettext' command? since the strings that need translating in the cake views are not wrapped using PHP's gettext() function. I found this useful for anyone else that is researching this topic: http://www.onlamp.com/pub/a/php/2002/06/13/php.html?page=1 Thanks, Richard On Feb 4, 9:31 pm, Mariano Iglesias [EMAIL PROTECTED] wrote: CakePHP 1.2 uses gettext for i18n, which places the contents on text files, as you can read here: http://ar.php.net/gettext So if you need your text elements to be on a database (thus allowing your application to easily modify them) you'll need to implement i18n DB support by yourself, or better yet integrate an existing i18n DB based package on Cake. Since I needed i18n DB support on my app, which is currently running on CakePHP 1.1.12 I'm using PEAR::Translation2 available at: http://pear.php.net/package/Translation2 There may be better i18n packages (I've used others in the past) but I'm always inclined to use PEAR packages. Simply installing it as a PEAR library on your vendors dir, and then building a small component (so your controllers don't know about the internals of Translation2, making it easier to change the library in the future) to fetch the text elements will do the trick. -MI --- Remember, smart coders answer ten questions for every question they ask. So be smart, be cool, and share your knowledge. BAKE ON! -Mensaje original- De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre de Richard Enviado el: Domingo, 04 de Febrero de 2007 07:42 a.m. Para: Cake PHP Asunto: i18n 1.2 - database tables I would like to create a multi-lingual website with editable content through a CMS. Will this be possible with release of 1.2? --~--~-~--~~~---~--~~ 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: tagErrorMsg annoyance
I will answer my own question :) $html-tagIsInvalid() On Nov 17, 1:13 pm, Richard [EMAIL PROTECTED] wrote: Hi, I have removed the styling information from the tagErrorMsg method, so that no automaginess happens when outputting messages. This does mean everytime I update cake I will have to update html.php ... are there any other options? Do you agree that having the flexibility in surpressing this style information is a good thing? Now I can do things like this now: // turns my input element background red on error $html-input('Enquire/name', array($html-tagErrorMsg('Enquire/name', 'style=background-color:red'))); --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
tagErrorMsg annoyance
Hi, I have removed the styling information from the tagErrorMsg method, so that no automaginess happens when outputting messages. This does mean everytime I update cake I will have to update html.php ... are there any other options? Do you agree that having the flexibility in surpressing this style information is a good thing? Now I can do things like this now: // turns my input element background red on error $html-input('Enquire/name', array($html-tagErrorMsg('Enquire/name', 'style=background-color:red'))); --~--~-~--~~~---~--~~ 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 do you parse XML using cake?
I looked at the thinkingphp solution but it only works in Cake 1.2 ... the other option i could see was using PHP's SimpleXML (only PHP 5) . On Oct 23, 5:27 am, nate [EMAIL PROTECTED] wrote: http://bin.cakephp.org/saved/87http://www.thinkingphp.org/2006/09/21/dessert-14-the-new-xml-class/ --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: How do you parse XML using cake?
Hi Samuel I couldn't get it to work with 1.1 ...but have upgraded to 1.2 from SVN and will seee how I go. thanks for your replies - Richard On Oct 23, 7:02 pm, Samuel DeVore [EMAIL PROTECTED] wrote: actually you can move thexml.php file to vendors and it works pretty good in 1.1 On 10/23/06, Richard [EMAIL PROTECTED] wrote: I looked at the thinkingphp solution but it only works in Cake 1.2 ... the other option i could see was using PHP's SimpleXML (only PHP 5) . On Oct 23, 5:27 am, nate [EMAIL PROTECTED] wrote: http://bin.cakephp.org/saved/87http://www.thinkingphp.org/2006/09/21/...-- == S. DeVore (the old fart) the advice is free, the lack of crankiness will cost you --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
How do you parse XML using cake?
Hi, How do you guys parse XML? I have looked at various options and wondered if there where any preferred methods. Many thanks, Richard --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---