Re: Cake php connection with MS Sql Server 2000
Are you sure, that the connection settings are ok and the MS SQL server is running? You also have to change the security salt as the first message says. But I gues that this is not related to your SQL server problem. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Cake php connection with MS Sql Server 2000
hi, When I am trying to connect with MS Sql Sever 2000 database, it shows Notice (1024): Please change the value of 'Security.salt' in app/ config/core.php to a salt value specific to your application [CORE\cake \libs\debugger.php, line 556] 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 NOT able to connect to the database. Any help would be greatly appreciated! --Manohar manohar...@gmail.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: View Images
I would save the files using the user id as part of the filename e.g. user_12.jpg --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, 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: Count array
On Thu, May 28, 2009 at 11:05 PM, Dave Maharaj :: WidePixels.com wrote: > > Whats the easiest way to count the number of items in an array? I use the > data in the array so its more than just a count. > > I simply want to find if the array has more than 5 items then pass a > variable to the view to use a different div. > > Example: > > [Entry] => Array Ahn... have you tried sizeof( $this->data['Entry'] ) ??? 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: why support php-4
What is there in PHP 5 anyways besides more functions, the class features (private, public, protected, static, constant), etc. On May 28, 6:44 pm, Marcelo Andrade wrote: > On Thu, May 28, 2009 at 2:21 PM, Miles J wrote: > > > Sadly enough, tons of people still use PHP4. > > But dont worry, I believe 1.3 (or maybe it was 2.0) will be pure PHP > > 5. > > > On May 28, 3:14 am, devportals wrote: > >> hi friends, > >> I couldn't understand why cake still support php-4? > >> Don't u think going with pure php-5 way will make cake more robust? > > I'm sorry if it's a "dumb newbie" question, but what > features *exactly* do we expect in a pure-PHP5 Cake ? > > The main thing what I miss is a native sqlite3 driver. > But the ticked #3003 works fine. I used ZF too and > magic methods is not a real need to me. In my > applications I still haven't any serious PHP4 specific > performance or security issues either. > > My serves already are PHP5 but I still prefer using > CakePHP. > > 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 -~--~~~~--~~--~--~---
Count array
Whats the easiest way to count the number of items in an array? I use the data in the array so its more than just a count. I simply want to find if the array has more than 5 items then pass a variable to the view to use a different div. Example: [Entry] => Array ( [0] => Array ( [id] => 1 [image] => 1243476746.jpg ) [1] => Array ( [id] => 2 [image] => 1243476755.jpg ) [2] => Array ( [id] => 3 [image] => 1243476767.jpg ) [3] => Array ( [id] => 4 [image] => 1243476778.jpg ) [4] => Array ( [id] => 5 [image] => 1243476787.jpg ) [5] => Array ( [id] => 6 [image] => 1243476804.jpg ) [6] => Array ( [id] => 7 [image] => 1243476812.jpg ) [7] => Array ( [id] => 8 [image] => 1243476821.jpg ) [8] => Array ( [id] => 9 [image] => 1243476834.jpg ) [9] => Array ( [id] => 10 [image] => 1243476846.jpg ) [10] => Array ( [id] => 21 [image] => 1243546434.jpg ) ) ) Dave Maharaj Freelance Designer d...@widepixels.com www.widepixels.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: Blog tutorial - I get a blank page
On Wed, May 27, 2009 at 7:54 PM, cshehadi wrote: > (..) If you're using Apache web server, please check your error_log file to see if you've got a "Segmentation fault" error. If that's the case, you could fix it reinstalling your Apache+PHP webserver. 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: why support php-4
On Thu, May 28, 2009 at 2:21 PM, Miles J wrote: > > Sadly enough, tons of people still use PHP4. > But dont worry, I believe 1.3 (or maybe it was 2.0) will be pure PHP > 5. > > On May 28, 3:14 am, devportals wrote: >> hi friends, >> I couldn't understand why cake still support php-4? >> Don't u think going with pure php-5 way will make cake more robust? I'm sorry if it's a "dumb newbie" question, but what features *exactly* do we expect in a pure-PHP5 Cake ? The main thing what I miss is a native sqlite3 driver. But the ticked #3003 works fine. I used ZF too and magic methods is not a real need to me. In my applications I still haven't any serious PHP4 specific performance or security issues either. My serves already are PHP5 but I still prefer using CakePHP. 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: Forms with math computations and multiple buttons
Thanks for answering my questions. The number helper is only for the view right? Can I use it on my component/controller? I have search through the internet and people don't recommend it. brian-263 wrote: > > > OK, I understand. Why don't you use the currency method? > > http://api.cakephp.org/class/number-helper#method-NumberHelpercurrency > > You might want to override the defaults with the $options array if you > don't want a dollar sign, etc. > > Note that the comment for format() method ("Formats a number into a > currency format.") is bogus. That's just been copied from currency(). > > -- View this message in context: http://www.nabble.com/Forms-with-math-computations-and-multiple-buttons-tp23718059p23772979.html Sent from the CakePHP mailing list archive at Nabble.com. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Missing Database table error: possibly related to model caching
Is the missing table an actual table in the database? Sometimes it throws errors when your model associations are 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: RFC 6160
Hello. I just want to add a couple of comments. On May 25, 3:40 am, WebbedIT wrote: > If anyone is confused with this post it is in relation to the below > posting which Braulio could not reply to due to it's age: > > http://groups.google.com/group/cake-php/browse_thread/thread/19cbc5dc... 1: I do not know if it is irony or you misunderstood me. The reason I did not reply to the old thread is because it is not possible. There is not "Reply" link in the web, only "Reply to author", and if one replies by email, Google Groups automatically creates a new thread. It has nothing to do with my age. ;-) 2: I also wanted to add that the link you sent (http://book.cakephp.org/ view/24/Model-and-Database-Conventions) doesn't say anything about columns names, it speaks about table names. Therefore you have totally missed my point. I have totally respected the convention about table names. Where I am using spaces is in the column names, which are the names of attributes of models, and not the names of models. Spaces come naturally in those attributes, V.G.: labels of form fields. At present, Cake supports spaces in column names like 99% (note that I am not asking for spaces in table names). The only problem when one uses spaces in column names right now is that, if you declare that attribute unique in the model, Cake crashes because it confuses the string after the last space as an operator. In fact, if my patch was approved it would make Cake more robust by checking that an operator is a valid operator (I think I have said that already). Please, if someone wants to support adding those 3/4 lines of code send a comment in https://trac.cakephp.org/ticket/6160 . Best regards, B. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Missing Database table error: possibly related to model caching
Hi All, I am having a problem with one of our websites, all of the pages are broken, each one saying that a database table is missing. This is actually a project i have in Subversion, and is the 13th checkout of identical code. All 13 sites use the same database file structure. Upon trying to launch the last new domain is when i started to receive these errors for all the pages. This exact same code is still working for the other 12 sites...I have done extensive research into the subject today, and everywhere i find people with similar problems, i get the same answer...its has to do with the model cache. From what i've read clearing the model cache should do the trick, but i am still getting the same errors. Some things i have tried: -clearing all cache files from "/app/tmp/cache/models/" & "/app/tmp/ cache/persistent/" -reset cache by setting debug mode to 2. -Even tried disabling cache for the site completely in core.php... "Configure::write('Cache.disable', true);" Does anyone have any insight as to what else i could try to get my tables working again? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
PHP SQL Server interface is not installed - Wamp server solution
I have now got found the solution to this problem, but thought I would share my experiences as doing a google search for this title shows up nothing but cake source code. I got the error message "PHP SQL Server interface is not installed" when trying to bake model for a SQL Server database. My setup is as follows: * Windows XP * SQL Server Express 2005 * Wamp Server 2.0 (PHP 5.2.5) Going through the Wamp server interface, I had enabled the php_mssql extension and could call such functions as mssql_connect in a php page on localhost through my web browser. However running "cake bake" in a DOS window, then trying to create a model gave the above error. The problem is that there are two php.ini files that come with Wamp server. One in the apache directory (C:\Program Files\wamp\bin\apache \apache2.2.8\bin\php.ini), which the web browser and Wamp server interface use. The other is in the php directory (C:\Program Files \wamp\bin\php\php5.2.5\php.ini) which the command line interface of php uses. You need to uncomment the line in the php5.2.5\php.ini file that has "extension=php_mssql.dll" --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, 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: problem with cake console
I think you have not added cake to your path, anyway you don't need to alter the cake.bat file This screencast helped me set up cake console http://cakephp.org/screencasts/view/6 as a result I am now a happy baker :) - S 2009/5/28 Paulos23 > > Hi ppl, > I have read some previous posts about cake console but nothing rly > helped me.I want to use cake console to build an ACL app but i am > facing a problem.I am using Xampp and the directory is: C:\Program > Files\xampp ,my app path is at: C:\Program Files\xampp\htdocs\my_cake > \app. > Then i open the cake.bat file and change the path from:php -q "%lib > %cake.php" -working "%CD%" %* to :C:\Program Files\xampp\php > \php.exe -q "%lib%cake.php" -working "%CD%" %* . > After that i open a cmd window and i work on this dir: > > > C:\Program Files\xampp\htdocs\my_cake\cake\console>cake bake > > 'C:\Program' is not recognized as an internal or external command, > operable program or batch file. > > And the line above is the error i take! > > Any help plz??? > > P.S:I tried also the -app command but still same > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, 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 record HABTM
I have a HABTM association, productsAssets. As admin add a product they can select if they want to some assets. If selected they are redirect to the asset library and can then select 1 or many assets for the product_id stored in a session. When i submit one of the assets, the post values being sent to the controller are correct, but the products_assets_controller adds a new asset record takes the new asset.id and adds this to the products_assets table? Any advice would be appreciated. R --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Add id to validate array
Hi Is it possible to add an id to the model $validate array? I want to add an id that's relative to the fieldname for ajax validation. Cheers R --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Multiple Accounts w/ Multiple Users in one Cake app
Hello, I'm fairly saavy at writing cake apps at this point but I am not sure where to start with this one. What I need to accomplish is a single Application with a single database but multiple accounts (companies), each with multiple users (employees). As much as would love to put each company in its own app directory with its own db its not an option. All accounts would share the single database, but each one would need to be able to restrict access to their data. I would prefer a different point of entry/portal for each company, I assume I would use Router to accomplish this? /appname.com/company1/users/login /appname.com/company2/users/login etc. So obviously ALL controllers are prefixed by the company name: /appname.com/company1/reports/view etc.. I'm not sure how I should seperate the data between different companies 1) Multiple tables with a company name prefix (ie companyname1_people, companyname2_people, etc.) and a dynamic table prefix based on the User.session? 2) All companies share the same tables but each row has a unique company_id, and based on the company name in the session, only the data belonging to said company is accessed by users with the same company_id. (In other words, is better to seperate tables and potentially have hundreds or share them and have 20 or so with thousands and thousands of rows? Its my minimal understanding that the latter is better) Further more, assuming everyone is sharing tables, where should the logic to seperate this data be located? Is there a $this->params that extracts the company name prefixing the controller (/companyname/ controller) and could that be tested against the user's company id/ name when fetching data? If so, in the model or the controller? I tried using $this->params['prefix'] but it seemed to only prefix the controller calls (ie. /companyname/controller = companyname_controller) I don't expect everyone to write this app for me, but a bit of direction so I can at least start it correctly would we very much appreciated. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
problem with cake console
Hi ppl, I have read some previous posts about cake console but nothing rly helped me.I want to use cake console to build an ACL app but i am facing a problem.I am using Xampp and the directory is: C:\Program Files\xampp ,my app path is at: C:\Program Files\xampp\htdocs\my_cake \app. Then i open the cake.bat file and change the path from:php -q "%lib %cake.php" -working "%CD%" %* to :C:\Program Files\xampp\php \php.exe -q "%lib%cake.php" -working "%CD%" %* . After that i open a cmd window and i work on this dir: C:\Program Files\xampp\htdocs\my_cake\cake\console>cake bake 'C:\Program' is not recognized as an internal or external command, operable program or batch file. And the line above is the error i take! Any help plz??? P.S:I tried also the -app command but still same --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, 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: users/edit function cake changes the password even when no password is provided
If you are using the Auth component, Auth will hash the blank password. The workaround I've found for this is to use a dummy password field (e.g. new_password) instead of the real password field, then in your controller::save() do if (!empty($this->data) { if (!empty($this->data['Model']['new_password']) { $this->data['Model']['password'] = $this->Auth->password($this- >data['Model']['new_password']; } if ($this->Model->save($this->data) { // data saved } else { // there was an error in the form submission } } On May 28, 6:30 pm, Bryan Paddock wrote: > Hiya all > Weird problem here - in my users/edit function i have a form for updating > your user information > > If you submit the form with a blank password (so the user is not changing > their password) then cake decides to change the password anyways! > > I have tried fixing it in my own code but nothing seems to work: > > if (! $this->data['User']['password']) { > unset($this->data['User']['password']); > > } > > but that doesnt work because cake hashes the (blank) password before it even > reaches the function > > any ideas why its doing 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: Possible Bug? $this->find for NULL values uses wrong syntax
I'll try and get a test case done at work tomorrow. That said, I've never written a unit test before but I can post the code required to duplicate it easily... On 28 May, 17:51, Gwoo wrote: > test case? this could be a problem with the proper defaults not being > set for the table. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: user/group dependent redirect
Ok. I solved the problem. Here are the steps and changes I made to my code. I hope this can help someone to fix an similar problem. 1.) app_controller $this->Auth->loginRedirect = '/users/loginRedirect'; $this->Auth->autoRedirect = false; 2.) users_controller function login() { if ($this->Auth->login()) { $this->loginRedirect(); } } function logout() { $this->Session->setFlash('Sie sind abgemeldet.'); $this->Auth->logout(); $this->redirect($this->Auth->logoutRedirect); $this->Session->del('Auth.redirect'); $this->Session->del('referer'); } function loginRedirect() { $userinfo = $this->Auth->user(); switch($userinfo['User']['group_id']) { case '1': $this->redirect(array ( 'controller' => 'members', 'action' => 'index'), null, true); break; case '4': $this->redirect(array ( 'controller' => 'members', 'action' => 'otherList'), null, true); break; default: $this->redirect(array ( 'controller' => 'members', 'action' => 'index'), null, true); } } Thanks for your help, draikin On 27 Mai, 22:04, brian wrote: > On Tue, May 26, 2009 at 3:57 PM, draikin wrote: > > > This doesn't work for me. I added the redirekt in app_controller and > > create a new function home() in users_controller: > > > function home() > > { > > $userinfo = $this->Auth->user(); // assuming the group is in > > there > > switch($userinfo['User']['group_id']) > > { > > case '1': $this->redirect(array ( > > 'controller' => 'members', > > 'action' => 'index'), null, true); > > break; > > > case '4': $this->redirect(array ( > > 'controller' => 'members', > > 'action' => 'otherList'), null, > > true); > > break; > > > default: $this->redirect(array ( > > 'controller' => 'members', > > 'action' => 'index'), null, true); > > } > > } > > > If I firstloginas member of group '4', all the redirection is > > correct.Afterlogout andloginas member of group '1' I get the same > > redirection as before. Not the expected redirection to /members/ > > index. > > > Whats going wrong here? > > Not sure. But you're still adding an extraredirectif you do it from home(). > > I'm also not sure what happened to my other post. This is what I'm using: > > AppController::beforeFilter() > > $this->Auth->loginRedirect = array('controller' => 'pages', 'action' > => 'display', 'home'); > > UsersController::login() > > if ($this->Auth->user('group_id') > 3) > { > ... > $this->redirect($this->Auth->loginRedirect);} > > ... > $this->redirect( > array( > 'controller' => 'sections', > 'action' => 'index', > 'admin' => 1 > ) > ); --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
View Images
This is a simple question that has me stumped. A user uploads an image that gets saves to webroot/img/user/photos Now in the profile there is the thumbnails of the photos...but how do I get the url for that so when clicked they can view the full image in webroot/img/user/photos/large? 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: Pagination with contain problem
$this->paginate['Group'] = $parametros; near the end is $this->paginate ['Group'] = $parameters; On May 28, 8:39 pm, Xoubaman wrote: > User HABTM Group > Group HABTM User > > When calling pagination I get these queries: > > SELECT COUNT(*) AS `count` FROM `groups` AS `Group` INNER JOIN > `groups_users` AS `GroupsUser` ON (`GroupsUser`.`group_id` = > `Group`.`id` AND `GroupsUser`.`user_id` = 1) WHERE 1 = 1 > > SELECT `Group`.`id`, `Group`.`name`, `Group`.`slug`, > `Group`.`description`, `Group`.`image`, `Group`.`group_comment_count`, > `Group`.`is_public`, `Group`.`created` FROM `groups` AS `Group` WHERE > 1 = 1 ORDER BY `GroupsUser`.`created` DESC LIMIT 5 > > 1054: Unknown column 'GroupsUser.created' in 'order clause' > > So, pagination is doing well the join with GroupsUser to count the > number of records, but fails fetching the groups, although both > queries should use the same paginate parameters. > > ¿I'm missing something? > > The code: > > $this->Group->unbindModel(array('hasAndBelongsToMany'=>array > ('User'))); > $this->Group->bindModel(array('hasOne'=>array('GroupsUser'=>array > ('foreignKey'=>false,'type'=>'INNER','conditions'=>array > ('GroupsUser.group_id = Group.id','GroupsUser.user_id = '. > $user_id); > > $parameters = array('contain' => array('GroupsUser'), > 'order' => array('GroupsUser.created' => > 'DESC'), > 'limit' => $this->elementos_por_pagina); > > $this->paginate['Group'] = $parametros; > $groups = $this->paginate('Group'); > $this->set('groups', $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 -~--~~~~--~~--~--~---
Pagination with contain problem
User HABTM Group Group HABTM User When calling pagination I get these queries: SELECT COUNT(*) AS `count` FROM `groups` AS `Group` INNER JOIN `groups_users` AS `GroupsUser` ON (`GroupsUser`.`group_id` = `Group`.`id` AND `GroupsUser`.`user_id` = 1) WHERE 1 = 1 SELECT `Group`.`id`, `Group`.`name`, `Group`.`slug`, `Group`.`description`, `Group`.`image`, `Group`.`group_comment_count`, `Group`.`is_public`, `Group`.`created` FROM `groups` AS `Group` WHERE 1 = 1 ORDER BY `GroupsUser`.`created` DESC LIMIT 5 1054: Unknown column 'GroupsUser.created' in 'order clause' So, pagination is doing well the join with GroupsUser to count the number of records, but fails fetching the groups, although both queries should use the same paginate parameters. ¿I'm missing something? The code: $this->Group->unbindModel(array('hasAndBelongsToMany'=>array ('User'))); $this->Group->bindModel(array('hasOne'=>array('GroupsUser'=>array ('foreignKey'=>false,'type'=>'INNER','conditions'=>array ('GroupsUser.group_id = Group.id','GroupsUser.user_id = '. $user_id); $parameters = array('contain' => array('GroupsUser'), 'order' => array('GroupsUser.created' => 'DESC'), 'limit' => $this->elementos_por_pagina); $this->paginate['Group'] = $parametros; $groups = $this->paginate('Group'); $this->set('groups', $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 -~--~~~~--~~--~--~---
Problem with DISTINCT query....
I am trying to get a distinct list of invoices based on the customer_id using the following line: $this->set('invoices', $this->Invoice->findAll(null, 'DISTINCT customer_id')); Problem is that it doesn't work as it should since the query comes out like this: SELECT DISTINCT `Invoice`.`customer_id`, `Invoice`.`id` FROM `invoices` Since it selects the Invoice.id as well as the distinct Invoice.customer_id, my results aren't distinct at all! Can anyone help me pleeease? :) Thanks, Matt --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, 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: Blog tutorial - I get a blank page
unfortunately no. When I check http headers, using Firefox plug-in I get: 200 OK When I use the command line browser links, locally, connecting to: http://localhost/cakedir/posts/index I get "Error reading from socket" On May 28, 1:37 pm, Gwoo wrote: > anything in the server error logs? > > #cakephp on irc.freenode.net for some real-time 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: Blog tutorial - I get a blank page
sure, it's copied straight out of the tutorial: [u...@staging cakedir]# cat app/controllers/posts_controller.php set('posts', $this->Post->find('all')); } } ?> and: [r...@staging cakedir]# cat app/views/posts/index.ctp Blog posts Id Title Created link($post['Post'] ['title'], "/posts/view/".$post['Post']['id']); ?> * for what it's worth, I went into: /app/webroot/index.php and put in this debugging line, echo "url: $url"; exit; right before: $Dispatcher->dispatch($url); and the output in http://server/posts/index was: url: I don't know how CakePHP is supposed to work, but should this $url variable be set to a value other than ''? I can't tell from the code where this variable is supposed to be set in the first place. Unless it's supposed to be referencing $_GET['url'] but that would scare me a bit. On May 28, 1:22 pm, Miles J wrote: > Can I see your index actions code? And the view for it. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: why support php-4
> Don't u think going with pure php-5 way will make cake more robust? You can build a very robust application with Cake right now. One of the immediate goals was to ensure Cake runs on "anything". This goal was more important than the perceived "robustness" of php5. There is nothing stopping you from using php5 only features in your application. Also, as is stated on the roadmap, Cake 2 will be php5 only. Next question."when will Cake 2 be ready?" Next answer"when it's ready" Honestly, I feel these questions are pretty meaningless. The questions you need to ask..."Does CakePHP help me solve my problems? What new feature/optimization/etc in CakePHP would better solve my problems? How can I help CakePHP?" I can only answer the last question..."join #cakephp on irc.freenode.net, talk to other developers, write test cases, provide patches..." Bake on, Gwoo --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, 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: Blog tutorial - I get a blank page
anything in the server error logs? #cakephp on irc.freenode.net for some real-time 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: Blog tutorial - I get a blank page
I've done this, no such luck, unfortunately. And I'm new to CakePHP, but not new to sys admin, or PHP programming, so I'm not in over my head here. On May 28, 12:54 pm, christo wrote: > Start with a fresh install and go through the tutorial again? maybe > you missed something. > > On May 28, 6:21 am, cshehadi wrote: > > > I apologize for the typo - I meant to write: > > > /app/views/posts/ > > > On May 28, 2:04 am, John Andersen wrote: > > > > Please confirm that your view directory is named "views" not "view"! > > > John > > > > On May 28, 1:54 am, cshehadi wrote: > > > > > Hi, > > > > > I'm trying to get through the blog tutorial, and trying to view my > > > > first page at: > > > > >http://server/post/index > > > > > but I'm getting a blank page. I'm sure the rewrite engine's working > > > > correctly because if I try to access a nonexistent controller, such > > > > as: > > > > >http://server/blah/index > > > > > I get the appropriate error: Missing Controller - so this tells me > > > > it's finding the controller ok. > > > > > But somehow it's not displaying index.ctp > > > > > which I have confirmed is in: > > > > > /app/view/posts/ > > > > > When I view source on the page, I get nothing - not even a default > > > > layout, or even an tag. It's just blank (in Firefox - just > > > > checked in it IE and I get "Internet Explorer cannot display the > > > > webpage") > > > > > I can reach the main cakephp page without any problems, it displays > > > > images and css and gives me the green light to proceed (database is > > > > configured, etc...) > > > > > I've also confirmed that the permissions of /app/tmp are drwxrwxr-x > > > > and that it's in the same group as the web server. > > > > > Without any error message at all, I'm at a complete loss as to how to > > > > debug this thing. > > > > > debug setting in /app/config/core.php is at 2, so it should be barking > > > > at me if I've done something wrong. > > > > > Anyone have a clue as to what to do next? > > > > > -Charlie --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: temporary tables in cake.
Oops, sorry. Forget this - I had a stupid typo in my code (it must be too late, I'm going home). Mal On 28 May, 18:29, MalContented wrote: > Hi, > I am trying to use temporary tables for some data manipulation but > they don't seem to work... > > Consider this simplified code: > > $sql = 'create temporary table t_hold select * from hold'; > $result = $model->query ( $sql ); // This returns true > > $sql = 'select * from t_hold'; > $result = $model->query ( $sql ); // This throws an error 1146 - Table > doesn't exist > > Now, the same error also happens if I take the 'temporary' out of the > create statement. > Furthermore, if I stick a 'show tables' statement before and after the > select, the 't_hold' table appears in the resulting array indicating > that it has indeed been created. > I tried puting a commit after the create as we are using innodb > tables. > > Does anyone know what's happening here / have a fix? > > Thanks in anticipation. > > Mal --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
users/edit function cake changes the password even when no password is provided
Hiya all Weird problem here - in my users/edit function i have a form for updating your user information If you submit the form with a blank password (so the user is not changing their password) then cake decides to change the password anyways! I have tried fixing it in my own code but nothing seems to work: if (! $this->data['User']['password']) { unset($this->data['User']['password']); } but that doesnt work because cake hashes the (blank) password before it even reaches the function any ideas why its doing 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 -~--~~~~--~~--~--~---
temporary tables in cake.
Hi, I am trying to use temporary tables for some data manipulation but they don't seem to work... Consider this simplified code: $sql = 'create temporary table t_hold select * from hold'; $result = $model->query ( $sql ); // This returns true $sql = 'select * from t_hold'; $result = $model->query ( $sql ); // This throws an error 1146 - Table doesn't exist Now, the same error also happens if I take the 'temporary' out of the create statement. Furthermore, if I stick a 'show tables' statement before and after the select, the 't_hold' table appears in the resulting array indicating that it has indeed been created. I tried puting a commit after the create as we are using innodb tables. Does anyone know what's happening here / have a fix? Thanks in anticipation. Mal --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, 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: Blog tutorial - I get a blank page
Can I see your index actions code? And the view for it. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: why support php-4
Sadly enough, tons of people still use PHP4. But dont worry, I believe 1.3 (or maybe it was 2.0) will be pure PHP 5. On May 28, 3:14 am, devportals wrote: > hi friends, > I couldn't understand why cake still support php-4? > Don't u think going with pure php-5 way will make cake more robust? > > Regards, > Bala. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, 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 and Model Design for HABTM
The only thing i see, and this may be a result of your description and not how you actually want the app to work, is that a recipe belongs to one subcategory, and it is the subcategories which HABTM main categories. In your example, steak belongs to the subcategory of beef, which in turn is in both the main categories BBQ and Main Dish. On May 28, 7:03 am, Luke wrote: > Hi, > > I am still a Cake newbie, but maybe someone give me a hint on my > issue. I am trying to learn cake by developing a recipe site. > > There are Maincategories and Subcategories. > F.e. > > BBQ -> (Pork, Beef, Vegetarian) > Main Dish -> (Vegetarian) > > A recipe can belong to different Categories, so a "Steak" could show > up under "BBQ" and "Main Dish" and there under Beef. > > I'm planing to have a Form which reads out the Maincategories from the > DB and when you click on a checkbox, the subcategories should show up > (AJAX Request?) > > I have been thinking about the DB Design now for a while and thought I > first had a solution. Than I got doubts and re-designed the tables and > the models. I am now rather confused if this design is correct and > would hope that someone could give some feedback. Okay, here the > tables: > === > maincategories *** this table is filled manually > - id > - maincategory > === > subcategories *** this table is filled manually > - id > - subcategory > - maincategory_id > === > recipes_subcategories ** this will be filled in when Add Recipe Form > was send off > - id > - subcategory_id > - recipe_id > === > recipes ** this will be filled in when Add Recipe Form was send off > - id > - recipename > === > > My Models: > > == Recipe Model > === > class Recipe extends AppModel { > var $name = 'Recipe'; > var $belongsTo = array( > 'User' => array( > 'className' > => 'User' > ) > ); > > var $hasAndBelongsToMany = array( > 'Subcategory' > => > > array( > > 'className' => 'Subcategory', > > 'joinTable' => 'recipes_subcategories', > > 'foreignKey' => 'recipe_id', > > 'associationForeignKey' => 'subcategory_id' > > ) > ); > > > > == Subcategory Model > === > class Subcategory extends AppModel { > var $name = 'Subcategory'; > var $belongsTo = array('Maincategory'); > var $hasAndBelongsToMany = array( > > 'Recipe' => > > array( > > 'className' => 'Recipe', > > 'joinTable' => 'recipes_subcategories', > > 'foreignKey' => 'subcategory_id', > > 'associationForeignKey' => 'recipe_id' > > ) > ); > > } > > Is this setup correct or any advice how it should look instead? Thanks > a lot 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: Possible Bug? $this->find for NULL values uses wrong syntax
test case? this could be a problem with the proper defaults not being set for the table. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How do I bake pre-existing tables with non-conforming names?
can't you just bake them to get the files and then tweak your models as needed for your foreign keys and such? On May 27, 8:52 pm, Jorge Garifuna wrote: > Any updates on this? > > > > On Tue, May 26, 2009 at 1:41 PM, Jorge Garifuna wrote: > > I have a few database tables that were created several years ago and > > are now heavily dependent upon for pre-existing components. > > > I would like to use cakePHP to bake a portion of the application to > > make publically available. My issues is that the command "cake bake > > all" is failing the create the models because the plural name of the > > table does not exist. > > > These pre-existing tables use singular names and the primary fields > > names is prefixed with the table names (eg: table "user", primary key > > "user_id"). > > > Below is a simplified listing of some of these tables: > > > CREATE TABLE IF NOT EXISTS `user` ( > > `user_id` INT(10) NOT NULL AUTO_INCREMENT , > > `login` VARCHAR(25) NOT NULL , > > `password` VARCHAR(50) NOT NULL , > > `active` TINYINT(1) UNSIGNED NULL DEFAULT 0 , > > PRIMARY KEY (`user_id`) > > ); > > > CREATE TABLE IF NOT EXISTS `video_item` ( > > `video_item_id` INT(10) NOT NULL AUTO_INCREMENT , > > `title` VARCHAR(255) NOT NULL , > > `icon_image` VARCHAR(255) NULL , > > `video_file` VARCHAR(255) NULL , > > `description` TEXT NULL , > > `active` TINYINT(1) NULL , > > PRIMARY KEY (`video_item_id`) > > ); > > > CREATE TABLE IF NOT EXISTS `video_comment` ( > > `video_comment_id` INT(10) NOT NULL AUTO_INCREMENT , > > `video_item_id` INT(10) NOT NULL , > > `subject` VARCHAR(255) NOT NULL , > > `comment` TEXT NOT NULL , > > PRIMARY KEY (`video_comment_id`) > > ); > > > As you can see the names and primary keys of these tables are: > > > user/user_id, video_item/video_item_id and video_comment/ > > video_comment_id > > > and cake bake expects them to be: > > > users/id, video_items/id and video_comments/id > > > Since these tables are already used internally within other systems, > > it would be very time consuming to review all the dependencies within > > the existing systems to make them conform to cakePHP naming > > convention. > > > Is there a way to use the command "cake bake all" with some minor > > tweaking so that the models, controllers and views are created with > > the existing name of the tables? > > > Any assistance would be greatly appreciated. > > > Jorge > > -- > Jorge Garifuna > Professional Web Developer > "Your Web Solution Partner" > Garinet Media Network, LLC. > 811 Wilshire Blvd. Suite 1705 > Los Angeles, CA 90017http://www.GariDigital.com > Business Operating Hours: Monday - Friday: 9AM - 6 PM PST --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Blog tutorial - I get a blank page
Start with a fresh install and go through the tutorial again? maybe you missed something. On May 28, 6:21 am, cshehadi wrote: > I apologize for the typo - I meant to write: > > /app/views/posts/ > > On May 28, 2:04 am, John Andersen wrote: > > > Please confirm that your view directory is named "views" not "view"! > > John > > > On May 28, 1:54 am, cshehadi wrote: > > > > Hi, > > > > I'm trying to get through the blog tutorial, and trying to view my > > > first page at: > > > >http://server/post/index > > > > but I'm getting a blank page. I'm sure the rewrite engine's working > > > correctly because if I try to access a nonexistent controller, such > > > as: > > > >http://server/blah/index > > > > I get the appropriate error: Missing Controller - so this tells me > > > it's finding the controller ok. > > > > But somehow it's not displaying index.ctp > > > > which I have confirmed is in: > > > > /app/view/posts/ > > > > When I view source on the page, I get nothing - not even a default > > > layout, or even an tag. It's just blank (in Firefox - just > > > checked in it IE and I get "Internet Explorer cannot display the > > > webpage") > > > > I can reach the main cakephp page without any problems, it displays > > > images and css and gives me the green light to proceed (database is > > > configured, etc...) > > > > I've also confirmed that the permissions of /app/tmp are drwxrwxr-x > > > and that it's in the same group as the web server. > > > > Without any error message at all, I'm at a complete loss as to how to > > > debug this thing. > > > > debug setting in /app/config/core.php is at 2, so it should be barking > > > at me if I've done something wrong. > > > > Anyone have a clue as to what to do next? > > > > -Charlie > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Form Helper to build Multiple Forms from data array from Find ('all')
Hi, I'm pretty new to cakephp, so thank in advance for any input. I am attempting to build a series of forms in a view with form helper based on a set of data from a find('all') in my controller. The layout is that I have a course table and a schedule table, with each schedule record having a course_id and each course record having many schedules. I set it up so on entry of a new course, the course->add action automatically adds three schedule records, one for each day of class, automatically incrementing each one day with start and end times and etc (based on a datetime field in the course add form). A consecutive three day class is therefore default for each course. But I also needed on new course entry to confirm/edit each scheduled day of class, (especially datetimes), and also to be able to add descriptions for each day and etc, so I redirect from the add course action to a schedule->edit($course_id) action which takes $course_id as an input and: $this->data = find('all',array('conditions'=>array('course_id'=> $course_id))); (for some reason findByCourse_id($course_id) would not work) The idea I thought would be to loop through the three results in the view using formhelper to build the three forms, which could each be examined and updated separately. I spent some time on this problem and discovered that formhelper is not particularly helpful in this case - building the form didn't work automagically in the loop. I fussed around with it a bit but I get a bit muddy on how the various helpers and components and conventions deal with their arrays of data - still learning - so I'm not at all clear on if this problem is dead simple, or if I'm trying to do something impossible, or if there's another solution looking me in the face. I did google the problem quite a bit but could not find anything to help me - although that doesn't mean nothing is out there. This article is similar, and suggests the problem: http://bakery.cakephp.org/articles/view/multirecord-helper-behavior One peculiar thing I found was that I could get partial results from form helper in the loop if I prepended a incrementing number to the create and fields like this: $i=0; foreach($schedules as $schedule) /* also $this->data = $schedules from controller because I believe form helper uses $this->data? */ $form->create("$i.Schedule") // ie: '1.Schedule' $form->input("Schedule.$i.id") // ie: 'Schedule.1.id' $form->input("Schedule.$i.start_date") // ie: 'Schedule.1.id' $i++ endforeach; Form helper populated 2 out of three of these forms with data from the set. the first on ($i=0) was always blank. But it didn't convert the start_date to a set of date select fields. Anyway, I'm in over my head here and any help would be appreciated. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Determine which database driver is being used
Hello, Not sure if this has been discussed before, but I couldn't find it. As much as I hate to do it, I think I may need to use my first custom query out of this entire website (either that or use a recursive search, which is running thousands of queries instead of just 1). My biggest issue with a custom query is that for my local development machine, I use MySQL and the production server uses MS SQL (not my choice). Obviously a custom query won't work when copying code between these two, so I wanted to try coding something like: if ($database_driver == 'mssql') { $query = 'select'; } elseif ($database_driver == 'mysql') { $query = 'select'; } I'm open to suggestions if there's a way to avoid a custom query here, but if not, is there at least a good way I can determine which DB driver is being used so I can do something similar to the above? 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: Authenticating a CakePHP app within an already built system
Jenski, I've recently done something in a similar situation. The legacy application saved a session variable with the userid of the logged in user. For the integration of the CakePHP portions, I use that session variable. If the variable is set, the user is logged in and I know their userid... If it is not set I assume the user is not logged in and redirect to the legacy application's login page. All the pages provided by CakePHP require the user to be logged in. I handle it all in a component, with something along the lines of http://example.com'; public $sessionKey='session_key'; public function startup(&$controller){ if(empty($_SESSION[$this->sessionKey])) { $controller->redirect($this->loginUrl); } } } -teh On May 28, 3:59 am, Jenski wrote: > Hi Guys, > > We have an intranet, and I have decided to use CakePHP to build an > application within it. > > We currently authenticate the users and their username/password > (hashed) is stored in sessions > > I've managed to get this info in the bootstrap file of CakePHP > > so I now have Configure::read('password') and Configure:read > ('password') available in the Cake App... > > I have a database table with usernames in and related data, > > what is the best way of using this information to authenticate the > user? > > Thanks in advance > > Jen --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Feedback from TranslateBehavior creator needed
Hello, I have some issues while working with TranslateBehavior. I'll try get to the point: There's ArticleVersion model, which have this fields: id, name: varchar, introduction:text, created:datetime. I've defined to name and introduction fields to be translatable: var $actsAs = array('Translate' => array('name', 'introduction')); Quick adding a new ArticleVersion is made by filling just name field and submitting, and introduction doesn't need to be fulfilled. Now, when I go to ArticleVersion edit page - I can't see name I just filled (it is in i18n table) because TranslateBehavior->beforeSave is making this query: SELECT `ArticleVersion`.*, `Article`.*, `ArticleMedia`.*, `I18n__name`.`content`, `I18n__introduction`.`content`, `ArticleVersion`.`id` FROM `article_versions` AS `ArticleVersion` LEFT JOIN `i18n` AS `I18n__name` ON (`ArticleVersion`.`id` = `I18n__name`.`foreign_key` AND `I18n__name`.`model` = 'ArticleVersion' AND `I18n__name`.`field` = 'name') LEFT JOIN `i18n` AS `I18n__introduction` ON (`ArticleVersion`.`id` = `I18n__introduction`.`foreign_key` AND `I18n__introduction`.`model` = 'ArticleVersion' AND `I18n__introduction`.`field` = 'introduction') LEFT JOIN `articles` AS `Article` ON (`ArticleVersion`.`article_id` = `Article`.`id`) LEFT JOIN `article_media` AS `ArticleMedia` ON (`ArticleVersion`.`article_medium_id` = `ArticleMedia`.`id`) WHERE `ArticleVersion`.`id` = 80165 AND `I18n__name`.`locale` = 'pol' AND `I18n__introduction`.`locale` = 'pol' LIMIT 1 It returns no rows, because there's `I18n__introduction`.`locale` = 'pol' in where statement, and the introtuction field is't saved in Quick add operation. What I need is `i18n__*`='pol' in ON statement for LEFT JOINS, so not existing translation is not making any of those troubles. I found interesting if condition in translateBehavior between lines 162 and 195. It checks if $locale variable is array. If not- it places `i18n__*` statements in WHERE (my example above). Otherwise it looks like placing `i18n__*` statements in LEFT JOIN ... ON clause. But I don't know how to make $locale variable an array? Tried Configure::write('Config.language', array('pol'=>'pol')); but it didn't work. Just for test I changed else statement in that if statement I'm referring to from: http://bin.cakephp.org/saved/46610 to http://bin.cakephp.org/saved/46611 After that it works as I wanted it to work. But I don't like messing up with core, and don't now if it broke something some place else. So I need an advice from somebody who knows what TranslateBehavior's guts does, or someone who can explain to me how to make TranslateBehavior to work as I desire (if it's possible at all :)) I'm sorry for long post, and not the best English, and thank You for Your time :) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: set and field of more words
>> $this->set( ??, $array_of_value); // PostOfTheMonths doesn't work, >> postOfTheMonths neither > Close, it should be: > postOfTheMonths you mean something like: camelized + pluralized + first letter in lowercase: postOfTheMonths ? it doesn't works! -- pietro --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: set and field of more words
Close, it should be: postOfTheMonths :-) On May 28, 9:11 am, fain182 wrote: > > I'm having some trouble figuring out what the problem is here. Could > > you clarify why you want a variable name with spaces? > > ok, i want to have a form->input() that make me a select, for example, > if the field's name is group: > in controller: > $this->set('groups', $array_of_value); > in view: > echo $form->input('Group'); > > but if the field name is like "post of the month" ? > in controller: > $this->set( ??, $array_of_value); // PostOfTheMonths doesn't work, > postOfTheMonths neither > in view: > echo $form->input('post of the month'); > > thank you > > -- > pietro --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Possible Bug? $this->find for NULL values uses wrong syntax
Problem appears to be this line in cake/libs/model/datasource/ dbo_source.php $null = ($value === null || (is_array($value) && empty($value))); Should be: $null = ($value == null || (is_array($value) && empty($value))); I'm the value is being cast from a null to a string somewhere before this code is being executed and the absolutely equal (===) is failing because the datatype of a null string is different to the null its being compared to. Should I ticket this? On May 28, 3:22 pm, "rich...@home" wrote: > In the model: > > $this->find("first", array( > "conditions"=>array( > "OrderDetail.id"=>"" > ) > ; > > Produces the following SQL where clause: > > WHERE `OrderDetail`.`id` = NULL > > That will never match any records (comparing anything directly with > NULL always results in NULL, ie. comparing anything with an unknown > will always produce an unknown answer) > > The correct syntax should be: > > WHERE `OrderDetail`.`id` IS NULL > > Shouldn't CakePHP use IS NULL when building the where clause for NULL > values in comparisons? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, 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: Possible Bug? $this->find for NULL values uses wrong syntax
Sorry, should have made that a bit more clear: The value is coming from a form posting. The value is a PHP null in the form post array so the condition is actually: $price = $this->Price->find("first", array( "conditions"=>array( "Price.product_id"=>$data['OrderDetail']['product_id'], "Size.name"=>$data['OrderDetail']['price_id'], "Price.print_mounting_id"=>$data['OrderDetail'] ['print_laminating_id'] ), "contain"=>array( "Size"=>array( "id", "name" ) ) )); echo $data['OrderDetail']['print_laminating_id'] == null ? "Yes" : "No"; Displays 'Yes', so the data in the post array is a PHP null. Oddly, the following: $price = $this->Price->find("first", array( "conditions"=>array( "Price.product_id"=>$data['OrderDetail']['product_id'], "Size.name"=>$data['OrderDetail']['price_id'], "Price.print_mounting_id"=>null ), "contain"=>array( "Size"=>array( "id", "name" ) ) )); Works as expected and uses IS NULL WTF? On May 28, 3:30 pm, Jon Bennett wrote: > > The correct syntax should be: > > > WHERE `OrderDetail`.`id` IS NULL > > try: > > $this->find("first", array( > "conditions"=>array( > "OrderDetail.id"=>NULL > ) > ; > > hth > > jon > > -- > > jon bennett > w:http://www.jben.net/ > iChat (AIM): jbendotnet Skype: jon-bennett --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, 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: Possible Bug? $this->find for NULL values uses wrong syntax
> The correct syntax should be: > > WHERE `OrderDetail`.`id` IS NULL try: $this->find("first", array( "conditions"=>array( "OrderDetail.id"=>NULL ) ; hth jon -- jon bennett w: http://www.jben.net/ iChat (AIM): jbendotnet Skype: jon-bennett --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Possible Bug? $this->find for NULL values uses wrong syntax
In the model: $this->find("first", array( "conditions"=>array( "OrderDetail.id"=>"" ) ; Produces the following SQL where clause: WHERE `OrderDetail`.`id` = NULL That will never match any records (comparing anything directly with NULL always results in NULL, ie. comparing anything with an unknown will always produce an unknown answer) The correct syntax should be: WHERE `OrderDetail`.`id` IS NULL Shouldn't CakePHP use IS NULL when building the where clause for NULL values in comparisons? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, 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 and Model Design for HABTM
Hi, I am still a Cake newbie, but maybe someone give me a hint on my issue. I am trying to learn cake by developing a recipe site. There are Maincategories and Subcategories. F.e. BBQ -> (Pork, Beef, Vegetarian) Main Dish -> (Vegetarian) A recipe can belong to different Categories, so a "Steak" could show up under "BBQ" and "Main Dish" and there under Beef. I'm planing to have a Form which reads out the Maincategories from the DB and when you click on a checkbox, the subcategories should show up (AJAX Request?) I have been thinking about the DB Design now for a while and thought I first had a solution. Than I got doubts and re-designed the tables and the models. I am now rather confused if this design is correct and would hope that someone could give some feedback. Okay, here the tables: === maincategories *** this table is filled manually - id - maincategory === subcategories *** this table is filled manually - id - subcategory - maincategory_id === recipes_subcategories ** this will be filled in when Add Recipe Form was send off - id - subcategory_id - recipe_id === recipes ** this will be filled in when Add Recipe Form was send off - id - recipename === My Models: == Recipe Model === class Recipe extends AppModel { var $name = 'Recipe'; var $belongsTo = array( 'User' => array( 'className' => 'User' ) ); var $hasAndBelongsToMany = array( 'Subcategory' => array( 'className' => 'Subcategory', 'joinTable' => 'recipes_subcategories', 'foreignKey' => 'recipe_id', 'associationForeignKey' => 'subcategory_id' ) ); == Subcategory Model === class Subcategory extends AppModel { var $name = 'Subcategory'; var $belongsTo = array('Maincategory'); var $hasAndBelongsToMany = array( 'Recipe' => array( 'className' => 'Recipe', 'joinTable' => 'recipes_subcategories', 'foreignKey' => 'subcategory_id', 'associationForeignKey' => 'recipe_id' ) ); } Is this setup correct or any advice how it should look instead? Thanks a lot 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 -~--~~~~--~~--~--~---
why support php-4
hi friends, I couldn't understand why cake still support php-4? Don't u think going with pure php-5 way will make cake more robust? Regards, Bala. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Authenticating a CakePHP app within an already built system
Hi Guys, We have an intranet, and I have decided to use CakePHP to build an application within it. We currently authenticate the users and their username/password (hashed) is stored in sessions I've managed to get this info in the bootstrap file of CakePHP so I now have Configure::read('password') and Configure:read ('password') available in the Cake App... I have a database table with usernames in and related data, what is the best way of using this information to authenticate the user? Thanks in advance Jen --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, 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: Blog tutorial - I get a blank page
I apologize for the typo - I meant to write: /app/views/posts/ On May 28, 2:04 am, John Andersen wrote: > Please confirm that your view directory is named "views" not "view"! > John > > On May 28, 1:54 am, cshehadi wrote: > > > Hi, > > > I'm trying to get through the blog tutorial, and trying to view my > > first page at: > > >http://server/post/index > > > but I'm getting a blank page. I'm sure the rewrite engine's working > > correctly because if I try to access a nonexistent controller, such > > as: > > >http://server/blah/index > > > I get the appropriate error: Missing Controller - so this tells me > > it's finding the controller ok. > > > But somehow it's not displaying index.ctp > > > which I have confirmed is in: > > > /app/view/posts/ > > > When I view source on the page, I get nothing - not even a default > > layout, or even an tag. It's just blank (in Firefox - just > > checked in it IE and I get "Internet Explorer cannot display the > > webpage") > > > I can reach the main cakephp page without any problems, it displays > > images and css and gives me the green light to proceed (database is > > configured, etc...) > > > I've also confirmed that the permissions of /app/tmp are drwxrwxr-x > > and that it's in the same group as the web server. > > > Without any error message at all, I'm at a complete loss as to how to > > debug this thing. > > > debug setting in /app/config/core.php is at 2, so it should be barking > > at me if I've done something wrong. > > > Anyone have a clue as to what to do next? > > > -Charlie --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Problem Uploading Flash
So I have a problem uploading a flash video using MeioUpload in CakePHP. Here is my controller code for the add function: function add() { if (!empty($this->data['Video'])) { $mrClean = new Sanitize(); $id = $this->Session->read('buildId'); $slug = $this->Session->read('buildSlug'); $this->data['Video']['build_id'] = $id; if ($this->Video->save($this->data['Video'])) { $this->Session->setFlash('New video for build ' . $slug . ' have been added.'); $this->redirect('/builds/view/' . $slug); $this->exit(); } else { $this->Session->setFlash('New video for build ' . $slug . ' could not be added.'); $this->redirect('/builds/view/' . $slug); $this->exit(); } } } and the code for the Video model: class Video extends AppModel { var $name = 'Video'; var $actsAs = array( 'MeioUpload' => array( 'video' => array( 'dir' => 'videos/builds/uploads', 'create_directory' => false, 'allowed_mime' => array('video/x-flv'), 'allowed_ext' => array('.flv') ) ) ); } and the code for the add view: echo $form->create('Video', array('action' => 'add', 'type' => 'file')); echo $form->label('Video.video', 'Video:'); echo $form->input('Video.video', array('label' => false, 'type' => 'file')); echo $form->submit('background.png'); echo $form->end(); I've been through this now for the past 2 days and can't figure out anything wrong with the code, yet the video will not get uploaded and as such the database entry never gets created. I have no idea what the problem is so I have no clue what to look for. Is anyone able to help me with 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: Star Rating Help
Great work! Henrique Machado 2009/5/27 schneimi > > I read about some bakery criterias the plugin doesn't match (like > styles and tests), but you are right, I could give it a try anyway. > > You're welcome to use it. Btw I just put up a new version that also > supports jQuery. > > Regards, > Michael > > Dardo Sordi Bogado schrieb: > > > Because I am not sure about the requirements for the bakery, I just > > > put it on my blog: > > > > I couldn't see anything that can prevent your blog post from being a > > good Bakery article, why don't just give it a try? > > > > > Let me know what you think about it. > > > > I'm testing it now, I think it could be useful for me in my current > > project, thanks! > > > > Regards, > > - Dardo. > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: invalid tree model struct in Xml
this working right $arr['data']['Invoice'] = $invoice['Invoice']; $arr['data']['Client'] = $invoice['Client']; $arr['data']['Seller'] = $invoice['Seller']; $arr = new Xml($arr); echo ''; echo $arr; //echo new Xml($invoice['Client']); echo ''; debug(Set::reverse($arr)); On May 28, 12:53 pm, "andrzejborkow...@gmail.com" wrote: > so i have problem with Xml component > > my arry from find loks like that > > array( > [Invoice] => array(...) > [Seler] => array(...) > > so its good... > > after > $xml = new Xml($invoice); > xml loks like that (this is stupid...) > > > after > $result = Set::reverse($xml); > > arr loks like bad... that > array( > [Invoice] => array( > [Seler] => array(...) > ) > > full example > > App::import('Core','Xml'); > debug($arr); > $xml = new Xml($arr); > debug($xml); > $arr = Set::reverse($xml); > debug($arr); > exit; > > whats 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 -~--~~~~--~~--~--~---
invalid tree model struct in Xml
so i have problem with Xml component my arry from find loks like that array( [Invoice] => array(...) [Seler] => array(...) so its good... after $xml = new Xml($invoice); xml loks like that (this is stupid...) after $result = Set::reverse($xml); arr loks like bad... that array( [Invoice] => array( [Seler] => array(...) ) full example App::import('Core','Xml'); debug($arr); $xml = new Xml($arr); debug($xml); $arr = Set::reverse($xml); debug($arr); exit; whats 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: Error Installation CakePHP 1.2.
On Thu, May 28, 2009 11:43 am, andy wrote: > > If you remove the "echo $html->meta('icon');" line, does the page > display correctly? it doesnt make any difference with that line removed. > On May 27, 6:17 am, iammikek wrote: >> We're getting the same issue with php5.2.5 using the cake_1.2.3.8166 >> release >> so suggest the issue doesnt only apply to php4. >> >> Anyone got any ideas why this happening? >> >> >> >> brian-9 wrote: >> >> > I suggest that you consider upgrading to version 5.x as Cake may not >> > support PHP4.x for much longer. This isn't an official announcement, >> > only based on the number of people who have been strongly suggesting >> > that Cake no longer support it. >> >> > In any case, PHP4.x itself has been discontinued for a very long time >> now. >> >> > On Wed, May 13, 2009 at 9:49 PM, genobee wrote: >> >> >>> > Notice: Undefined offset: 0 in /var/www/vhosts/ideal-weddings.com/ >> >>> > httpdocs/cakephp/cake/libs/configure.php on line 1185 >> >> >>> > Line 1185: "unset($this->__paths[rtrim($core[0], DS)]);" part of >> >>> > destructor method >> >> -- >> View this message in >> context:http://n2.nabble.com/Error-Installation-CakePHP-1.2.-tp2879433p298038... >> Sent from the CakePHP mailing list archive at Nabble.com. > > > > -- Mike Karthauser Managing Director - Brightstorm Ltd Email: mi...@brightstorm.co.uk Web: http://www.brightstorm.co.uk Tel: 07939 252144 (mobile) Fax: 0870 1320560 Address: 1 Brewery Court, North Street, Bristol, BS3 1JS --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Error Installation CakePHP 1.2.
If you remove the "echo $html->meta('icon');" line, does the page display correctly? On May 27, 6:17 am, iammikek wrote: > We're getting the same issue with php5.2.5 using the cake_1.2.3.8166 release > so suggest the issue doesnt only apply to php4. > > Anyone got any ideas why this happening? > > > > brian-9 wrote: > > > I suggest that you consider upgrading to version 5.x as Cake may not > > support PHP4.x for much longer. This isn't an official announcement, > > only based on the number of people who have been strongly suggesting > > that Cake no longer support it. > > > In any case, PHP4.x itself has been discontinued for a very long time now. > > > On Wed, May 13, 2009 at 9:49 PM, genobee wrote: > > >>> > Notice: Undefined offset: 0 in /var/www/vhosts/ideal-weddings.com/ > >>> > httpdocs/cakephp/cake/libs/configure.php on line 1185 > > >>> > Line 1185: "unset($this->__paths[rtrim($core[0], DS)]);" part of > >>> > destructor method > > -- > View this message in > context:http://n2.nabble.com/Error-Installation-CakePHP-1.2.-tp2879433p298038... > Sent from the CakePHP mailing list archive at Nabble.com. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Database design
Thanks for that hint with the condition. I edited my models accordingly and it works as expected regards, harpax On 27 Mai, 15:27, Martin Westin wrote: > I would choose separate tables for comments, shoutbox and guestbook. > The reason is that one day soon you might come up with an idea to > expand the guestbook and then you will curse being locked in with the > other models. > > For flexibility and reuse of code there is nothing stopping you from > Creating an "AbstractComment" model and let the other concrete models > inherit it. > The flexibility on the View end would be to use elements. > In the Controller you should have little code and any duplication > there would be negligible. But you could always make an abstract > controller if you wanted. > > If you were to use a single table then you should (IMHO) use a single > Model and call them all comments (or something). A guestbook would > contain "site owner comments" and the shoutbox "site comments" or > something like it. But since you talk of them as separate entities > then you should probably make several tables. > > @harpax > I use that technique a lot. I have some models in my app that are used > by many other models that recide in plugins I have. > You can quite easily use Cake's normal associations with just a simple > change to the association. > > var $hasMany = array( > 'Reminder' => array( > 'className' => 'Reminder', > 'foreignKey'=> 'foreign_id', > 'conditions'=> array('Reminder.belongs_to' => 'Post'), > 'dependent' => true > ) > ); > > Notice that I have set both a foreign key and a condition. That is all > it takes. I advocate using a field named belongs_to instead of > foreign_type and put the exact Model name (or alias) into that field. > This is simply since a type of reminder might be used by more than one > model. Saying that this record belongs to that model reads a little > clearer to me. > > /Martin > > On May 27, 10:22 am, Braindead wrote: > > > Well, my problem is not directly related to CakePHP, but as it's about > > database design maybe I'll get some good answers. > > > On my page I have news, downloads and users. These three can be > > commented. Additionally I have a shoutbox and a guestbook. The > > comments, shoutbox and guestbook have all the same fields. So they > > could reside in the same table. > > > Is it best practice to only have one table for all comments (news, > > downloads, users), the shoutbox and the guestbook and actually filter > > based on a type column? Or is it better to separate everything into > > it's own table? > > > Using only one table has the advantage, that I could use only one > > controller and a limited set of views, where as using multiple tables > > would mean multiple controllers and duplicated views (as they are all > > nearly the same). > > > So what do you recomment? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: welcome to cake-php members
I am learning cakephp and have found the following very helpful: http://book.cakephp.org - overview of all (or most) cakephp stuff. http://bakery.cakephp.org - articles/code related to cakephp projects. Good place to learn about behaviours and different things. I have also found lots of cool tutorials and things by searching google, cakephp & the issue usually pulls some things up. This group is also a great resource. Good luck. On May 27, 2:48 pm, "jason.t.stein" wrote: > Maybe tryhttp://www.w3schools.com/php/default.asp > for PHP. For Cake click on the learn link athttp://cakephp.org/ > > On May 27, 1:03 am, greeta wrote: > > > > > Hi all, > > > I am new to cake-php. could you help me by sending cake-php > > samples/ examples...Is there any simple website like w3schools.com for > > php.. > > > Thanks in advance --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Associated models foreach loop/pagination - not sure how to include them.
I'm working with the searchable behaviour and have got it setup and running OK, but I'm really not sure how I set associated data for output in the view. I have a search.ctp file which shows related data such as categories, users etc. I know normally to retrieve the data I would just do a find, but there is one variable set ($results), and I do not know how to add in more data to be retrieved. I have searched and tried various things include multiple for loops (worked but the data wasn't linked to the search). There must be some way of doing it, but I am still new to the cake way of doing things and just can't seem to know how to do it. This is the basic code: function search($keyword = null) { // Load SearchIndex Model: $this->loadModel('SearchIndex'); $search = $this->SearchIndex->findAllById('search_index.id'); // Do search stuff: $this->SearchIndex->searchModels(array('Post','Comment')); $this->paginate = array( 'limit' => 10 ); $this->set('results', $this->paginate('SearchIndex')); } I need to fit in the associated models in there somewhere Any help would be greatly appreciated! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: set and field of more words
> I'm having some trouble figuring out what the problem is here. Could > you clarify why you want a variable name with spaces? ok, i want to have a form->input() that make me a select, for example, if the field's name is group: in controller: $this->set('groups', $array_of_value); in view: echo $form->input('Group'); but if the field name is like "post of the month" ? in controller: $this->set( ??, $array_of_value); // PostOfTheMonths doesn't work, postOfTheMonths neither in view: echo $form->input('post of the month'); thank you -- pietro --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---