Re: Handling minute and hour elements in forms
Thanks. What I'm missing is some kind of listing where it's clearly defined which form field in cake is associated with which datatype in mysql. something like $form-input --- varchar, text $form-minute hour -- datetime $form-checkbox -- some kind of int field for setting 0 or 1 That's also a thing I still don't understand about the hour and minute fields. Are they really associated with a datetime field in mysql? Cause there's an actual datetime input type in cake forms and my experiments with hour minute form fields in cake and datetime columns didn't work, yet. On May 27, 4:03 am, Brendon Kozlowski brendon...@hotmail.com wrote: Although there are some discrepancies or missing inforrmation in the Cookbook, the nice thing is that we, as a community, can offer suggestions to improve it. It's basically a huge moderated Wiki (or integrated and web-based Trac system for documentation). ...either way, even without a definition in the method itself of what $options can be filled with, what you were passing it was still incorrect, based on the cookbook. The values you can trry to pass to the minute() or hour() methods can be found under:http://book.cakephp.org/view/189/Automagic-Form-Elements-- see all the $options['..'] descriptions. As for alternative sources, there's also the API and you can search through the code to find the answers you need. (api.cakephp.org) On May 26, 4:58 pm, Bs sommerf...@hs-heilbronn.de wrote: Hi Brendon, the problem I have with the Cookbook is that many methods aren't documented that well. The minute function for example...I couldn't find any info what values are allowed for attributes. The method is just defined but not documented that well. On 26 Mai, 20:24, Brendon Kozlowski brendon...@hotmail.com wrote: It doesn't look like you're using the FormHelper's methods properly. Looking at the API, and just the minute's method, I see it's incorrectly used. function minute($fieldName, $selected = null, $attributes = array(), $showEmpty = true){ //... } Check the book (book.cakephp.org) and Core Helpers to understand how to use the Form methods with proper syntax and parameters. (I think you already have an idea of how to use them, but if it asks for an array, supply it with an array or you might get undesirable and unexpected results.) On May 26, 12:24 pm, Bs sommerf...@hs-heilbronn.de wrote: Hi Stu, I tried it out with datetime column but that doesn't work, either. Result is null in the column. Here's part of my code: add.cpt: ... tr td style=text-align:right;Opening time/td td style=text-align:left;from ?php echo $form-hour ('OpeningStartHours',1,6);? : ?php echo $form-minute ('OpeningStartMinutes',0,null,00);? to ?php echo $form-hour('OpeningEndHours', 1,18);? : ?php echo $form-minute('OpeningEndMinutes',0,null,00);? o'clock /td /tr ... mycontroller: function add() { $startMinutes = $data['myobject']['OpeningStartMinutes']; $startHours = $data['myobject']['OpeningStartHours']; $endMinutes = $data['myobject']['OpeningEndMinutes']; $endHours = $data['myobject']['OpeningEndHours']; $data['myobject']['OpeningStartMinutes'] = $startMinutes['min']; $data['myobject']['OpeningStartHours'] = $startHours['hour']; $data['myobject']['OpeningEndMinutes'] = $endMinutes['min']; $data['myobject']['OpeningEndHours'] = $endHours['hour']; That way it works, but of course it's quite complicated always converting those values and storing them in 4 different fields. After your hint I tried it with a datetime OpeningStart and OpeningEnd field like this ... tr td style=text-align:right;Opening time/td td style=text-align:left;from ?php echo $form-hour ('OpeningStart',1,6);? : ?php echo $form-minute('OpeningStart', 0,null,00);? to ?php echo $form-hour('OpeningEnd',1,18);? : ?php echo $form-minute('OpeningEnd',0,null,00);? o'clock /td /tr ... and commented out the conversion code in my controller, but that resulted in null values for OpeningStart and OpeningEnd in the database.- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Need help on password generation
Hi all, I need help on the cakePHP coding. I have a function called generatePassword() in the controller. I want to create an ajax link in such a way that user can click on the link and it will talk to the method, take the password and display it on the textbox. Can this be done? Gangzheng --~--~-~--~~~---~--~~ 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: Need help on password generation
Hi Gangzheng, Use the core ajax helper for that. in your controller: var $helpers = array('Ajax', 'Javascript') var $components = array('RequestHandler') in the view that is going to hold the link, create the link with the ajax helper instead of the html helper: echo $ajax-link( 'Generate Password', array( 'controller' = 'controllername', 'action' = 'generatePassword', array( 'update' = 'id_of_div_to_be_updated', 'complete' = 'alert(Your password has been generated) ' ) ); then in your generatepassword controller function make sure you send the generated password to the view which you'll create in your views/controller folder $this-set('password', $new_password); so you can print out the password in your view with echo $password; hope this helps! bryan On Wed, May 27, 2009 at 8:39 AM, liaogz82 liaog...@gmail.com wrote: Hi all, I need help on the cakePHP coding. I have a function called generatePassword() in the controller. I want to create an ajax link in such a way that user can click on the link and it will talk to the method, take the password and display it on the textbox. Can this be done? Gangzheng --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Quick-tip: Simple Excel export from PHP
There is a very very simple way to export Excel-files without any special libraries or classes. The cheat, and it is a cheat but who cares when Excel doesn't :), is to export a html table and call it an excel file. That's it. Simple, right? • Point to an URL with an xls file extension (use parseExtensions is a good idea). example.com/stats/weekly.xls • Set the output headers. RequestHandler wants: $this-RequestHandler-setContent('xls', 'application/vnd.ms- excel'); • Output a table in your view. Do not output a html page. Just the table will do. Please add some 90's formatting to the table to get some borders. Add any h# tags and p tags before and after the table to add some information and labeling. I did not learn this until recently when I was sent an excel-file that my excel import could not read. At first I thought it was some new xlsx variation that my mac could not read but it turned out it was a html table masked as an excel file. I thought this might be useful to some of you. It is a lot less painful than most excel libraries when you just want to export some stats page as excel. Your view will probably already have a table of data. /Martin --~--~-~--~~~---~--~~ 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 invalidate
Ok, although I'm not satisfied with Model::save() saving the non validating data, I've found a work-around. It seems to work quite nice for me so why not posting it here: Practically, what I'm trying to do is submitting agenda items through a form. The items have a date, whole_day (bool), start and stop time. I want the start and stop time to be required if the whole_day box is not marked. This is what I did initially: The Item model doesn't have validation rules for start and stop. The items controller checks if whole_day == false (meaning that start and stop time would be required). In that case, start and stop is manually validated and then decided weather or not to 'invalidate' those fields. Quite a hassle... Now, I'm doing the opposite: The model is setup to do validation on all the fields. In the items controller, some validation rules are removed depending on certain submitted values. To do the opposite of invalidate, i've written a small model function named 'uninvalidate ()' ;-). Uninvalidate removes the validation rule for a given field. /app/app_model.php class AppModel extends Model { function uninvalidate($field) { if (isset($this-validate[$field])) { unset($this-validate[$field]); } } } Validation rules in the Item model: var $validate = array( 'start_time' = array('notempty'), 'stop_time' = array('notempty') ); Now, the items controller logic looks like: if ($this-data['Item']['whole_day'] == 1) { $this-Item-uninvalidate('start_time'); $this-Item-uninvalidate('stop_time') } if ($this-Item-validates() $this-Item-save($this-data)) { } Unlike my initial attempt, you leave the validation work to cake. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Database design
Well, my problem is not directly related to CakePHP, but as it's about database design maybe I'll get some good answers. On my page I have news, downloads and users. These three can be commented. Additionally I have a shoutbox and a guestbook. The comments, shoutbox and guestbook have all the same fields. So they could reside in the same table. Is it best practice to only have one table for all comments (news, downloads, users), the shoutbox and the guestbook and actually filter based on a type column? Or is it better to separate everything into it's own table? Using only one table has the advantage, that I could use only one controller and a limited set of views, where as using multiple tables would mean multiple controllers and duplicated views (as they are all nearly the same). So what do you recomment? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Admin Login
Hello, I have a requirement, I have two logins .. one for normal users and one for administrators. I have two login pages separately. In my users' controller, I have login() and adminlogin() actions. For normal users I want to use users table to check the username and password, and for administrator, i want to use users table and groups table. groups table is the user groups such as admin and www. How can i do validation using Auth for both in users controller. Thanks, Bharani _ Hotmail® has a new way to see what's up with your friends. http://windowslive.com/Tutorial/Hotmail/WhatsNew?ocid=TXT_TAGLM_WL_HM_Tutorial_WhatsNew1_052009 --~--~-~--~~~---~--~~ 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: Admin Login
Take a look at this: http://book.cakephp.org/view/172/Authentication and this: http://book.cakephp.org/view/46/Routes-Configuration at Prefix routing On Wed, 2009-05-27 at 08:56 +, lakers fan wrote: Hello, I have a requirement, I have two logins .. one for normal users and one for administrators. I have two login pages separately. In my users' controller, I have login() and adminlogin() actions. For normal users I want to use users table to check the username and password, and for administrator, i want to use users table and groups table. groups table is the user groups such as admin and www. How can i do validation using Auth for both in users controller. Thanks, Bharani __ Hotmail® has a new way to see what's up with your friends. Check it out. --~--~-~--~~~---~--~~ 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: Admin Login
Sorry let me refine my question. I have a user model which has a list of groups. namely 'user', 'admin' etc. Similarly the group has multiple users. I have an associate for this in my User model: var $hasAndBelongsToMany = array( 'Group' = array('className' = 'Group', 'joinTable' = 'groups_users', 'foreignKey' = 'user_id', 'associationForeignKey' = 'group_id', 'unique' = true ) ); Now I have two logins, http://localhost/cake/admin/users/login for admin http://localhost/cake/users/login for regular users. when a user logins in say as admin, I need to get the groupid associated in groups_users table so that I can redirect him to appropriate admin page. Same is true for regular users.. Both admin and regular users use the same User model. Is there a way to differenciate between these two users? Thanks, Bharani Subject: Re: Admin Login From: bogdanbursu...@gmail.com To: cake-php@googlegroups.com Date: Wed, 27 May 2009 12:24:15 +0300 Take a look at this: http://book.cakephp.org/view/172/Authentication and this: http://book.cakephp.org/view/46/Routes-Configuration at Prefix routing On Wed, 2009-05-27 at 08:56 +, lakers fan wrote: Hello, I have a requirement, I have two logins .. one for normal users and one for administrators. I have two login pages separately. In my users' controller, I have login() and adminlogin() actions. For normal users I want to use users table to check the username and password, and for administrator, i want to use users table and groups table. groups table is the user groups such as admin and www. How can i do validation using Auth for both in users controller. Thanks, Bharani __ Hotmail® has a new way to see what's up with your friends. Check it out. _ Windows Live™: Keep your life in sync. http://windowslive.com/explore?ocid=TXT_TAGLM_BR_life_in_synch_052009 --~--~-~--~~~---~--~~ 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: Star Rating Help
Because I am not sure about the requirements for the bakery, I just put it on my blog: I couldn't see anything that can prevent your blog post from being a good Bakery article, why don't just give it a try? Let me know what you think about it. I'm testing it now, I think it could be useful for me in my current project, thanks! Regards, - Dardo. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: HABTM (tags) - using a text input instead of a select.
I found that tutorial very helpful was just the job, thanks Paolo. Dan I looked at that in the bakery before I posted actually, but there was some criticisms surrounding it so I thought there might be a better solution. On May 26, 6:16 pm, Paolo Portaluri poweruser...@work.to.it wrote: Il giorno 26/mag/09, alle ore 18:49, number9 ha scritto: It really isn't feasible to use a select input since a project I am working on is likely to produce a large amount of tags. I basically am looking to create something akin to wordpress where when a new post is created, there is a single text box where you can enter tags with comments. If they do not exist they are created at the same time. I have searched around for any help/information relating to this but haven't really found anything. Before I try and put something together myself if anybody knows of a cake way of doing this, or any links that could help it would be appreciated! Look at this:http://mrphp.com.au/code/code-category/cakephp/cakephp-1-2/working-ha... Ciao Paolo -- Paolo Portaluri mail: poweru...@work.to.it web:http://work.to.it/ AIM: poweruser82 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Poll: what do you hate about CakePHP?
We've got a few good goals for the upcoming version... http://thechaw.com/cakephp/wiki/1.3/Hit_List --~--~-~--~~~---~--~~ 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: Add id to error-message div element
Look in cake/libs/view/helpers/form.php in the error function. $defaults = array('wrap' = true, 'class' = 'error-message', 'escape' = true); Add your new class like: 'error-message your-class'. Although I don't see why you need to do this when you can just use the error-message class as is. Rick On May 26, 3:41 pm, ross.hagg...@googlemail.com ross.hagg...@googlemail.com wrote: Hi Is it possible to add an id to the error-message div, tried adding it to the $validate array in the model. I want an id that's specific to the form field. Cheers R --~--~-~--~~~---~--~~ 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: Database design
Hello group, I have a similar question: I got 2 models, that are almost identical - the only difference is, that they have a belongsTo field, that is linked to different models. Controllers and views are all the same, so I think to really use two models is not very DRY. The models post_reminders === id post_id user_id comment section_reminder = id section_id user_id comment My 1st thought was to put them into one table like that: reminders === id foreign_type foreign_id user_id comment but with that i cannot use assocations by default (I would need two queries). Maybe anyone out there has an advice on how to solve this (with a new parent class maybe?) Thanks, harpax On 27 Mai, 10:22, Braindead markus.he...@gmail.com wrote: Well, my problem is not directly related to CakePHP, but as it's about database design maybe I'll get some good answers. On my page I have news, downloads and users. These three can be commented. Additionally I have a shoutbox and a guestbook. The comments, shoutbox and guestbook have all the same fields. So they could reside in the same table. Is it best practice to only have one table for all comments (news, downloads, users), the shoutbox and the guestbook and actually filter based on a type column? Or is it better to separate everything into it's own table? Using only one table has the advantage, that I could use only one controller and a limited set of views, where as using multiple tables would mean multiple controllers and duplicated views (as they are all nearly the same). So what do you recomment? --~--~-~--~~~---~--~~ 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: Admin Login
You could simple do this by adding a admin boolean to the users table, and test $data['User']['admin'] or if you want to do it with groups you can do a find on the logged user like this: $user = $this-User-find('all'); and here you will have the user data and it's groups if you want to do this in login action then set in the beforeFitler(): $this-Auth-autoRedirect = false; or if you want to cancel the auth redirection only for login action do: if ($this-params['action'] == 'login' || $this-params['action'] == 'admin_login') { $this-Auth-autoRedirect = false; } dunno if this is what you want but you can access the join model like this: $this-User-GroupsUser cake automatically creates it for you On Wed, 2009-05-27 at 11:35 +, lakers fan wrote: Sorry let me refine my question. I have a user model which has a list of groups. namely 'user', 'admin' etc. Similarly the group has multiple users. I have an associate for this in my User model: var $hasAndBelongsToMany = array( 'Group' = array('className' = 'Group', 'joinTable' = 'groups_users', 'foreignKey' = 'user_id', 'associationForeignKey' = 'group_id', 'unique' = true ) ); Now I have two logins, http://localhost/cake/admin/users/login for admin http://localhost/cake/users/login for regular users. when a user logins in say as admin, I need to get the groupid associated in groups_users table so that I can redirect him to appropriate admin page. Same is true for regular users.. Both admin and regular users use the same User model. Is there a way to differenciate between these two users? Thanks, Bharani Subject: Re: Admin Login From: bogdanbursu...@gmail.com To: cake-php@googlegroups.com Date: Wed, 27 May 2009 12:24:15 +0300 Take a look at this: http://book.cakephp.org/view/172/Authentication and this: http://book.cakephp.org/view/46/Routes-Configuration at Prefix routing On Wed, 2009-05-27 at 08:56 +, lakers fan wrote: Hello, I have a requirement, I have two logins .. one for normal users and one for administrators. I have two login pages separately. In my users' controller, I have login() and adminlogin() actions. For normal users I want to use users table to check the username and password, and for administrator, i want to use users table and groups table. groups table is the user groups such as admin and www. How can i do validation using Auth for both in users controller. Thanks, Bharani __ Hotmail® has a new way to see what's up with your friends. Check it out. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
welcome to cake-php members
Hi all, I am new to cake-php. could you help me by sending cake-php samples/ examples...Is there any simple website like w3schools.com for php.. 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 -~--~~~~--~~--~--~---
Re: Error Installation CakePHP 1.2.
We're getting the same issue with php5.2.5 using the cake_1.2.3.8166 release so suggest the issue doesnt only apply to php4. Anyone got any ideas why this happening? brian-9 wrote: I suggest that you consider upgrading to version 5.x as Cake may not support PHP4.x for much longer. This isn't an official announcement, only based on the number of people who have been strongly suggesting that Cake no longer support it. In any case, PHP4.x itself has been discontinued for a very long time now. On Wed, May 13, 2009 at 9:49 PM, genobee wid.w...@gmail.com wrote: Notice: Undefined offset: 0 in /var/www/vhosts/ideal-weddings.com/ httpdocs/cakephp/cake/libs/configure.php on line 1185 Line 1185: unset($this-__paths[rtrim($core[0], DS)]); part of destructor method -- View this message in context: http://n2.nabble.com/Error-Installation-CakePHP-1.2.-tp2879433p2980388.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: Database design
we do this with an type column. On May 27, 9:22 am, Braindead markus.he...@gmail.com wrote: Well, my problem is not directly related to CakePHP, but as it's about database design maybe I'll get some good answers. On my page I have news, downloads and users. These three can be commented. Additionally I have a shoutbox and a guestbook. The comments, shoutbox and guestbook have all the same fields. So they could reside in the same table. Is it best practice to only have one table for all comments (news, downloads, users), the shoutbox and the guestbook and actually filter based on a type column? Or is it better to separate everything into it's own table? Using only one table has the advantage, that I could use only one controller and a limited set of views, where as using multiple tables would mean multiple controllers and duplicated views (as they are all nearly the same). So what do you recomment? --~--~-~--~~~---~--~~ 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: Database design
we do this with an type column. On May 27, 9:22 am, Braindead markus.he...@gmail.com wrote: Well, my problem is not directly related to CakePHP, but as it's about database design maybe I'll get some good answers. On my page I have news, downloads and users. These three can be commented. Additionally I have a shoutbox and a guestbook. The comments, shoutbox and guestbook have all the same fields. So they could reside in the same table. Is it best practice to only have one table for all comments (news, downloads, users), the shoutbox and the guestbook and actually filter based on a type column? Or is it better to separate everything into it's own table? Using only one table has the advantage, that I could use only one controller and a limited set of views, where as using multiple tables would mean multiple controllers and duplicated views (as they are all nearly the same). So what do you recomment? --~--~-~--~~~---~--~~ 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: Database design
First, sorry my bad English... Well, you could have a field type that reference the entity that has the commentary. Pattern Single Table. Braindead wrote: Well, my problem is not directly related to CakePHP, but as it's about database design maybe I'll get some good answers. On my page I have news, downloads and users. These three can be commented. Additionally I have a shoutbox and a guestbook. The comments, shoutbox and guestbook have all the same fields. So they could reside in the same table. Is it best practice to only have one table for all comments (news, downloads, users), the shoutbox and the guestbook and actually filter based on a type column? Or is it better to separate everything into it's own table? Using only one table has the advantage, that I could use only one controller and a limited set of views, where as using multiple tables would mean multiple controllers and duplicated views (as they are all nearly the same). So what do you recomment? --~--~-~--~~~---~--~~ 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: complex query for pivot table
select h.name as PSC ,count(DISTINCT c.id) as Papers,avg (c.duration),count(DISTINCT c.duration = 155),count(DISTINCT 155 = c.duration) from contracts as c inner join holders as h on h.id = c.holder_id where c.status = 1 and c.waiver =0 and c.commitee_id !=6 group by h.name using the above query i manage to get it done half way.however the last 2 column still have problem as i still finding way to count duration less than 155 and more than 155 --~--~-~--~~~---~--~~ 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: complex query for pivot table
select h.name as PSC ,count(DISTINCT c.id) as Papers,avg (c.duration),count(DISTINCT c.duration 155),count(DISTINCT 155 = c.duration) from contracts as c inner join holders as h on h.id = c.holder_id where c.status = 1 and c.waiver =0 and c.commitee_id !=6 group by h.name I managed to get it work half way however the last 2 column is a problem.I still finding ways on how to count records that have duration = 155 and duration =155 On May 27, 10:09 am, 0x1A4 xum4...@gmail.com wrote: hey all, i have a problem here.There are 2 tables contracts and holders. [contracts] -id -holder_id -duration -contract_no -contract_title -date_start -date_end -created [holders] -id -name i need to display it in a table order by holder's names. [holders][no of contracts][average duration][duration = 155][duration= 155] [7 INC ][ 16 ][ 200 days ] [ 12 ][ 4 ] hope everyone could help with awesome idea how to solve it. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Database design
I would choose separate tables for comments, shoutbox and guestbook. The reason is that one day soon you might come up with an idea to expand the guestbook and then you will curse being locked in with the other models. For flexibility and reuse of code there is nothing stopping you from Creating an AbstractComment model and let the other concrete models inherit it. The flexibility on the View end would be to use elements. In the Controller you should have little code and any duplication there would be negligible. But you could always make an abstract controller if you wanted. If you were to use a single table then you should (IMHO) use a single Model and call them all comments (or something). A guestbook would contain site owner comments and the shoutbox site comments or something like it. But since you talk of them as separate entities then you should probably make several tables. @harpax I use that technique a lot. I have some models in my app that are used by many other models that recide in plugins I have. You can quite easily use Cake's normal associations with just a simple change to the association. var $hasMany = array( 'Reminder' = array( 'className' = 'Reminder', 'foreignKey'= 'foreign_id', 'conditions'= array('Reminder.belongs_to' = 'Post'), 'dependent' = true ) ); Notice that I have set both a foreign key and a condition. That is all it takes. I advocate using a field named belongs_to instead of foreign_type and put the exact Model name (or alias) into that field. This is simply since a type of reminder might be used by more than one model. Saying that this record belongs to that model reads a little clearer to me. /Martin On May 27, 10:22 am, Braindead markus.he...@gmail.com wrote: Well, my problem is not directly related to CakePHP, but as it's about database design maybe I'll get some good answers. On my page I have news, downloads and users. These three can be commented. Additionally I have a shoutbox and a guestbook. The comments, shoutbox and guestbook have all the same fields. So they could reside in the same table. Is it best practice to only have one table for all comments (news, downloads, users), the shoutbox and the guestbook and actually filter based on a type column? Or is it better to separate everything into it's own table? Using only one table has the advantage, that I could use only one controller and a limited set of views, where as using multiple tables would mean multiple controllers and duplicated views (as they are all nearly the same). So what do you recomment? --~--~-~--~~~---~--~~ 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: Function works only sometimes?
Did you ever find out what the problem was? I suspect isAjax() is occasionally returning false—it does so for me sometimes (maybe 1 in every 10 AJAX requests) and I have no idea why :( --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
geo-location database
hey guys, not really a cake specific question but related nonetheless... have any of you worked with international location databases? know of any pay-for or free? busy working on a property site and the requirement is to have it be internationalized with country-state/suburb/county/etc selectable for the whole world... it's quite a requirement but it must have been done before... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Quick-tip: Simple Excel export from PHP
thx for the useful hint :) i'll try this On 27 Mag, 09:46, Martin Westin martin.westin...@gmail.com wrote: There is a very very simple way to export Excel-files without any special libraries or classes. The cheat, and it is a cheat but who cares when Excel doesn't :), is to export a html table and call it an excel file. That's it. Simple, right? • Point to an URL with an xls file extension (use parseExtensions is a good idea). example.com/stats/weekly.xls • Set the output headers. RequestHandler wants: $this-RequestHandler-setContent('xls', 'application/vnd.ms- excel'); • Output a table in your view. Do not output a html page. Just the table will do. Please add some 90's formatting to the table to get some borders. Add any h# tags and p tags before and after the table to add some information and labeling. I did not learn this until recently when I was sent an excel-file that my excel import could not read. At first I thought it was some new xlsx variation that my mac could not read but it turned out it was a html table masked as an excel file. I thought this might be useful to some of you. It is a lot less painful than most excel libraries when you just want to export some stats page as excel. Your view will probably already have a table of data. /Martin --~--~-~--~~~---~--~~ 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: welcome to cake-php members
Maybe try http://www.w3schools.com/php/default.asp for PHP. For Cake click on the learn link at http://cakephp.org/ On May 27, 1:03 am, greeta greeta2...@gmail.com wrote: Hi all, I am new to cake-php. could you help me by sending cake-php samples/ examples...Is there any simple website like w3schools.com for php.. 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 -~--~~~~--~~--~--~---
Re: complex query for pivot table
Hi, this have nothing to do with cake, but I try to help you anyway. I think you can do something like this: select h.name as PSC ,count(DISTINCT c.id) as Papers,avg (c.duration), sum(if(c.duration = 155, 1, 0)), sum(IF(c.duration 155, 1, 0)) from contracts as c inner join holders as h on h.id = c.holder_id where c.status = 1 and c.waiver =0 and c.commitee_id !=6 group by h.name hope this help. 2009/5/27 0x1A4 xum4...@gmail.com select h.name as PSC ,count(DISTINCT c.id) as Papers,avg (c.duration),count(DISTINCT c.duration 155),count(DISTINCT 155 = c.duration) from contracts as c inner join holders as h on h.id = c.holder_id where c.status = 1 and c.waiver =0 and c.commitee_id !=6 group by h.name I managed to get it work half way however the last 2 column is a problem.I still finding ways on how to count records that have duration = 155 and duration =155 On May 27, 10:09 am, 0x1A4 xum4...@gmail.com wrote: hey all, i have a problem here.There are 2 tables contracts and holders. [contracts] -id -holder_id -duration -contract_no -contract_title -date_start -date_end -created [holders] -id -name i need to display it in a table order by holder's names. [holders][no of contracts][average duration][duration = 155][duration= 155] [7 INC ][16 ][ 200 days] [ 12 ][ 4 ] hope everyone could help with awesome idea how to solve it. -- Mauricio Tellez --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Handling minute and hour elements in forms
Perhaps this will help: http://book.cakephp.org/view/657/Data-Type-Associations-by-Database On May 27, 2:36 am, Bs sommerf...@hs-heilbronn.de wrote: Thanks. What I'm missing is some kind of listing where it's clearly defined which form field in cake is associated with which datatype in mysql. something like $form-input --- varchar, text $form-minute hour -- datetime $form-checkbox -- some kind of int field for setting 0 or 1 That's also a thing I still don't understand about the hour and minute fields. Are they really associated with a datetime field in mysql? Cause there's an actual datetime input type in cake forms and my experiments with hour minute form fields in cake and datetime columns didn't work, yet. On May 27, 4:03 am, Brendon Kozlowski brendon...@hotmail.com wrote: Although there are some discrepancies or missing inforrmation in the Cookbook, the nice thing is that we, as a community, can offer suggestions to improve it. It's basically a huge moderated Wiki (or integrated and web-based Trac system for documentation). ...either way, even without a definition in the method itself of what $options can be filled with, what you were passing it was still incorrect, based on the cookbook. The values you can trry to pass to the minute() or hour() methods can be found under:http://book.cakephp.org/view/189/Automagic-Form-Elements--see all the $options['..'] descriptions. As for alternative sources, there's also the API and you can search through the code to find the answers you need. (api.cakephp.org) On May 26, 4:58 pm, Bs sommerf...@hs-heilbronn.de wrote: Hi Brendon, the problem I have with the Cookbook is that many methods aren't documented that well. The minute function for example...I couldn't find any info what values are allowed for attributes. The method is just defined but not documented that well. On 26 Mai, 20:24, Brendon Kozlowski brendon...@hotmail.com wrote: It doesn't look like you're using the FormHelper's methods properly. Looking at the API, and just the minute's method, I see it's incorrectly used. function minute($fieldName, $selected = null, $attributes = array(), $showEmpty = true){ //... } Check the book (book.cakephp.org) and Core Helpers to understand how to use the Form methods with proper syntax and parameters. (I think you already have an idea of how to use them, but if it asks for an array, supply it with an array or you might get undesirable and unexpected results.) On May 26, 12:24 pm, Bs sommerf...@hs-heilbronn.de wrote: Hi Stu, I tried it out with datetime column but that doesn't work, either. Result is null in the column. Here's part of my code: add.cpt: ... tr td style=text-align:right;Opening time/td td style=text-align:left;from ?php echo $form-hour ('OpeningStartHours',1,6);? : ?php echo $form-minute ('OpeningStartMinutes',0,null,00);? to ?php echo $form-hour('OpeningEndHours', 1,18);? : ?php echo $form-minute('OpeningEndMinutes',0,null,00);? o'clock /td /tr ... mycontroller: function add() { $startMinutes = $data['myobject']['OpeningStartMinutes']; $startHours = $data['myobject']['OpeningStartHours']; $endMinutes = $data['myobject']['OpeningEndMinutes']; $endHours = $data['myobject']['OpeningEndHours']; $data['myobject']['OpeningStartMinutes'] = $startMinutes['min']; $data['myobject']['OpeningStartHours'] = $startHours['hour']; $data['myobject']['OpeningEndMinutes'] = $endMinutes['min']; $data['myobject']['OpeningEndHours'] = $endHours['hour']; That way it works, but of course it's quite complicated always converting those values and storing them in 4 different fields. After your hint I tried it with a datetime OpeningStart and OpeningEnd field like this ... tr td style=text-align:right;Opening time/td td style=text-align:left;from ?php echo $form-hour ('OpeningStart',1,6);? : ?php echo $form-minute('OpeningStart', 0,null,00);? to ?php echo $form-hour('OpeningEnd',1,18);? : ?php echo $form-minute('OpeningEnd',0,null,00);? o'clock /td /tr ... and commented out the conversion code in my controller, but that resulted in null values for OpeningStart and OpeningEnd in the database.- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send
Re: Handling minute and hour elements in forms
Whoops, wrong page. The FormHelper's main page, very first table shows that information. http://book.cakephp.org/view/189/Automagic-Form-Elements On May 27, 2:36 am, Bs sommerf...@hs-heilbronn.de wrote: Thanks. What I'm missing is some kind of listing where it's clearly defined which form field in cake is associated with which datatype in mysql. something like $form-input --- varchar, text $form-minute hour -- datetime $form-checkbox -- some kind of int field for setting 0 or 1 That's also a thing I still don't understand about the hour and minute fields. Are they really associated with a datetime field in mysql? Cause there's an actual datetime input type in cake forms and my experiments with hour minute form fields in cake and datetime columns didn't work, yet. On May 27, 4:03 am, Brendon Kozlowski brendon...@hotmail.com wrote: Although there are some discrepancies or missing inforrmation in the Cookbook, the nice thing is that we, as a community, can offer suggestions to improve it. It's basically a huge moderated Wiki (or integrated and web-based Trac system for documentation). ...either way, even without a definition in the method itself of what $options can be filled with, what you were passing it was still incorrect, based on the cookbook. The values you can trry to pass to the minute() or hour() methods can be found under:http://book.cakephp.org/view/189/Automagic-Form-Elements--see all the $options['..'] descriptions. As for alternative sources, there's also the API and you can search through the code to find the answers you need. (api.cakephp.org) On May 26, 4:58 pm, Bs sommerf...@hs-heilbronn.de wrote: Hi Brendon, the problem I have with the Cookbook is that many methods aren't documented that well. The minute function for example...I couldn't find any info what values are allowed for attributes. The method is just defined but not documented that well. On 26 Mai, 20:24, Brendon Kozlowski brendon...@hotmail.com wrote: It doesn't look like you're using the FormHelper's methods properly. Looking at the API, and just the minute's method, I see it's incorrectly used. function minute($fieldName, $selected = null, $attributes = array(), $showEmpty = true){ //... } Check the book (book.cakephp.org) and Core Helpers to understand how to use the Form methods with proper syntax and parameters. (I think you already have an idea of how to use them, but if it asks for an array, supply it with an array or you might get undesirable and unexpected results.) On May 26, 12:24 pm, Bs sommerf...@hs-heilbronn.de wrote: Hi Stu, I tried it out with datetime column but that doesn't work, either. Result is null in the column. Here's part of my code: add.cpt: ... tr td style=text-align:right;Opening time/td td style=text-align:left;from ?php echo $form-hour ('OpeningStartHours',1,6);? : ?php echo $form-minute ('OpeningStartMinutes',0,null,00);? to ?php echo $form-hour('OpeningEndHours', 1,18);? : ?php echo $form-minute('OpeningEndMinutes',0,null,00);? o'clock /td /tr ... mycontroller: function add() { $startMinutes = $data['myobject']['OpeningStartMinutes']; $startHours = $data['myobject']['OpeningStartHours']; $endMinutes = $data['myobject']['OpeningEndMinutes']; $endHours = $data['myobject']['OpeningEndHours']; $data['myobject']['OpeningStartMinutes'] = $startMinutes['min']; $data['myobject']['OpeningStartHours'] = $startHours['hour']; $data['myobject']['OpeningEndMinutes'] = $endMinutes['min']; $data['myobject']['OpeningEndHours'] = $endHours['hour']; That way it works, but of course it's quite complicated always converting those values and storing them in 4 different fields. After your hint I tried it with a datetime OpeningStart and OpeningEnd field like this ... tr td style=text-align:right;Opening time/td td style=text-align:left;from ?php echo $form-hour ('OpeningStart',1,6);? : ?php echo $form-minute('OpeningStart', 0,null,00);? to ?php echo $form-hour('OpeningEnd',1,18);? : ?php echo $form-minute('OpeningEnd',0,null,00);? o'clock /td /tr ... and commented out the conversion code in my controller, but that resulted in null values for OpeningStart and OpeningEnd in the database.- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to
Re: how to integrate openID with Auth component?
Daniel Hofstetter also wrote an article about this some time ago: http://cakebaker.42dh.com/2008/12/09/how-to-use-the-openid-component-with-the-auth-component/ On May 26, 8:24 pm, Matti Putkonen matti.putko...@fi3.fi wrote: Some code I used way back when using the Auth + OpenId: http://trac.assembla.com/bakesale/browser/bakesalehq/controllers/user... On 24 touko, 20:55, Andrei Thomaz andreitho...@gmail.com wrote: dear forum, I am developing a very simple admin with CakePHP. I want the user be able to login using OpenID, so he/she can use the same username/ password from a WordPress site (this part is done). I could install the openid component (http://cakebaker.42dh.com/ 2008/02/06/new-version-of-the-openid-component/) successfully, but I am not being able to figure out which actions are needed to integrate it with Auth component. What I want is that, after the login through openid succeds, all the controllersn using Auth component allows access to the user. Have you done something similar? How? thank you, andrei- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: geo-location database
Hi Bryan, On the bakery is also a CakePHP component to extract postcode to geo code information from google, at no cost. It's a fair age now, so may not work. Hope this helps, Richard On Wed, May 27, 2009 at 2:41 PM, Bryan Paddock bryanpadd...@gmail.comwrote: hey guys, not really a cake specific question but related nonetheless... have any of you worked with international location databases? know of any pay-for or free? busy working on a property site and the requirement is to have it be internationalized with country-state/suburb/county/etc selectable for the whole world... it's quite a requirement but it must have been done before... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Handling minute and hour elements in forms
Hey, sorry for the late reply. For time data, I still use the $form-dateTime function, there is a parameter that voids the Date value. If you check out the source code, it explains it all. API: http://api.cakephp.org/class/form-helper#method-FormHelperdateTime Source: http://api.cakephp.org/view_source/form-helper/#line-1479 So basically you'll want to set the second parameter to 'NONE', and hopefully this will work for you. ps: I've test this with a 'time' column type and it worked for me. Goodluck! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Handling minute and hour elements in forms
ps: The view code should look something like this: echo $form-dateTime('column_name', 'NONE', '12'); The '12' just represents the format, you can either choose '12' (e.g. 11:15 am) or '24' (e.g. 23:15) --~--~-~--~~~---~--~~ 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 and field of more words
$this-set uses camel casing so: $post of the month becomes : $postOfTheMonth Hope this helps Good luck --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Accessing a foreign_key from an indirectly referenced model
In the project I am working on, I have the following models: class Student extends AppModel { var $name = 'Student'; var $belongsTo = 'School'; var $hasMany = 'Competitor'; } class Competitor extends AppModel { var $name = 'Competitor'; var $belongsTo = array('Student','Trackmeet'); } class School extends AppModel { var $name = 'School'; var $hasMany = array('User','Student','Trackmeet'); } class Trackmeet extends AppModel { var $name = 'Trackmeet'; var $belongsTo = 'School'; var $hasMany = 'Competitor'; } class Trackmeet extends AppModel { var $name = 'Trackmeet'; var $belongsTo = 'School'; var $hasMany = 'Competitor'; } In the Trackmeet controller, I am able to select all of the competitors in a specific event which returns an array with elements ('Competitor','Student','Trackmeet). I would like to be able to find out the name of the school the student attends so I can pass it to the appropriate view. Do I have to do a separate query based on school_id in the student model or is there an easier way? Thanks for any 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 -~--~~~~--~~--~--~---
Re: Accessing a foreign_key from an indirectly referenced model
I would use the Containable behavior, and use that to specify which model to return. eg: $contain = array( 'School', 'Competitor' = array( 'Trackmeet', 'Student' = array( 'School' ) ) ); $trackmeets = $this-Trackmeet-find('all',compact('contain')); or something along those lines. that being said, it seems to me that students are competitors. I would probably do a Student hasAndBelongsToMany Trackmeet and get rid of the Competitor model. -d On May 27, 8:14 am, jason.t.stein jason.t.st...@gmail.com wrote: In the project I am working on, I have the following models: class Student extends AppModel { var $name = 'Student'; var $belongsTo = 'School'; var $hasMany = 'Competitor'; } class Competitor extends AppModel { var $name = 'Competitor'; var $belongsTo = array('Student','Trackmeet'); } class School extends AppModel { var $name = 'School'; var $hasMany = array('User','Student','Trackmeet'); } class Trackmeet extends AppModel { var $name = 'Trackmeet'; var $belongsTo = 'School'; var $hasMany = 'Competitor'; } class Trackmeet extends AppModel { var $name = 'Trackmeet'; var $belongsTo = 'School'; var $hasMany = 'Competitor'; } In the Trackmeet controller, I am able to select all of the competitors in a specific event which returns an array with elements ('Competitor','Student','Trackmeet). I would like to be able to find out the name of the school the student attends so I can pass it to the appropriate view. Do I have to do a separate query based on school_id in the student model or is there an easier way? Thanks for any 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 -~--~~~~--~~--~--~---
Re: Star Rating Help
I read about some bakery criterias the plugin doesn't match (like styles and tests), but you are right, I could give it a try anyway. You're welcome to use it. Btw I just put up a new version that also supports jQuery. Regards, Michael Dardo Sordi Bogado schrieb: Because I am not sure about the requirements for the bakery, I just put it on my blog: I couldn't see anything that can prevent your blog post from being a good Bakery article, why don't just give it a try? Let me know what you think about it. I'm testing it now, I think it could be useful for me in my current project, thanks! Regards, - Dardo. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Poll: what do you hate about CakePHP?
I just want to add one minor thing: I don't like that debug() is making print_r() instead of var_dump(), so when I want to debug some variable and see nothing - I know that there's null, false, true or empty string or string full white chars, so I need to make my own debugging with pre tags and var_dump. That just inconvenient On 27 Maj, 14:40, keymaster ad...@optionosophy.com wrote: We've got a few good goals for the upcoming version... http://thechaw.com/cakephp/wiki/1.3/Hit_List --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Good way to paginate my index view by several keys / and-conditions
I've dealt with this before and usually end up reading/writing from the named params and doing some of the lifting that paginator usually does. Sometimes tho, if the table is small enough, I just switch to JavaScript and use the excellent TableSorter jQuery plugin. http://tablesorter.com/ There's even support for pagination (although you obviously have to load all rows at once and then it handles pagination in its own way). It has its drawbacks but if your table isn't thousands of rows I find this to be a quick fix. On May 26, 1:55 pm, Bs sommerf...@hs-heilbronn.de wrote: Well, right now my index looks just like in the cookbook table tr th?php echo $paginator-sort('Country', ''Country'); ?/th th?php echo $paginator-sort('Postal', 'Postal'); ?/th th?php echo $paginator-sort('Region', 'Region'); ?/th th?php echo $paginator-sort('City', 'City'); ?/th /tr tr .print the model entries /tr /table When the user clicks Country the model view is ordered by country, when he clicks Postal it's ordered by postal and so onbut he can't order the whole view by Country and Region for example. The $paginator is defined as follows: var $paginate = array( 'fields' = array ('Myobject.id','Myobject.Name','Myobject.Country','Myobject.Postal','Myobje ct.Region','Myobject.City'), 'limit' = 100, 'order' = array( ''Myobject.Country' = 'desc',''Myobject.Postal' = 'asc' ) ); On 26 Mai, 19:25, brian bally.z...@gmail.com wrote: OK, I understand. It looks like you'll need to check $this-params and deal with yourself some of the things paginator does automatically. The principle is the same, however: just add however many fields you need to the order array. It seems like you're going to make the interface overly complicated, though. But, without seeing your app, I can't really judge. Just an observation. On Tue, May 26, 2009 at 12:56 PM, Bs sommerf...@hs-heilbronn.de wrote: Hi, thanks for the hint but I want to provide the users with buttons to paginate the index view dynamically. Just like written in this howto http://book.cakephp.org/view/166/Pagination-in-Views but not only for singular columns but for 2, 3 or more so that they can order their view after country, region and city for example. Right now the code in my index view looks like this: th?php echo $paginator-sort('Country', 'Country'); ?/th And what I would like to do is something like this: $sort[] = Country; $sort[] = Region; $sort [] = City; th?php echo $paginator-sort($sort, 'Country'); ?/th So that the view is sorted by several keys when the user clicks. On 26 Mai, 18:37, brian bally.z...@gmail.com wrote: On Tue, May 26, 2009 at 11:56 AM, Bs sommerf...@hs-heilbronn.de wrote: Hi, I'm trying to order my index view by several conditions. As far as I can see from the documentation, the $paginator only accepts one key for sorting the model. http://book.cakephp.org/view/166/Pagination-in-Views What is the best practice to order my model by several keys? (For example, ordering my cities by country, region, and city name in my index view) 'order' = array( 'City.country' = 'ASC', 'City.region' = 'ASC', 'City.name' = 'ASC' ) --~--~-~--~~~---~--~~ 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 can I configure the value of CAKE_CORE_INCLUDE_PATH?
Hi, I did a website using CakePHP, I need to configure the CAKE_CORE_INCLUDE_PATH (app/webroot/index.php). How can I do that? Someone has an example? I need to know the complete path of my server to be able to do that? Using phpinfo()? Regards, --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How can I configure the value of CAKE_CORE_INCLUDE_PATH?
Hi, you can do that in app/webroot/index.php and test.php This is the code i use to switch the core path depending on the server name: if (!defined('CAKE_CORE_INCLUDE_PATH')) { $srvname = $_SERVER['SERVER_NAME']; if( $srvname == 'localhost' || $srvname == '127.0.0.1' || $srvname == ''){ // Dev Path // PATH: D:\sharedlibs\libs\cakephp\1.2.x.x define('CAKE_CORE_INCLUDE_PATH', 'D:'.DS.'sharedlibs'.DS.'libs'.DS.'cakephp'.DS.'1.2.x.x'); }else{ // Prod Path // PATH: /home/sharedlibs/libs/cakephp/1.2.x.x define('CAKE_CORE_INCLUDE_PATH', DS.'home'.DS.'sharedlibs'.DS.'libs'.DS.'cakephp'.DS.'1.2.x.x'); } } simon...@gmail.com escribió: Hi, I did a website using CakePHP, I need to configure the CAKE_CORE_INCLUDE_PATH (app/webroot/index.php). How can I do that? Someone has an example? I need to know the complete path of my server to be able to do that? Using phpinfo()? Regards, --~--~-~--~~~---~--~~ 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: Moving a webapp from Windows to Linux
It looks like you've set the path somewhere with a semi-colon too many. htaccess, maybe? The value from ini_get('include_path') seems to have a semi-colon prepended. No, wait--you've got 2 colons separated by a period. Am I reading that correctly? What does the block starting with if (!defined('CORE_PATH')) { in webroot/index.php look like? On Wed, May 27, 2009 at 1:58 AM, ShiVik vikramvmalhotra1...@gmail.com wrote: Hello there This is the error that I am getting. Failed opening required 'cake/bootstrap.php' (include_path='/webapp/ code/app1/cake:/webapp/code/app1/:.:/opt/lampp/lib/php') in /var/www/ webapp/htdocs/index.php on line 88 Thanks and Regards Vikram On May 27, 2:52 pm, Braindead markus.he...@gmail.com wrote: Are you sure that your problem is related to the PATH_SEPARATOR? I guess they use the constant PATH_SEPARATOR to make it work on Windows and Linux without having to worry about that. I also develop on Windows using XAMPP and my production server is on Linux. I never had that kind of problems. --~--~-~--~~~---~--~~ 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: Forms with math computations and multiple buttons
I'm not sure what you mean. sprintf()? http://www.php.net/manual/en/function.sprintf.php On Tue, May 26, 2009 at 9:23 PM, espontaneo acohln...@gmail.com wrote: it works, thanks! I have another question, how can I format the computed values coming from my component? brian-263 wrote: if (isset($this-params['form']['compute'])) On Tue, May 26, 2009 at 3:31 AM, espontaneo acohln...@gmail.com wrote: Hope you guys could help me. I am currently working on a form that will have two buttons: Compute and Add. What I wanted to do: click Compute button-computed values will populate fields-click Add button(submit form) So when I click on my Compute button, the salary will be passed on a component I made and will be processed to come up with computed values to populate some fields before I submit the form. The compute button is working well but when I click on the add button, I am getting errors Notice (8): Undefined index: compute [APP\controllers\deductions_controller.php, line 67] and Warning (2): Cannot modify header information - headers already sent by (output started at D:\wamp\www\cake\cake\basics.php:111) [CORE\cake\libs\controller\controller.php, line 640] here's my controller code for the buttons: if($this-params['form']['compute'] == Compute) { $this-data['Model']['field'] = $this-component-function($salary). '.00'; $this-data['Model']['field'] = $this-component-function($salary). '.00'; $this-data['Model']['field'] = $this-component-function($salary). '.00'; } elseif($this-params['form']['add'] == Add) { $this-Model-save($this-data); $this-Session-setFlash('Deductions has been added to employee', 'success'); $this-redirect(array('action' = 'list_deduction')); } Also, if you notice the . '.00' I have in my Compute button code above, I'm having problems with formatting the computed values in a money format so for now, I'm concatenating the result with the decimal point. But I want to do it properly. I've tried to use the number helper and I've searched through the net about this, but I can't get enough information. -- View this message in context: http://www.nabble.com/Forms-with-math-computations-and-multiple-buttons-tp23718059p23718059.html Sent from the CakePHP mailing list archive at Nabble.com. -- View this message in context: http://www.nabble.com/Forms-with-math-computations-and-multiple-buttons-tp23718059p23734427.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: user/group dependent redirect
On Tue, May 26, 2009 at 3:57 PM, draikin thomas.heinr...@gmx.de wrote: This doesn't work for me. I added the redirekt in app_controller and create a new function home() in users_controller: function home() { $userinfo = $this-Auth-user(); // assuming the group is in there switch($userinfo['User']['group_id']) { case '1': $this-redirect(array ( 'controller' = 'members', 'action' = 'index'), null, true); break; case '4': $this-redirect(array ( 'controller' = 'members', 'action' = 'otherList'), null, true); break; default: $this-redirect(array ( 'controller' = 'members', 'action' = 'index'), null, true); } } If I first login as member of group '4', all the redirection is correct. After logout and login as member of group '1' I get the same redirection as before. Not the expected redirection to /members/ index. Whats going wrong here? Not sure. But you're still adding an extra redirect if you do it from home(). I'm also not sure what happened to my other post. This is what I'm using: AppController::beforeFilter() $this-Auth-loginRedirect = array('controller' = 'pages', 'action' = 'display', 'home'); UsersController::login() if ($this-Auth-user('group_id') 3) { ... $this-redirect($this-Auth-loginRedirect); } ... $this-redirect( array( 'controller' = 'sections', 'action' = 'index', 'admin' = 1 ) ); --~--~-~--~~~---~--~~ 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: Accessing a foreign_key from an indirectly referenced model
d, Thanks d. I took a quick read through, and it looks like containables may work. I chose to use the competitor model to avoid duplicating data. I couldn't figure out how to merge competitor and student without always duplicating personal information. I am not a database designer, but this seemed like the easiest way to reduce duplicate data. On May 27, 9:50 am, d mil...@gmail.com wrote: I would use the Containable behavior, and use that to specify which model to return. eg: $contain = array( 'School', 'Competitor' = array( 'Trackmeet', 'Student' = array( 'School' ) ) ); $trackmeets = $this-Trackmeet-find('all',compact('contain')); or something along those lines. that being said, it seems to me that students are competitors. I would probably do a Student hasAndBelongsToMany Trackmeet and get rid of the Competitor model. -d On May 27, 8:14 am, jason.t.stein jason.t.st...@gmail.com wrote: In the project I am working on, I have the following models: class Student extends AppModel { var $name = 'Student'; var $belongsTo = 'School'; var $hasMany = 'Competitor'; } class Competitor extends AppModel { var $name = 'Competitor'; var $belongsTo = array('Student','Trackmeet'); } class School extends AppModel { var $name = 'School'; var $hasMany = array('User','Student','Trackmeet'); } class Trackmeet extends AppModel { var $name = 'Trackmeet'; var $belongsTo = 'School'; var $hasMany = 'Competitor'; } class Trackmeet extends AppModel { var $name = 'Trackmeet'; var $belongsTo = 'School'; var $hasMany = 'Competitor'; } In the Trackmeet controller, I am able to select all of the competitors in a specific event which returns an array with elements ('Competitor','Student','Trackmeet). I would like to be able to find out the name of the school the student attends so I can pass it to the appropriate view. Do I have to do a separate query based on school_id in the student model or is there an easier way? Thanks for any 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 -~--~~~~--~~--~--~---
Re: set and field of more words
$this-set uses camel casing so: $post of the month becomes : $postOfTheMonth Hope this helps yes, it helps.. in cakebook ( http://book.cakephp.org/view/189/Automagic-Form-Elements ) says: In your controller, set a camelCase plural variable (group - groups in this case, or ExtraFunkyModel - extraFunkyModels) with the select options. this is not the camelize in Inflector::camelize, because with camelize would make singular and first letter capitalized.. for example.. name: post of the month camelized: PostOfTheMonth camelized + pluralized: PostOfTheMonths camelized + pluralized + first letter in lowercase: postOfTheMonths and this should be the code: $field = Inflector::pluralize(Inflector::camelize($field)); $field = low($field{0}).substr($field, 1); $this-set($field, $a); but it works only for field that doens't contains space... someone can help me find the right name to give to set in order to have a select? thank you! -- pietro --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Poll: what do you hate about CakePHP?
I had another minor issue too. When changing a table's primary key, I'd like to just setting this adequately with the $primaryKey model atribute and the relationships use it. Personally I hate to have to change $belongsTo relationship to add the foreignKey parameter too. I'd like if Cake identify the name used for the other table's primary key and use it as a part of the convention instead of _id. For example, I think it could be better if we can do something like this class Country extends AppModel { $primaryKey = 'isocode'; // ^--- primary key defined... class Trip extends AppModel { $belongsTo = 'Country'; // ^-- instead of: $belongsTo = array('Country'= array('foreignKey'= 'country_isocode')) I know we could use 'country_id' in the database as a foreign key, but I it not so intuitive. Best regards. -- MARCELO DE F. ANDRADE Belem, PA, Amazonia, Brazil Linux User #221105 http://mfandrade.wordpress.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
[Newbe] Utilizing autocomplete and ObseveField
Hi at all, I have this problem: I have ad assistance model that have a belongsTo relation with another model called client. So i want to utilize ajax autocomplete to substitute the classic select field generated by the FORM helper fot the client_id. So I want that aoutocomplete search in the client table and show me the name of the client, but when I select one of this I want that del client_id is filled by the relative ID of the client. I think that utilizing a hidden field is the solution, but I don't know howto make the work. For now I have prepared the autocompelte function like the examples in the book.cakephp.org in the assistance controller: function autoComplete() { $this-set('clients', $this-Assistance-Client-find('all', array ('conditions' = array('Client.name LIKE' = $this-data['Client'] ['name'].'%'),'fields' = array ('id','name','Cellulare'),'order'='Client.name ASC'))); $this-layout = 'ajax'; } I have made the autocomplete.ctp ul ?php foreach($clients as $client): ? li?php echo $client['Client']['name']; ?/li ?php endforeach; ? /ul and in the view: echo $ajax-autoComplete('Client.name', '/clients/autoComplete',array ('label' = 'Nome e Cognome Cliente')); Does anyone suggest me how to monitor the change of that field, and fill the correct idden field with the id? Best Regards Franco Tampieri --~--~-~--~~~---~--~~ 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: Installing CakePHP to mediatemple(dv) issue
The issue was the server wasn't supporting PHP --~--~-~--~~~---~--~~ 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 and field of more words
I'm having some trouble figuring out what the problem is here. Could you clarify why you want a variable name with spaces? On Wed, May 27, 2009 at 4:28 PM, fain182 fain...@gmail.com wrote: $this-set uses camel casing so: $post of the month becomes : $postOfTheMonth Hope this helps yes, it helps.. in cakebook ( http://book.cakephp.org/view/189/Automagic-Form-Elements ) says: In your controller, set a camelCase plural variable (group - groups in this case, or ExtraFunkyModel - extraFunkyModels) with the select options. this is not the camelize in Inflector::camelize, because with camelize would make singular and first letter capitalized.. for example.. name: post of the month camelized: PostOfTheMonth camelized + pluralized: PostOfTheMonths camelized + pluralized + first letter in lowercase: postOfTheMonths and this should be the code: $field = Inflector::pluralize(Inflector::camelize($field)); $field = low($field{0}).substr($field, 1); $this-set($field, $a); but it works only for field that doens't contains space... someone can help me find the right name to give to set in order to have a select? thank you! -- pietro --~--~-~--~~~---~--~~ 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: Forms with math computations and multiple buttons
Isn't the number helper the equivalent of number_format()? How can I format the computed values coming from my component? part of my controller code: $this-data['Model']['field'] = $this-component-function($salary). '.00'; If you notice the . '.00' I have in my code above, I'm having problems with formatting the computed values in a money format. For the meantime, I'm concatenating the result with the decimal point. But I want to format it properly. I've tried to use the number helper and I've searched through the net about this, but I can't get enough information. brian-263 wrote: I'm not sure what you mean. sprintf()? http://www.php.net/manual/en/function.sprintf.php -- View this message in context: http://www.nabble.com/Forms-with-math-computations-and-multiple-buttons-tp23718059p23753775.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: How do I bake pre-existing tables with non-conforming names?
Any updates on this? On Tue, May 26, 2009 at 1:41 PM, Jorge Garifuna garif...@gmail.com wrote: I have a few database tables that were created several years ago and are now heavily dependent upon for pre-existing components. I would like to use cakePHP to bake a portion of the application to make publically available. My issues is that the command cake bake all is failing the create the models because the plural name of the table does not exist. These pre-existing tables use singular names and the primary fields names is prefixed with the table names (eg: table user, primary key user_id). Below is a simplified listing of some of these tables: CREATE TABLE IF NOT EXISTS `user` ( `user_id` INT(10) NOT NULL AUTO_INCREMENT , `login` VARCHAR(25) NOT NULL , `password` VARCHAR(50) NOT NULL , `active` TINYINT(1) UNSIGNED NULL DEFAULT 0 , PRIMARY KEY (`user_id`) ); CREATE TABLE IF NOT EXISTS `video_item` ( `video_item_id` INT(10) NOT NULL AUTO_INCREMENT , `title` VARCHAR(255) NOT NULL , `icon_image` VARCHAR(255) NULL , `video_file` VARCHAR(255) NULL , `description` TEXT NULL , `active` TINYINT(1) NULL , PRIMARY KEY (`video_item_id`) ); CREATE TABLE IF NOT EXISTS `video_comment` ( `video_comment_id` INT(10) NOT NULL AUTO_INCREMENT , `video_item_id` INT(10) NOT NULL , `subject` VARCHAR(255) NOT NULL , `comment` TEXT NOT NULL , PRIMARY KEY (`video_comment_id`) ); As you can see the names and primary keys of these tables are: user/user_id, video_item/video_item_id and video_comment/ video_comment_id and cake bake expects them to be: users/id, video_items/id and video_comments/id Since these tables are already used internally within other systems, it would be very time consuming to review all the dependencies within the existing systems to make them conform to cakePHP naming convention. Is there a way to use the command cake bake all with some minor tweaking so that the models, controllers and views are created with the existing name of the tables? Any assistance would be greatly appreciated. Jorge -- Jorge Garifuna Professional Web Developer Your Web Solution Partner Garinet Media Network, LLC. 811 Wilshire Blvd. Suite 1705 Los Angeles, CA 90017 http://www.GariDigital.com Business Operating Hours: Monday - Friday: 9AM - 6 PM PST --~--~-~--~~~---~--~~ 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: Moving a webapp from Windows to Linux
Hello Brian Here's how I have defined CORE_PATH if (!defined('CAKE_CORE_INCLUDE_PATH')) { //define ('CAKE_CORE_INCLUDE_PATH', FULL PATH TO DIRECTORY WHERE CAKE CORE IS INSTALLED'); //You should also use the DS define to seperate your directories define('CAKE_CORE_INCLUDE_PATH', DS.'webapp'.DS.'code'.DS.'app_name'.DS.'cake'); } if (!defined('CORE_PATH')) { if (function_exists('ini_set')) { ini_set('include_path', CAKE_CORE_INCLUDE_PATH . PATH_SEPARATOR . ROOT . DS . APP_DIR . DS . PATH_SEPARATOR . ini_get('include_path')); define('APP_PATH', null); define('CORE_PATH', null); } else { define('APP_PATH', ROOT . DS . APP_DIR . DS); define('CORE_PATH', CAKE_CORE_INCLUDE_PATH . DS); } } Thanks and Regards Vikram On May 28, 4:52 am, brian bally.z...@gmail.com wrote: It looks like you've set the path somewhere with a semi-colon too many. htaccess, maybe? The value from ini_get('include_path') seems to have a semi-colon prepended. No, wait--you've got 2 colons separated by a period. Am I reading that correctly? What does the block starting with if (!defined('CORE_PATH')) { in webroot/index.php look like? On Wed, May 27, 2009 at 1:58 AM, ShiVik vikramvmalhotra1...@gmail.com wrote: Hello there This is the error that I am getting. Failed opening required 'cake/bootstrap.php' (include_path='/webapp/ code/app1/cake:/webapp/code/app1/:.:/opt/lampp/lib/php') in /var/www/ webapp/htdocs/index.php on line 88 Thanks and Regards Vikram On May 27, 2:52 pm, Braindead markus.he...@gmail.com wrote: Are you sure that your problem is related to the PATH_SEPARATOR? I guess they use the constant PATH_SEPARATOR to make it work on Windows and Linux without having to worry about that. I also develop on Windows using XAMPP and my production server is on Linux. I never had that kind of problems. --~--~-~--~~~---~--~~ 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: Moving a webapp from Windows to Linux
What about your path? Have you set that somewhere? The part where it has: APP_DIR . DS . PATH_SEPARATOR . ini_get('include_path') is translating to: '/webapp/code/app1/:.:/opt/lampp/lib/php' So, it seems that your include path is set with extra ':.' at the beginning. Check the output of ini_get('include_path') to see. On Wed, May 27, 2009 at 10:02 PM, ShiVik vikramvmalhotra1...@gmail.com wrote: Hello Brian Here's how I have defined CORE_PATH if (!defined('CAKE_CORE_INCLUDE_PATH')) { //define ('CAKE_CORE_INCLUDE_PATH', FULL PATH TO DIRECTORY WHERE CAKE CORE IS INSTALLED'); //You should also use the DS define to seperate your directories define('CAKE_CORE_INCLUDE_PATH', DS.'webapp'.DS.'code'.DS.'app_name'.DS.'cake'); } if (!defined('CORE_PATH')) { if (function_exists('ini_set')) { ini_set('include_path', CAKE_CORE_INCLUDE_PATH . PATH_SEPARATOR . ROOT . DS . APP_DIR . DS . PATH_SEPARATOR . ini_get('include_path')); define('APP_PATH', null); define('CORE_PATH', null); } else { define('APP_PATH', ROOT . DS . APP_DIR . DS); define('CORE_PATH', CAKE_CORE_INCLUDE_PATH . DS); } } Thanks and Regards Vikram On May 28, 4:52 am, brian bally.z...@gmail.com wrote: It looks like you've set the path somewhere with a semi-colon too many. htaccess, maybe? The value from ini_get('include_path') seems to have a semi-colon prepended. No, wait--you've got 2 colons separated by a period. Am I reading that correctly? What does the block starting with if (!defined('CORE_PATH')) { in webroot/index.php look like? On Wed, May 27, 2009 at 1:58 AM, ShiVik vikramvmalhotra1...@gmail.com wrote: Hello there This is the error that I am getting. Failed opening required 'cake/bootstrap.php' (include_path='/webapp/ code/app1/cake:/webapp/code/app1/:.:/opt/lampp/lib/php') in /var/www/ webapp/htdocs/index.php on line 88 Thanks and Regards Vikram On May 27, 2:52 pm, Braindead markus.he...@gmail.com wrote: Are you sure that your problem is related to the PATH_SEPARATOR? I guess they use the constant PATH_SEPARATOR to make it work on Windows and Linux without having to worry about that. I also develop on Windows using XAMPP and my production server is on Linux. I never had that kind of problems. --~--~-~--~~~---~--~~ 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: Forms with math computations and multiple buttons
OK, I understand. Why don't you use the currency method? http://api.cakephp.org/class/number-helper#method-NumberHelpercurrency You might want to override the defaults with the $options array if you don't want a dollar sign, etc. Note that the comment for format() method (Formats a number into a currency format.) is bogus. That's just been copied from currency(). On Wed, May 27, 2009 at 9:30 PM, espontaneo acohln...@gmail.com wrote: Isn't the number helper the equivalent of number_format()? How can I format the computed values coming from my component? part of my controller code: $this-data['Model']['field'] = $this-component-function($salary). '.00'; If you notice the . '.00' I have in my code above, I'm having problems with formatting the computed values in a money format. For the meantime, I'm concatenating the result with the decimal point. But I want to format it properly. I've tried to use the number helper and I've searched through the net about this, but I can't get enough information. brian-263 wrote: I'm not sure what you mean. sprintf()? http://www.php.net/manual/en/function.sprintf.php -- View this message in context: http://www.nabble.com/Forms-with-math-computations-and-multiple-buttons-tp23718059p23753775.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 -~--~~~~--~~--~--~---
Blog tutorial - I get a blank page
Hi, I'm trying to get through the blog tutorial, and trying to view my first page at: http://server/post/index but I'm getting a blank page. I'm sure the rewrite engine's working correctly because if I try to access a nonexistent controller, such as: http://server/blah/index I get the appropriate error: Missing Controller - so this tells me it's finding the controller ok. But somehow it's not displaying index.ctp which I have confirmed is in: /app/view/posts/ When I view source on the page, I get nothing - not even a default layout, or even an HTML tag. It's just blank (in Firefox - just checked in it IE and I get Internet Explorer cannot display the webpage) I can reach the main cakephp page without any problems, it displays images and css and gives me the green light to proceed (database is configured, etc...) I've also confirmed that the permissions of /app/tmp are drwxrwxr-x and that it's in the same group as the web server. Without any error message at all, I'm at a complete loss as to how to debug this thing. debug setting in /app/config/core.php is at 2, so it should be barking at me if I've done something wrong. Anyone have a clue as to what to do next? -Charlie --~--~-~--~~~---~--~~ 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: Moving a webapp from Windows to Linux
Hello Brian I checked the include_path...its value is .:/opt/lampp/lib/php. Please tell me if I am wrong. It seems like the PATH_SEPARATOR in linux is a colon. If that is the case, then there is no problem in setting of paths I think. I have set the user permissions for all the files to read, write and execute for all users and groups. What else could be the issue? Thanks and Regards Vikram On May 28, 12:07 pm, brian bally.z...@gmail.com wrote: What about your path? Have you set that somewhere? The part where it has: APP_DIR . DS . PATH_SEPARATOR . ini_get('include_path') is translating to: '/webapp/code/app1/:.:/opt/lampp/lib/php' So, it seems that your include path is set with extra ':.' at the beginning. Check the output of ini_get('include_path') to see. On Wed, May 27, 2009 at 10:02 PM, ShiVik vikramvmalhotra1...@gmail.com wrote: Hello Brian Here's how I have defined CORE_PATH if (!defined('CAKE_CORE_INCLUDE_PATH')) { //define ('CAKE_CORE_INCLUDE_PATH', FULL PATH TO DIRECTORY WHERE CAKE CORE IS INSTALLED'); //You should also use the DS define to seperate your directories define('CAKE_CORE_INCLUDE_PATH', DS.'webapp'.DS.'code'.DS.'app_name'.DS.'cake'); } if (!defined('CORE_PATH')) { if (function_exists('ini_set')) { ini_set('include_path', CAKE_CORE_INCLUDE_PATH . PATH_SEPARATOR . ROOT . DS . APP_DIR . DS . PATH_SEPARATOR . ini_get('include_path')); define('APP_PATH', null); define('CORE_PATH', null); } else { define('APP_PATH', ROOT . DS . APP_DIR . DS); define('CORE_PATH', CAKE_CORE_INCLUDE_PATH . DS); } } Thanks and Regards Vikram On May 28, 4:52 am, brian bally.z...@gmail.com wrote: It looks like you've set the path somewhere with a semi-colon too many. htaccess, maybe? The value from ini_get('include_path') seems to have a semi-colon prepended. No, wait--you've got 2 colons separated by a period. Am I reading that correctly? What does the block starting with if (!defined('CORE_PATH')) { in webroot/index.php look like? On Wed, May 27, 2009 at 1:58 AM, ShiVik vikramvmalhotra1...@gmail.com wrote: Hello there This is the error that I am getting. Failed opening required 'cake/bootstrap.php' (include_path='/webapp/ code/app1/cake:/webapp/code/app1/:.:/opt/lampp/lib/php') in /var/www/ webapp/htdocs/index.php on line 88 Thanks and Regards Vikram On May 27, 2:52 pm, Braindead markus.he...@gmail.com wrote: Are you sure that your problem is related to the PATH_SEPARATOR? I guess they use the constant PATH_SEPARATOR to make it work on Windows and Linux without having to worry about that. I also develop on Windows using XAMPP and my production server is on Linux. I never had that kind of problems. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---