Validations
Hi Guys, Is there any way to piggy-back off the validations on the model to validate fields that are not in the table? Other than doing it manually of course ;) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: MVC 101? Please forgive this really basic question
I have successfully implemented the blog tutorial twice now, since I had to reinstall cake. I was seeking to use the tutorial as a 'quick-start' method to getting to understand what makes Cake tick. Unfortunately, I don't feel like the tutorial helped concepts really sink in for me, so I have been reading the manual from the top, more closely this time, attempting to understand everything within. In the end, the tutorial itself was confusing me in this case because it seemed to contradict what I was reading in the manual. I admit I have a lot of weakness in OOP, never programmed in it before although I have created my own classes in php because they were a good fit for the need. But I was under the impression that Cake was novice-friendly. CakePHP aims to assist PHP users of all levels to create robust, maintainable applications quickly and easily. This manual expects a basic knowledge of PHP and HTML. A familiarity with the Model-View-Controller programming pattern is helpful, but we will cover that along the way for those new to MVC. Of course, I'm happy to undertake the learning oop, but if the Cake community recommends I do so with a different language other than php under Cake, then that might be something worth communicating as part of the introduction to Cake. I'm sure I represent a large number of web developers, accustomed to more linear php programming and seeking something better, who are beating a path to Cake's door today as of the publicized release of 1.0. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Scaffold: How to draw a SELECT OPTION for a filed having parent_id with the same Table
Will it work if you use 'categories_id' instead of 'parent_id'?Following the cake conventions this might make sense.On 5/8/06, Kotekar [EMAIL PROTECTED] wrote:categories TABLE- id- name- parent_id While Add New Category,i need the SELECT OPTION to draw the values ofpresent Category List to choose if the New one is Sub Category ofpresented one.Can any one help, to find out how to build the association to this. Thanx in advance. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
$this-log error.log location
I'm a new cake (1.0.1) user and have been trying out the tutorials etc, it all looks good so far. The problem I've had is with the $this-log() function. I was getting permissions errors about creating the file wherever the function was called. I'm using Apache2 on Ubuntu, and the function tries to create the error.log file in the root directory of the file system (/error.log). I let it do it once and it worked, but obviously this isn't really a good place for the log to be - is there a setting somewhere I can change? Cheers. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Scaffold: How to draw a SELECT OPTION for a filed having parent_id with the same Table
sorry that was supposed to be bake.php was broken. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Session issue
Try this (for testing purposes): function index($id='1') { //$_SESSION['Customers.id'] = $id; $this-set('data',$this-Assessment-findAllByCustomerId($id)); } Obviously, you'd replace the '1' in the function def with an id you know is valid. See if everything else works without the session. This way, you'll know if the problem is a weird session issue, or if there is something else going on. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Session issue
Hi Alberto, And nothing...I get always that favicon.ico. What exactly does this mean? Are you saying that h1?php echo $customers_id; ?/h1 ... rest of file ... in your view file outputs h1favicon.ico/h1 ... rest of file ... ? AD7six --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Two select menu in one form?
My problem now is that: I have a class that defines users and users are linked to assessments via a foreign key assessment_id. An assessment, is linked to a customer via a foreign key customer_id; now the challenge is that when I'm creating the add.thtml view to insert a new customer I'll have 2 select menus from where I'll select the customer and then the assessment. But, how can I make them dependent, I mean, how can I make something that when I select a customer from the first one it fills the second with the assessments of that customer? Thanks in advance! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Session issue
The problem is that when I need to read the Customers.id value I geta strange text: favicon.ico. How can I avoid that?Thanks to all for the help!Try adding the favicon.ico to your DOCUMENT ROOT. There is one in the app/webroot/ copy it to your DOCUMENT ROOT If you have DOCUMENT ROOT set to app/webroot this should not be an issue. -- /** * @author Larry E. Masters * @var string $userName * @param string $realName * @returns string aka PhpNut * @accesspublic */ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Session issue
Ok so, the favicon.ico location is not the problem because I never changed roots. I'm using Windows XP Home, Mozilla Firefox latest version and CakePHP cake_1.0.1.2708. Here's the code: 1) this is the controller of customers, the first page I access ?php class CustomersController extends AppController { var $name = 'Customers'; function index() { $this-Session-renew(); $this-set('data',$this-Customer-findAll()); } function add() { if (empty($this-params['data'])) { $this-render(); } else { if ($this-Customer-save($this-params['data'])) { $this-flash('Customer added.','/customers'); } } } function destroy($id) { if ($this-Customer-del($id, $cascade=true)) { $this-flash('Customer has been destroyed.', '/customers'); } } } ? 2) this is the code of assessments controller, I access this one after I selected a customer and $id is passed via URL ?php class AssessmentsController extends AppController { var $name = 'Assessments'; function index($id) { $this-Session-write('Customers.id',$id); $this-set('data',$this-Assessment-findAllByCustomerId($id)); } function add() { $this-set('customers',$this-Assessment-Customer-generateList()); if (empty($this-params['data'])) { $this-render(); } else { if ($this-Assessment-save($this-params['data'])) { $this-flash('Assessment added.','/customers'); } } } function destroy($id) { if ($this-Assessment-del($id, $cascade=true)) { $this-flash('Assessment has been destroyed.', '/customers'); } } } ? 3) this is the code from project controller. I access the projects page after I selected an assessment so $id is passed via URL and is the id of an assessment ?php class ProjectsController extends AppController { var $name = 'Projects'; function index($id) { $this-set('data',$this-Project-findAllByAssessmentId($id)); } function add() { $c_id = $this-Session-read('Customers.id'); $this-set('customer',$this-Project-Assessment-Customer-findAllById($c_id)); $this-set('assessment',$this-Project-Assessment-generateList()); if (empty($this-params['data'])) { $this-render(); } else { if ($this-Project-save($this-params['data'])) { $this-flash('Project added.','/customers'); } } } function destroy($id) { if ($this-Project-del($id, $cascade=true)) { $this-flash('Project has been destroyed.', '/customers'); } } } ? 4) Now I should have saved the Customer ID into the session because when I want to add a new project I NEED to know the customer to which it will depend. Here's the view of the INDEX of projects: the print of the value stored in the session is only for debugging purposes: h1Registered Projects/h1 table tr thId/th thProject/th thnbsp;/th /tr ?php foreach ($data as $project): ? tr td?php echo $project['Project']['id']; ?/td td ?php echo $html-link( $project['Project']['name'], /projects/index/{$project['Project']['id']} ); ? /td td?php echo $html-link('Delete',/projects/destroy/{$project['Project']['id']}, null, Are you sure you want to delete?)? /td /tr ?php endforeach; ? /table ?php echo $html-link(Back, /customers/index); ?nbsp;|nbsp;?php echo Customer ID: . $this-controller-Session-read('Customers.id'); ? this problem is driving me mad... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Session issue
Ok so, the favicon.ico location is not the problem because I neverchanged roots. Is the favicon.ico in your DOCUMENT ROOT? -- /** * @author Larry E. Masters * @var string $userName * @param string $realName * @returns string aka PhpNut * @accesspublic */ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Two select menu in one form?
I think the best solution is using ajax. When a customer is selected, call a function to retrieve the assessments with the customer id and display them in a new box. Of course you could do it without ajax by adding a condition before save() to rerender the view with an assesment box.. but it's less elegent and takes longer. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
generateList with two fields.
Hi, I need to make a select box with name of people. I need it to show (Last name, First Name). In the databsase, i have two fields, first_name and last_name. I need to retrieve the data for a select box. I know i can do it with findall but i'dd rather do it with generatelist. the problem is i can't seem to find how to make generatelist get more than one field. Is there a way to do it? Thanks. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Scaffold: How to draw a SELECT OPTION for a filed having parent_id with the same Table
Hi Mika, It seems to be broken, it didn't worked. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: admin routes and passwords
You only use the admin route to gather administrativ actions under a common base URL. It has nothing to do with authentication it is all about URL translation. To set authentication you still need to do that in the controllers and actions just like you would do without the admin route. If you don't have one built into your app yet you could check out cakeForge and the snippets library. There are a few different login managers there. A simple one is this othAuth from the snippets: http://cakeforge.org/snippet/detail.php?type=snippetid=38 I have used User Management mysef as a base for a small project: http://cakeforge.org/projects/usermgmt/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: How to change layout for plugins errors
Thanks Felix. I'll try both and let you know. ;) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Need help passing id between controllers
Hello, I need a little help with a simple application I am building. I already have most of it done except that I cannot figure out how to pass the right id from one model to another. I have a model vehicles which has a hasMany relationship with a model vlogs. The model vlogs also has a belongsTo relationship with the model vehicles. When the user logs in he is taken to the vehicles index page which lists his vehicles. From there he can either edit or add another vehicle but I also want him to be able to insert a log for a vehicle. Since I know the id of each vehicle from this page I have a link for each vehicle which should allow the user to add a log to the vehicle he choses. The log link from the vehicles page has the form: ?php echo $html-link('Add Log',/vlogs/add/{$vehicle['Vehicle']['id']}) ? and the acual link winds up having the form: http://10.1.39.52/maxmympg/vlogs/add/4 with the 4 being the vehicle_id needed for inserting into the vlogs table. The problem is that the vlogs page knows nothing about the 4. All of my relationships in my models and controllers and tables is correct I believe. How do I tell the vlogs model the right vehicle_id top insert the record with. What is the correct cake way of doing this ?? Any help would be appreciated. --thanx --dusty --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Need help passing id between controllers
On May 9, 2006, at 9:05 AM, Dusty wrote:snippedThe problem is that the vlogs page knows nothingabout the "4". All of my relationships in my models andcontrollers and tables is correct I believe.How do I tell the "vlogs" model the right "vehicle_id"top insert the record with. What is the correct "cake"way of doing this ??In your VlogsController, you should have an add function. It should look something like this:?class VlogsController extends AppController{ function add($id) { //make sure you have the $id parameter - this is where you can use the ID passed in by the URL // so calling /vlogs/add/23 would mean that $id = 23 at this point. }}?Basically:/controller/action/var1/var2/var3 callsController::action('var1', 'var2', 'var3');Hope that helps.-- John --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Newbie problems
I found the problem : i use cake under windows and then i can't see the error message . This day i try to install cake under debian and it's ok i can see the error message . Perhaps it's due to easyphp , i don' t now exactly . thanx to BoBB Tinmar --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Need help passing id between controllers
John, Thanks for the help !! Basically I have already tried that and for some reason I get the warning missing argument for add() in /vlogs_controller.php. So I must be doing something wrong or not have something set up correctly. For some reason it doesn't see the $id variable being passed to it. I have pasted the code for the vlogs_controller.php below. If I un-comment the line: //$this-params['data']['Vlog']['vehicle_id'] = '2' ; everything works ok and a record is inserted with the vehicle id = 2. function add($id) { if (empty($this-params['data'])) { $this-render(); } else { $this-params['data']['Vlog']['vehicle_id'] = $id ; //$this-params['data']['Vlog']['vehicle_id'] = '2' ; $this-Output-filter($this-params['data']); $this-Sanitize-cleanArray($this-params['data']); if ($this-Vlog-save($this-params['data'])) { $this-flash('Your log has been saved.','/vlogs'); } else { $this-set('data', $this-params['data']); $this-render(); } } } --thanx again --dusty --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Scaffold: How to draw a SELECT OPTION for a filed having parent_id with the same Table
hi it's not a problem with mysql itself (otherwise, it would return something like unable to connect) I'm no expert (and all this depends on the way you 'upgraded' php4 to php5), but maybe it comes from a wrong setup of php5. in php.ini (the one for php5), in the extension (module) section I have had to uncomment (or add, I don't remember) : extension=php_mysql.dll maybe it's particular for me (because I run php5 as a cgi, still php4 by default), but I think mysql was built in php4, not php5, something like that. anyway, it's OT ;) ++ clemos On 5/9/06, Spark [EMAIL PROTECTED] wrote: i tried it last night, and I got this message: _ _ ___ _ _ ___ ___ _ _ ||__| |_/ |___ |__] |__| |__]|__] |__| |_/ |___ |___ | | | \_ |___ || | | |__] | | | \_ |___ --- [M]odel [C]ontroller [V]iew Please select a class to Bake: (M/V/C) m --- Model Bake: --- Fatal error: Call to undefined function mysql_connect() in D:\webroot\cake\cake\libs\model\dbo\dbo_mysql.php on line 116 I'm running winXP, easyphp 1.8 , upgraded everything (php 5, mysql 5, phpmyadmin, etc), and i'm NOT running mysql as a service. is it essencial ? mysql is also on the Path. thank you spark! On 5/9/06, Mika [EMAIL PROTECTED] wrote: What response did you get? -- [web] http://synapsisdi.com.br [livesets] http://djspark.com.br --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
What kind of code is appropriate for a view?
I'm working on extending the blog tutorial a bit and part of it was rolling out a user auth system. This was actually quite a bit easier than I expected, and I've even set it up so that one only needs to be logged in to add, delete, or edit posts. So my question is this: I'd like for a logout button to appear on the list of posts, but obviously only if someone is logged in. Would it be considered too much business-logic for a view to do a conditional to check if the user is logged in before displaying the logout button? If so, what would be the best way to display a logout button only under the condition that someone is logged in. It seems silly to me to define a whole separate view for logged in users just to make one small change... especially if I was dealing with a complex view and needed to make changes! Any suggestions/ideas/affirmations? Thanks! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Two select menu in one form?
Oh thanks! I was expecting you to suggest me Ajax use...well can you suggest me any good Ajax help to do this? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: What kind of code is appropriate for a view?
I wouldn't balk too much at something like ?php if (!empty($_SESSION['uid'])):? a href=/users/logoutLogout/a ?endif;? in a view. Just my opinion though. I mean I guess you could put something in the controller that would tell the view if you're logged in or not (which I *would* do if you're checking login status more than once in a page), but I don't know if it makes much of a difference if you're only checking once. : / -- John On May 9, 2006, at 10:52 AM, roberts.sean wrote: I'm working on extending the blog tutorial a bit and part of it was rolling out a user auth system. This was actually quite a bit easier than I expected, and I've even set it up so that one only needs to be logged in to add, delete, or edit posts. So my question is this: I'd like for a logout button to appear on the list of posts, but obviously only if someone is logged in. Would it be considered too much business-logic for a view to do a conditional to check if the user is logged in before displaying the logout button? If so, what would be the best way to display a logout button only under the condition that someone is logged in. It seems silly to me to define a whole separate view for logged in users just to make one small change... especially if I was dealing with a complex view and needed to make changes! Any suggestions/ideas/affirmations? Thanks! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Session issue
Well it's in the default app/webroot directory. How can I see my document root? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Session issue
When your page is rendered view the HTML source in your web browser.Send us that code so we can see where things are getting printed out too.On 5/9/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Well it's in the default app/webroot directory.How can I see my document root? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: beforeFilter
Wrap your entire before filter in if (in_array($this-action, array('protected', 'actions', 'here'))) { } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Session issue
Here it is man: !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; head titleCakePHP : A Rapid Development Framework :: Projects/title link rel=shortcut icon href=favicon.ico type=image/x-icon / meta http-equiv=Content-Type content=text/html; charset=UTF-8 /link rel=stylesheet type=text/css href=/process_strategy/css/cake.default.css /!--[if lt IE 7] link rel=stylesheet type=text/css href=/process_strategy/css/cake.ie.css /![endif]-- /head body div id=wrapper div id=header img src=/process_strategy/img/cake.logo.png alt=CakePHP : Rapid Development Framework border=0 //div div id=content h1Registered Projects/h1 table tr thId/th thProject/th thnbsp;/th /tr tr td1/td td a href=/process_strategy/projects/index/1 Geran BR 8.0/a/td tda href=/process_strategy/projects/destroy/1 onclick=return confirm('Are you sure you want to delete?');Delete/a/td /tr tr td2/td td a href=/process_strategy/projects/index/2 Geran BR 9.0/a/td tda href=/process_strategy/projects/destroy/2 onclick=return confirm('Are you sure you want to delete?');Delete/a/td /tr /table a href=/process_strategy/customers/index Back/anbsp;|nbsp;Customer ID: favicon.ico /div div id=footer pCakePHP :: a href=http://www.cakefoundation.org/pages/copyright/;copy; 2006 Cake Software Foundation, Inc./a /p br / p !--PLEASE USE ONE OF THE POWERED BY CAKEPHP LOGO-- a href=http://www.cakephp.org/; target=_blank img src=/process_strategy/img/cake.power.png alt=CakePHP : Rapid Development Framework height=15 width=80 //a /p p a href=http://validator.w3.org/check?uri=referer; img src=/process_strategy/img/w3c_xhtml10.png alt=Valid XHTML 1.0 Transitional height=15 width=80 //a a href=http://jigsaw.w3.org/css-validator/check/referer; img src=/process_strategy/img/w3c_css.png alt=Valid CSS! height=15 width=80 //a /p /div /div /body /html!-- 0.2375s -- --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Model association
Hello, I'm new to cake and i'm having some trouble getting things done but i'm sure i'll get used to it once I understand how certain things work in Cake. The problem i'm having is that I cant associate different models, like fetching data from 3 different table at the same time with the help of foreign keys. Here's my situation. I have some tables in mysql (posts, comments, categories, post_category etc). I am able to add/edit/delete posts and categories but I cant associate posts with the categories. I need to have a list of categories with checkboxes on my Add Posts form so that I can categorize my posts. This is pretty complex and there's no way I could get this working on cake but i'm sure its possible. Here's my database structure: posts - id - title - body categories - id - name - desc post_category - post_id - category_id FOREIGN KEY (post_id) REFERENCES posts (id), FOREIGN KEY (category_id) REFERENCES categories (id) Now how do I get these 3 tables connected? Thanks in advance. Azad --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Model association
I'm having a similar problem simply trying to add comments to posts. I've tried to get a list of comments that would be associated with a single post by adding $this-set('comments', $this-Comment-findAll(WHERE post_id = '$id')); to the view() function under posts_controller.php but that line returns Fatal error: Call to a member function on a non-object. I don't fully understand how to go about viewing and manipulating data like comments that are fully dependent on posts. I shouldn't have to set up individual controllers and views for them because I don't want users to have to go to /comments to view them. Can anyone give a little insight into this as well as the original question? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Session issue
Ok. In your view (at the top) do the following and then send us the output when you view your html page. ?php print pre; print_r($_SESSION); print /pre; exit; ? This should give us the contents of your session while your view is rendering. On 5/9/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Here it is man: !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; head titleCakePHP : A Rapid Development Framework :: Projects/title link rel=shortcut icon href=favicon.ico type=image/x-icon / meta http-equiv=Content-Type content=text/html; charset=UTF-8 /link rel=stylesheet type=text/css href=/process_strategy/css/cake.default.css /!--[if lt IE 7] link rel=stylesheet type=text/css href=/process_strategy/css/cake.ie.css /![endif]-- /head body div id=wrapper div id=header img src=/process_strategy/img/cake.logo.png alt=CakePHP : Rapid Development Framework border=0 //div div id=content h1Registered Projects/h1 table tr thId/th thProject/th thnbsp;/th /tr tr td1/td td a href=/process_strategy/projects/index/1 Geran BR 8.0/a/td tda href=/process_strategy/projects/destroy/1 onclick=return confirm('Are you sure you want to delete?');Delete/a/td /tr tr td2/td td a href=/process_strategy/projects/index/2 Geran BR 9.0/a/td tda href=/process_strategy/projects/destroy/2 onclick=return confirm('Are you sure you want to delete?');Delete/a/td /tr /table a href=/process_strategy/customers/index Back/anbsp;|nbsp;Customer ID: favicon.ico /div div id=footer pCakePHP :: a href=http://www.cakefoundation.org/pages/copyright/;copy; 2006 Cake Software Foundation, Inc./a /p br / p !--PLEASE USE ONE OF THE POWERED BY CAKEPHP LOGO-- a href=http://www.cakephp.org/; target=_blank img src=/process_strategy/img/cake.power.png alt=CakePHP : Rapid Development Framework height=15 width=80 //a /p p a href=http://validator.w3.org/check?uri=referer; img src=/process_strategy/img/w3c_xhtml10.png alt=Valid XHTML 1.0 Transitional height=15 width=80 //a a href=http://jigsaw.w3.org/css-validator/check/referer; img src=/process_strategy/img/w3c_css.png alt=Valid CSS! height=15 width=80 //a /p /div /div /body /html!-- 0.2375s -- --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Model association
Gotta use model assocations - it makes this sort of thing so much nicer. http://manual.cakephp.org/chapter/6 Looks like your Comment belongsTo Post, and probably Post hasMany Comment. Give the manual a look, and let me know if you have questions on it. -- J On May 9, 2006, at 1:47 PM, roberts.sean wrote: I'm having a similar problem simply trying to add comments to posts. I've tried to get a list of comments that would be associated with a single post by adding $this-set('comments', $this-Comment-findAll(WHERE post_id = '$id')); to the view() function under posts_controller.php but that line returns Fatal error: Call to a member function on a non-object. I don't fully understand how to go about viewing and manipulating data like comments that are fully dependent on posts. I shouldn't have to set up individual controllers and views for them because I don't want users to have to go to /comments to view them. Can anyone give a little insight into this as well as the original question? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Model association
I read through the manual in one go last week, totally forgot I had to set up the associations myself. Now that I've done it I can't believe how simple it is. I'm REALLY starting to like this whole baking thing. Thanks John! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Session issue
Ok, this is what I got: Array ( [Config] = Array ( [rand] = 2397 [time] = 1147224143 [userAgent] = ed1c6dfd48691613681e0b701c02a7d4 ) [Customers] = Array ( [id] = favicon.ico ) ) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Session issue
Ok lets try this one last time.You DOCUMENT ROOT in the path where apache looks for the app/webroot.Where did you install cake? Is it in a sub directory of your web accessible path?If this is the case, or you do not have DOCUMENT ROOT set to app/webroot, then you need to copy the favicon.ico to your webservers root pathThis would be www.example.com/ where ever this would be directedAnd correct me if I am wrong this only happens with Fire Fox? -- /*** @author Larry E. Masters* @var string $userName* @param string $realName* @returns string aka PhpNut* @accesspublic*/On 5/9/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Ok, this is what I got:Array([Config] = Array([rand] = 2397[time] = 1147224143[userAgent] = ed1c6dfd48691613681e0b701c02a7d4 )[Customers] = Array([id] = favicon.ico)) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
prevent expiration of session info?
I'm using the Cake Session component to store user login information. This is a Web app for which the user will want to remain logged in indefinitely. Right now, after a little while the session information appears to be gone (and thus the user is no longer logged in). How can I change this? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: prevent expiration of session info?
In app/config/core.php on line 108: /** * Set Cake Session time out. * If CAKE_SECURITY define is set * high: multiplied by 10 * medium: is multiplied by 100 * low is: multiplied by 300 * * Number below is seconds. */ define('CAKE_SESSION_TIMEOUT', '120'); Hope that helps, Adam --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Switching associations on and off
you should look in the api for the bindModel and unbindModel methods for the model, I think it is what you are looking for, it's a little cleaner and the reset after you use them http://api.cakephp.org/class_model.htmldoesn't seem to be in the manual yet, but there was a page in the wikiSam DOn 5/9/06, BCN Adam [EMAIL PROTECTED] wrote:Hullo, I am basically posting the same question as thirdleaf on 2006-01-01 tosee if there is any more news or information.I have two tables 'foo' and 'bar', which are joined by a HABTMrelationship with the table 'foo_bar'. Sometimes I would like to use these associations, and sometimes not.At the moment I am putting the following in foo_controller.php (someexamples):$this-Foo-hasAndBelongsToMany = null; $data = "">to disactivate this particular association, or$this-Foo-hasAndBelongsToMany['Bar']['limit'] = 5;$data = "">to set a special limit first 5 condition. Is there a better or different way of doing this?Regards,AdamPS:I have been using CakePHP for about a year now and this is myfirst post to the Google group. Congrats and thanks to all who have been involved in this project. Keep up the good work! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Switching associations on and off
Hi, Adam! Try to use this: http://cakebaker.wordpress.com/2006/02/22/new-feature-bindmodelunbindmodel/ -- Regards, jtraub --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Multi-templates in CakePHP apps
Hello all,Is there any way to develop a distributable template in Cake? I find that putting all template files in to a single view directory as instructed in Cake manual make it impossible to attach more than one distributable template into a single application. I wish that I can put all my template file into a sub directory in views like this -- views --template1 -- pages -- layouts -- images -- controller_name_1 -- controller_name_2 -- sub_controller_name_2 --template2 -- pages -- layouts -- images -- controller_name_1 -- controller_name_2 -- sub_controller_name_2Does CakePHP currently support this kind of templating?Thanks-- Nobody in nowhere --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Multi-templates in CakePHP apps
Dinh,I wrote this theme class a few months ago and have note checked to see if it would work with the latest release. But for the most part it should, when I make changes in the core, I usally am pretty good about not breaking other code I wrote. http://cakeforge.org/snippet/detail.php?type=snippetid=18-- /*** @author Larry E. Masters* @var string $userName * @param string $realName* @returns string aka PhpNut* @accesspublic*/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Problem with baking views
Hi, I'm just starting out with Cake and am going through the Cake Bakery tutorial. I'm at the point where you use bake to create your scaffolded views but I'm getting this error: Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/mysql/mysql.sock' (2) in /Library/WebServer/Documents/development/bakery/cake/libs/model/dbo/dbo_mysql.php on line 117 I'm on OSX10.4 and have mysql installed in usr/local/ so I assume that could be the problem...however if I manually create my views, Cake has no problem connecting to mysql. Is there a way to tell Cake where to look for the mysql.sock file? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Problem with baking views
This is a known issue with mysql installations on OS X 10.4 the official workaround is posted here: http://docs.info.apple.com/article.html?artnum=301457 Other people have suggested simply creating a symlink, which sounds like a very sound recommendation. However, by the time I had read that, I had already followed the official advice. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: CakePHP Manual 1.x.x.2806
Api done too. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Session issue
Ok so: first of all the problem occours only with Firefox, not with IE why? And I installed Cake into: C:\xampp\htdocs\process_strategy\ Web accessible path I assume is C:\xampp\htdocs so in browser: http://localhost/process_strategy/ I feel we are near to the solution... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---