Re: Search
Thanks Issac for the reply.. Let me ask one more thing that, I need to use different tables (like user, potentail user, and subscribed user ), for the functionality. Is it possible with your solution ? If so how can i do it.. Can you give me an example (code) for that .? On Tue, Jul 21, 2009 at 7:42 AM, Isaac Raja isaacr...@gmail.com wrote: Hi bino dev, since you are using a searches controller, and you are using a line like this $data = $this-Search-findAll($sql , NULL, $order, $limit, $page); you need to create a Search model.(with searches table) Actually it is not necessary to create searches controller and its view. you need to include a search method in the controller which you want to search. For example, if you want to seach the products table, create a method search in products controller and a model Product. Thanks Isaac Raja On Tue, Jul 21, 2009 at 2:35 AM, bino dev biy@gmail.com wrote: Hi, Please help me. Friends i need to create one search page, its searching with company , first name, lastname, email i created the view , controller for the functionality. Do i need to create any model for it. Iam getting the error if there is no model in it.If i need to create the model , what should be the $name in the model. searchs_controller.php ( http://bin.cakephp.org/view/243917622 ) ?php class SearchsController extends AppController { //var $uses = array('search'); var $name = 'Search'; var $useTable = false; function admin_index() { if(isset($this-params['url']['data'])) { echo $this-params['url']['data']['searchs']['first_name']; echo $this-params['url']['data']['searchs']['last_name']; echo $this-params['url']['data']['searchs']['company']; echo $this-params['url']['data']['searchs']['email']; echo $this-params['url']['data']['searchs']['phone']; echo $this-params['url']['data']['searchs']['address']; $datass = user.status = 1 ; if($this-params['url']['data']['searchs']['first_name'] !='') { $datass .= and user.first_name like '%.$this-params['url']['data']['searchs']['first_name'].%'; } if($this-params['url']['data']['searchs']['last_name'] !='') { $datass .= and user.last_name like '%.$this-params['url']['data']['searchs']['last_name'].%'; } if($this-params['url']['data']['searchs']['email'] !='') { $datass .= and user.email like '%.$$this-params['url']['data']['searchs']['email'] .%'; } //list($order,$limit,$page) = $this-Pagination-init($datass); //pr($this-params); $sql = array('conditions' = array($datass), 'recursive' = 1 , 'fields' = array('Search.username, Search.first_name, Search.last_name, Search.email, Search.status, Search.created, Search.modified'), 'order' = array( 'Search.created DESC'), 'limit' = $limit, 'page' = $page ); } $data = $this-Search-findAll($sql , NULL, $order, $limit, $page); $this-set('userdetails', $data); } } ? view page http://bin.cakephp.org/view/311196886 ?php $this-setLayout('admin'); ? script type=text/javascript jQuery(document).ready(function($) { $('.roundbox').hover( function(){$('.roundbox ul').show();}, function(){$('.roundbox ul').hide();} ); }); /script style #sidebar { background-color: white; position: absolute; top: 84px; right: 20px; z-index: 999; } .roundbox ul { display: none; } #main { width: 100%; padding-top:15px; } /style div id=sidebar div class=roundbox h2Sub Menu/h2 ul class=actions linbsp;/li li?php echo $html-link('Export current items in CSV format', '/admin/potential_suppliers/export'); ?/li linbsp;/li /ul /div /div div id=main h2List Potential Suppliers/h2 br / ?php //$pagination-setPaging($paging); // echo ($filter-setFiltering($filters)); ? form action= method=get class=uniForm table border=0 tr td?php echo $form-labelTag('searchs/first_name', 'First Name');?/td td ?php echo $html-input('searchs/first_name', array('size'='35','class'='textInput'));? ?php echo $html-tagErrorMsg('searchs/first_name', 'Please enter first_name.');? /td td ?php echo $form-labelTag('searchs/last_name', 'Last Name');? /td td?php echo $html-input('searchs/last_name', array('size'='35','class'='textInput'));? ?php echo $html-tagErrorMsg('searchs/last_name', 'Please enter Last Name');? /td tr td ?php echo $form-labelTag('searchs/company', 'Company Name');? /td td ?php
Re: Model question
no, but yes. Have a model, but in it set var $useTable = false; On Jul 21, 3:55 pm, Binoy binoy...@gmail.com wrote: Is it possible to create a new functionlity without model ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
set the selected value in dropdown
HI i have a form with dropdown for selecting the industry which i have populated. but in the modify form, i need to set the selected value which is come from the database. this is the code that i have written in the view ?php echo $form-select('industry',array($industry),*$industry*,array(),'Select Industry'); ? array($industry) - list of values which is displaying in the drop down how do i go about setting the value in the dropdown. $form-select( $fieldName, $options = array ( ), $selected =NULL, $attributes = array ( ), $showEmpty = '' ) -- Regards Pradheep Ayyanar [PraDz] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the 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 confusion
I have solved my problem. Basically I changed my code from $advertisers = $this-paginate('TblDetail', array ('TblDetail.ap_advertiser LIKE'=%.$searchstr.%)); to $advertisers = $this-paginate($this-TblDetail-TblAdCategory, array ('TblDetail.ap_advertiser LIKE'=%.$searchstr.%)); and I got the result I was looking for. On Jul 20, 9:46 pm, stevel isig...@gmail.com wrote: Been trying to make sense of HABTM relationship. Hope someone could help throw some light on this. I have the following models defined: class TblCategory extends AppModel { var $name = 'TblCategory'; var $hasAndBelongsToMany = array('TblDetail'=array( 'className' = 'TblDetail', 'joinTable' = 'tbl_ad_categories', 'with' = 'TblAdCategory', 'foreignKey' = 'tbl_category_id', 'associationForeignKey' = 'tbl_detail_id' )); } class TblDetail extends AppModel { var $name = 'TblDetail'; var $hasAndBelongsToMany = array('TblCategory'=array( 'className' = 'TblCategory', 'joinTable' = 'tbl_ad_categories', 'with' = 'TblAdCategory', 'foreignKey' = 'tbl_detail_id', 'associationForeignKey' = 'tbl_category_id' )); } class TblAdCategory extends AppModel { var $name = 'TblAdCategory'; var $belongsTo = array('TblDetail','TblCategory'); } In my controller I have the following statement: $advertisers = $this-paginate('TblDetail', array ('TblDetail.ap_advertiser LIKE'=%.$searchstr.%)); where $searchstr is merely a value passed in from a form. When I do a pr($advertisers) it shows the [TblDetail] Array as expected. But the associated [TblCategory] shows an empty array even though there is related TblCategory records. Been trying to figure out where I have gone wrong. How do I get the associated TblCategory record as well? Any help is greatly appreciated. Thanks. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: set the selected value in dropdown
Just set $this-data in controller to record data you will modify and Cake will set 'selected' and other values itself. On Jul 21, 1:50 pm, Pradheep Ayyanar mapradh...@gmail.com wrote: HI i have a form with dropdown for selecting the industry which i have populated. but in the modify form, i need to set the selected value which is come from the database. this is the code that i have written in the view ?php echo $form-select('industry',array($industry),*$industry*,array(),'Select Industry'); ? array($industry) - list of values which is displaying in the drop down how do i go about setting the value in the dropdown. $form-select( $fieldName, $options = array ( ), $selected =NULL, $attributes = array ( ), $showEmpty = '' ) -- Regards Pradheep Ayyanar [PraDz] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the 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: call function from .ctp file in cakephp1.2
Issac is right. In General: Use requestAction and Elements Use an existing Cake Helper Create a custom Helper On Jul 21, 4:05 am, Isaac Raja isaacr...@gmail.com wrote: Please mention what you are trying to achieve; we can find a better way to do it. Isaac On Tue, Jul 21, 2009 at 2:49 AM, Marcelo Andrade mfandr...@gmail.comwrote: On Mon, Jul 20, 2009 at 2:02 AM, liyakat Aliali786...@gmail.com wrote: i need to call function from .ctp file. And function is defined in App Controller. is it possible. As Pixelastic and Rob both said, if you have to call some method in your view, this method is best suited to be placed in a helper and not in your controller. Check this out: http://book.cakephp.org/view/101/Creating-Helpers Best regards. -- MARCELO DE F. ANDRADE Belem, PA, Amazonia, Brazil Linux User #221105 http://mfandrade.wordpress.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: set the selected value in dropdown
thanks On Tue, Jul 21, 2009 at 12:52 PM, Dr. Loboto drlob...@gmail.com wrote: Just set $this-data in controller to record data you will modify and Cake will set 'selected' and other values itself. On Jul 21, 1:50 pm, Pradheep Ayyanar mapradh...@gmail.com wrote: HI i have a form with dropdown for selecting the industry which i have populated. but in the modify form, i need to set the selected value which is come from the database. this is the code that i have written in the view ?php echo $form-select('industry',array($industry),*$industry*,array(),'Select Industry'); ? array($industry) - list of values which is displaying in the drop down how do i go about setting the value in the dropdown. $form-select( $fieldName, $options = array ( ), $selected =NULL, $attributes = array ( ), $showEmpty = '' ) -- Regards Pradheep Ayyanar [PraDz] -- Regards Pradheep Ayyanar [PraDz] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the 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 views in cake folder are used over my app views
Works for me. On Jul 20, 6:50 pm, MikeBates d...@opskwan.com wrote: I am trying to customise my error views, and have copied the .ctp files from the cake folder to my app/views/errors folder. But the .ctp files in cake/lib/views/errors/ are still being used. I don't want to delete (or change) anything in the cake folder, so how can I get cake to use my errors views instead? Thanks, Mike -- View this message in context:http://www.nabble.com/Error-views-in-cake-folder-are-used-over-my-app... 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: can I get the info of user in a model?
check this out: http://github.com/mcurry/cakephp_static_user/tree/master On 21 Jul., 06:32, Rimoe meiyo...@gmail.com wrote: hi, everyone! I have use ($this-Auth-user()) to get the log in info in controller. but now I want to get the info of user in a model. because the method of model has been used in many controller, change the method has became a big work, can I get the info of user in a model.php? thank you very much! rimoe --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
$_POST and Auth encryption
Hello all :) I need your help for another one time :) I'm creating an Application with CakePHP and ExtJS. The problem that I have is that the ExtJS send the Data to CakePHP with the $_POST http methos and when I save new users to my database the password is not hashed with the default Auth hash method. How can I encrypt my password ? ? ? Kind regards Merianos Nikos --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: $_POST and Auth encryption
Hello, I need your help for another one time :) I'm creating an Application with CakePHP and ExtJS. The problem that I have is that the ExtJS send the Data to CakePHP with the $_POST http methos and when I save new users to my database the password is not hashed with the default Auth hash method. How can I encrypt my password ? ? ? Not sure if that's what you mean, but try: http://book.cakephp.org/view/386/password Regards, Piotr --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: $_POST and Auth encryption
This is the answer ! :) Thanks a lot :) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Simple cakePHP login authentication
Issac, I done that example. http://www.studiocanaria.com/articles/cakephp_auth_component_users_groups_permissions_revisited i have few doubts, how do i create main page with logout. i have placed this line in app_controller.php $this-Auth-loginRedirect = '/posts'; and, created index.ctp in posts folder and posts_controller.php Actual learning is i would like to merge blog post and login authntication aplication to single sample application Any great tips Regards, Dhileep --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
how to delete data main and from tables in single call
hy let have a example i have table tags model Tag table contenttags and model Contenttag table catgorytags and model Catgorytag in model Tag var $hasMany = array( 'Contenttag' = array('className' = 'Contenttag', 'foreignKey' = 'tag_id', ), 'Categorytag' = array('className' = 'Categorytag', 'foreignKey' = 'tag_id', ), 'Contenttypetag' = array('className' = 'Contenttypetag', 'foreignKey' = 'tag_id', ) ); other Contenttag categoryTag are like class Contenttag extends AppModel{ var $belongsTo = array('Tag'); } now i want to delete record form tag table which should also be delete from contenttag and categorytag. what should i do ? for this. should i need to define the dependent table as well --~--~-~--~~~---~--~~ You received this message because you are subscribed to the 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: Session/Cookie problem with Facebook JS + PHP
Something is wrong removing localhost from your hosts file may have a negative impact on any applications that expect localhost, a de facto standard, to be the local loopback address. Besides that it should not affect cookies from another domain. Although the two may be related, I don't think you should declare victory yet. On Jul 20, 2:19 am, eric.winch...@gmail.com eric.winch...@gmail.com wrote: The bad news is I am an idiot. The good news is the solution is to not use LOCALHOST. I changed C: \Windows\System32\drivers\etc\hosts 'localhost' to 'localhost.com' and Facebook cookies work the way they should. On Jul 19, 11:12 pm, eric.winch...@gmail.com eric.winch...@gmail.com wrote: More information: I checked to be sure Facebook is instantiating correctly. I think CakePHP is preventing the Facebook class from getting the cookie data. Facebook::get_valid_fb_params() tries to access $_COOKIE but the only thing in there is $_COOKIE['CAKEPHP'] There is a weird fix on the FB Wiki but tricking Cake to use Facebook's session seems like the wrong thing to do. Given this problem, I don't understand how this works:http://cutfromthenorth.com/integrating-facebook-connect-with-cakephps... On Jul 19, 4:02 pm, eric.winch...@gmail.com eric.winch...@gmail.com wrote: I'm attempting to use Facebook Connect with its PHP library. fb:login-button onlogin=update_login_box()/fb:login-button That gets the user logged in ok but then using the PHP libs: $facebook-get_loggedin_user() is always NULL. Anyone run into this? I'm wondering if it has something to do with Cake taking over the sessions and cookies. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the 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: Auth Component - Password empty - Try to make a change password page
Reset Passwords in CakePHP http://edwardawebb.com/programming/php-programming/cakephp/reset-lost-passwords-cakephp On Jul 20, 1:24 pm, brian bally.z...@gmail.com wrote: I've never had problems with this but there's lots of info online: http://www.google.com/search?source=ighl=enrlz=1G1GGLQ_ENUS271=q=... On Mon, Jul 20, 2009 at 7:10 AM, Pascal Messanakinglo...@gmail.com wrote: Hi! I am trying to make a page where users can change their password. The user has to insert the actual password and the new password in form inputs, then submit the form. Then, I want to compare the submitted password and the real password (the one in the database). I try to get the real password through the Auth component : $real_password = $this-Auth-user('password'); But it is empty! So, how can I get the password of a member ? I also tried to directly make a query through the model, but again it is still empty. Maybe I can try to use the Auth-login() method with the password submitted and see what it returns, but it seems dirty. Or in the worst case I could make a direct query to get the password, through the controller method query(), but again this is dirty. Any idea ? Thank you --~--~-~--~~~---~--~~ You received this message because you are subscribed to the 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: Session/Cookie problem with Facebook JS + PHP
I agree. A better way would be to stage your application with myapp.com (or whatever name you want), and set that in your hosts file. You'll need to adjust your Facebook App setting and your apache configuration to reflect this change. On Jul 21, 6:56 pm, Smelly Eddie ollit...@gmail.com wrote: Something is wrong removing localhost from your hosts file may have a negative impact on any applications that expect localhost, a de facto standard, to be the local loopback address. Besides that it should not affect cookies from another domain. Although the two may be related, I don't think you should declare victory yet. On Jul 20, 2:19 am, eric.winch...@gmail.com eric.winch...@gmail.com wrote: The bad news is I am an idiot. The good news is the solution is to not use LOCALHOST. I changed C: \Windows\System32\drivers\etc\hosts 'localhost' to 'localhost.com' and Facebook cookies work the way they should. On Jul 19, 11:12 pm, eric.winch...@gmail.com eric.winch...@gmail.com wrote: More information: I checked to be sure Facebook is instantiating correctly. I think CakePHP is preventing the Facebook class from getting the cookie data. Facebook::get_valid_fb_params() tries to access $_COOKIE but the only thing in there is $_COOKIE['CAKEPHP'] There is a weird fix on the FB Wiki but tricking Cake to use Facebook's session seems like the wrong thing to do. Given this problem, I don't understand how this works:http://cutfromthenorth.com/integrating-facebook-connect-with-cakephps... On Jul 19, 4:02 pm, eric.winch...@gmail.com eric.winch...@gmail.com wrote: I'm attempting to use Facebook Connect with its PHP library. fb:login-button onlogin=update_login_box()/fb:login-button That gets the user logged in ok but then using the PHP libs: $facebook-get_loggedin_user() is always NULL. Anyone run into this? I'm wondering if it has something to do with Cake taking over the sessions and cookies. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the 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 -~--~~~~--~~--~--~---
Get current database host?
Hi there, Is is possible to read the current database host programmatically (i.e. the value of $default['host'] from database.php)? Thanks, Toby --~--~-~--~~~---~--~~ You received this message because you are subscribed to the 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: Multiples lists of different tables :S
Thank you 3lancer.eu that's solves my problem =) My next step is to generate : 1- xml or 2-json from the database records . i tried to do so ,and i succeeded , but i think the cakePHp generate a non standard JSON format . 4 example (JSON) ,from my categories table : it generated like this !!! [{Category:{id:1,name:CSS}},{Category: {id:2,name:XHTML}},{Category:{id:3,name:JQUERY}}] I guess this is not the correct forme of a JSON file !! Even parsing it with jquery is quite hard due to the incorrect format !! I also tried with xml and i get a valid xml format but to make the parsing code with jquery work in IE6 FF is impossible so , I'm pretty sure that JSON will be my lonely solution . How can I generate A valid JSON Format with JQUERY (AGAIn I tried alost all the tutorials on the web ,but still without solution :S ) Thx Again On Jul 14, 8:34 pm, 3lancer.eu kilc...@gmail.com wrote: Hello, Actually I have 4 tables in my database : 1-comments 2-posts 3-categories 4-work And i have a lonely page : default.php (my web site is juste 1 page ). which is located in my webSite Root. Any reason not to follow the Cake MVC pattern / file structure? So i want to get all the tables records in my page(default.php) ,all my models r working ,my controllers as well . The problem is i want to show all my tables records in the same page , how can i do that without being forced to use every view of every model (table) . If I understand your goal right, you can always instantinate/import models (using App::import('model', ...)) in any controller action and just pass results to the views. Even better would be to add all 4 model names to the controller var $uses array, then you can just use: $this-Comment-find $this-Post-find $this-Categories-find etc. Of course in case of relationships you can usually do it with even less code. Regards, Piotr --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Catch stored procedure error
Hi, i want to know if its possible to catch stored procedure error? i would like to rollback on error... $this-query('call sp_CustomersProduct_addProductsByFamily(?,?)',array (1,1); should i return a value on succes? thank you --~--~-~--~~~---~--~~ You received this message because you are subscribed to the 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: Get current database host?
Hello, Is is possible to read the current database host programmatically (i.e. the value of $default['host'] from database.php)? Why not just use DATABASE_CONFIG::$default ? :) However, each Model instance will have the following method: http://api.cakephp.org/class/model#method-ModelgetDataSource which should be better for you. I didn't use that yet, though. Regards, Piotr --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Multiples lists of different tables :S
Hello, How can I generate A valid JSON Format with JQUERY (AGAIn I tried alost all the tutorials on the web ,but still without solution :S ) But how do you want your JSON/XML to look like? I guess you don't like having 'Category' as a key, but pls supply us some examples of the desired format. Regards, Piotr --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Cake validating fields it shouldn't be
Try adding 'allowEmpty' = true to each of the rules. Rick On Jul 20, 9:38 am, blake blake.jor...@gmail.com wrote: Any possible ideas anyone? On Jul 17, 10:17 am, blake blake.jor...@gmail.com wrote: Hello, For one of my models, I have this (among other) validation requirements: 'fee' = array( 'gt_0' = array( 'rule' = array('comparison', '=', 0), 'message' = 'Please enter a valid fee (eg. $100.00)' ), 'number' = array( 'rule' = 'numeric', 'message' = 'Please enter a valid fee (eg. $100.00)' ) ), I have a couple of different edit screens for this model, one of which asks for the 'fee' field, one does not. On the screen that does not ask, the field is not in the $this-data array anywhere before calling Model-save(). However, validation is failing for some reason on that field. Is there a reason for this? When the model is being created initially, and the 'fee' field is still not specified, validation passes and it creates successfully. This only happens on an update. Any way around this? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Session between controllers. Works only in FF.
Hello everybody, I have spent more then a day on this issue and still no solution :( I am working on my first cake based project and i have a session problem. Currently using php session, security level low, session name is CAKEPHP. Check agent = false. In FF everithing works fine, but in other browsers (IE, Safari, Opera tested so far) the session is not available between controllers. Ex: I login and i get redirected to the /home page From here i go to the /example page and the session is empty. I go back to /home and the session is there. I have also tested, database session, cakephp session and still the same prblem. This happens in every browser except FF. Help pls I am running out of time :(. Tibor. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the 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 -~--~~~~--~~--~--~---
404 Header
Hello Guys, i have a problem with my CakePHP app where the client needs me to return a valid 404 page together with a valid 404 http header incase of page not found, i have handled the 404 page through app_error but the problem is when i execute ( curl -I http://www.example.com/sdfsdfas ) on my debian box it keeps returning ( 302 Page Found ) instead of ( 404 Page Not Found) , anyone faced something like this, and if any, would you please explain how you solve it? Thanks a lot. MHA -- http://phpirate.net --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Pagination add parameter to type of find to the url
Hi I use pagination in a my view , in the relative action of controller I use the find('matches') that Nate has shared in bakery. Now in the view in helper paginator is added a matches parameter to the url. Is It possible to eliminate this from the url that is created by pagination helper? Many Thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Get current database host?
In model: $this-getDataSource()-config['host'] On Jul 21, 7:15 pm, toby1kenobi toby.math...@gmail.com wrote: Hi there, Is is possible to read the current database host programmatically (i.e. the value of $default['host'] from database.php)? Thanks, Toby --~--~-~--~~~---~--~~ You received this message because you are subscribed to the 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 -~--~~~~--~~--~--~---
IE7 form submission with array fields
I'm not sure this is specific to cakePHP, but has anyone encountered an issue with IE7 where it truncates an array-like form field? Basically, I have a dynamic form using javascript that allows an arbitrary number of fields, all named the same (prices.0.price, prices. 1.price, etc). Whenever I submit the form in IE7, it seems to only take the first and last field, and drops everything in between. So if I have 4 fields, $this-data will show up with only fields 0 and 3. Is there a fix for this that anyone knows about or has anyone found a way around it? FF, IE8, Chrome, Safari all work just fine. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the 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: MISSING TABLE
What is on line 453 in your version of \cake\dispatcher.php? What is context of this error? Most likely missing table error is not real but just caused by previous one. On Jul 21, 4:58 pm, biancmb mauro.bertolo...@gmail.com wrote: Guys, I am trying hard to make CakePHP work. I have followed all instructions. Official docs and other guides. The cake page renders fine. Triple-checked models and controllers, config files, etc. Still getting the missing table.. message. Already tried to delete the ceche files, etc. What is left to do? Am I missing anything? The web seems to be inundated by people like me, all getting the same error message. I'd love to work with cakePHP, I believe it's a valid alternative to RoR and plain PHP, which I have been using for a while. I am comfortable with sysadmin, apache, mysql, linux, windows, php, etc. I am now using XAMPP on WindowsXP. But I get the same message under easyphp. I will try on my linuxbox at home as soon as I get the chance. output ofhttp://localhost/prod/ Your tmp directory is writable. The FileEngine is being used for caching. To change the config edit APP/config/core.php Your database configuration file is present. Cake is able to connect to the database. output ofhttp://localhost/prod/fams Notice (8): Use of undefined constant Fams - assumed ' Fams ' [CORE \cake\dispatcher.php, line 453] Missing Database Table Error: Database table fams s for model Fams was not found. Notice: If you want to customize this error message, create app\views \errors\missing_table.ctp controller fams_controller.php ?php class FamsController extends AppController { var $name = ‘Fams’; var $scaffold;} ? -model fam.php ?php class Fam extends AppModel { var $name = ‘Fam’;} ? Note the DB contains a table named fams What is wrong? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Get current database host?
Great, thanks Piotr and Dr, that was what I was after! Toby On Jul 21, 3:37 pm, Dr. Loboto drlob...@gmail.com wrote: In model: $this-getDataSource()-config['host'] On Jul 21, 7:15 pm, toby1kenobi toby.math...@gmail.com wrote: Hi there, Is is possible to read the current database host programmatically (i.e. the value of $default['host'] from database.php)? Thanks, Toby --~--~-~--~~~---~--~~ You received this message because you are subscribed to the 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 -~--~~~~--~~--~--~---
Locale cakePHP-usersgroup near Cologne / Lokale cakePHP-usersgroup Nähe Köln
Hi, we want to start a local usersgroup here in Cologne, so we are looking for some interested people. Please note, that the following text is therefore written in german: -- Wir entwickeln nun knapp ein Jahr intensiv mit cakePHP und sind nun auf der Suche nach Entwicklern hier in der Umgebung zum Erfahrungs- und Wissensaustausch, Vorstellung eigener Projekte, Forschungen, etc rund um cakePHP. Wir betreiben die Social Comminity Platinnetz (www.platinnetz.de), welche vollständig auf cakePHP gebaut wurde, inkl. aller background- jobs, die mit einer umfangreichen eigenen cake-shell entwickelt wurden. Im Zuge der intensiven Entwicklung konnten wir bereits viel Interna von cake kennenlernen, vieles Nützliche, aber auch einiges Unnütze und auch nicht Verwendbare, sowie gänzlich fehlende Elelmente, was man selber neuschrieb. So haben wir z.B. eine funktionierende MySQL-Master/Slave-Anbindung entwickelt mithilfe einer modifizierten Datasource, die AuthComponent erweitert um den eigenen Passowort-Hash-Mechanismus, eine umfangreiche Cachemechanik und anderes. Dieses Wissen wollen wir nicht im stillen Kämmerchen für uns behalten sondern kundtun, aber auch erfahren, was ihr so gemacht habt. Wer Interesse hat, meldet sich bitte einfach bei uns und wir versuchen mal sowas auf die Beine zu stellen. Schraibt eine Mail an cake...@platinnetz.de Wir freuen uns auf eure Rückmeldung! Schöne Grüße aus Köln, Andreas Hofmann, Olav Schettler Platinnetz GmbH --~--~-~--~~~---~--~~ You received this message because you are subscribed to the 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: Session between controllers. Works only in FF.
Hello, I have spent more then a day on this issue and still no solution :( I am working on my first cake based project and i have a session problem. Currently using php session, security level low, session name is CAKEPHP. Check agent = false. In FF everithing works fine, but in other browsers (IE, Safari, Opera tested so far) the session is not available between controllers. Ex: I login and i get redirected to the /home page From here i go to the /example page and the session is empty. I go back to /home and the session is there. I have also tested, database session, cakephp session and still the same prblem. This happens in every browser except FF. Help pls I am running out of time :(. As a 1st step I'd check how do your cookies look like in Fx, IE etc. Possibly the session id is lost for some reason. Let us know. Regards, Piotr --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Multiples lists of different tables :S
Actually I fixed All that problems related to JSON , I got all my records on the web page via ajax call (That's Perfect). Wot makes things harder in CakePHp is how to select records from a table depending on another one !! ill explain further. I got4 example 2 tables :: 1-Categories 2-Posts I want to get all the posts records whom r in a specific category . let's say that i want all the posts whom r in JQUERY category! thx Agin 4 ur response ,I appreciate Abraham On Jul 21, 12:49 pm, Piotr Kilczuk kilc...@gmail.com wrote: Hello, How can I generate A valid JSON Format with JQUERY (AGAIn I tried alost all the tutorials on the web ,but still without solution :S ) But how do you want your JSON/XML to look like? I guess you don't like having 'Category' as a key, but pls supply us some examples of the desired format. Regards, Piotr --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: 404 Header
Hello, i have a problem with my CakePHP app where the client needs me to return a valid 404 page together with a valid 404 http header incase of page not found, i have handled the 404 page through app_error but the problem is when i execute ( curl -I http://www.example.com/sdfsdfas ) on my debian box it keeps returning ( 302 Page Found ) instead of ( 404 Page Not Found) , anyone faced something like this, and if any, would you please explain how you solve it? Can you paste the complete response (all server headers)? Regards, Piotr --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Database / Relationship question (habtm)
I'm somewhat new to cake, this is my second app and I'm having problems with relationships. The first app I created was pretty straightforward and I had a great time writing it in cake but my database skills aren't up to par with my php! Here goes: I have three tables that contain data which I want to relate, profiles, categories and topics. I created a categories_topics table with category_id and topic_id and that's just fine. However, I want to link the categories and topics to profiles so I created categories_topics_profiles which contains the category_topic_id (from the join table) and the profile_id (to link to the Profiles model) but it's giving me errors when I try to run a simple find. Is this the right way to build the tables or am I missing something? Any help would be GREATLY appreciated. Thanks, -Chris --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
CakePHP - updating models.
Hello all! I'm trying to implement functionality in my CMS system to be able to move up/down items on the list based on position column. Here is my code: public function admin_up($position) { $neighbours = $this-News-find('neighbors', array('position' = $position)); $currentRecord = $this-News-findByPosition($position); $currentRecord = $currentRecord['News']; $previousRecord = $neighbours['prev']['News']; $this-temp = $previousRecord; $this-News-id = $previousRecord['id']; $this-News-position = $currentRecord['position']; $this-News-save(); $this-News-id = $currentRecord['id']; $this-News-position = $this-temp['position']; $this-News-save(); // $this-Session-setFlash(News został przesunięty!); // $this-redirect('index'); } and SQL dump: UPDATE `news` SET `id` = 20, `position` = 23 WHERE `news`.`id` = 20 UPDATE `news` SET `id` = 20, `position` = 23 WHERE `news`.`id` = 20 it invokes bad parametrs in second call. Why? I spent for it 10 hours and still the same results... Please help, I'm getting confused! :S --~--~-~--~~~---~--~~ You received this message because you are subscribed to the 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 -~--~~~~--~~--~--~---
Find conditions
How would I find the newest entry added using the created date? 'conditions' = array( 'Entry.showcase_id' = $showcase_id, 'Entry.created' = not sure how to get the newest??/?), Thanks Dave --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: CakePHP - updating models.
Hello, $this-News-id = $previousRecord['id']; $this-News-position = $currentRecord['position']; $this-News-save(); $this-News-id = $currentRecord['id']; $this-News-position = $this-temp['position']; $this-News-save(); // $this-Session-setFlash(News został przesunięty!); // $this-redirect('index'); I think you'd better use $this-News-saveField() in this case, since you only update 1 field... http://book.cakephp.org/view/75/Saving-Your-Data Pozdrawiam :), Piotr --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Find conditions
Order the resultset by created and limit the result to 1 entry 2009/7/21 Dave Maharaj :: WidePixels.com d...@widepixels.com How would I find the newest entry added using the created date? 'conditions' = array( 'Entry.showcase_id' = $showcase_id, 'Entry.created' = not sure how to get the newest??/?), Thanks Dave --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Pagination
Iam using Cakephp 1.1 My controller code for search.In first page iam getting the search result, but when i click on the next page iam getting full record, ( because it is not getting inside the condition). How can i solve this problem. if(!empty($this-data['PotentialSubscriber']['first_name'])) { $myCond .= and first_name like '.$this-data['PotentialSubscriber']['first_name'].%'; } if(!empty($this-data['PotentialSubscriber']['last_name'])) { $myCond .= and last_name like '.$this-data['PotentialSubscriber']['last_name'].%'; } if (!$cond) { $cond = $myCond; } else { $cond = $myCond . ' AND ' . $cond; } $this-Pagination-ajaxAutoDetect = false; $this-Pagination-show = $this-adminperpage; list($order, $limit, $page) = $this-Pagination-init($cond); $data = $this-PotentialSubscriber-findAll($cond, NULL, $order, $limit, $page); $this-set('users', $data); --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Cake validating fields it shouldn't be
I had tried that before with no luck, but I think the problem is solved now. I'm not sure, but I suspect the problem was related to there being a Model-read() that was executing in a separate area (permissions check) before calling Model-save(). the -read was replaced with a find first and all seems to be well now. -Blake On Jul 21, 8:57 am, Rick will...@gmail.com wrote: Try adding 'allowEmpty' = true to each of the rules. Rick On Jul 20, 9:38 am, blake blake.jor...@gmail.com wrote: Any possible ideas anyone? On Jul 17, 10:17 am, blake blake.jor...@gmail.com wrote: Hello, For one of my models, I have this (among other) validation requirements: 'fee' = array( 'gt_0' = array( 'rule' = array('comparison', '=', 0), 'message' = 'Please enter a valid fee (eg. $100.00)' ), 'number' = array( 'rule' = 'numeric', 'message' = 'Please enter a valid fee (eg. $100.00)' ) ), I have a couple of different edit screens for this model, one of which asks for the 'fee' field, one does not. On the screen that does not ask, the field is not in the $this-data array anywhere before calling Model-save(). However, validation is failing for some reason on that field. Is there a reason for this? When the model is being created initially, and the 'fee' field is still not specified, validation passes and it creates successfully. This only happens on an update. Any way around this? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: MISSING TABLE
What sort of quotes do you have in 'Fams'? There's an 'undefined constant' error there, suggesting your quotes aren't correct. Perhaps they're the fancy kind? Don't edit scripts with anything that outputs those. On Tue, Jul 21, 2009 at 5:58 AM, biancmbmauro.bertolo...@gmail.com wrote: Guys, I am trying hard to make CakePHP work. I have followed all instructions. Official docs and other guides. The cake page renders fine. Triple-checked models and controllers, config files, etc. Still getting the missing table.. message. Already tried to delete the ceche files, etc. What is left to do? Am I missing anything? The web seems to be inundated by people like me, all getting the same error message. I'd love to work with cakePHP, I believe it's a valid alternative to RoR and plain PHP, which I have been using for a while. I am comfortable with sysadmin, apache, mysql, linux, windows, php, etc. I am now using XAMPP on WindowsXP. But I get the same message under easyphp. I will try on my linuxbox at home as soon as I get the chance. output of http://localhost/prod/ Your tmp directory is writable. The FileEngine is being used for caching. To change the config edit APP/config/core.php Your database configuration file is present. Cake is able to connect to the database. output of http://localhost/prod/fams Notice (8): Use of undefined constant �Fams� - assumed '�Fams�' [CORE \cake\dispatcher.php, line 453] Missing Database Table Error: Database table �fams�s for model �Fams� was not found. Notice: If you want to customize this error message, create app\views \errors\missing_table.ctp controller fams_controller.php ?php class FamsController extends AppController { var $name = ‘Fams’; var $scaffold; } ? -model fam.php ?php class Fam extends AppModel { var $name = ‘Fam’; } ? Note the DB contains a table named fams What is wrong? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
using tree behaviour on layout for a menu of categories
Hi I'm having troubling doing the following: I have a table for categories that actsAs tree and I use the tree helper along with some javascript to generate a multi level drop down menu. I would like to have this menu appearing in all pages, which (i guess) means that i have to include it in a layout. The call looks like that ?=$tree-generate($stuff, array('class' = 'sf-menu' , 'element' = 'thisone'));? The problem is that I generate the $stuff array using the categoriesController. How can I put this function on a layout (making them available everywhere) and pass the data from the Controller to that function. thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: belongsto relationship not working
I tried changing the name of FK in both the database and model and it still does not work. I have used BelongsTo before with plural FK and it worked. I wonder if it has something to do with my code and naming convention Names are, Database = irrigation_events Model = IrrigationEvent (irrigationEvent.php) Controller = IrrigationEventsController (irrigation_events_controller.php) These are my set functions in the controller $this-set('irrigationEvents', $this-IrrigationEvent-findAll()); $this-set('fields',$this-IrrigationEvent-Field-find('list')); I think I might not be using the right plural/camel case conventions any ideas? Travis --~--~-~--~~~---~--~~ You received this message because you are subscribed to the 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: belongsto relationship not working
I tried changing the name of FK in both the database and model and it still does not work. I have used BelongsTo before with plural FK and it worked. I wonder if it has something to do with my code and naming convention Names are, Database = irrigation_events Model = IrrigationEvent (irrigationEvent.php) Controller = IrrigationEventsController (irrigation_events_controller.php) These are my set functions in the controller $this-set('irrigationEvents', $this-IrrigationEvent-findAll()); $this-set('fields',$this-IrrigationEvent-Field-find('list')); I think I might not be using the right plural/camel case conventions any ideas? Travis On Jul 19, 2:25 pm, Carlos Lavin carloslavi...@gmail.com wrote: Cake expects it to be called field_id... although im not sure that is whats creating the problem.. give it a shot and let us know 2009/7/19 Travis marbletra...@gmail.com fields_id is what the FK is called in the table, I have a table called fields, when I created the foreign key in irrigation_events I called it fields_id. Travis On Jul 16, 1:30 pm, Piotr Kilczuk kilc...@gmail.com wrote: Hello, I have successfully set up other belongsto relationships in this program but one does not work the model code is: class IrrigationEvent extends AppModel { var $name = 'IrrigationEvent'; var $useTable = 'irrigation_events'; var $belongsTo = array( 'Field' = array( 'className' = 'Field', 'foreignKey'= 'fields_id' )); } ? FK should be field_id? Regards, Piotr --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Database / Relationship question (habtm)
How are these 3 models related? Can a Topic belong to more than one Category? And how is Profile related to either of the others? A Topic has a Profile? One or more? What about Category? On Tue, Jul 21, 2009 at 11:06 AM, ulteriorulteriordes...@gmail.com wrote: I'm somewhat new to cake, this is my second app and I'm having problems with relationships. The first app I created was pretty straightforward and I had a great time writing it in cake but my database skills aren't up to par with my php! Here goes: I have three tables that contain data which I want to relate, profiles, categories and topics. I created a categories_topics table with category_id and topic_id and that's just fine. However, I want to link the categories and topics to profiles so I created categories_topics_profiles which contains the category_topic_id (from the join table) and the profile_id (to link to the Profiles model) but it's giving me errors when I try to run a simple find. Is this the right way to build the tables or am I missing something? Any help would be GREATLY appreciated. Thanks, -Chris --~--~-~--~~~---~--~~ You received this message because you are subscribed to the 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 tree behaviour on layout for a menu of categories
do it in your AppController::beforeFilter(). you can then use $stuff variable in your views application wide. $this-set('stuff', $yourStuff); On Jul 21, 11:23 pm, Yannis ikasso...@gmail.com wrote: Hi I'm having troubling doing the following: I have a table for categories that actsAs tree and I use the tree helper along with some javascript to generate a multi level drop down menu. I would like to have this menu appearing in all pages, which (i guess) means that i have to include it in a layout. The call looks like that ?=$tree-generate($stuff, array('class' = 'sf-menu' , 'element' = 'thisone'));? The problem is that I generate the $stuff array using the categoriesController. How can I put this function on a layout (making them available everywhere) and pass the data from the Controller to that function. thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Help with JQuery and Cake
I am uploading a file and the script uses name: 'data[Image][image]', to pass the file name to Cake. What I want to do is not use the file name the user enters and change the file name before the page is submitted. I can change the file name server side but then I need to run more queries to get the file name back to the page which is not what I want to do. So how can i define the data that goes into 'data[Image][image] before submit? something like var 'data[Image][image] = whatever i want it to be. Just no idea how to do it. Ideas or suggestions? thanks Dave --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: CakePHP - updating models.
This is unlikely to work the way that you want. The problem is that you change one record's position to, eg. 23 but there may be another record that already has that value. In order for this to work, you'll have to re-sort the entire table. You might want to use TreeBehavior to take advantage of its moveup() movedown() methods. You can do this even if your records are all on the same level, hierarchically. 2009/7/21 mariusz.lewandowski lew...@gmail.com: Hello all! I'm trying to implement functionality in my CMS system to be able to move up/down items on the list based on position column. Here is my code: public function admin_up($position) { $neighbours = $this-News-find('neighbors', array('position' = $position)); $currentRecord = $this-News-findByPosition($position); $currentRecord = $currentRecord['News']; $previousRecord = $neighbours['prev']['News']; $this-temp = $previousRecord; $this-News-id = $previousRecord['id']; $this-News-position = $currentRecord['position']; $this-News-save(); $this-News-id = $currentRecord['id']; $this-News-position = $this-temp['position']; $this-News-save(); // $this-Session-setFlash(News został przesunięty!); // $this-redirect('index'); } and SQL dump: UPDATE `news` SET `id` = 20, `position` = 23 WHERE `news`.`id` = 20 UPDATE `news` SET `id` = 20, `position` = 23 WHERE `news`.`id` = 20 it invokes bad parametrs in second call. Why? I spent for it 10 hours and still the same results... Please help, I'm getting confused! :S --~--~-~--~~~---~--~~ You received this message because you are subscribed to the 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 -~--~~~~--~~--~--~---
authorize.net SIM woes
I've been banging my head against the wall on this one for hours now, and have run out of ideas. Has anyone successfully gotten the relay response to work with authorize.net's SIM method of credit card processing? Here's my deal: The test cc is processed successfully, but i have problems getting back to my page. I get this message: An error occurred while trying to report this transaction to the merchant. An e-mail has been sent to the merchant informing them of the error. The following is the result of the attempt to charge your credit card. In my form i post directly to the authorize.net test server, and i have specified these fields: x_relay_response = true x_relay_url = http://[myserver]/registration/receipt /receipt is actually routed to attendees/receipt. I have also tried to specify http://[myserver]/registration/attendees/receipt as the x_relay_url as well, thinking it was a routing issue. Both of these addresses work fine if i type them directly into the browser. At this point i am just trying to echo 'success!'; The odd thing is that if i remove $this-Auth-allow('receipt') from my attendees controller, the response from authorize.net gets kicked to my login page. I have tried everything i can think of. debug is set to 0. There are no errors in my code. I don't know what else to try. Any ideas? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the 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: belongsto relationship not working
The model filename should be irrigation_event.php On Tue, Jul 21, 2009 at 12:41 PM, Travismarbletra...@gmail.com wrote: I tried changing the name of FK in both the database and model and it still does not work. I have used BelongsTo before with plural FK and it worked. I wonder if it has something to do with my code and naming convention Names are, Database = irrigation_events Model = IrrigationEvent (irrigationEvent.php) Controller = IrrigationEventsController (irrigation_events_controller.php) These are my set functions in the controller $this-set('irrigationEvents', $this-IrrigationEvent-findAll()); $this-set('fields',$this-IrrigationEvent-Field-find('list')); I think I might not be using the right plural/camel case conventions any ideas? Travis --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: CakePHP - updating models.
Well, that's true but my assumption was to save record with position number the same as ID. That would protect me before doubling values. So in case I have unique values - why it doesn't work? I also tried saveField but it behaves strangely - sometimes it works sometimes doesn't ... On Jul 21, 6:53 pm, brian bally.z...@gmail.com wrote: This is unlikely to work the way that you want. The problem is that you change one record's position to, eg. 23 but there may be another record that already has that value. In order for this to work, you'll have to re-sort the entire table. You might want to use TreeBehavior to take advantage of its moveup() movedown() methods. You can do this even if your records are all on the same level, hierarchically. 2009/7/21 mariusz.lewandowski lew...@gmail.com: Hello all! I'm trying to implement functionality in my CMS system to be able to move up/down items on the list based on position column. Here is my code: public function admin_up($position) { $neighbours = $this-News-find('neighbors', array('position' = $position)); $currentRecord = $this-News-findByPosition($position); $currentRecord = $currentRecord['News']; $previousRecord = $neighbours['prev']['News']; $this-temp = $previousRecord; $this-News-id = $previousRecord['id']; $this-News-position = $currentRecord['position']; $this-News-save(); $this-News-id = $currentRecord['id']; $this-News-position = $this-temp['position']; $this-News-save(); // $this-Session-setFlash(News został przesunięty!); // $this-redirect('index'); } and SQL dump: UPDATE `news` SET `id` = 20, `position` = 23 WHERE `news`.`id` = 20 UPDATE `news` SET `id` = 20, `position` = 23 WHERE `news`.`id` = 20 it invokes bad parametrs in second call. Why? I spent for it 10 hours and still the same results... Please help, I'm getting confused! :S --~--~-~--~~~---~--~~ You received this message because you are subscribed to the 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 tree behaviour on layout for a menu of categories
Thank you very much for the prompt reply, I've tried that. However I get an error, when trying to access the Category: [The full code goes like that] $this-Category-contain(...); $stuff = $this-Category-find(...); $this-set(compact('stuff')); I get an error: Notice (8): Undefined property: PagesController::$Category [APP/ app_controller.php, line 9] Fatal error: Call to a member function contain() on a non-object in / Applications/MAMP/cakephp/learning/sylor/app_controller.php on line 9 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: Database / Relationship question (habtm)
You really need to think of the three entities separately first, and decide how they should be related before you go on and start coding. Making an ER diagram is usually very helpful. (look it up if you don't know what an ER diagram is...you'll find a ton of info). It sounds like your app is like a bulletin board. In that case, off the top of my head, how I'd first flesh it out follows: Categories can have many topics Topics belong to a category Profiles can have many topics (a user can start many topics) Topics belong to many profiles (topics are written to by more than one user) Categories and Profiles don't need a relationship; their relation can be inferred by the other relationships if need be. I guess if you REALLY wanted to know who created a category though, you'd have Categories belong to Profiles and Profiles Have Many Categories, but I won't include that. So you'd have: Categories Have Many Topics Topics Belong To Categories Profiles HABTM Topics And you'd need the tables: categories, topics, profiles, profiles_topics Now, if this was a BB, you'd also have posts. And Posts would belong to Topics (threads) and Topics would have many Posts. That's how I'd do it I guess. If your app is different from that though, then your relationships would possibly be different and you'd have to follow the previous post's advice and ask yourself those questions. I think an ER diagram will help you a lot to figure out what you want before you spend a lot of time coding in the wrong direction. On Jul 21, 10:06 am, ulterior ulteriordes...@gmail.com wrote: I'm somewhat new to cake, this is my second app and I'm having problems with relationships. The first app I created was pretty straightforward and I had a great time writing it in cake but my database skills aren't up to par with my php! Here goes: I have three tables that contain data which I want to relate, profiles, categories and topics. I created a categories_topics table with category_id and topic_id and that's just fine. However, I want to link the categories and topics to profiles so I created categories_topics_profiles which contains the category_topic_id (from the join table) and the profile_id (to link to the Profiles model) but it's giving me errors when I try to run a simple find. Is this the right way to build the tables or am I missing something? Any help would be GREATLY appreciated. Thanks, -Chris --~--~-~--~~~---~--~~ You received this message because you are subscribed to the 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 -~--~~~~--~~--~--~---
Error in controller
Please chk it , Iam getting the error saying that *Notice*: Undefined property: SearchsController::$Search in * htdocs\app\controllers\searchs_controller.php* on line *61* *Fatal error*: Call to a member function findAll() on a non-object in * htdocs\app\controllers\searchs_controller.php* on line *61* code is here http://bin.cakephp.org/view/932628126 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the 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 tree behaviour on layout for a menu of categories
OK I think I found it... Hopefully it is the best method: I have to load the model using: $this-loadModel('Category') and then it is available to the appController If you think there is a better way please let me know. thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: using tree behaviour on layout for a menu of categories
That's because PagesController doesn't know about Category. You can't use $this-something unless the class/object has a 'something' property. You'd need to import the CategoriesController class and instantitate it (as, eg. $categories). But you'd probably be far better off taking this out of PagesController entirely and creating a menu element. In that, use requestAction() to get the data directly from CategoriesController. Just remember to use caching so that you're not fetching this data on every page request. On Tue, Jul 21, 2009 at 1:17 PM, Yannisikasso...@gmail.com wrote: Thank you very much for the prompt reply, I've tried that. However I get an error, when trying to access the Category: [The full code goes like that] $this-Category-contain(...); $stuff = $this-Category-find(...); $this-set(compact('stuff')); I get an error: Notice (8): Undefined property: PagesController::$Category [APP/ app_controller.php, line 9] Fatal error: Call to a member function contain() on a non-object in / Applications/MAMP/cakephp/learning/sylor/app_controller.php on line 9 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: Multiples lists of different tables :S
Hello, Wot makes things harder in CakePHp is how to select records from a table depending on another one !! ill explain further. I got4 example 2 tables :: 1-Categories 2-Posts I want to get all the posts records whom r in a specific category . let's say that i want all the posts whom r in JQUERY category! thx Agin 4 ur response ,I appreciate Depends on relationship type... I guess this classical case (Posts Comments) is well documented in Cakebook or am I wrong? Regards, Piotr --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Component inside helper
How can i use my componnt inside helper? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the 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 with additional data scaffold update problem.
Here follows my dirty solution I've created: app_controller.php: function _beforeScaffold($method) { $this-_HABTM_scaffold_preserve($method); return parent::_beforeScaffold($method); } function _HABTM_scaffold_preserve($method){ $model = $this-uses['0']; if ($method == 'edit' !empty($this-data ) $model !empty ($this-{$model}-hasAndBelongsToMany)){ foreach ($this-{$model}-hasAndBelongsToMany as $HABTM_model = $dummy){ if (isset($this-{$model}-hasAndBelongsToMany[$HABTM_model] ['with']) $this-{$model}-hasAndBelongsToMany[$HABTM_model] ['with']){ $model_id_text = $this-{$model}-hasAndBelongsToMany [$HABTM_model]['foreignKey']; $habtm_id_text = $this-{$model}-hasAndBelongsToMany [$HABTM_model]['associationForeignKey']; $with_model = $this-{$model}-hasAndBelongsToMany[$HABTM_model] ['with']; if (!empty($this-data[$HABTM_model][$HABTM_model])){ $this-log(app_controller.php/_HABTM_scaffold_preserve: Preserving $model = $with_model, LOG_DEBUG); $model_id = $this-data[$model]['id']; foreach ($this-data[$HABTM_model][$HABTM_model] as $k = $habtm_id){ $data = $this-{$model}-{$with_model}-find( 'first', array( 'conditions' = array($model_id_text= $model_id, $habtm_id_text= $habtm_id ), 'contain' = array() )); if ($data isset($data[$with_model][$habtm_id_text])) $this-data[$HABTM_model][$HABTM_model][$k] = $data [$with_model]; }//foreach }//if }//if }//foreach }//if }//_HABTM_scaffold_preserve --~--~-~--~~~---~--~~ You received this message because you are subscribed to the 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 / Relationship question (habtm)
That actually makes perfect sense. I guess I was trying to overthink the whole thing. Thanks very much! -Chris On Jul 21, 12:27 pm, George geo...@hakumei.net wrote: You really need to think of the three entities separately first, and decide how they should be related before you go on and start coding. Making an ER diagram is usually very helpful. (look it up if you don't know what an ER diagram is...you'll find a ton of info). It sounds like your app is like a bulletin board. In that case, off the top of my head, how I'd first flesh it out follows: Categories can have many topics Topics belong to a category Profiles can have many topics (a user can start many topics) Topics belong to many profiles (topics are written to by more than one user) Categories and Profiles don't need a relationship; their relation can be inferred by the other relationships if need be. I guess if you REALLY wanted to know who created a category though, you'd have Categories belong to Profiles and Profiles Have Many Categories, but I won't include that. So you'd have: Categories Have Many Topics Topics Belong To Categories Profiles HABTM Topics And you'd need the tables: categories, topics, profiles, profiles_topics Now, if this was a BB, you'd also have posts. And Posts would belong to Topics (threads) and Topics would have many Posts. That's how I'd do it I guess. If your app is different from that though, then your relationships would possibly be different and you'd have to follow the previous post's advice and ask yourself those questions. I think an ER diagram will help you a lot to figure out what you want before you spend a lot of time coding in the wrong direction. On Jul 21, 10:06 am, ulterior ulteriordes...@gmail.com wrote: I'm somewhat new to cake, this is my second app and I'm having problems with relationships. The first app I created was pretty straightforward and I had a great time writing it in cake but my database skills aren't up to par with my php! Here goes: I have three tables that contain data which I want to relate, profiles, categories and topics. I created a categories_topics table with category_id and topic_id and that's just fine. However, I want to link the categories and topics to profiles so I created categories_topics_profiles which contains the category_topic_id (from the join table) and the profile_id (to link to the Profiles model) but it's giving me errors when I try to run a simple find. Is this the right way to build the tables or am I missing something? Any help would be GREATLY appreciated. Thanks, -Chris --~--~-~--~~~---~--~~ You received this message because you are subscribed to the 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 -~--~~~~--~~--~--~---
Strange association behavior
I must be missing something... maybe fresh eyes can see the problem. Hopefully! I have a complex set of table associations that looks like this: layers id ruleexceptions id rulevaluetypes id layerrules id layer1_id layer2_id ruleexception_id ruleitems id layerrule_id exception_id ruleitemvalues id ruleitem_id rulevaluetype_id Everything works great, except I can't get layerrules and ruleitems to link up. The model for layerrules says: models/layerrule.php:var $hasMany = array('Ruleitem'); models/ruleitem.php: var $belongsTo = array ('Kit','Ruleexception','Layerrule'); Trying to read using any of these models works great except Ruleitem doesn't link up to Layerrule. No errors or anything. Here's one of my sample queries from Ruleitemvalue model: function getByRIV($list) { $find = array_keys ($list); $get = $this-find('all', array( 'contain' = array( 'Ruleitem' = array( 'Layerrule', 'Ruleexception', ), ), 'conditions' = array(Ruleitemvalue.id = $find), ) ); return $get; } Snippet from the data returned: Array ( [0] = Array ( [Ruleitemvalue] = Array ( [id] = 26 [rulevaluetype_id] = 1 [ruleitem_id] = 14 [kit_id] = 1 [value] = 2 [rule] = def [valid] = ) [Ruleitem] = Array ( [id] = 14 [layerrule_id] = 24 [ruleexception_id] = 5 [kit_id] = 1 [Ruleexception] = Array ( [id] = 5 [name] = ntie [desc] = [kit_id] = 1 [nonexception] = 0 ) ) ) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the 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: Strange association behavior
I just wanted to add, I don't get any error from the query like I would if I added an unrelated model to the 'contain' array. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Strange association behavior
Sorry, more info to add: It works fine if I do the query through the Layerrule model, but not through the Ruleitem model. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the 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 in controller
Do you have a search model? Try adding $uses = array('Search'); --~--~-~--~~~---~--~~ You received this message because you are subscribed to the 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 in controller
But there is no table named Search, i need to find the result from some other tables , is this ok ? On Wed, Jul 22, 2009 at 12:38 AM, Miles J mileswjohn...@gmail.com wrote: Do you have a search model? Try adding $uses = array('Search'); --~--~-~--~~~---~--~~ You received this message because you are subscribed to the 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: 404 Header
Sure ... HTTP/1.1 302 Found Date: Tue, 21 Jul 2009 20:00:04 GMT Server: Apache X-Powered-By: PHP/5.2.6 Location: http://video.maktoob.com/?url=sfgsd Cache-Control: private, no-cache, no-store, proxy-revalidate, no-transform, max-age=0, must-revalidate Expires: Tue, 21 Jul 2009 20:00:04 GMT Vary: Accept-Encoding,User-Agent Content-Type: text/html Connection: Keep-Alive Set-Cookie: userCountry=JO; expires=Thu, 17-Dec-2020 19:00:04 GMT; path=/ Set-Cookie: MKTID_copy=deleted; expires=Mon, 21-Jul-2008 20:00:03 GMT; path=/; domain=video.maktoob.com On Tue, Jul 21, 2009 at 6:18 PM, Piotr Kilczuk kilc...@gmail.com wrote: Hello, i have a problem with my CakePHP app where the client needs me to return a valid 404 page together with a valid 404 http header incase of page not found, i have handled the 404 page through app_error but the problem is when i execute ( curl -I http://www.example.com/sdfsdfas ) on my debian box it keeps returning ( 302 Page Found ) instead of ( 404 Page Not Found) , anyone faced something like this, and if any, would you please explain how you solve it? Can you paste the complete response (all server headers)? Regards, Piotr -- http://phpirate.net --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
HABTM query issue
profiles has many users. users has many profiles. I just want to do a query which will join profiles profiles_users table, so i do the following: $this-Profile-Behaviors-attach('Containable'); $this-Profile-contain(ProfilesUser); $this-data = $this-Profile-find('all'); However, its not working, it just querying profiles table. i want something like profiles join with profiles_users. whats wrong?? -- View this message in context: http://www.nabble.com/HABTM-query-issue-tp24595184p24595184.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 -~--~~~~--~~--~--~---
Using HtmlHelper::autolink and Sanitize::clean together
Hi all, I've run into a little trouble, which I can't seem to get myself out of: for certain user input, I want to Sanitize::html() the input when echoing in my template. So far so good, the Sanitize class does its job pretty good. Unfortunately, I really like the HtmlHelper::autolink method for this kind of input too, so people's input gets linked automatically. Is there any way of achieving this, combining the two methods? In my case, it works well, until I enter a url with characters that Sanitize::html() cleans up; unfortunately, some of these chars are valid characters for a url (like '', or '-'), and cleaning text like this renders the urls useless. For example: a url like http://www.test-test.com will get malformed to http://www.test/#45;test.com when doing a $html-autolink (Sanitize::html($url)); What's the best way to deal with this, preferably without sacrificing on CakePHP's excellent html helper or Sanitize class? Thanks, Jeroen --~--~-~--~~~---~--~~ You received this message because you are subscribed to the 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 -~--~~~~--~~--~--~---
Distinguishing a new user from a returning user with an expired session?
How can one distinguish between: 1. a new user coming to the site for the first time, and 2. a returning user whose session has expired? The returning user needs to be informed his session has expired. The new user should be allowed to continue on his merry way. Thanks. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Distinguishing a new user from a returning user with an expired session?
Hello, How can one distinguish between: 1. a new user coming to the site for the first time, and 2. a returning user whose session has expired? The returning user needs to be informed his session has expired. The new user should be allowed to continue on his merry way. Good question, I'll have to keep an eye on this thread. One idea is to have a cookie that expires later than the session cookie and check these... Regards, Piotr --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Form helper not populating fields with accents
Hello I'm having problems with the form helper. When a field contains chars like ñ or vocals with accent, the value is not set to the corresponding input. ie, $this-data is Array ( [User] = Array ( [id] = 1 [username] = foo ) [Profile] = Array ( [id] = 1 [user_id] = 1 [first_name] = Carlos [last_name] = Gándara ) ) but echo $form-input('Profile.last_name',array('label' = false)); shows an empty text field. In the layout i'm using $html-charset('ISO-8859-1'); but I don't think the problem is here because $this-data gets the correct value. Any idea? 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: Using HtmlHelper::autolink and Sanitize::clean together
Figured out a solution: using h() - cake's htmlspecialchars() wrapper - works together with autolink, whilst maintaining HtmlHelper::autolink functionality just fine. Still, if someone has any thoughts on other solutions, involving the use of the Sanitize::html method, I'd love to hear about 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 -~--~~~~--~~--~--~---
How to overwrite database fields in a model?
Dear All, I'm a beginner with CakePHP (and therefore new to this group) and I'm currently facing a (basic) problem: I have a database table with some information like the mobile phone, status of a shipment (which is a TYNINT field in my mysql db), etc. I want to know if there is a simple way to parse the value of the fields directly in the model in order to have a more readable results in my views. Here is a short example to be clear: - My status fields has the following value in my db table: 0, 1, 2, 3 - my business rule is the following: - 0 = not yet processed - 1 = processing - 2 = shipped - 3 = delivered How can change my model to include this business logic directly there ? I don't want to parse the results in every views, because if the logic change I will have to change it in every view. Thanks in advance for your help, cheers, Simon --~--~-~--~~~---~--~~ You received this message because you are subscribed to the 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: Session between controllers. Works only in FF.
The session id is not lost, infact the session is not available in the whole domain. After the login the user is rediredcted to http://domain.de/app/webroot/index.php/home in fact, it shuld go to http://domain.de/home the session is empty for all pages under http://domain.de/ but it is filled under http://domain.de/app/webroot/index.php/ so i assume that i have to fix the redirection part. my redirects look like $this-redirect(array('controller' = 'home', 'action' = 'index')); and my .htaccess files are the default ones provided my cake. how can i remove the /app/webroot/ part from the urls? Cheers, Tibor On Tue, Jul 21, 2009 at 5:16 PM, Piotr Kilczuk kilc...@gmail.com wrote: Hello, I have spent more then a day on this issue and still no solution :( I am working on my first cake based project and i have a session problem. Currently using php session, security level low, session name is CAKEPHP. Check agent = false. In FF everithing works fine, but in other browsers (IE, Safari, Opera tested so far) the session is not available between controllers. Ex: I login and i get redirected to the /home page From here i go to the /example page and the session is empty. I go back to /home and the session is there. I have also tested, database session, cakephp session and still the same prblem. This happens in every browser except FF. Help pls I am running out of time :(. As a 1st step I'd check how do your cookies look like in Fx, IE etc. Possibly the session id is lost for some reason. Let us know. Regards, Piotr --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How to overwrite database fields in a model?
i guess i will have to show you my little secret - how it can be achieved in a very neat way in your Model: /** Static Enums **/ /** * Static Model::method() * BILL STATUS */ function statuses($value = null) { $options = array( BILL_STATUS_NEW = __('New',true), BILL_STATUS_OPEN = __('Open',true), BILL_STATUS_CLOSED = __('Closed',true), ); if ($value !== null) { if (array_key_exists($value, $options)) { return $options[$value]; } return ''; } return $options; } now, in your views, controller etc you can simply use it statically: echo $form-input('status', array('options'=CompanyBill::statuses ())); or in the controller $this-flashMessage('Status: '.CompanyBill::statuses($value)); = Closed, e.g. PS: instead of defining constants at the top of your model you could as well use the numeric values right away (but the constant way is cleaner, especially if you need some logic in the controller like if ($value == STATUS_PROCESSED) {} thats more readable then if ($value == 1) {} PPS: remember that the model needs to be included if you want to use those enums in other controllers but from my experience they are always included anyway through some HasMany/BelongsTo relation. happy baking :) On 21 Jul., 23:30, Simon simon.gani...@gmail.com wrote: Dear All, I'm a beginner with CakePHP (and therefore new to this group) and I'm currently facing a (basic) problem: I have a database table with some information like the mobile phone, status of a shipment (which is a TYNINT field in my mysql db), etc. I want to know if there is a simple way to parse the value of the fields directly in the model in order to have a more readable results in my views. Here is a short example to be clear: - My status fields has the following value in my db table: 0, 1, 2, 3 - my business rule is the following: - 0 = not yet processed - 1 = processing - 2 = shipped - 3 = delivered How can change my model to include this business logic directly there ? I don't want to parse the results in every views, because if the logic change I will have to change it in every view. Thanks in advance for your help, cheers, Simon --~--~-~--~~~---~--~~ You received this message because you are subscribed to the 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: Form helper not populating fields with accents
use utf8 throughout your website saves you usually a lot of trouble :) On 21 Jul., 23:34, Xoubaman xouba...@gmail.com wrote: Hello I'm having problems with the form helper. When a field contains chars like ñ or vocals with accent, the value is not set to the corresponding input. ie, $this-data is Array ( [User] = Array ( [id] = 1 [username] = foo ) [Profile] = Array ( [id] = 1 [user_id] = 1 [first_name] = Carlos [last_name] = Gándara ) ) but echo $form-input('Profile.last_name',array('label' = false)); shows an empty text field. In the layout i'm using $html-charset('ISO-8859-1'); but I don't think the problem is here because $this-data gets the correct value. Any idea? 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 -~--~~~~--~~--~--~---
Captcha validation in model
Hello, i am trying to set up pretty simple board application and came wit a problem of captcha validation. Problem occures when validating the form as one because i use $validation array method in my model and most captchas components use validation in controller, which sets a problem of validation priorities since i have some costum validation functions in my model. what i would like to achieve is that the validation errors would show under each input field (including captcha field) when post is submitted. ive tried some components that i found in bakery but couldnt get it rolling because i run into validation problems. if someone has a solution for this problem i would really appriciate this. Thanks, Nick --~--~-~--~~~---~--~~ You received this message because you are subscribed to the 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 -~--~~~~--~~--~--~---
Additional checks at login (email validated)
In my app I require users to register with a valid email address, which I send an email to with a link to a confirmation page. This page checks the validity of the ticket (hash) embedded on the link and sets a Validated flag on the user record. This works fine (although the email looks a little ugly). So I think I've done the hard part, but I'm unsure how to do the simple bit. How should I change the login functionality to check the user's status? It currently checks the password using Auth out-of-the-box functionality i.e. uses an empty login() function in the Users controller. Should I write a new login function from scratch or should I be adding code to beforeFilter and somehow leveraging what is already working (not sure how to mix my validation and error messages with cake/auth's own)? Thanks in advance, Sid. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the 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: Additional checks at login (email validated)
http://book.cakephp.org/view/487/userScope On Tue, Jul 21, 2009 at 8:30 PM, Sidneyaussiealthomp...@gmail.com wrote: In my app I require users to register with a valid email address, which I send an email to with a link to a confirmation page. This page checks the validity of the ticket (hash) embedded on the link and sets a Validated flag on the user record. This works fine (although the email looks a little ugly). So I think I've done the hard part, but I'm unsure how to do the simple bit. How should I change the login functionality to check the user's status? It currently checks the password using Auth out-of-the-box functionality i.e. uses an empty login() function in the Users controller. Should I write a new login function from scratch or should I be adding code to beforeFilter and somehow leveraging what is already working (not sure how to mix my validation and error messages with cake/auth's own)? Thanks in advance, Sid. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the 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 -~--~~~~--~~--~--~---
Simple Authentication - Verifying Login Status
Hi, I'm wanting to create a simple authentication system for use with ACL. I do not believe the Auth component is suitable for this, as my ACL setup is not based on controller/actions and is quite strange in general. I currently have a system such as that described in http://bakery.cakephp.org/articles/view/simple-form-authentication-in-1-2-x-x at the moment, however before the application is released into the wild I would just like to ask about a couple of security concerns with this system. I understand that this system is very simple, basically consisting of a login() and __validateLoginStatus() functions. My concern with the implementation is that can't a 3rd party just repeatedly try different SessionIDs until successful, as when validating the current login status, it just checks to see if there is a Session variable defined for User. Isn't this open to abuse? What would be a more secure method of validation. (Actual logging in seems fine (ish) - apart from packet sniffing where the username/password combo could be picked up, but as not every site in the world uses SSL I assume this isn't such an issue.) I think I have confused myself with this problem, and am probably looking at this incorrectly. I blame my inexperience, and the opiates they gave me after my operation earlier. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the 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: Additional checks at login (email validated)
Brilliant! That works perfectly, thanks Dardo for your super fast help. [and sorry for not finding it in the cookbook myself. D'oh] Sid. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the 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: can I get the info of user in a model?
Thank you I'll test it rimoe 2009/7/21 Mark dereurom...@googlemail.com check this out: http://github.com/mcurry/cakephp_static_user/tree/master On 21 Jul., 06:32, Rimoe meiyo...@gmail.com wrote: hi, everyone! I have use ($this-Auth-user()) to get the log in info in controller. but now I want to get the info of user in a model. because the method of model has been used in many controller, change the method has became a big work, can I get the info of user in a model.php? thank you very much! rimoe --~--~-~--~~~---~--~~ You received this message because you are subscribed to the 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: Help with JQuery and Cake
Impossible. Browser security rules. Javascript can only read input type=file but not edit. On Jul 21, 11:43 pm, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: I am uploading a file and the script uses name: 'data[Image][image]', to pass the file name to Cake. What I want to do is not use the file name the user enters and change the file name before the page is submitted. I can change the file name server side but then I need to run more queries to get the file name back to the page which is not what I want to do. So how can i define the data that goes into 'data[Image][image] before submit? something like var 'data[Image][image] = whatever i want it to be. Just no idea how to do it. Ideas or suggestions? thanks Dave --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Error in controller
In this case $uses = false; On Jul 22, 2:20 am, bino dev biy@gmail.com wrote: But there is no table named Search, i need to find the result from some other tables , is this ok ? On Wed, Jul 22, 2009 at 12:38 AM, Miles J mileswjohn...@gmail.com wrote: Do you have a search model? Try adding $uses = array('Search'); --~--~-~--~~~---~--~~ You received this message because you are subscribed to the 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 -~--~~~~--~~--~--~---
Saving Sessions before entering database
I'm a noob so this my be a really stupid question. I'm trying to grab data and place it in sessions when a user is created. I tried to use a beforeSave() so that I can reuse the id, but the session is empty. Please help. Thans Here's my code function beforeSave(){ if(!empty($this-data)){ $this-Session-write('Fac', $this-data['User'] ['id']); } return true; } function add() { if (!empty($this-data)) { $this-User-create(); if ($this-User-save($this-data)) { $this-Session-setFlash(__('The User has been saved', true)); $this-redirect(array('action'='index')); } else { $this-Session-setFlash(__('The User could not be saved. Please, try again.', true)); } } $positions = $this-User-Position-find('list',array('conditions' = array('type' = 'position'))); $classifications = $this-User-Classification-find('list', array ('conditions' = array('type' = 'class'))); $groups = $this-User-Group-find('list', array('conditions' = array('id ' = '1'))); $this-set(compact('positions', 'classifications', 'groups')); } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the 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: Model validation on unit testing
same here On 7月10日, 下午5時03分, williamn wnotowida...@gmail.com wrote: Hi all, Did this ever happened to anyone here? :) On Jun 7, 8:14 pm, williamn wnotowida...@gmail.com wrote: Hi all, I have a simple model like below class Department extends AppModel { var $name = 'Department'; var $validate = array( 'code' = array('notempty'), 'name' = array('notempty'), 'abbreviation' = array('notempty'), 'phone_num' = array('notempty') ); } and create a simpletestlike this function testInvalidCreate() { $this-Department-create(); $this-assertFalse($this-Department-save()); } correct me if I'm wrong, $this-Department-save() should return false right? but in my case it returning an array. Any suggestion? Thanks. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---