Re: Many to Many relationship issue
I'm only a cake noob, and I obviously don't know for sure about how your thinking of Users and Profiles. In my mind: User hasOne Profile Follower hasAndBelongsToMany Profiles (or prehaps instead of Profiles its Users) But User and Follower are essentially the same so in my Database mind.. User user_profile : user_id, profile_id, follower (set either true/false) [if you can follow your own Profile then you'd also add: owner (true/ false) ] Profile --~--~-~--~~~---~--~~ 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: Many to Many relationship issue
Thanks for the input. But,the relationship is this way 1) users HASBTM profiles. 1st scenario ) user can have multiple profiles. A profile can belong to multiple user. 2nd scenrio ) even if user is not having a particular profile, he can still follow that profile. thats the reason there are 2 HASBTM tables. 1) users_profiles for 1st scenario 2) followers for 2nd scenario. womble-2 wrote: I'm only a cake noob, and I obviously don't know for sure about how your thinking of Users and Profiles. In my mind: User hasOne Profile Follower hasAndBelongsToMany Profiles (or prehaps instead of Profiles its Users) But User and Follower are essentially the same so in my Database mind.. User user_profile : user_id, profile_id, follower (set either true/false) [if you can follow your own Profile then you'd also add: owner (true/ false) ] Profile -- View this message in context: http://www.nabble.com/Many-to-Many-relationship-issue-tp24466294p24493429.html Sent from the CakePHP mailing list archive at Nabble.com. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: setFlash and redirect problem
if your using a multi-lingual applications with translations do not remove. __('Bill was sent by e-mail successfully', true) $this-Session-setFlash(__('Bill was sent by e-mail successfully', true)); setting __('this field', true) enables you to generate a po(t) file to translate that string into another language. If your application has no interest in translations you do not need to use it and can change it to $this-Session-setFlash('Bill was sent by e-mail successfully'); On Jul 14, 6:55 pm, Kau-Boy bernhard...@gmail.com wrote: See my correction on your code:http://pastebin.com/m6b2da595 (Use the Diff to see the correction) Sometimes it can be this easy to solve but also very hard to find even looking thousands of times on the same line of code :-) On Jul 14, 1:40 pm, Raph ra...@epoczta.pl wrote: There's still blank page. On 14 Lip, 12:28, M Naveed Akram cmn...@gmail.com wrote: hey set your debug mode to 2 or 3 so that you can receive error message.. On Tue, Jul 14, 2009 at 3:15 PM, jeff jeffery2k2...@gmail.com wrote: explain what problem exactly r u facing and also the code... On Tue, Jul 14, 2009 at 3:41 PM, Raph ra...@epoczta.pl wrote: Still the same problem. :/ If I remove setFlash then is ok. On 14 Lip, 11:52, jeff jeffery2k2...@gmail.com wrote: use the foll: manner $this-Session-setFlash('User profile has been updated.'); $this-redirect('/users/home'); // controller name/action name On Tue, Jul 14, 2009 at 3:19 PM, Raph ra...@epoczta.pl wrote: Hello! I have weird (I think) problem. In one of my actions I have the code: $this-Sesssion-setFlash(__('Bill was sent by e-mail successfully', true)); $this-redirect(array('controller' = 'somecotroller'); and nothing happend. Redirection dosen't work, there's only blank screen. When I remove setFlash everything is ok. Whtat's wrong with setFlash? -- Raph -- -- (¨`•.•´¨) I may be busy, `•.¸(¨`•.•´¨) but I assure you, (¨`•.•´¨)¸.•´ you are always in my heart `•.¸.•´ With Lots of Love. THANKS AND REGARDS Jeffery Jacob -- -- (¨`•.•´¨) I may be busy, `•.¸(¨`•.•´¨) but I assure you, (¨`•.•´¨)¸.•´ you are always in my heart `•.¸.•´ With Lots of Love. THANKS AND REGARDS Jeffery Jacob --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Manually trigger callbacks on associated models with saveAll()
I have ImageSet hasMany Image Image actsAs MeioUpload (an upload behavior from the Bakery) My add form has one ImageSet and 3 Images. When I $this-ImageSet-saveAll($this-data) in the controller, it creates the ImageSet and Image records, but the callbacks aren't called for Image. I know this is expected -- callbacks on associations do not get called in Cake 1.2. The question is: is there a way to get around this limitation and have the callbacks triggered? I've not thought of a way to do this short of overloading saveAll() in my ImageSet model. There is this somewhat related patch from two years ago. https://trac.cakephp.org/ticket/2056 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 -~--~~~~--~~--~--~---
Stop AJAX Request
Hi, I am still working on my first Cake Project and I am now stuck in some AJAX Request where I would need some feedback. I am trying to achieve the following. I have recipes everybody can see. There is a link above the recipe to add it to your favorites. If you are logged in the page should check if you have it already saved, than the link should show Already in cookbook otherwise Add to favorites. Next step is when you want to add it, you have to be logged in, otherwise the login window should show up. The Add to cookbook I wanted to do with AJAX in the background. So I am using if($this-Auth-user() == null) { $this-redirect('/users/login'); } in my addToFavorites($id) to check if the User is logged in, if not, the Login Form shows up above the recipe. But what I actually would like to reach is that the recipe doesn't show up at all anymore but instead just the Login Form. If you are than logged in, you should be seeing the recipe again and the link should have changed. I suppose it happens, because I am only replacing the content in the div with AJAX. Is there any chance to stop the AJAX response and instead re-load the full page or what would you guys suggest? Thanks for any advice. Luke --~--~-~--~~~---~--~~ 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: css class
Thanks jeff. somewhat i understood its good enough to proceed. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
cakephp with javascript
Hi everybody, Anybody know how do call an javascript for popup window from .ctp hyperlink Regards, Dhileepen --~--~-~--~~~---~--~~ 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: submitting to cookbook
Hi AD, Sorry i wasn't clear the last time -- i *want* to submit some code snippets to the cookbook and don't know how ... OK, now i see what you mean; the edit is present in the cookbook page too and i just need to hit edit there. Just to be sure, i'll update the 3. Submit additions in the How- it-Works. After that gets accepted, will do the edit in the code section. thanks, krishnan I invite you to press edit here:http://book.cakephp.org/view/526/How-it-Works * Which will take you here:http://book.cakephp.org/edit/526/How-it-Works Please change the text to make it more clear that anyone can submit a correction/improvement. If you wanted to create a new section - click suggest a new section on the first link [*]. Regards, AD --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: cakephp with javascript
Hello, Anybody know how do call an javascript for popup window from .ctp hyperlink As usual? Just use 'javascript: popup()' as target, onclick attribute or bind an event to the proper element using JS. Regards, Piotr --~--~-~--~~~---~--~~ 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: Many to Many relationship issue
It should result in the same db structure. Just use appropriate flag attributes in the associative table. When you run your find() you'll want to use conditions to filter on the attributes. User user_profile: follower, profileowner Profile In data modeling speak, the stucture is physical implementtion of a User Many-To-Many Profile. The 'real' primary key in the user_profile table is user_id+profile_id and both are individually foreign keys (I use 'real' because cake uses id and _id for pkey and fkey by default). You use the relationship (implemented as user_profile) to describe some additional data - if you think about it you can't place owner and follower data in User as they can be multiple entries (dito for Pages), but it fits into user_profile. You'll see a similar type of structure in the ACL component, where aros_acos contains the permissions (_create, _delete etc). With the structure you can answer: - is user A a follower of Profile B - is user A an owner of Profile B - Who are all the owners of Profile B - Who are all the followers of Profile B - What profiles does user A follow - What profiles does user A own - Is an owner also a follower etc. On Jul 15, 6:18 pm, abhishekh timba...@gmail.com wrote: Thanks for the input. But,the relationship is this way 1) users HASBTM profiles. 1st scenario ) user can have multiple profiles. A profile can belong to multiple user. 2nd scenrio ) even if user is not having a particular profile, he can still follow that profile. thats the reason there are 2 HASBTM tables. 1) users_profiles for 1st scenario 2) followers for 2nd scenario. womble-2 wrote: I'm only a cake noob, and I obviously don't know for sure about how your thinking of Users and Profiles. In my mind: User hasOne Profile Follower hasAndBelongsToMany Profiles (or prehaps instead of Profiles its Users) But User and Follower are essentially the same so in my Database mind.. User user_profile : user_id, profile_id, follower (set either true/false) [if you can follow your own Profile then you'd also add: owner (true/ false) ] Profile -- View this message in context:http://www.nabble.com/Many-to-Many-relationship-issue-tp24466294p2449... Sent from the CakePHP mailing list archive at Nabble.com. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Stop AJAX Request
IIRC, you cannot do that with AJAX requests. Since you're already using Auth component, you can set the Auth- ajaxLogin variable (in your AppController) to contain the appropriate error and handle that condition accordingly in your javascript. On Jul 15, 4:01 pm, Luke eik...@hotmail.com wrote: Hi, I am still working on my first Cake Project and I am now stuck in some AJAX Request where I would need some feedback. I am trying to achieve the following. I have recipes everybody can see. There is a link above the recipe to add it to your favorites. If you are logged in the page should check if you have it already saved, than the link should show Already in cookbook otherwise Add to favorites. Next step is when you want to add it, you have to be logged in, otherwise the login window should show up. The Add to cookbook I wanted to do with AJAX in the background. So I am using if($this-Auth-user() == null) { $this-redirect('/users/login'); } in my addToFavorites($id) to check if the User is logged in, if not, the Login Form shows up above the recipe. But what I actually would like to reach is that the recipe doesn't show up at all anymore but instead just the Login Form. If you are than logged in, you should be seeing the recipe again and the link should have changed. I suppose it happens, because I am only replacing the content in the div with AJAX. Is there any chance to stop the AJAX response and instead re-load the full page or what would you guys suggest? Thanks for any advice. Luke --~--~-~--~~~---~--~~ 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: cakephp with javascript
Thanks Piotr. Actually i want to know form validation as well. Model is confusing me ( i am a beginner). then i go for javascript validation is it possible? --~--~-~--~~~---~--~~ 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: Setting up table ID's
What is the purpose of the UUID? The database generates a unique ID for each user anyways so if it's just for internal usage then just use the ID. If you need a UUID then i'd recommend adding an extra field in the db for it. The correct way to go about it would involve the use of foregin keys. --- Users --- id uuid name email other_fields Profiles - id user_id - foreign key for the User.id field other_fields Galleries --- id user_id - foreign key for the User.id field gallery_name Albums -- id gallery_id- foreign key for the Gallery.id field album_name --- If you need to fetch the users galleries then you'll call $this-User-Gallery-find('all', array('conditions' = array( 'Gallery.user_id' = $this-Auth-user('id') ) ); And if your model's are associated properly then you'll fetch all the albums related to that gallery too. Hope this helps. On Mon, Jul 13, 2009 at 9:36 PM, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: I am setting up am app and trying UUID for each user but question I have is: So a User.id is a UUID that User hasOne Profile.id which will be the User.id correct? User.id = same as = Profile.id And say a User hasOne Gallery which hasMany Albums and each Album hasMany Photos Would the Gallery.id be the User.id? the Album has its own ID, gallery_id which would be the same UUID? User.id = same as = Gallery.id Album.id = int(11) Album.gallery_id = the users UUID Photos.id = int(11) Photos.album_id = int(11) and Photos would have their own ID but relate back to the album_id whichc would trace back to the Gallery.id and back to its original owner? Hope that makes sense Is that the right way to do it? 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: setFlash and redirect problem
Yes that's right. But I think Raph will keep the __() function as he now knows that it was the tripple S in $this-Sesssion() which caused the problem. @Raph: So ignore jeffs adivce and keep using the __() function. Even if you don't want to translate your page know, you should use the function as all the text inside will be echoed anyways. And if you'll have to translate your page one day you will save a lot of time. On Jul 15, 10:20 am, seancul...@gmail.com seancul...@gmail.com wrote: if your using a multi-lingual applications with translations do not remove. __('Bill was sent by e-mail successfully', true) $this-Session-setFlash(__('Bill was sent by e-mail successfully', true)); setting __('this field', true) enables you to generate a po(t) file to translate that string into another language. If your application has no interest in translations you do not need to use it and can change it to $this-Session-setFlash('Bill was sent by e-mail successfully'); On Jul 14, 6:55 pm, Kau-Boy bernhard...@gmail.com wrote: See my correction on your code:http://pastebin.com/m6b2da595 (Use the Diff to see the correction) Sometimes it can be this easy to solve but also very hard to find even looking thousands of times on the same line of code :-) On Jul 14, 1:40 pm, Raph ra...@epoczta.pl wrote: There's still blank page. On 14 Lip, 12:28, M Naveed Akram cmn...@gmail.com wrote: hey set your debug mode to 2 or 3 so that you can receive error message.. On Tue, Jul 14, 2009 at 3:15 PM, jeff jeffery2k2...@gmail.com wrote: explain what problem exactly r u facing and also the code... On Tue, Jul 14, 2009 at 3:41 PM, Raph ra...@epoczta.pl wrote: Still the same problem. :/ If I remove setFlash then is ok. On 14 Lip, 11:52, jeff jeffery2k2...@gmail.com wrote: use the foll: manner $this-Session-setFlash('User profile has been updated.'); $this-redirect('/users/home'); // controller name/action name On Tue, Jul 14, 2009 at 3:19 PM, Raph ra...@epoczta.pl wrote: Hello! I have weird (I think) problem. In one of my actions I have the code: $this-Sesssion-setFlash(__('Bill was sent by e-mail successfully', true)); $this-redirect(array('controller' = 'somecotroller'); and nothing happend. Redirection dosen't work, there's only blank screen. When I remove setFlash everything is ok. Whtat's wrong with setFlash? -- Raph -- -- (¨`•.•´¨) I may be busy, `•.¸(¨`•.•´¨) but I assure you, (¨`•.•´¨)¸.•´ you are always in my heart `•.¸.•´ With Lots of Love. THANKS AND REGARDS Jeffery Jacob -- -- (¨`•.•´¨) I may be busy, `•.¸(¨`•.•´¨) but I assure you, (¨`•.•´¨)¸.•´ you are always in my heart `•.¸.•´ With Lots of Love. THANKS AND REGARDS Jeffery Jacob --~--~-~--~~~---~--~~ 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: cakephp with javascript
Hello, Actually i want to know form validation as well. Model is confusing me ( i am a beginner). then i go for javascript validation is it possible? Possible, but you generally can't trust client-side JavaScript validation. I think that JS validation is even harder than the CakePHP built in one, but choose best approach for you. Regards, Piotr --~--~-~--~~~---~--~~ 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: cakephp with javascript
!-- File: /app/views/posts/add.ctp -- h1Add Post/h1 ?php echo $form-create('Post'); echo $form-input('title'); echo $form-input('body', array('rows' = '3')); echo $form-end('Save Post'); ? ?php class Post extends AppModel { var $name = 'Post'; var $validate = array( 'title'=VALID_NOT_EMPTY, 'body'=VALID_NOT_EMPTY ); } ? If i am not enter any value then it says This field cannot be left blank but i want to show a message Please enter Title How do i do? Regards, Dhileepen --~--~-~--~~~---~--~~ 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: Stop AJAX Request
Hi, Oh, so I can not re-send the complete Page when I realise the User is not logged in!? So I will have to re-think my idea. I really thought that there is a possibility, but good that you have given a clear No, not possible I have now tried something out from the IBM Tutorial, its a bit of a different issue, but I did not want to start a new post. http://www.ibm.com/developerworks/opensource/library/os-php-cake5/index.html?S_TACT=105AGX44S_CMP=TUT They use the following: function removeFromFavorites($id) { $username = $this-Session-read('user'); $success = false; $user = $this-Product-User-findByUsername ($username, 'User.id'); $this-Product-User-id = $user['User']['id']; $success = $this-Product-User-removeFavorite($id); if ( $this-RequestHandler-isAjax() ) { echo 'Removed product from favorites'; exit; } else { if ( $success ) { $this-Session-setFlash('Removed product from favorites'); $this-redirect('/users/favorites'); } else { $this-Session-setFlash('Access denied'); $this-redirect('/products/index'); } } } I have tried this out to understand the structure behind it but get Query: removeFavorite So it must be the below line, but what is the issue with this code? Why is it using the method as a query? $success = $this-Product-User-removeFavorite($id); I can't see what is wrong. Anyone an idea? Thanks so much in advance. Luke --~--~-~--~~~---~--~~ 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: cakephp with javascript
The ‘message’ key allows you to define a custom validation error message for the rule: var $validate = array( 'password' = array( 'rule' = array('minLength', 8), 'message' = 'Password must be at least 8 characters long' ) ); http://book.cakephp.org/view/127/One-Rule-Per-Field On Wed, Jul 15, 2009 at 4:45 PM, Dhileepen Chakravarthy dhileepen.cake...@gmail.com wrote: !-- File: /app/views/posts/add.ctp -- h1Add Post/h1 ?php echo $form-create('Post'); echo $form-input('title'); echo $form-input('body', array('rows' = '3')); echo $form-end('Save Post'); ? ?php class Post extends AppModel { var $name = 'Post'; var $validate = array( 'title'=VALID_NOT_EMPTY, 'body'=VALID_NOT_EMPTY ); } ? If i am not enter any value then it says This field cannot be left blank but i want to show a message Please enter Title How do i do? Regards, Dhileepen -- -- (¨`•.•´¨) I may be busy, `•.¸(¨`•.•´¨) but I assure you, (¨`•.•´¨)¸.•´ you are always in my heart `•.¸.•´ With Lots of Love. THANKS AND REGARDS Jeffery Jacob --~--~-~--~~~---~--~~ 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: When/how do you publish Bakery articles?
Since I also use EclipsePDT as my Cake dev environment I'm very interested in this article :) On Tue, Jul 14, 2009 at 4:02 PM, GravyFacegravyf...@gmail.com wrote: I wrote a tutorial on CakePHP + EclipsePDT autocomplete almost a month ago and it hasn't been published yet. If there's a submittal/workflow I'm not aware of, let me know. --~--~-~--~~~---~--~~ 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: Stop AJAX Request
Hello, I have tried this out to understand the structure behind it but get Query: removeFavorite So it must be the below line, but what is the issue with this code? Why is it using the method as a query? $success = $this-Product-User-removeFavorite($id); I can't see what is wrong. Anyone an idea? Thanks so much in advance. You have to have this method inside your User model, I guess you don't. There are no automagic remove methods in Cake (but there are magic findBy... and findAllBy... methods, which might confuse you). As for the AJAX issue, I'd say it's possible. I'd suggest you used JSON as a return of an ajax check, and the do the rest of the view logic, but maybe I miss the point of your problem... Regards, Piotr --~--~-~--~~~---~--~~ 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: cakephp with javascript
Thanks jeff. I tried like this. ?php class Post extends AppModel { var $name = 'Post'; /*var $validate = array( 'title'=VALID_NOT_EMPTY, 'body'=VALID_NOT_EMPTY );*/ var $validate = array( 'title' = array( 'rule' = VALID_NOT_EMPTY, // or: array('ruleName', 'param1', 'param2' ...) 'required' = true, 'allowEmpty' = false, 'on' = 'create', // or: 'update' 'message' = 'Please enter Title this field should not be empty' ), 'body' = array( 'bodyRule1' = array( 'rule' = VALID_NOT_EMPTY, // or: array('ruleName', 'param1', 'param2' ...) 'required' = true, 'allowEmpty' = false, 'on' = 'create', // or: 'update' 'message' = 'Please enter Body this field should not be empty' ), 'bodyRule1' = array( 'rule' = array('minLength', '100'), 'message' = 'Minimum length of 100 characters' ) ) ); } ? What i need is body is empty then show 'Please enter Body this field should not be empty' if it is not empty check the minLength is 100. then message 'Minimum length of 100 characters' How do i fix this issue Regards, Dhileepen --~--~-~--~~~---~--~~ 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: cakephp with javascript
try to use this array for the body... 'body' = array( 'notEmpty' = array( 'rule' = 'notEmpty', 'message' = 'The body field cannot be blank.' ), 'minlength'=array( 'rule'=array('minLength',100), 'message'='The bodymust be atleast 100 characters .' ) ) On Wed, Jul 15, 2009 at 5:41 PM, Dhileepen Chakravarthy dhileepen.cake...@gmail.com wrote: Thanks jeff. I tried like this. ?php class Post extends AppModel { var $name = 'Post'; /*var $validate = array( 'title'=VALID_NOT_EMPTY, 'body'=VALID_NOT_EMPTY );*/ var $validate = array( 'title' = array( 'rule' = VALID_NOT_EMPTY, // or: array('ruleName', 'param1', 'param2' ...) 'required' = true, 'allowEmpty' = false, 'on' = 'create', // or: 'update' 'message' = 'Please enter Title this field should not be empty' ), 'body' = array( 'bodyRule1' = array( 'rule' = VALID_NOT_EMPTY, // or: array('ruleName', 'param1', 'param2' ...) 'required' = true, 'allowEmpty' = false, 'on' = 'create', // or: 'update' 'message' = 'Please enter Body this field should not be empty' ), 'bodyRule1' = array( 'rule' = array('minLength', '100'), 'message' = 'Minimum length of 100 characters' ) ) ); } ? What i need is body is empty then show 'Please enter Body this field should not be empty' if it is not empty check the minLength is 100. then message 'Minimum length of 100 characters' How do i fix this issue Regards, Dhileepen -- -- (¨`•.•´¨) I may be busy, `•.¸(¨`•.•´¨) but I assure you, (¨`•.•´¨)¸.•´ you are always in my heart `•.¸.•´ With Lots of Love. THANKS AND REGARDS Jeffery Jacob --~--~-~--~~~---~--~~ 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: cakephp with javascript
http://book.cakephp.org/view/134/Core-Validation-Rules learn this link for proper validation On Wed, Jul 15, 2009 at 5:47 PM, jeff jeffery2k2...@gmail.com wrote: try to use this array for the body... 'body' = array( 'notEmpty' = array( 'rule' = 'notEmpty', 'message' = 'The body field cannot be blank.' ), 'minlength'=array( 'rule'=array('minLength',100), 'message'='The bodymust be atleast 100 characters .' ) ) On Wed, Jul 15, 2009 at 5:41 PM, Dhileepen Chakravarthy dhileepen.cake...@gmail.com wrote: Thanks jeff. I tried like this. ?php class Post extends AppModel { var $name = 'Post'; /*var $validate = array( 'title'=VALID_NOT_EMPTY, 'body'=VALID_NOT_EMPTY );*/ var $validate = array( 'title' = array( 'rule' = VALID_NOT_EMPTY, // or: array('ruleName', 'param1', 'param2' ...) 'required' = true, 'allowEmpty' = false, 'on' = 'create', // or: 'update' 'message' = 'Please enter Title this field should not be empty' ), 'body' = array( 'bodyRule1' = array( 'rule' = VALID_NOT_EMPTY, // or: array('ruleName', 'param1', 'param2' ...) 'required' = true, 'allowEmpty' = false, 'on' = 'create', // or: 'update' 'message' = 'Please enter Body this field should not be empty' ), 'bodyRule1' = array( 'rule' = array('minLength', '100'), 'message' = 'Minimum length of 100 characters' ) ) ); } ? What i need is body is empty then show 'Please enter Body this field should not be empty' if it is not empty check the minLength is 100. then message 'Minimum length of 100 characters' How do i fix this issue Regards, Dhileepen -- -- (¨`•.•´¨) I may be busy, `•.¸(¨`•.•´¨) but I assure you, (¨`•.•´¨)¸.•´ you are always in my heart `•.¸.•´ With Lots of Love. THANKS AND REGARDS Jeffery Jacob -- -- (¨`•.•´¨) I may be busy, `•.¸(¨`•.•´¨) but I assure you, (¨`•.•´¨)¸.•´ you are always in my heart `•.¸.•´ With Lots of Love. THANKS AND REGARDS Jeffery Jacob --~--~-~--~~~---~--~~ 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: Render Xml
On 07/14/2009 04:29 PM, Paulos23 wrote: How i can take these data from the array[] and print them like this for example? name:Barcelona lat:... lng... Given $i is the name of your array. foreach($i['Geoname'] as $parent){ foreach($parent as $key = $child){ echo $key, ': ', $child; } } PS: Look into arrays; lots of resources available. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Correct Way to save HTML code to database
Hi There, I am having a problem saving html code to a MySQL field using the saveAll method. Basically what is happening is that only half of the html is actually saved at times depending on the content. At other times it works fine. When the body is comprised of text everything works perfectly everytime. This tells me that the code is in order for saving etc, the problem must be with certain html entities. The code is extracted from html formatted emails (body). Being new to ... wait for it ... PHP, CakePHP and MySQL this is a challenge as I have googled and yahood and read the manual been through the API code and to no avail ... Humbly I ask for any assistance that anyone may provide, I am not sure if I should be running a function against the html prior to saving, and then again possibly when I want to display it (important to note that I require the original html to be viewed by a user at a later stage) Thanks Jacques --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Getting Started With CakePHP
Hello All, I am new to cakephp. Can anybody tell me what are steps required to build a new application in cakephp. Best Regards, Pradip Jadhav --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
views management
Hy i am new to cakephp. I want to maintain different directories for admin view and client view, meanwhile i want to make themeable as well. any idea from seniors ??? 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 -~--~~~~--~~--~--~---
Components/helpers/... and parsing markup
Hi all, I am developing an application which requires some quite powerful markup. I won't bother explaining with words until you've seen some markup: === [title]A title which will be pulled and put in to a field separate to the content in the database[/title] This [i]is[/i] [b]some[/b] text. Here is the first paragraph of the about page: [div=home][page url=/about limit=paragraph start=1][/div] Here is 200 characters starting 100 characters in of the news page: [div=news][page url=/news limit=200 start=100][/div] [quote=23] Here I am quoting an item of content with id 23, the quote header will have a link to the content in question and will grab the username of the content creator. [/quote] Some more text. === Note: the above markup is just representative of what I might like to do, it is not exactly what I will do. What I want to know, is how I should split the logic for this. I have a parser which understands the markup, but should it be in a component (surely it needs to have open communication with the controller, for the controller to get the information it needs) or should it be split between a component and a helper So, Option 1, only a component: Tells the controller what data to get, parses the markup to HTML and hands it back to the controller to pass on to the view (which is non-the-wiser as to any pre-processing having occurred). Option 2: The component parses the markup and tells the controller to get and give to the view any data it will need from the model. Then the helper re-parses the markup and turns it in to a html representation based on the data given. Option n: Any other suggestions? I hope this makes sense, 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: Getting Started With CakePHP
http://book.cakephp.org/ On Wed, Jul 15, 2009 at 1:57 PM, Pradip Jadhav jadhavpradi...@gmail.comwrote: Hello All, I am new to cakephp. Can anybody tell me what are steps required to build a new application in cakephp. Best Regards, Pradip Jadhav -- http://phpirate.net --~--~-~--~~~---~--~~ 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: Getting Started With CakePHP
Sure, why don't you tell me what you want to build and I'll start working on it for you! Don't worry about any fussy things like details or requirements -- I won't stop working until you're completely satisfied. On Wed, Jul 15, 2009 at 6:57 AM, Pradip Jadhavjadhavpradi...@gmail.com wrote: Hello All, I am new to cakephp. Can anybody tell me what are steps required to build a new application in cakephp. Best Regards, Pradip Jadhav --~--~-~--~~~---~--~~ 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: Correct Way to save HTML code to database
Hello, I am having a problem saving html code to a MySQL field using the saveAll method. Basically what is happening is that only half of the html is actually saved at times depending on the content. At other times it works fine. When the body is comprised of text everything works perfectly everytime. This tells me that the code is in order for saving etc, the problem must be with certain html entities. The code is extracted from html formatted emails (body). Being new to ... wait for it ... PHP, CakePHP and MySQL this is a challenge as I have googled and yahood and read the manual been through the API code and to no avail ... Humbly I ask for any assistance that anyone may provide, I am not sure if I should be running a function against the html prior to saving, and then again possibly when I want to display it (important to note that I require the original html to be viewed by a user at a later stage) What kind of field are you using to store HTML? Regards, Piotr --~--~-~--~~~---~--~~ 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: Getting Started With CakePHP
Feeling a bit trollish are we:)? 2009/7/15 GravyFace gravyf...@gmail.com Sure, why don't you tell me what you want to build and I'll start working on it for you! Don't worry about any fussy things like details or requirements -- I won't stop working until you're completely satisfied. On Wed, Jul 15, 2009 at 6:57 AM, Pradip Jadhavjadhavpradi...@gmail.com wrote: Hello All, I am new to cakephp. Can anybody tell me what are steps required to build a new application in cakephp. Best Regards, Pradip Jadhav --~--~-~--~~~---~--~~ 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: Getting Started With CakePHP
I think he's closer to trolling (whether he knows it or not) by asking a question like that. On Wed, Jul 15, 2009 at 10:31 AM, Carlos Gonzalez Lavincarloslavi...@gmail.com wrote: Feeling a bit trollish are we:)? 2009/7/15 GravyFace gravyf...@gmail.com Sure, why don't you tell me what you want to build and I'll start working on it for you! Don't worry about any fussy things like details or requirements -- I won't stop working until you're completely satisfied. On Wed, Jul 15, 2009 at 6:57 AM, Pradip Jadhavjadhavpradi...@gmail.com wrote: Hello All, I am new to cakephp. Can anybody tell me what are steps required to build a new application in cakephp. Best Regards, Pradip Jadhav --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
jQuery UI Tabs and Ajax
Hi together, I have a view where I want to display the jQuery Tabs UI with 5 tabs. Four of them are contain the content from the current Controller / View. So I have build it like the example: script type=text/javascript $(function() { $(#tabs).tabs(); }); /script div id=tab-1 div id=tabs ul lia href=#tab-1span?php echo __('Details'); ?/span/ a/li lia href=#tab-2span?php echo __('Fittings'); ?/span/ a/li lia href=#tab-3span?php echo __('Conditions'); ?/ span/a/li lia href=#tab-4span?php echo __('Partner'); ?/span/ a/li lia href=/admin/attachements/getlist/?php echo $this-data ['Posts']['id']; ?span?php echo __('Attachements'); ?/span/ a/li /ul The fifths tab should countain attachements, which is a 1:n relation to the current model. It tried to call it as a link (like in jQuery Documentation described). In my attachement controller I have this function function admin_getlist($id = null, $details = null) { if ($this-RequestHandler-isAjax()) { $this-Attachements-Behaviors-attach('Containable'); $conditions = array('Attachements.post_id' = $id); $attachements = $this-Attachements-find('all', array( 'conditions' = $conditions, 'contain' = false ) ); $this-set('Attachements',$attachements); $this-render(null,'ajax');exit; } } From tab 1 to 4 everything works fine. If I call tab 5 I got the error: [code]Notice (8): Undefined variable: javascript [APP/views/layouts/ admin.ctp, line 45] Fatal error: Call to a member function link() on a non-object in /www/ htdocs/w0064edd/demo/app/views/layouts/admin.ctp on line 45 On line 45 is the command echo $javascript-link('jquery/ ui.core.js'); This looks like missing the Javascript Helper. But the Javascript Helper is used in every controller and also in the AppController. Can somebody explain me the reason? Regards Thomas --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
HABTM with additional data scaffold update problem.
Hi, My join table additional data get lost when I update any of the 2 models that has HABTM relation: I have 2 models that has HABTM relation and the join table between these has additional data. The problem is that when I edit and update any record on first model, it will delete and insert join table records and I loose my additional data on join table. How I solve it? I alread tried the HABTM 'with' tag and changed the 'unique' tag too, but no success. Kind regards, Franco --~--~-~--~~~---~--~~ 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: Correct Way to save HTML code to database
What kind of field are you using to store HTML? As your new to MySQL its worth emphasising that text fields with the datatype of varchar have a maximum length. Your data may be getting truncated as it's too long to fit in the varchar field. Have you tried increasing the size of the field in the database to a larger value? On Jul 15, 3:30 pm, Piotr Kilczuk kilc...@gmail.com wrote: Hello, I am having a problem saving html code to a MySQL field using the saveAll method. Basically what is happening is that only half of the html is actually saved at times depending on the content. At other times it works fine. When the body is comprised of text everything works perfectly everytime. This tells me that the code is in order for saving etc, the problem must be with certain html entities. The code is extracted from html formatted emails (body). Being new to ... wait for it ... PHP, CakePHP and MySQL this is a challenge as I have googled and yahood and read the manual been through the API code and to no avail ... Humbly I ask for any assistance that anyone may provide, I am not sure if I should be running a function against the html prior to saving, and then again possibly when I want to display it (important to note that I require the original html to be viewed by a user at a later stage) What kind of field are you using to store HTML? Regards, Piotr --~--~-~--~~~---~--~~ 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: Correct Way to save HTML code to database
A TEXT type of db field would be a better option for this... 2009/7/15 rich...@home richardath...@gmail.com What kind of field are you using to store HTML? As your new to MySQL its worth emphasising that text fields with the datatype of varchar have a maximum length. Your data may be getting truncated as it's too long to fit in the varchar field. Have you tried increasing the size of the field in the database to a larger value? On Jul 15, 3:30 pm, Piotr Kilczuk kilc...@gmail.com wrote: Hello, I am having a problem saving html code to a MySQL field using the saveAll method. Basically what is happening is that only half of the html is actually saved at times depending on the content. At other times it works fine. When the body is comprised of text everything works perfectly everytime. This tells me that the code is in order for saving etc, the problem must be with certain html entities. The code is extracted from html formatted emails (body). Being new to ... wait for it ... PHP, CakePHP and MySQL this is a challenge as I have googled and yahood and read the manual been through the API code and to no avail ... Humbly I ask for any assistance that anyone may provide, I am not sure if I should be running a function against the html prior to saving, and then again possibly when I want to display it (important to note that I require the original html to be viewed by a user at a later stage) What kind of field are you using to store HTML? Regards, Piotr --~--~-~--~~~---~--~~ 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: views management
no need to use different directories :-) Check out 'admin routing' in the docs: http://book.cakephp.org/view/544/Prefix-Routing This enables you to make special views for your administrators. For example, the views for a post controller would look like: app/views/posts/ admin_add.ctp admin_edit.ctp view.ctp index.ctp If you wanted an edit view for non-admins it would be called: edit.ctp On Jul 15, 6:44 am, shahgeb superior.am...@gmail.com wrote: Hy i am new to cakephp. I want to maintain different directories for admin view and client view, meanwhile i want to make themeable as well. any idea from seniors ??? 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: Any dissadvantage to adding Containable behvior to all models
There's the small overhead of linking that behavior to those models, but I suspect it's so minimal as to be not noticed. BTW, I just figured out the Containable behavior, and I love it! Should be more prominent in the Cake book. On Jul 14, 12:38 am, Miles J mileswjohn...@gmail.com wrote: No its basically what it was made for. --~--~-~--~~~---~--~~ 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: Tried to install another application inside cakePHP configuration
I've got PMA installed on all my systems, even those with Cake. I use the httpd.conf to specify an alias in Apache to redirect the request to a different part of the filesystem. Works great everywhere I've done it. On Jul 14, 12:52 am, Dr. Loboto drlob...@gmail.com wrote: Or install them into cake webroot, or edit cake root .htaccess to not pass openx, phpMyAdmin, phpBB and what other soft you install requests to cake. On Jul 14, 12:34 pm, saavedrajj saavedr...@gmail.com wrote: Hello everybody, inside my cakePHP configuration i want to install the phpMyAdmin and phpBB forum http://www.cakeapp.com/phpMyAdminhttp://www.cakeapp.com/phpBB I have been uploaded, as usual, the applications in my root server directory, but the following error appears: Missing Controller Error: OpenxController could not be found. Error: Create the class OpenxController below in file: app/controllers/ openx_controller.php ?php class OpenxController extends AppController { var $name = 'Openx';} ? the same thing happens with another application that i tried to install (PhpMyAdmin, phpBB, etc.) ¿is there a solution for this? 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: views management
Theming you app is a piece of cake ;). All you have to do is set a couple of controller fields: class MyController extends AppController { var $view = 'Theme'; var $theme = 'mytheme'; } then in your views and webroot directories you´d create: views\ themed\ mytheme\ layouts\ elements\ any_other_views_you_want_to_override\ (...)\ webroot\ themed\ mytheme\ css\ js\ img\ (...)\ Then as long as you stick to using cake helpers for css, images, javascript and so on the framework is smart enough to look for whatever asset you require in the correponding theme directory and move up the tree into the base directory if it's not found. This is quite handy as it allows you to customize only the necessary bits for your new themes. You can also employ some theme switching code in one of AppControllers callbacks to allow for user selectable themes or configuration based themes. As for maintining admin views in separete folders, I can't recall any way of doing it, but then again I've never needed this type of functionality. You could probably manage to do it setting the $viewPath field in the controller but I haven't tried it. Another thing you could do is create an admin theme and have something like this in your AppController: beforeFilter(0 { parent::beforeFilter(); if (isset($this-params[Configure::read('Routing.admin')]) $this-params[Configure::read('Routing.admin')]) { $this-view = 'Theme'; $this-theme = 'admin'; } } shahgeb wrote: Hy i am new to cakephp. I want to maintain different directories for admin view and client view, meanwhile i want to make themeable as well. any idea from seniors ??? 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: jQuery UI Tabs and Ajax
Don't use exit(). Try: function admin_getlist($id = null, $details = null) { if ($this-RequestHandler-isAjax()) { ... $this-set('Attachements',$attachements); Configure::write('debug', 0); $this-layout = 'ajax'; } } Why do you have attach-('Containable') but then not use it? It should be Attachments, btw, but i guess it doesn't really matter. On Wed, Jul 15, 2009 at 10:42 AM, havannathomas.blas...@diacs.de wrote: Hi together, I have a view where I want to display the jQuery Tabs UI with 5 tabs. Four of them are contain the content from the current Controller / View. So I have build it like the example: script type=text/javascript $(function() { $(#tabs).tabs(); }); /script div id=tab-1 div id=tabs ul lia href=#tab-1span?php echo __('Details'); ?/span/ a/li lia href=#tab-2span?php echo __('Fittings'); ?/span/ a/li lia href=#tab-3span?php echo __('Conditions'); ?/ span/a/li lia href=#tab-4span?php echo __('Partner'); ?/span/ a/li lia href=/admin/attachements/getlist/?php echo $this-data ['Posts']['id']; ?span?php echo __('Attachements'); ?/span/ a/li /ul The fifths tab should countain attachements, which is a 1:n relation to the current model. It tried to call it as a link (like in jQuery Documentation described). In my attachement controller I have this function function admin_getlist($id = null, $details = null) { if ($this-RequestHandler-isAjax()) { $this-Attachements-Behaviors-attach('Containable'); $conditions = array('Attachements.post_id' = $id); $attachements = $this-Attachements-find('all', array( 'conditions' = $conditions, 'contain' = false ) ); $this-set('Attachements',$attachements); $this-render(null,'ajax');exit; } } From tab 1 to 4 everything works fine. If I call tab 5 I got the error: [code]Notice (8): Undefined variable: javascript [APP/views/layouts/ admin.ctp, line 45] Fatal error: Call to a member function link() on a non-object in /www/ htdocs/w0064edd/demo/app/views/layouts/admin.ctp on line 45 On line 45 is the command echo $javascript-link('jquery/ ui.core.js'); This looks like missing the Javascript Helper. But the Javascript Helper is used in every controller and also in the AppController. Can somebody explain me the reason? Regards Thomas --~--~-~--~~~---~--~~ 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: Stop AJAX Request
If you want the login form to load in place of whatever would normally be returned, you can simply render it (if your login form is an element) instead of the recipe. if ($this-Auth-user() == null) { $this-viewPath = 'elements/users'; $this-render('login'); } else { // normal code ... } If you want the entire page to be refreshed to the login screen, just send back something in the response that your JS code will check for. If found, instead of loading the content into the page, change the location to your login page. On Wed, Jul 15, 2009 at 5:01 AM, Lukeeik...@hotmail.com wrote: Hi, I am still working on my first Cake Project and I am now stuck in some AJAX Request where I would need some feedback. I am trying to achieve the following. I have recipes everybody can see. There is a link above the recipe to add it to your favorites. If you are logged in the page should check if you have it already saved, than the link should show Already in cookbook otherwise Add to favorites. Next step is when you want to add it, you have to be logged in, otherwise the login window should show up. The Add to cookbook I wanted to do with AJAX in the background. So I am using if($this-Auth-user() == null) { $this-redirect('/users/login'); } in my addToFavorites($id) to check if the User is logged in, if not, the Login Form shows up above the recipe. But what I actually would like to reach is that the recipe doesn't show up at all anymore but instead just the Login Form. If you are than logged in, you should be seeing the recipe again and the link should have changed. I suppose it happens, because I am only replacing the content in the div with AJAX. Is there any chance to stop the AJAX response and instead re-load the full page or what would you guys suggest? Thanks for any advice. Luke --~--~-~--~~~---~--~~ 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: When/how do you publish Bakery articles?
+1 Bert Van den Brande wrote: Since I also use EclipsePDT as my Cake dev environment I'm very interested in this article :) On Tue, Jul 14, 2009 at 4:02 PM, GravyFacegravyf...@gmail.com wrote: I wrote a tutorial on CakePHP + EclipsePDT autocomplete almost a month ago and it hasn't been published yet. If there's a submittal/workflow I'm not aware of, let me know. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Searching and filtering on id -- problem with form behavior (forms helper)
Hello! I have a table where the primary key, id is not autoincremented, but is in fact a 6-digit real value. I want to give people the ability to search and filter by ID and a few other fields like budget_name. I have implemented a filter component that I found (here: http://blog.uplevel.pl/index.php/2008/06/cakephp-12-filter-component/) and it all works well up to a point, but I am encountering problems with the way forms helper works by default. I'll give 2 examples: If I add the following form bits to my index view: echo $form-create('Budgets',array('url'=array('action'='index'))); echo $form-input('id'); echo $form-input('budget_name'); echo $form-end('Search'); both inputs appear but neither are applied by the filter when I hit search. So I got the notion to qualify each input with the model name like so: echo $form-create('Budgets',array('url'=array('action'='index'))); echo $form-input('Budget.id'); echo $form-input('Budget.budget_name'); echo $form-end('Search'); Now I get 1 input for budget_name and searching/filtering works, but the input for id no longer appears. I looked at the generated HTML and the input for id is made hidden (as in this example): !-- form id=BudgetsAddForm method=post action=/app/budgets/index fieldset style=display:none;input type=hidden name=_method value=POST //fieldset input type=hidden name=data[Budget][id] value= id=BudgetId / div class=input textlabel for=BudgetBudgetNameBudget Name/ label input name=data[Budget][budget_name] type=text maxlength=30 value= id=BudgetBudgetName //div div class=submitinput type=submit value=Search //div/ form -- So, am I right in assuming that forms helper handles id in this conventional way (make it hidden) and is there a way to override this without breaking general behavior of forms helper. I looked at the 1.2 Cookbook and I only found a hidden method, no unhidden method. Jim (apologies for my formatting. I wasn't sure how Google Groups handle in-line code snippets. Automagically, I think.) --~--~-~--~~~---~--~~ 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: Tried to install another application inside cakePHP configuration
it works with this code IfModule mod_rewrite.c RewriteEngine on rewritecond %{REQUEST_URI} ^/(name_of_folder_application|fm)/ RewriteRule .* - [S=2] RewriteRule^$ app/webroot/[L] RewriteRule(.*) app/webroot/$1 [L] /IfModule any better idea? --~--~-~--~~~---~--~~ 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: Searching and filtering on id -- problem with form behavior (forms helper)
Hi, echo $form-input('Budget.id',array('type' = 'text')); Have you tried something like that? geste wrote: Hello! I have a table where the primary key, id is not autoincremented, but is in fact a 6-digit real value. I want to give people the ability to search and filter by ID and a few other fields like budget_name. I have implemented a filter component that I found (here: http://blog.uplevel.pl/index.php/2008/06/cakephp-12-filter-component/) and it all works well up to a point, but I am encountering problems with the way forms helper works by default. I'll give 2 examples: If I add the following form bits to my index view: echo $form-create('Budgets',array('url'=array('action'='index'))); echo $form-input('id'); echo $form-input('budget_name'); echo $form-end('Search'); both inputs appear but neither are applied by the filter when I hit search. So I got the notion to qualify each input with the model name like so: echo $form-create('Budgets',array('url'=array('action'='index'))); echo $form-input('Budget.id'); echo $form-input('Budget.budget_name'); echo $form-end('Search'); Now I get 1 input for budget_name and searching/filtering works, but the input for id no longer appears. I looked at the generated HTML and the input for id is made hidden (as in this example): !-- form id=BudgetsAddForm method=post action=/app/budgets/index fieldset style=display:none;input type=hidden name=_method value=POST //fieldset input type=hidden name=data[Budget][id] value= id=BudgetId / div class=input textlabel for=BudgetBudgetNameBudget Name/ label input name=data[Budget][budget_name] type=text maxlength=30 value= id=BudgetBudgetName //div div class=submitinput type=submit value=Search //div/ form -- So, am I right in assuming that forms helper handles id in this conventional way (make it hidden) and is there a way to override this without breaking general behavior of forms helper. I looked at the 1.2 Cookbook and I only found a hidden method, no unhidden method. Jim (apologies for my formatting. I wasn't sure how Google Groups handle in-line code snippets. Automagically, I think.) --~--~-~--~~~---~--~~ 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: Searching and filtering on id -- problem with form behavior (forms helper)
Maybe try echo $form-input('Budget.id',array('type' = 'text')); 2009/7/15 geste jim.ho...@gmail.com Hello! I have a table where the primary key, id is not autoincremented, but is in fact a 6-digit real value. I want to give people the ability to search and filter by ID and a few other fields like budget_name. I have implemented a filter component that I found (here: http://blog.uplevel.pl/index.php/2008/06/cakephp-12-filter-component/) and it all works well up to a point, but I am encountering problems with the way forms helper works by default. I'll give 2 examples: If I add the following form bits to my index view: echo $form-create('Budgets',array('url'=array('action'='index'))); echo $form-input('id'); echo $form-input('budget_name'); echo $form-end('Search'); both inputs appear but neither are applied by the filter when I hit search. So I got the notion to qualify each input with the model name like so: echo $form-create('Budgets',array('url'=array('action'='index'))); echo $form-input('Budget.id'); echo $form-input('Budget.budget_name'); echo $form-end('Search'); Now I get 1 input for budget_name and searching/filtering works, but the input for id no longer appears. I looked at the generated HTML and the input for id is made hidden (as in this example): !-- form id=BudgetsAddForm method=post action=/app/budgets/index fieldset style=display:none;input type=hidden name=_method value=POST //fieldset input type=hidden name=data[Budget][id] value= id=BudgetId / div class=input textlabel for=BudgetBudgetNameBudget Name/ label input name=data[Budget][budget_name] type=text maxlength=30 value= id=BudgetBudgetName //div div class=submitinput type=submit value=Search //div/ form -- So, am I right in assuming that forms helper handles id in this conventional way (make it hidden) and is there a way to override this without breaking general behavior of forms helper. I looked at the 1.2 Cookbook and I only found a hidden method, no unhidden method. Jim (apologies for my formatting. I wasn't sure how Google Groups handle in-line code snippets. Automagically, I think.) --~--~-~--~~~---~--~~ 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: Searching and filtering on id -- problem with form behavior (forms helper)
Damn u beat me to it :( 2009/7/15 Carlos Gonzalez Lavin carloslavi...@gmail.com Maybe try echo $form-input('Budget.id',array('type' = 'text')); 2009/7/15 geste jim.ho...@gmail.com Hello! I have a table where the primary key, id is not autoincremented, but is in fact a 6-digit real value. I want to give people the ability to search and filter by ID and a few other fields like budget_name. I have implemented a filter component that I found (here: http://blog.uplevel.pl/index.php/2008/06/cakephp-12-filter-component/) and it all works well up to a point, but I am encountering problems with the way forms helper works by default. I'll give 2 examples: If I add the following form bits to my index view: echo $form-create('Budgets',array('url'=array('action'='index'))); echo $form-input('id'); echo $form-input('budget_name'); echo $form-end('Search'); both inputs appear but neither are applied by the filter when I hit search. So I got the notion to qualify each input with the model name like so: echo $form-create('Budgets',array('url'=array('action'='index'))); echo $form-input('Budget.id'); echo $form-input('Budget.budget_name'); echo $form-end('Search'); Now I get 1 input for budget_name and searching/filtering works, but the input for id no longer appears. I looked at the generated HTML and the input for id is made hidden (as in this example): !-- form id=BudgetsAddForm method=post action=/app/budgets/index fieldset style=display:none;input type=hidden name=_method value=POST //fieldset input type=hidden name=data[Budget][id] value= id=BudgetId / div class=input textlabel for=BudgetBudgetNameBudget Name/ label input name=data[Budget][budget_name] type=text maxlength=30 value= id=BudgetBudgetName //div div class=submitinput type=submit value=Search //div/ form -- So, am I right in assuming that forms helper handles id in this conventional way (make it hidden) and is there a way to override this without breaking general behavior of forms helper. I looked at the 1.2 Cookbook and I only found a hidden method, no unhidden method. Jim (apologies for my formatting. I wasn't sure how Google Groups handle in-line code snippets. Automagically, I think.) --~--~-~--~~~---~--~~ 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: When/how do you publish Bakery articles?
Found it -- the original source (well, some of it) from the following convo a few years ago; this is what I based my Bakery article on (which I should edit it and give due credit): http://groups.google.com/group/cake-php/browse_thread/thread/04b94b593714b394/9c71e02157bcaacd Check out voidstate and schneimi's comments further down. On Wed, Jul 15, 2009 at 12:01 PM, Bernardo Vieirabvieira.li...@gmail.com wrote: +1 Bert Van den Brande wrote: Since I also use EclipsePDT as my Cake dev environment I'm very interested in this article :) On Tue, Jul 14, 2009 at 4:02 PM, GravyFacegravyf...@gmail.com wrote: I wrote a tutorial on CakePHP + EclipsePDT autocomplete almost a month ago and it hasn't been published yet. If there's a submittal/workflow I'm not aware of, let me know. --~--~-~--~~~---~--~~ 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: Searching and filtering on id -- problem with form behavior (forms helper)
Carlos, Bernadoi, Thank you! I had not tried just expanding the definition of the input. Your quick answers mean I can move on...to be confused by other things! :). (I am still a CakePHP novice and I still get a bit nervous about conventions. Like should I just throw in the toweal and make all of my primary keys autoincremented. But I have some pivotal tables where it just seems wrong to overlook a very logical key like that budget number.) Thanks again. Perhaps this will help some other newbie. Jim On Jul 15, 9:14 am, Bernardo Vieira bvieira.li...@gmail.com wrote: Hi, echo $form-input('Budget.id',array('type' = 'text')); Have you tried something like that? geste wrote: Hello! I have a table where the primary key, id is not autoincremented, but is in fact a 6-digit real value. I want to give people the ability to search and filter by ID and a few other fields like budget_name. I have implemented a filter component that I found (here: http://blog.uplevel.pl/index.php/2008/06/cakephp-12-filter-component/) and it all works well up to a point, but I am encountering problems with the way forms helper works by default. I'll give 2 examples: If I add the following form bits to my index view: echo $form-create('Budgets',array('url'=array('action'='index'))); echo $form-input('id'); echo $form-input('budget_name'); echo $form-end('Search'); both inputs appear but neither are applied by the filter when I hit search. So I got the notion to qualify each input with the model name like so: echo $form-create('Budgets',array('url'=array('action'='index'))); echo $form-input('Budget.id'); echo $form-input('Budget.budget_name'); echo $form-end('Search'); Now I get 1 input for budget_name and searching/filtering works, but the input for id no longer appears. I looked at the generated HTML and the input for id is made hidden (as in this example): !-- form id=BudgetsAddForm method=post action=/app/budgets/index fieldset style=display:none;input type=hidden name=_method value=POST //fieldset input type=hidden name=data[Budget][id] value= id=BudgetId / div class=input textlabel for=BudgetBudgetNameBudget Name/ label input name=data[Budget][budget_name] type=text maxlength=30 value= id=BudgetBudgetName //div div class=submitinput type=submit value=Search //div/ form -- So, am I right in assuming that forms helper handles id in this conventional way (make it hidden) and is there a way to override this without breaking general behavior of forms helper. I looked at the 1.2 Cookbook and I only found a hidden method, no unhidden method. Jim (apologies for my formatting. I wasn't sure how Google Groups handle in-line code snippets. Automagically, I think.) --~--~-~--~~~---~--~~ 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: Manually trigger callbacks on associated models with saveAll()
I've never tried it but this might work: $this-ImageSet-Image-afterSave($created); You'd need to sort out whether $created is true or not. If you wanted to get fancy, you could parse out the models from $this-data so as to abstract this a bit. On Wed, Jul 15, 2009 at 4:54 AM, Dennis S. Hennendennis.hen...@gmail.com wrote: I have ImageSet hasMany Image Image actsAs MeioUpload (an upload behavior from the Bakery) My add form has one ImageSet and 3 Images. When I $this-ImageSet-saveAll($this-data) in the controller, it creates the ImageSet and Image records, but the callbacks aren't called for Image. I know this is expected -- callbacks on associations do not get called in Cake 1.2. The question is: is there a way to get around this limitation and have the callbacks triggered? I've not thought of a way to do this short of overloading saveAll() in my ImageSet model. There is this somewhat related patch from two years ago. https://trac.cakephp.org/ticket/2056 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: When/how do you publish Bakery articles?
Cool... following that thread you pointed out I realized that I've done all that already following Mark Story's blog post [1]. I was really hoping for a better way to autocomplete models for controllers, have you made any progress in that area? As apps grow it becomes a real burden to keep updating thoes phpDoc blocks to get autocomplete to work. I think cake's dynamic loading of models doesn't really help in that area. Anyway, thanks for the link and I look forward to your article. [1] http://mark-story.com/posts/view/code-completion-for-cakephp-in-eclipse GravyFace wrote: Found it -- the original source (well, some of it) from the following convo a few years ago; this is what I based my Bakery article on (which I should edit it and give due credit): http://groups.google.com/group/cake-php/browse_thread/thread/04b94b593714b394/9c71e02157bcaacd Check out voidstate and schneimi's comments further down. On Wed, Jul 15, 2009 at 12:01 PM, Bernardo Vieirabvieira.li...@gmail.com wrote: +1 Bert Van den Brande wrote: Since I also use EclipsePDT as my Cake dev environment I'm very interested in this article :) On Tue, Jul 14, 2009 at 4:02 PM, GravyFacegravyf...@gmail.com wrote: I wrote a tutorial on CakePHP + EclipsePDT autocomplete almost a month ago and it hasn't been published yet. If there's a submittal/workflow I'm not aware of, let me know. --~--~-~--~~~---~--~~ 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: Correct Way to save HTML code to database
this could be any number of things. Where is the html from? I'd examine the source first, to make sure that's not the problem. Second, i'd test out the html that gives you a problem. Where is it cutting off? Do you run html_entities, or real escape on it before you insert? If it was an html entity causing mysql to truncate, it probably wouldn't insert at all, but would instead give you a mysql error. Unless your field is the wrong type, as people have already mentioned, in which case you'd get truncated html in your field as you do. On Jul 15, 12:18 am, Jacques jacques.van.nieuwenhui...@gmail.com wrote: Hi There, I am having a problem saving html code to a MySQL field using the saveAll method. Basically what is happening is that only half of the html is actually saved at times depending on the content. At other times it works fine. When the body is comprised of text everything works perfectly everytime. This tells me that the code is in order for saving etc, the problem must be with certain html entities. The code is extracted from html formatted emails (body). Being new to ... wait for it ... PHP, CakePHP and MySQL this is a challenge as I have googled and yahood and read the manual been through the API code and to no avail ... Humbly I ask for any assistance that anyone may provide, I am not sure if I should be running a function against the html prior to saving, and then again possibly when I want to display it (important to note that I require the original html to be viewed by a user at a later stage) Thanks Jacques --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
How debug CakePHP 1.2 with Zend Debugger or XDebug
Hello I have problem with remote debugging on Zend Debugger or XDebug. I attemped debug CakePHP 1.2 in Zend Studio (PDT) with Zend Debugger on linux and XDebug in Windows. Debuggers work. But when I started debugging first lines passed but in result I got: Fatal error: Cannot redeclare config() (previously declared in Y:\home \jab\www\cake\basics.php:59) in Y:\home\jab\www\cake\basics.php on line 77 Please, tell, how you configure debug for your CakePHP 1.2 Thanks in advance for any suggestions. Taras --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
HATBM
Hello, I'm a bit new to cakephp now working on a project and came across HTABM. Did a simple test with a Post model and a comments one. Everything works great my only problem is that it also returns for each comment the join table. Is this how it's supose to work ? Here is what I get : Array ( [0] = Array ( [Post] = Array ( [id] = 1 [name] = claudiu [type] = 1 ) [Comment] = Array ( [0] = Array ( [id] = 1 [subiect] = test1 [comment] = ss [Join] = Array ( [id] = 1 [comment_id] = 1 [post_id] = 1 ) ) ) ) Thank you, Claudiu --~--~-~--~~~---~--~~ 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: HATBM
For Post Comment, you should probably be using belongsTo hasMany. You're unlikely to have comments that can belong to more than one Post. Post hasMany Comment Comment belongsTo Post (so, comments table should have a post_id column) On Wed, Jul 15, 2009 at 1:58 PM, Claudiu Apetreiclaudiu.apet...@gmail.com wrote: Hello, I'm a bit new to cakephp now working on a project and came across HTABM. Did a simple test with a Post model and a comments one. Everything works great my only problem is that it also returns for each comment the join table. Is this how it's supose to work ? Here is what I get : Array ( [0] = Array ( [Post] = Array ( [id] = 1 [name] = claudiu [type] = 1 ) [Comment] = Array ( [0] = Array ( [id] = 1 [subiect] = test1 [comment] = ss [Join] = Array ( [id] = 1 [comment_id] = 1 [post_id] = 1 ) ) ) ) Thank you, Claudiu --~--~-~--~~~---~--~~ 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: HATBM
Sorry bad choice of model names. This was just a test example not related to the application I am building. The main question is if that's the way cakephp returns data from the HABTM relations. With the join table array for each. [Join] = Array ( [id] = 1 [comment_id] = 1 [post_id] = 1 ) Is can I get my data back without this sub array ? Thank you, Claudiu On Jul 15, 9:15 pm, brian bally.z...@gmail.com wrote: For Post Comment, you should probably be using belongsTo hasMany. You're unlikely to have comments that can belong to more than one Post. Post hasMany Comment Comment belongsTo Post (so, comments table should have a post_id column) On Wed, Jul 15, 2009 at 1:58 PM, Claudiu Apetreiclaudiu.apet...@gmail.com wrote: Hello, I'm a bit new to cakephp now working on a project and came across HTABM. Did a simple test with a Post model and a comments one. Everything works great my only problem is that it also returns for each comment the join table. Is this how it's supose to work ? Here is what I get : Array ( [0] = Array ( [Post] = Array ( [id] = 1 [name] = claudiu [type] = 1 ) [Comment] = Array ( [0] = Array ( [id] = 1 [subiect] = test1 [comment] = ss [Join] = Array ( [id] = 1 [comment_id] = 1 [post_id] = 1 ) ) ) ) Thank you, Claudiu --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Weird email-sending problem: sometimes emails are not send with same recipient!?
Hey, I'm having an issue that is really weird and I don't know how to solve it myself, so I hope someone here has an explanation for this and can help me out... Situation: In my controller I send 3 seperate Emails, to different recipients and with different reply-adresses, and on my dev-server everything seems to work fine. Seems to because I can only test with email-adresses from GMX, googlemail and one other. This is the part of the email-sening in my controller: - $this-Email-reset(); $this-Email-to = Configure::read ('Email.reservation_to_email'); $this-Email-charset = 'utf-8'; $this-Email-subject = 'Booking #'.$booking['Booking'] ['transaction_id']; $this-Email-replyTo = Configure::read ('Email.reservation_to_email'); $this-Email-from = Configure::read ('Email.reservation_from_name').' '.Configure::read ('Email.reservation_from_email').''; $this-Email-template = 'booking'; $this-Email-sendAs = 'both'; $this-set(compact('booking', 'titles', 'scooters', 'extras', 'age', 'nettosum', 'vatsum', 'totalsum', 'shop')); if ($this-Email-send()) { $this-Client-id = $booking[Client']['id']; $this-Client-saveField('master_mail', 1); } $this-Email-reset(); $this-Email-to = $booking['Shop']['email']; $this-Email-charset = 'utf-8'; $this-Email-subject = 'Booking #'.$booking['Booking'] ['transaction_id']; $this-Email-replyTo = $booking['Client']['email']; $this-Email-from = $booking['Client']['email'].' '.$booking ['Client']['email'].''; $this-Email-template = 'booking'; $this-Email-sendAs = 'both'; $this-set(compact('booking', 'titles', 'scooters', 'extras', 'age', 'nettosum', 'vatsum', 'totalsum', 'shop')); if ($this-Email-send()) { $this-Client-id = $booking[Client']['id']; $this-Client-saveField('master_mail', 1); } $this-Email-reset(); $this-Email-to = $booking['Client']['email']; $this-Email-charset = 'utf-8'; $this-Email-subject = __('Booking Confirmation', true).' ('.__('Booking', true).' #'.$booking['Booking'] ['transaction_id'].')'; $this-Email-replyTo = $booking['Shop']['email']; $this-Email-from = $booking['Shop']['name'].' '.$booking ['Shop']['email'].''; $this-Email-template = 'booking'; $this-Email-sendAs = 'both'; $this-set(compact('booking', 'titles', 'scooters', 'extras', 'age', 'nettosum', 'vatsum', 'totalsum', 'shop')); if ($this-Email-send()) { $this-Client-id = $booking[Client']['id']; $this-Client-saveField('master_mail', 1); } On my dev-Server everything works finde; on my production server it seems not even $this-Email-send() is returned true, because the fields of my databse which should be 1 for all three fields, are left at 0, even though the email is actually send! And the weirdest of all problems is, the first email-adress is everytime the same, but not every email is sent to this adress! How can that be? Do I have to put the to part of the email in and or what am I missing here?! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Weird email-sending problem: sometimes emails are not send with same recipient!?
There are two mistakes in my code, there should be this-Client-saveField('shop_mail', 1); after sending the 2nd email, and this-Client-saveField('client_mail', 1); after sending the 3rd email! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Root Server: email-component fails sometimes, why?
Hey, the App on my root-server sometimes does not send emails, even if the recipients are the same. So when I use a testfunction which sends the exact same email to the same address let's say 5 times, there are only 3 or 4 mails delivered and the other(s) are not! How can this happen? --~--~-~--~~~---~--~~ 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: Root Server: email-component fails sometimes, why?
Anything in your sendmail/qmail/postfix queue? logs? On Wed, Jul 15, 2009 at 4:01 PM, DigitalDudee.blumsten...@googlemail.com wrote: Hey, the App on my root-server sometimes does not send emails, even if the recipients are the same. So when I use a testfunction which sends the exact same email to the same address let's say 5 times, there are only 3 or 4 mails delivered and the other(s) are not! How can this happen? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Paginate possible bug (order and Calculated field)
Hi, i need create a order links in a view, it have a Calculated field: $this-paginate['fields'] = array('Contrato.id', 'Contrato.numero_processo', 'Contrato.numero_contrato', '(TO_DAYS (data_termino) - TO_DAYS(now()) ) as dias', '(PERIOD_DIFF (DATE_FORMAT(now(), \'%Y%m\'), DATE_FORMAT (data_inicio, \'%Y%m\'))) as meses', 'Contrato.valor_total'); $this-paginate['conditions'] = $condicao; //**when i try : ?php echo $paginator-sort('Meses', 'meses'); ? // nothing happens Thanks, Celso. --~--~-~--~~~---~--~~ 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: Root Server: email-component fails sometimes, why?
Hey, yes, all emails that are not being delivered are not listet in the logs of my email server. It looks like the send() command never gets executed, the email is never passed into the mail-queue on the server. The weirdest thing of all is, that on another server, every email gets send without ANY problems. And it is the exact same code! On 15 Jul., 22:07, GravyFace gravyf...@gmail.com wrote: Anything in your sendmail/qmail/postfix queue? logs? On Wed, Jul 15, 2009 at 4:01 PM, DigitalDudee.blumsten...@googlemail.com wrote: Hey, the App on my root-server sometimes does not send emails, even if the recipients are the same. So when I use a testfunction which sends the exact same email to the same address let's say 5 times, there are only 3 or 4 mails delivered and the other(s) are not! How can this happen? --~--~-~--~~~---~--~~ 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: Official forum for CakePHP
@GravyFace: It only matters in that it was not what the original question had specifically asked for. Since they mentioned official (specifically), I'd imagine they were probably searching for a CakePHP forum from the official CakePHP website and was unable to find one - because there is none. That's not to say that the very active CakePHPForum.net website is not a great resource - it is. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
URI problem
I install cake like this: /path/to/my/username/public_html/cake/app/ /path/to/my/usernamepublic_html/cake/cake/lib /path/to/my/username/public_html/cake/index.php I can access the cake by: http://web.domain.edu/~username/ I add .htaccess to the public_html folder IfModule mod_rewrite.c RewriteEngine On RewriteBase /~username/cake/ RewriteRule ^$ app/webroot/ [L] RewriteRule (.*) app/webroot/$1 [L] /IfModule I add .htaccess to the public_html/cake folder IfModule mod_rewrite.c RewriteEngine On RewriteBase /~username/cake/ RewriteRule ^$ app/webroot/ [L] RewriteRule (.*) app/webroot/$1 [L] /IfModule and I add a line of RewriteBase to public_html/cake/app/weboot folder RewriteBase /~username/cake/ but the problem comes like this: I can access my home page like http://web.domain.edu/~username/ while I click the link in my cake application, it goes to: http://web.domain.edu/controller_name/action_name rather than: http://web.domain.edu/~username/controller_name/action_name How can I add ~username in the url before the controller name? Thanks in advance. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Set different recursive values for different models
Ok so I have a profile model that hasMany favorite games and friends. To find the friends icon extension to display their user icon I have to set the recursive property to 3 in my profile model. This then causes the favorite games to fetch their game comments and ratings and such. Is there any way I can make the favorite games model only follow a recursive setting of 2, but have the friend model follow a recursive setting of 3 to prevent the fetching of unnecessary data? I could get around this by unbinding several models, but this seems like a lot of work, and it feels like it would defeat the benefits of using cakephp's help. Any thoughts? --~--~-~--~~~---~--~~ 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: After moving from windows to Ubuntu, getting Missing View error
Wel, not exactly. I have Cake in Ubunto 9.04, and it works well. I have some questions: Make shure the web server You are using does have access to all your application, cake and vendors tree. - You can ensure this with the following commands: - sudo find your_cake_path -type d -exec chmod 755 {} + ; - sudo find your_cake_path -type f -exec chmod 644 {} + ; - sudo find your_app_path -type d -exec chmod 755 {} + ; - sudo find your_app_path -type f -exec 644 {} + ; - sudo find your_app_path/tmp -type d -exec chmod 777 {} + ; - sudo find your_app_path/tmp -type f -exec chmod 666 {} + ; Also make shure all file names are lowercase, including the extension. Regards. 2009/7/14 GravyFace gravyf...@gmail.com Also check your permissions; www-data needs at least read permissions on your files/directories, but check the Linux installation guide for CakePHP (you'll need to grant rw to the tmp directory, etc.). On Tue, Jul 14, 2009 at 11:08 AM, MrMeikelmrmei...@gmail.com wrote: Not very experienced with Linux. But my first guess would be that Linux uses case-sensitive file names - check all your views to make sure they are correctly cased (I do not know what the correct casing is in this situtation). On Jul 14, 8:24 am, Prabu prabui...@gmail.com wrote: Hi, I just moved my cake app folder from windows to ubuntu and getting this error : missing view (could not find .ctp) In my controller I have two methods like this: function foo1($viewtype = null) { // loads data here... $this-render($viewtype, 'ajax'); } function foo2() { $this-Session-write('abcd', \\); $this-foo1(); } when I call gohome it throws the MissingView error. It was working correctly in windows. Anyone faced such problem? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Data Validation - What's wrong?
I have this validate in Model: var $validate = array( module_data = array( module_dataRule1 = array( rule = array(minLength, 5), message = min ), module_dataRule2 = array( rule = array(maxLength, 10), message = max ), required = true, allowEmpty = false ) ); And I left empty form for module_data and I get no error. What do I have wrong?? --~--~-~--~~~---~--~~ 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: jQuery UI Tabs and Ajax
Hi Brian, thank you for your answer. With $this-contain = false I'm using the shortform (see on http://book.cakephp.org/view/474/Containable). I tried your changes. The errors changed: now in my view the vars which I set in the controller are unknown: Undefined variable: Objektnummer. Is it right, that the view is the same as for tab 1 to 4 or need I an element to display my variables? Regards Thomas On 15 Jul., 17:45, brian bally.z...@gmail.com wrote: Don't use exit(). Try: function admin_getlist($id = null, $details = null) { if ($this-RequestHandler-isAjax()) { ... $this-set('Attachements',$attachements); Configure::write('debug', 0); $this-layout = 'ajax'; } } Why do you have attach-('Containable') but then not use it? It should be Attachments, btw, but i guess it doesn't really matter. On Wed, Jul 15, 2009 at 10:42 AM, havannathomas.blas...@diacs.de wrote: Hi together, I have a view where I want to display thejQueryTabs UI with 5 tabs. Four of them are contain the content from the current Controller / View. So I have build it like the example: script type=text/javascript $(function() { $(#tabs).tabs(); }); /script div id=tab-1 div id=tabs ul lia href=#tab-1span?php echo __('Details'); ?/span/ a/li lia href=#tab-2span?php echo __('Fittings'); ?/span/ a/li lia href=#tab-3span?php echo __('Conditions'); ?/ span/a/li lia href=#tab-4span?php echo __('Partner'); ?/span/ a/li lia href=/admin/attachements/getlist/?php echo $this-data ['Posts']['id']; ?span?php echo __('Attachements'); ?/span/ a/li /ul The fifths tab should countain attachements, which is a 1:n relation to the current model. It tried to call it as a link (like injQuery Documentation described). In my attachement controller I have this function function admin_getlist($id = null, $details = null) { if ($this-RequestHandler-isAjax()) { $this-Attachements-Behaviors-attach('Containable'); $conditions = array('Attachements.post_id' = $id); $attachements = $this-Attachements-find('all', array( 'conditions' = $conditions, 'contain' = false ) ); $this-set('Attachements',$attachements); $this-render(null,'ajax');exit; } } From tab 1 to 4 everything works fine. If I call tab 5 I got the error: [code]Notice (8): Undefined variable: javascript [APP/views/layouts/ admin.ctp, line 45] Fatal error: Call to a member function link() on a non-object in /www/ htdocs/w0064edd/demo/app/views/layouts/admin.ctp on line 45 On line 45 is the command echo $javascript-link('jquery/ ui.core.js'); This looks like missing the Javascript Helper. But the Javascript Helper is used in every controller and also in the AppController. Can somebody explain me the reason? Regards Thomas --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Using layouts with themes
I have implemented themes on my site but I'm having trouble getting layouts within themes to work. Right now only the default layout with any given theme is being used. Can layouts work within themes? If so, are there any special things that need to be coded. Shouldn't $this-layout = 'mylayout' work within a theme? I couldn't find any information on this within the cakephp site or the google group. Any help or links would be appreciated! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Data Validation - What's wrong?
You need the notEmpty rule. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Fixtures import
Hi, I'm unable to make my fixtures import table definitions. Core tests for fixture pass, so I don't know what's happenings. I've tried: $import = 'Model' $import = array('model' = 'Model', $connection = 'default'); $import = array('table' = 'models', $connection = 'default'); and so on... Anyone can drop me a clue? Tests works well if I declare a $fields array. --- Fran Iglesias cakephpi...@gmail.com http://cakephpilia.blogspot.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
How to use $form-error
My scenario is : Keep for example there is a view file and it has 2 input fields for entering name. First field belong to model_1 which is the primary model of the view page. Second field belongs to another model model_2. Both fields are mandatory and has an error msg. if left blank. If I use $this-model-invalidFields() in my controller, I am getting the errors as an array. -- No issues here. But when I try to use $form-error(...) function, errors get displayed for the first field which belongs to the primary model but for the second field though I leave it blank no error msg. are getting displayed. I understand we have to tell cakePHP that second field belongs to another model, So I declared it in following way: echo $form-input('model_2.NAME', array('class' = 'input_edit')); echo $form-error('model_2.NAME', 'error msg'); What is wrong with the above? Am I not addressing something here? Please help me to solve this issue. --~--~-~--~~~---~--~~ 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: Set different recursive values for different models
The best thing, in my opinion, is to do the following: - set recursive to -1 in AppModel - enable Containable behavior, also in AppModel With containable behavior, you determine exactly what data is returned by your queries. So, if you want to find all Profiles, you would do this (from ProfilesController): $this-Profile-find('all'); That'll return just an array of profiles with no related data. If you want to find the friends associated with the profiles: $this-Profile-find('all', array( 'contain' = array('Friend') )); That'll return an array of profiles and friends. And if you want to take it one step further and find a model associated with Friend - let's say Friend hasMany Games - then you can put in a nested array: $this-Profile-find('all', array( 'contain' = array('Friend' = array('Game')) )); Make sense? Check out how containable behavior works at: http://book.cakephp.org/view/474/Containable - Jamie On Jul 15, 1:31 pm, David da...@reflashed.com wrote: Ok so I have a profile model that hasMany favorite games and friends. To find the friends icon extension to display their user icon I have to set the recursive property to 3 in my profile model. This then causes the favorite games to fetch their game comments and ratings and such. Is there any way I can make the favorite games model only follow a recursive setting of 2, but have the friend model follow a recursive setting of 3 to prevent the fetching of unnecessary data? I could get around this by unbinding several models, but this seems like a lot of work, and it feels like it would defeat the benefits of using cakephp's help. Any thoughts? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Insert Query from another table in .ctp
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: Using layouts with themes
Did you place the css files at webroot? That should work. You can call custom css for specific page by placing in the ctp file: ?php e($html-css('empty')); ? Hopefully it helps On Jul 16, 5:19 am, djfingers john.arr...@gmail.com wrote: I have implemented themes on my site but I'm having trouble getting layouts within themes to work. Right now only the default layout with any given theme is being used. Can layouts work within themes? If so, are there any special things that need to be coded. Shouldn't $this-layout = 'mylayout' work within a theme? I couldn't find any information on this within the cakephp site or the google group. Any help or links would be appreciated! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
ambiguous routes
Hi there, The application im currently working on allows Users and Groups to select their unique personalized URLs i.e. www.site.com/my_own_url. I have specified the routes like so: $Route-connect('/:user_url', array('controller' = 'users', 'action' = 'view', 'url' = ':user_url'), array('user_url' = '[\w]+')); $Route-connect('/:group_url', array('controller' = 'groups', 'action' = 'view', 'url' = ':group_url'), array('group_url' = '[\w] +')); The beforeFilter() method in the Users controller first checks if there is user with that URL, otherwise it will be passed on to the Groups controller. So in the Users controller's beforeFilter() method I have: function beforeFilter() { If user with URL exists - display view() page Else hand it to the Groups controller ($this-redirect('/' . $this- params['user_url'])) } The problem I'm having is a redirect loop. Of course the first route will always catch whatever it is. If I could somehow select which route to activate.. and I don't have the luxury of adding prefixes to the URL.. Thanks for all your help! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
$this-Model-validates() ALWAYS RETURN TRUEE!!!!!
I'm using Cake 1.2.3.8166. My problem is $this-Model-validates() ALWAYS RETURN TRUEE! Here is my Model file: ?php class Applicant extends AppModel { var $name = 'Applicant'; var $validate = array( 'nokp' = array( 'nokpRule-1'= array( 'rule'= array('maxLength', 12), 'message'='Maksimum aksara ialah 12 sahaja.', 'required'='true' ), 'nokpRule-2' = array( 'rule'='alphaNumeric', 'message' = 'No Kad Pengenalan mesti menggunakan nombor DAN perkataan ATAU nombor sahaja.') ), 'gelaran' = array( 'rule'='notempty', 'message'='Gelaran mesti dipilih.' ), 'nama' = array( 'namaRule-1'= array( 'rule'= array('maxLength', 100), 'message'='Maksimum aksara ialah 100 sahaja.', 'required'='true' ), 'namaRule-2' = array( 'rule'= array('custom', '/[a-zA-Z][^0-9]/'), 'message' = 'Nama mesti munggunakan perkataan sahaja.') ), 'tarikh_lahir' = array( 'rule'='date', 'message'='Tarikh mesti di dalam format yang betul.' ), 'emel' = array( 'rule'='email', 'message'='Emel mesti ditulis dengan format yang betul.' ), 'jawatan' = array( 'rule'='notempty', 'message'='Jawatan mesti diisi.' ), 'skim' = array( 'rule'='notempty', 'message'='Skim mesti dipilih.' ), 'gred' = array( 'rule'='notempty', 'message'='Gred mesti dipilih.' ), 'tarikh_lantikan' = array( 'rule'='date', 'message'='Tarikh mesti di dalam format yang betul.' ), 'gaji' = array( 'rule'='numeric', 'message'='Gaji mesti diisi dan dalam bentuk nombor sahaja.' ), 'tanggungan' = array( 'rule'='notempty', 'message'='Tanggungan mesti dipilih.' ), 'status_kahwin' = array( 'rule'='notempty', 'message'='Status kahwin mesti dipilih.' ), 'negeri' = array( 'rule'='notempty', 'message'='Negeri mesti dipilih.' ), 'no_telefon_pejabat' = array( 'rule'='numeric', 'message'='No telefon pejabat mesti diisi dan dalam bentuk nombor sahaja.' ), 'application_id' = array('notempty') ); //The Associations below have been created with all possible keys, those that are not needed can be removed var $belongsTo = array( 'Application' = array( 'className' = 'Application', 'foreignKey' = 'application_id', 'conditions' = '', 'fields' = '', 'order' = '' ) ); } ? And here is the controller function: function KJForm () { // Setting data for validaton by the model $this-Applicant-set($this-data); if ($this-Applicant-validates()) { // ALWAYS RETURN TRUE } else { } } --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
CakePHP Model Join Strategy - Returning mixed Array/Objects finds results
Hi, I have a doubt on the future of CakePHP regarding how will it handle joins in future releases. The issue is: When you have several models tied together through hasMany/belongsTo/hasAndBelongsToMany/hasOne, CakePHP will execute the database queries all at once, parse them and organise them into an array. So it'll likely you'll have something such: $users[0] = Array( User = Array(name = My Name, Remark = array(remark = i see it))); or even $remarks[0] = Array( Remarks = array(remark = i see it), User = array(name = My Name)); OK. That's how CakePHP works nowadays. I am not a master in MVC concepts and subtleties, but I wonder it could be a bad thing. You see, one of the main goals of OO programming is that you write code that can be changed. So let's suppose you have a model named User, it'd not be joint to anyone else. You write a whole application using: $this-User-find('all', c); For some wicked reason that shall remain rather vague, you do _not_ specify the recursiveness of these finds, and therefore CakePHP will default it to 1, which brings all model's data and additionally the first degree of joins. As this model has no such degree, it'll return only User's data. Yet this system is not complete, and at some point it demands that a Remark system to be attached to User model. The programmer goes on app/model/User.php and adds a hasMany entry into User, and a belongsTo entry into Remark. Suddenly, according to CakePHP's current logic, ALL finds will return not only User's data but also it'll return all the Remark entries each User has stored. All over the system. You ought to grep the source for $this-User- and write down a $this-User-recursive=0; all over the source code. So far, no news. Here's the catch: Should CakePHP model code return something like: $users[0] = Array( User = Array(name = My Name, Remark = new RemarkSpecialJoinObjectWhichSeeksInformationOnFirstCall($user ['User']['id'])); On the views reading $users and User data only, it'll imply neither a change on memory consumption nor SQL performance, because although User comunicates with Remark, the view would not demand the Remark entries, thus avoiding one database seek. They'd never read the Remark dimension, and therefore the database would never be read too. On the other hand, on the new code which needs both User's and Remark's entries, the object on its own would understand the situation and seek further data. Does anyone know if CakePHP will solve this problem in future releases? Thanks, Dérico Filho --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
How to use 'group by' with paginate()?
Hi I'm new to CakePHP and maybe it's a very stupid question. But I don't hope so :) My question is: How to use a group by clause with paginate()? Here's a short description of my project: Table 'news': Id, title, ... Table 'comments': Id, news_id, ... I want to query all news with the number of comments, which are related to this news-entry. After baking I got the following code: function index() { $this-News-recursive = 0; $this-set('news', $this-paginate('News')); } After reading the API (http://api.cakephp.org/class/controller#method- Controllerpaginate) I think, that I have to do this with some additional constructions. I thought of querying all number of comments with the related news-id: SELECT news_id, count( * ) AS counter FROM comments GROUP BY news_id This results in an easy-to-use table, which could be placed in an array. Then I could access the count with the news_id as a key. Is this a good idea in the world of CakePHP and how can I realize it? Thanks a lot --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
$_POST
Hello and thank you for your time and attention. I am building a Facebook app and I want to use CakePHP to build it. The problem is the following I have tried to translate this into cake to no avail: $is_tab = isset($_POST['fb_sig_in_profile_tab']); if( !$is_tab ) $user = $fb-require_login(); And that's really the only thing left in order to finish my app. I have got no clue on how to access 'normal' $_POST data inside of cake. Thank you very much and I really appreciate this. Mario R. Vallejo --~--~-~--~~~---~--~~ 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: Retreiving values from Jquery to a controller in cakephp
hai can anyone tell me how can i get the posted values from jquery to a controller so far this problem has not been solved.. my jquery alerts correctly as shown in the above disucssion now its the only problem of how to get this values to a controoler in cakephp any refrence or examples or tutorilas will also help thankyou --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
hasMany question
Hi! I have just started with CakePHP and it seems very good so far! But i have a little question... i have a Post model, each post hasMany comments, and comments belongsTo a Post. So, recursive in the Post model is default, so when i do $this-Post-find('all'); I get all posts and comments, now...If i want to order posts ASC and comments DESC...How do i do it? Also, another thing i dont know...When i'm in the Posts controller, i do $this-Post-find to get posts and $this-Post-Comment-find to get comments Why not $this-Comment-find ? --~--~-~--~~~---~--~~ 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: Correct Way to save HTML code to database
Hi All, I came right thanks - the problem was the character set being read in not being utf-8 a simple php mb_convert solved the problem. Cheers J On Jul 15, 9:18 am, Jacques jacques.van.nieuwenhui...@gmail.com wrote: Hi There, I am having a problem saving html code to a MySQL field using the saveAll method. Basically what is happening is that only half of the html is actually saved at times depending on the content. At other times it works fine. When the body is comprised of text everything works perfectly everytime. This tells me that the code is in order for saving etc, the problem must be with certain html entities. The code is extracted from html formatted emails (body). Being new to ... wait for it ... PHP, CakePHP and MySQL this is a challenge as I have googled and yahood and read the manual been through the API code and to no avail ... Humbly I ask for any assistance that anyone may provide, I am not sure if I should be running a function against the html prior to saving, and then again possibly when I want to display it (important to note that I require the original html to be viewed by a user at a later stage) Thanks Jacques --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---