RE: need advice
Well, AFAIK, since the element and helpers are on the same level, they can't call each other. Quick fix is: generate your code from the helper on the view first, then cut-paste the result to the element code. Let us know if anyone else has a better answer. BTW, I've used a helper in an element, but the element is inside the view (not in the layout). -Original Message- From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of ptc Sent: 31 Desember 2006 1:36 To: Cake PHP Subject: need advice Hi, i'm just begginer to cakePHP and i need some adivce. I would like to build webapp which will be using something like this: renderElement('menu'); ?> In main i put main content of my page. in menu i would like to put menu whit login and some useful stuph. As i've seen in manual that second dynamic content which i can put in view is only Element object. And there all variables which i need i must pass manual. Ok, i can do that, but in Element as i tested i can't use $html->form and other stuph (Fatal error: Call to undefined method HtmlHelper::form() in C:\wamp\www\app\views\elements\menu.thtml on line 6.). Can somebody explain me how to do correctly? Mabye good thing is to build menu somewhere else, not in Element? Best Regards, ptc. --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: Vocabulary question : What's the name of a "MVC object"
It's called pattern. MVC is a software pattern. On 12/26/06, Olivier Percebois-Garve <[EMAIL PROTECTED]> wrote: Hi We know what a Model is, or a Controller, or a View. For the three together however, I'm not sure. I'm saying "Object" or "MVC Object" but its quite vague and not really correct. What do you use fore that ? olivvv > -- Adrian Godong [EMAIL PROTECTED] Microsoft Student Ambassador --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: Table associations the CakePHP way
First you'll have to create correct associations for your Models (if you don't know how or too lazy to read the manual, ask again). Second, try dumping the whole thing you got from the Model->findAll or findBy... using debug($[modelname]->[functionname]); You'll see that accessing category.name and layout.name is just an array away from the main result. Still having problem? Print out to us the result of the steps above... On 12/26/06, phpjoy <[EMAIL PROTECTED]> wrote: I have a controller, and I want to fetch information from tables. With scaffold, it works wonderfully.. However I wanna load the information smartly for my app. These are my tables: section: id name field1 field2 layout_id category_id category: id name field3 field4 field5 field6 layout: id name field7 field8 I want to put the information from the section table in the view. the category_id and layout_id should have category.name and layout.name instead of the id of the category. I could build a MySQL query for this, but I wonder what's the CakePHP way. (The more ways, the marrier it is ;)) > -- Adrian Godong [EMAIL PROTECTED] Microsoft Student Ambassador --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
RE: findBy issue
Pardon me. I got it now. I usually set up a default value just in case the user does not supply a parameter. But I think your solution will be useful. From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Olexandr Melnyk Sent: 25 Desember 2006 8:09 To: cake-php@googlegroups.com Subject: Re: findBy issue 2006/12/25, Adrian Godong <[EMAIL PROTECTED]>: I'm assuming that you don't want any 'User' added on the query? What do you mean? The problem is that there is no value on the right side of the comparison operator in the where clause. -- Olexandr Melnyk, http://omelnyk.net/ --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
RE: findBy issue
I'm assuming that you don't want any 'User' added on the query? -Original Message- From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Kynlem Sent: 25 Desember 2006 5:24 To: Cake PHP Subject: findBy issue Hello, I've been having some problems with a findBy function. When I've called the method with a not empty string as argument, it worked fine, but when I've passed an empty string, Cake generated the query with the WHERE clause like: WHERE (`User`.`username` = ) I've spent a bit of time searching for the problem cause in Cake sources (a great benefit of open source software, you can explore it yourself), and came up changing dbo_source.php line #1380 from: if ($match['2'] != '' && !is_numeric($match['2'])) { to: if (!is_numeric($match['2'])) What solved the problem. Have anyone had a similar problem before? I have commented all relations inside my model declaration. I'm running PHP 5.2.0, MySQL 5.0.27 and CakePHP 1.1.11.4064. -- Olexandr Melnyk, http://omelnyk.net/ --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
RE: Joining 2 tables - better practice?
Not that I know of, and can't think of anything easy to implement. Unless you created a non-normal view where each Product row will have their own Holiday fields (therefore, duplicating Holiday fields for every Product row). CMIIW, are you creating an array of Product for a specific Holiday only? I mean, do your Holiday loop only contain one Holiday? -Original Message- From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of leamas Sent: 23 Desember 2006 23:21 To: Cake PHP Subject: Re: Joining 2 tables - better practice? Oh that worked perfectly. Thank you very much. However, would there be a way of making it so that I didn't have to have two foreach loops? --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: Newbie question
I don't think that Session is accessible from Model. But CMIIW. If the above is true, then you'll need to move the matching logic into the controller. You can use the beforeFilter callback function on the active Controller to validate accessible shops. On 12/22/06, kjohn <[EMAIL PROTECTED]> wrote: Hi all, I am a newbie to cakephp & php OO.. I am confused how best to handle the following case: - Shop hasAndBelongsToMany Users (who can edit the Shop details). - Now, in the shops view page (say shops/view/2), how to check that the currently logged in user can edit the shop (2) details? I was thinking of adding the following to the shop.php model: var $hasAndBelongsToMany = array('User' => array('className' => 'User', 'joinTable' => 'users_shops', 'conditions' => 'User.id = '. $this->Session->read('User.id'), ) ); If this works, I could just read the $shop['User'] to check if the current user can edit the Shop details. But it doesnt seem to work. Any better way to get this working? TIA john > -- Adrian Godong [EMAIL PROTECTED] Microsoft Student Ambassador --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
RE: Joining 2 tables - better practice?
OK, so basically you have an array on top of everything. That's why you can't debug($data['Product']); or loop it directly. For this particular $data, to iterate through each product, you will need to use: Foreach ($data as $holiday) { Foreach ($holiday['Prodcut'] as $product) { [Write your code here] } } If this still doesn't work, it's either you omitted something else important on your e-mail, or something really-really bad have happened. If this doesn't help, please provide us with the $this->set(); statement from the controller. -Original Message- From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of leamas Sent: 21 Desember 2006 7:06 To: Cake PHP Subject: Re: Joining 2 tables - better practice? I had remove ['Product'] from $data['Product'] otherwise it would cause an error if I debug($data). The output for $data is: Array ( [0] => Array ( [Holiday] => Array ( [id] => 1 [holiday_name] => Halloween ) [Product] => Array ( [0] => Array ( [id] => 668 [product_name] => //cut out [description] => //cut out [price] => 1.29 [URL] => //cut out [image] => //cut out [category_id] => 12 [holiday_id] => 1 [added] => 2006-04-29 [newProd] => 0 [stock] => 1 [hits] => 3 ) [1] => Array ( [id] => 1089 [product_name] => //cut out [description] => //cut out [price] => 0.60 [URL] => //cut out [image] => //cut out [category_id] => 9 [holiday_id] => 1 [added] => 2006-05-26 [newProd] => 0 [stock] => 1 [hits] => 0 ) [2] => Array ( [id] => 1090 [product_name] => //cut out [description] => //cut out [price] => 0.60 [URL] => //cut out [image] => //cut out [category_id] => 9 [holiday_id] => 1 [added] => 2006-05-26 [newProd] => 0 [stock] => 1 [hits] => 0 ) ... The way that this should work out is that $data would hold only products that are under the certain holiday, which itl ooks like it is doing from the output. So in the view, it will use a foreach loop and display each product from $data. --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
RE: does cake not join tables when using hasMany?
I think it has something to do with the result parser. It's not a bug, it's by design. Other association that does join tables are belongsTo. Why do you need it in one query? -Original Message- From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: 21 Desember 2006 4:11 To: Cake PHP Subject: does cake not join tables when using hasMany? i had some strange results today when working w/ associations in cake. from what i can tell, defining an association as hasMany, does not result in a table join query. instead, it queries the first table, and then queries the second table once for each result in the first table. when i changed the association to hasOne, it performed the query properly and did a join, but the result was not formatted as it should be. has anyone run into this problem? i can provide some sample code and examples if needed... --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
RE: Joining 2 tables - better practice?
? I'm still interested in this problem. It seems something syntactically wrong or I'm just dead reading code. Could you supply us again with the output of debug($data); and how do you plan on using it (i.e. the foreach block)? The error should be there somewhere. -Original Message- From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of leamas Sent: 20 Desember 2006 2:39 To: Cake PHP Subject: Re: Joining 2 tables - better practice? I have tried using both $data['Product'] and $data['Holiday'] and both return an invalid error. --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: Legal Concerns Regarding CakePHP and Cake Software Foundation
Not quite exactly, it's this one: http://lessig.org/freeculture/ (open the flash presentation) But he talks quite a lot about free culture, so Nimrod's link is valid as well. (spoiler: it's interesting to see how Disney can become such a large company) On 12/19/06, Nimrod A. Abing <[EMAIL PROTECTED]> wrote: > > > On 12/19/06, Adrian Godong <[EMAIL PROTECTED]> wrote: > > > > Prof. Lessig has one of those great presentations about copyright vs. > > Innovation. Try googling it up. I need to dig in several gigs of data to > > find the link. :D > > I think this is what you mean: > > http://philosophytalk.org/pastShows/WhoOwnsIdeas.htm > -- > _nimrod_a_abing_ > > [?] http://abing.gotdns.com > > > > -- Adrian Godong [EMAIL PROTECTED] Microsoft Student Ambassador --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
RE: Joining 2 tables - better practice?
What're you trying to do? Your array dump looks like only contains ONE Holiday with MANY Products (which is TRUE, according to your definition earlier). If you wanted to iterate through the products, you should use: Foreach($data['Product'] as $product) Not $data['Holiday']. -Original Message- From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of leamas Sent: 19 Desember 2006 3:55 To: Cake PHP Subject: Re: Joining 2 tables - better practice? I tried to follow the information from the link you provided, but it didn't work. Nor did trying $product['Holiday']['Product'] Here is basic output of my array ( I removed most of the output ): Array ( [Holiday] => Array ( [id] => 1 [holiday_name] => Halloween ) [Product] => Array ( [0] => Array ( [id] => 668 [product_name] => Cathy B Vellum Stickers - Crazy Candies [description] => This is a package of bright and festive Cathy B vellum stickers that are "raised and glitter-glazed." It includes approx. 20 various types of candy like lollipops, jellybeans, gum and more. [price] => 1.29 [URL] => http://www.scrapstop.com/shop.php?op=itemdetails&item=10612&refid=839176107 [image] => http://www.scrapstop.com/images/10612_sm.jpg [category_id] => 12 [holiday_id] => 1 [added] => 2006-04-29 [newProd] => 0 [stock] => 1 [hits] => 3 ) ... Now if I change foreach ($data as $product) to foreach($data['Holiday'] as $product) and this returns the error: Warning: Invalid argument supplied for foreach() Jon M. wrote: > I has the same question/problem the other day and nate came to the > rescue. > > --> > http://groups-beta.google.com/group/cake-php/browse_thread/thread/44f343a620 af343d > Hopefully that helps. > > Nate is the man! :) > > - J > > On Dec 17, 12:38 pm, "leamas" <[EMAIL PROTECTED]> wrote: --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
RE: Legal Concerns Regarding CakePHP and Cake Software Foundation
Prof. Lessig has one of those great presentations about copyright vs. Innovation. Try googling it up. I need to dig in several gigs of data to find the link. :D (usually, keyword "Lessig" does the job, it's in flash, BTW) -Original Message- From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: 18 Desember 2006 22:35 To: Cake PHP Subject: Re: Legal Concerns Regarding CakePHP and Cake Software Foundation Don't forget you are at just as great a risk of litigation with the code you write directly for them. If you are in the US, the only way your employer can get a warm and fluffy feeling is to retain the services of a lawyer - . I doubt there is a single line of useful code out there that isn't already covered by a US software patent. I can imagine the lawyer saying something like 'The only way you can *guarantee* not to be sued is to move all development and your business out of reach of the US legal system.' Given that is not a realistic option, it appears you just have to hope you don't get too rich an/or visible on someones radar. If you follow some of the discussions on www.groklaw.net, there appears to be a gradual understanding by the judiciary of the effect software patents are having on the ability of the industry to innovate (oh, how I hate that word now). I cannot believe it is a sustainable system but then, I'm not driven by the desire to get rich quick. I really hope the US system does get sorted - there are far to many talented people (including, obviously, the cake team) who should not have to be concerned about patent trolls and threats from the big boys. Here in Europe we have software patents too, but the yare not enforceable - despite best efforts of the entrenched software houses. There is still a risk common sense will not prevail. ~GreyCells --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
RE: Joining 2 tables - better practice?
Assumed that you do a findAll from the controller to variable named holiday. You can access it from $holiday['Holiday']['Product'] array. If you're not sure, you can try inserting debug($holiday); to see the structure of your variable. -Original Message- From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of leamas Sent: 18 Desember 2006 3:38 To: Cake PHP Subject: Re: Joining 2 tables - better practice? class Holiday extends AppModel { var $name = 'Holiday'; var $hasMany = 'Product'; } class Product extends AppModel { var $name = 'Product'; var $belongsTo = 'Holiday'; } This is what I've done and now my next question will be: If I have this, then in my view (/views/holidays/christmas.thtml), how do I retrieve the products that only pertain to Christmas when I can only access the holidays table? Brandon Olivares wrote: > Why not a hasMany association for holidays to products, and a belongsTo > association for the other way? I don't see why this wouldn't work? > > > -Original Message- > From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf > Of leamas > Sent: Sunday, December 17, 2006 2:27 PM > To: Cake PHP > Subject: Joining 2 tables - better practice? --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
RE: Edit form for associated tables
The selectTag has a third (or fourth) parameter after the name/value arrays parameter that accepts selected single name or array of names. Matching name from name/value parameter and selected name parameter will have the selected attribute on the generated HTML tag. Let me know if you need more code details. -Original Message- From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of igor Sent: 14 Desember 2006 18:30 To: Cake PHP Subject: Edit form for associated tables Hello, I have the following tables in the database: products, manufacturers, subcategories. Product has one manufacturer (associated with belongsTo / and hasMany the other way around) and multiple subcategories (HABTM). I created index, view, add and edit views, everything is working _almost_ perfectly. When I add or edit product, I get a drop-down list of producers and multiple-choice list of subcategories (created with generateList in the controller, $html->selectTag in the view). There's only one minor flaw. When I edit an existing product, I need to have a manufacturer and subcategories selected. I tried the manual and some tutorials from Cake Wiki, but couldn't find a solution - and I'm sure there must be a simple way. Igor --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
RE: findall custom query
Well, the first param for the findAll is the "SQL condition". CakePHP is not smart enough (yet) to understand arrays of conditions, it just accepts a string and place it after the WHERE clause in the SQL statement. To answer your question, change the array into it's SQL language (i.e. global=1 AND user_id='$id'); HTH -Original Message- From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: 08 Desember 2006 22:26 To: Cake PHP Subject: findall custom query Hi there, I have two tables: users: -id -name notes: -id -user_id -public A user can write notes. He can chose, if this note could be seen by the public. Now I want to print out all notes that are flaged as public and are from the user with the id "1". This doesn't work: $id=1; $this->set('notes', $this->Note->findAll(array ('global' => 1, 'user_id' => $id ))); How can I tell findAll give the right result? 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?hl=en -~--~~~~--~~--~--~---
RE: can I use generateList( ) get rather than Id?
To simplify your code, you can define var $displayField = 'name' in your Model, and have everything generated by the generateList(); <-- no params necessary. You will need to utilize Javascript on your second question. On the first selectTag, add 'onChange' => 'javascript:changeSelect();' on the fourth param. Then create a script (or load from external file) containing the method changeSelect. This method should check what is the current value of the first selectTag, and then modify the second selectTag based on it. Kinda hard, but when you tried Javascript once, it'll get easier. -Original Message- From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of ERic ZoU Sent: 08 Desember 2006 21:49 To: Cake PHP Subject: Re: can I use generateList( ) get rather than Id? Ok. thanks kind buddy in the irc , jacob and kalileo The first question's solution in already in the API. $this->set('list',$this->Fenlei->generateList(null, null, null, '{n}.Fenlei.name', '{n}.Fenlei.name')); BUT how is the second one ? --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
RE: Cant load prototype in my default.html .
You're welcome. Happened to me quite often in the past. :D -Original Message- From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of ERic ZoU Sent: 07 Desember 2006 19:29 To: Cake PHP Subject: Re: Cant load prototype in my default.html . Thanks Adrian. "s" Big "S" --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
RE: how manage more than one operation in the same view
1. You have several different options. You can use requestAction to call other controller/action and display the results in the current view/controller. If you only need the view (not the logic from the controller/action), you can move the view code to an element, and call the renderElement function. 2. First thing you should understand, one controller does not have to use only one model (i.e. MapsController and Map), it can use more than one (i.e. MapsController using Map and Region), or it can use no model at all. To define what models available from a certain controller, you can add this line below: var $uses = array('Model1', 'Model2', ...); in your controller. Also, associated models can be called without being declared on var $uses. For example, if you have Model1 belongsTo Model2, you can call Model2 function like this: $this->Model1->Model2->save(); -Original Message- From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Ilafra Sent: 07 Desember 2006 17:44 To: Cake PHP Subject: how manage more than one operation in the same view Hi everyone, we are two cake beginners! We have to develop a big web application that uses a mysql database and a GIS system. We are using cake to provide an MCV structure to this application. In this moment we have created the database and bake the application models, controllers and views. Afterwards reading the cake documentation we have understood the cake logic but we have some difficults to figure out some steps. Particulary we need help about the following matters: - how to manage more than one operation with the same Model in the same page (for example, how to call the "add" or "edit" views in the "index" view not through a link but showing them in the same page). - how manage several operations with many Models in the same page (for example we would like a page wherein put the list of Model1, a choice filled with Model2 and a form to update an item of the Model2). Your help is very important for us!! Thanks a lot!! Francesca and Ilaria --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: Cant load prototype in my default.html .
No, you should put var $helpers (notice the 's') on your code. And keep the 'Javascript'. On 12/7/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > try 'javascript' instead of 'Javascript' > > > > > -- Adrian Godong [EMAIL PROTECTED] Microsoft Student Ambassador --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: why getLastInsertID doesn't work?
Maybe something wrong with custom query? I've never used any custom query (with $this->execute($sql)) and never had any problem with getLastInsertId. IMO, I think you need to return the last insert id manually if you're usnig custom query. CMIIW. On 12/5/06, Samuel <[EMAIL PROTECTED]> wrote: > > > hi all: > in my mode process.php > there is a function named addProcess($datas) > and in the body I wrote: > $sql="INSERT INTO > > processes(pcs_aim_id,pcs_date,pcs_content,pcs_title,pcs_duration,pcs_modified)VALUES(".$datas['selectAim'].",NOW(),'".$datas['pcsContent']."','".$datas['pcsTitle']."','".$datas['pcsDuration']."',NOW())"; > mysql_query('SET NAMES gbk;'); > $this->execute($sql); > $pid=$this->getLastInsertID(); > > ... > > problems is that $pid is empty .why?? thanks !!! > > > > > -- Adrian Godong [EMAIL PROTECTED] Microsoft Student Ambassador --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: Replacing Html Helper
No, you don't need to. You can call other function just like they belong to your controller. Say HtmlHelper has link(...) function, when you need to call it in your overloaded controller, just call $this->link(...). You don't need to override what you don't want to change. On 11/30/06, Rodrigo Tassinari <[EMAIL PROTECTED]> wrote: > > > Adrian, I tried to do what you said, but I failed. I need to override > the dateTimeOptionTag() function, which uses lots of other functions > and public variables from thr HtmlHelper... how do I do that? Do I have > to override all those functions too? > > > > > -- Adrian Godong [EMAIL PROTECTED] Microsoft Student Ambassador --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
RE: Multiple HATBM (n:n) using the same model for different purposes
Well, the final choice is always yours. :D IMO, creting a Model to simulate HABTM would be rough on the programming side, since you have to define extra logic to save them (e.g., for each assoc, you need to save it). This is not the case when you use pure HABTM, just throw in an array, and Cake does the rest. I'm just being easy. But easy doesn't exactly correct/good. On a note: if you have several models that behaves similarly, it might well considering OOP inheritance. That way, you reduce DRY (don't repeat yourselft), which is one of the reason OOP is invented. -Original Message- From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of clemos Sent: 29 Nopember 2006 0:08 To: cake-php@googlegroups.com Subject: Re: Multiple HATBM (n:n) using the same model for different purposes hi adrian and marcelo you're probably right about the "feasibility" of customizing HABTM infos. then, to me, the solution would rather to make one single additional model (say : EventStoreRelation) that would "simulate" the HABTM table : it would belongTo both one Event and one Store, and would also have a column like "type", that would define the relationship between the event and the store, and so on... these relationships can be defined as an array is this model (like I said in my previous post). then if you have to add a "type", you don't even have to make a new table or a new model, you just have to add an entry in this array... because it looks like the relationships actually aren't that different, and anyway this additionnal model can probably handle different features for the different "types"... and my experience makes me think it's better to try to have as less models as possible, especially if several models actually have a similar behaviour. or maybe I misunderstood you ? +++ clemos On 11/28/06, Adrian Godong <[EMAIL PROTECTED]> wrote: > > Is the second solution feasible? I mean AFAIK, if you stick to the default > CakePHP implementation of HABTM, you can't have any other field other than > the two PK/FK fields. > > Take a look at how CakePHP handles saving HABTM assoc from the manual. > > If you want to "relate" model A with model B, when saving model A, you will > need to accompany it with array of model B _id's_. There's no extra data > saved here. > > Unless, of course, you have a "fake" HABTM model. > > My proposed solution would be the first one. Why? > 1. It provide a clear disctinction between each relation. Those relations > are _different_, right? > 2. It provide a more cohesive structure. When, just in case, you need to add > another relation between event and store (say, stores that sells/has rare > tickets), you won't need to touch the currently running code. You can say > it's a more pluggable architecture (because it is simpler to add things > later). > 3. It's easier to do the associations (one for each assoc), access data > (don't need to process anything on the logic, everything's done on the > database), and edit (you know that Cake deletes all of the HABTM relation > for a specific ID before inserting new ones -- that is, unless you managed > to create a custom update/save query). > > Just my 2 cents. > > -Original Message- > From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf > Of clemos > Sent: 28 Nopember 2006 18:26 > To: cake-php@googlegroups.com > Subject: Re: Multiple HATBM (n:n) using the same model for different > purposes > > > hi marcelo > > I'm not really a guru, but your second solution looks the best to me. > Then, if the "relationship_types" don't need to be editable, you can > just let them "static". > > For exemple you can define them as an array in your Event model : > > $store_types = array( >0 => "regular seller", >1 => "VIP seller", >2 => "partner" > ); > > And you have an int column in your habtm table called store_type or > something > At least, that's what I would do. > The nice thing is you can use this "store_types" array in your form > with selectTag > > +++ > clemos > > On 11/27/06, Marcelo de Moraes Serpa <[EMAIL PROTECTED]> wrote: > > Guys, I really need a hand here! > > > > Let's say I've got two models: > > > > * Event -> Represents a party event > > * Store -> A store where the user could buy a ticket to the party > > > > A user wants to go to a particular event. So, he enter the event > > informations page and sees a list of "stores" (places) where he/she can > buy > > tickets fo
RE: Replacing Html Helper
Create your own helper, inherited from HtmlHelper. Then override the dateTimeOptionTag on you helper. Let me know if any of this needs explanation. -Original Message- From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Rodrigo Tassinari Sent: 28 Nopember 2006 19:52 To: Cake PHP Subject: Replacing Html Helper Hi all, I'm using the Html Helper to generate some form fields in my applications. However, I need to make some changes to the dateTimeOptionTag() function to cater to my specifc needs. What is the best way to do this? At first I tried to copy html.php from cake/libs/view/helpers to app/views/helpers and change the file in this directory. This seems reasonable to me, but when I try to render any page using the Html helper now it freezes Apache. I'm using Cake 1.10, Apache2 and MySQL5 running on Ubuntu 6.06 and 6.10. Thanks, Rodrigo. --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
RE: Multiple HATBM (n:n) using the same model for different purposes
Is the second solution feasible? I mean AFAIK, if you stick to the default CakePHP implementation of HABTM, you can't have any other field other than the two PK/FK fields. Take a look at how CakePHP handles saving HABTM assoc from the manual. If you want to "relate" model A with model B, when saving model A, you will need to accompany it with array of model B _id's_. There's no extra data saved here. Unless, of course, you have a "fake" HABTM model. My proposed solution would be the first one. Why? 1. It provide a clear disctinction between each relation. Those relations are _different_, right? 2. It provide a more cohesive structure. When, just in case, you need to add another relation between event and store (say, stores that sells/has rare tickets), you won't need to touch the currently running code. You can say it's a more pluggable architecture (because it is simpler to add things later). 3. It's easier to do the associations (one for each assoc), access data (don't need to process anything on the logic, everything's done on the database), and edit (you know that Cake deletes all of the HABTM relation for a specific ID before inserting new ones -- that is, unless you managed to create a custom update/save query). Just my 2 cents. -Original Message- From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of clemos Sent: 28 Nopember 2006 18:26 To: cake-php@googlegroups.com Subject: Re: Multiple HATBM (n:n) using the same model for different purposes hi marcelo I'm not really a guru, but your second solution looks the best to me. Then, if the "relationship_types" don't need to be editable, you can just let them "static". For exemple you can define them as an array in your Event model : $store_types = array( 0 => "regular seller", 1 => "VIP seller", 2 => "partner" ); And you have an int column in your habtm table called store_type or something At least, that's what I would do. The nice thing is you can use this "store_types" array in your form with selectTag +++ clemos On 11/27/06, Marcelo de Moraes Serpa <[EMAIL PROTECTED]> wrote: > Guys, I really need a hand here! > > Let's say I've got two models: > > * Event -> Represents a party event > * Store -> A store where the user could buy a ticket to the party > > A user wants to go to a particular event. So, he enter the event > informations page and sees a list of "stores" (places) where he/she can buy > tickets for this event: > > Event information screen: > > > Event Name > (...other informations...) > > Where to buy regular tickets: > * R&B Co. > * Shopping 1 > > Whrere to buy VIP tickets: > * Carmen Steffens > * VIP store > > Companies that are supporting this event: > * Carmen Steffens > * VIP store > > > > > As you can see, there are 3 lists of store for each event. The store where > to buy a regular ticket, the store where to buy a VIP ticket and the > "stores" that are supporting this event. And here's where I get confused on > how to model this kind of association. > > I see 3 possible solutions for this problem: > > 1) having a n:n relationship table for each of the HABTM associations > (events_storeregularticket, events_supportstores... each having a event_id > and store_id of course) > 2) having only one "general" events_stores whith a "relationship_type" field > so I could filter the correspondent records for each of HABTM relationship; > 3) Fake RoR's throughassociation (see Felix's post here: > http://www.thinkingphp.org/2006/10/26/modeling-relationships-in-cakephp-faki ng-rails-throughassociation/ > ) transforming each of the HABTM association into an entitity itself, so I > would have a model (and a corresponding table) for: > * PlacesToBuyRegularTickets model; > * PlacesToBuyVipTickets model; > * EventSupportingStores model; > > Particulary, I find the second one to be a more clean solution as I keep > only one table, but I see that I would need to create another table to keep > the kinds of relationships :/ > > I'm really confused on the best way to model this in Cake. What would you > do/What have you done on your projects? > > Thanks in advance! > > Marcelo. > > > > > --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: beforeFilter Problem
Yes, components DO get loaded before CakePHP access beforeFilter. You might haven't add the component to the controller $components variable. On 11/28/06, Synchro <[EMAIL PROTECTED]> wrote: > > > > Adrian Godong wrote: > > Hi, I'm trying to implement some user authentication system, and need to > > check current user (from session) on every controller call. I've tried > > placing a beforeFilter method on AppController, but this method doesn't > seem > > to be executed. > > > > When I put the beforeFilter on one of the controller, it works. > > > > Does my controller overrides AppController's beforeFilter even though it > is > > not declared? > > I ran into something similar - beware that beforeFilter is called > before any components get setup called on them, so essentially you > can't use components in beforeFilter. > > > > > -- Adrian Godong [EMAIL PROTECTED] Microsoft Student Ambassador --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
RE: Querying Question
>From database normality PoV, you should stick with your current structure (approach 2). Complexity of SELECT query should belong to CakePHP engine, not yours. If you have defined the Model Association correctly, CakePHP will also retrieve related tables, so you shouldn't worry about how to query. >From what I understand, you will have the following associations: User hasOne Profile (and Profile belongsTo User) User hasMany Friend (and Friend belongsTo User) If you queried (findAll) a Profile, CakePHP will also fetch related User, Friends, and Friends' User. CakePHP have a recursive limit of 3, that means you can only get 3 associated tables from the current one. This is good enough for your problem. -Original Message- From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Mandy Sent: 19 Nopember 2006 19:24 To: Cake PHP Subject: Querying Question Hi, This might not necessarily related to cake, but I would like to know what's the best way to do this. I have a users table (that has user_id, first_name, last_name...etc) And a profile table (profile_id, user_id, country) And a friends table which has (friend_id, user_id profile_id) Now on the profile page, for that particular profile, I query friends table to get the user_id's of all the friends and display their photos, because all photos are user_id.jpg, but now I want to display the user's first name as well but that is in the user's table. I have 2 approaches - 1) Put user_name also in the friends table 2) Loop through all friends and for every entry go to the user table to get the user first name What do you guys suggest? 2nd one will have lots of select queries whereas first one would just duplicate data? Thanks in advance, Mandy. --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
RE: RE: Element vs Helper
It's element. Not component. On another note: what's an element like to a view? -Original Message- From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Samuel DeVore Sent: 16 Nopember 2006 22:16 To: cake-php@googlegroups.com Subject: Re: RE: Element vs Helper a component is like a helper for your controllers like many controllers might want to send email, so you could have a email component Sam D On 11/16/06, Adrian Godong <[EMAIL PROTECTED]> wrote: > > OK, I got the big point. > > But pls CMIIW: anything that a Helper can do, an Element can also do the > exact same thing, and vice versa. > > I'm looking at the hdCalendar component. It has a CalendarHelper that some > function would suit to Calendar Element better (keep the primitive functions > like Day on the helper). So I just haven't see any solid separation between > Helper and Element. > > -Original Message- > From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf > Of Dr. Tarique Sani > Sent: 16 Nopember 2006 15:13 > To: cake-php@googlegroups.com > Subject: Re: Element vs Helper > > > On 11/16/06, Adrian Godong <[EMAIL PROTECTED]> wrote: > > What's the difference between element and helper? When should I use one > over > > another? > > Let me try and put it as simply as possibly > > Element = snippet from a template which you just render in your > templates an example would be a dynamic menu which can be seen on all > pages > > Helper = Some thing which helps you write otherwise repetitive but > somewhat complex HTML in your templates abstracting away the > complexities in the call to its methods - the best example is the HTML > helper and the Form helper. > > HTH > Tarique > > -- > = > PHP Applications for E-Biz: http://www.sanisoft.com > Coppermine Picture Gallery: http://coppermine.sf.net > = > > > > > > -- == S. DeVore (the old fart) the advice is free, the lack of crankiness will cost you --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
RE: Element vs Helper
OK, I got the big point. But pls CMIIW: anything that a Helper can do, an Element can also do the exact same thing, and vice versa. I'm looking at the hdCalendar component. It has a CalendarHelper that some function would suit to Calendar Element better (keep the primitive functions like Day on the helper). So I just haven't see any solid separation between Helper and Element. -Original Message- From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Dr. Tarique Sani Sent: 16 Nopember 2006 15:13 To: cake-php@googlegroups.com Subject: Re: Element vs Helper On 11/16/06, Adrian Godong <[EMAIL PROTECTED]> wrote: > What's the difference between element and helper? When should I use one over > another? Let me try and put it as simply as possibly Element = snippet from a template which you just render in your templates an example would be a dynamic menu which can be seen on all pages Helper = Some thing which helps you write otherwise repetitive but somewhat complex HTML in your templates abstracting away the complexities in the call to its methods - the best example is the HTML helper and the Form helper. HTH Tarique -- = PHP Applications for E-Biz: http://www.sanisoft.com Coppermine Picture Gallery: http://coppermine.sf.net = --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Element vs Helper
Guys, What's the difference between element and helper? When should I use one over another? Thanks! -- Adrian Godong [EMAIL PROTECTED] Microsoft Student Ambassador --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: ERROR_Adding an RSS feed using FeedCreator
Code looks good. If you're sure that the $posts contains any content, I really don't know what's wrong.IMHO, it's something with the database and/or the findAll statement. You can also try decomposing the problem into which part of Cake (the model, view, or controller). My first step would be checking out that $posts variable by adding debug($posts); line on the view.On 11/13/06, Eric < [EMAIL PROTECTED]> wrote:- /app/views/layouts the file rss.thtml--- I paste itfrom the tutorial--PostsController-class PostsController extends AppController{//var $scaffold;var $name = 'Posts'; function index() {$this->Post->recursive = 0;$this->set('posts', $this->Post->findAll());}function rss() {$this->layout = 'rss'; $this->set('posts', $this->Post->findAll("","","modified DESC", // Sort order2 // Number to be returned)); } ---rss.thtml--vendor("feedcreator.class");$rss = new UniversalFeedCreator();$rss->title = "my title";$rss->description = "my description"; $rss->link = "my link";$rss->syndicationURL = "my syndication url";// Initialize the cssStyleSheet var, needed to avoid an error withFeedCreator version 1.7.2-mod (latest version at time of writing) $rss->cssStyleSheet = "";foreach ($posts as $post){$item = new FeedItem();$item->title = $post['Post']['title'];$item->link = "link"; $item->description = $post['Post']['body'];$newdate = $post['Post']['created'];list($date,$hours) = split(' ', $newdate);list($year,$month,$day) = split('-', $date); list($hour,$min,$sec) = split(':', $hours); $date = date("r", mktime($hour, $min, $sec, $month, $day,$year));$item->date = $date;$item->source = "source";$item->author = "author"; $rss->addItem($item);}$rss->saveFeed();?>Thanks-- Adrian Godong[EMAIL PROTECTED]Microsoft Student Ambassador --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: ERROR_Adding an RSS feed using FeedCreator
I can't really help you without the code... Coz I think it's in the code.Also check your findAll statement, maybe it's empty because there is no data being passed.On 11/13/06, Eric <[EMAIL PROTECTED]> wrote: Thank for your patient!I also do the tutorial said...and I also do your way change the$rss->outputFeed();to $rss->saveFeed();I have save the feed by my FF, and it appeard in my bookmarks Toolbar folder. BUT, It contains nothing....Don't know why...-- Adrian Godong[EMAIL PROTECTED]Microsoft Student Ambassador --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: ERROR_Adding an RSS feed using FeedCreator
Can you post the code? Mine's working well based on the tutorial.On 11/12/06, Eric <[EMAIL PROTECTED]> wrote: Thanks Buddy...BUT, I just can create a rss by browser like http://localhost/cake/posts/rssAnd I can add it for my FF2.0BUT it is contains nothing...Why?-- Adrian Godong[EMAIL PROTECTED]Microsoft Student Ambassador --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
RE: How do I retrieving the right amount of data
Well, you can't. Not without additional effort. :D My solution would be like this: Get the user with rec = 1. And then foreach review, get again with rec = 1. (so you will have N + 1 get operations, with N is the number of item for a specific user) You should try looking at the query execution time (with DEBUG = 2). If get user with rec = 2 is faster, maybe you should stick with that config. -Original Message- From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of lemp Sent: 10 Nopember 2006 20:22 To: Cake PHP Subject: How do I retrieving the right amount of data I am building a review system with a model like this one: users <-> reviews <-> items (<-> means HABTM) Each item also has a link to the user who added it to the DB. Each item has links to attributes tables (like colors, countries, etc.) Each user is also related to some other tables. My problem is that when I get the reviews with a recursive value of 1, I get the user and item for each review but I don't get the attributes values for the item. If I set the recursive value to 2, I get those attributes values, but I also get all relationship from the user, which brings back way too much data. --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
RE: Location of foreign key
Faced a similar problem here. I have a details table that can hold file detail (like filename, location, etc) for other tables, say videos, ebooks, and musics. The "correct" association would be videos hasOne details, and details hold the FK. But when you add the other two tables, that means details will hold the (nullable) FK for videos, ebooks, and musics. Not good. So I reversed the database structure. Now when you add a record in videos, ebooks, or musics, it will create the corresponding details record, and associate it with details_id FK found in each table. I know this looks silly, but this is the best, most flexible design I can create. If any other table needs an association with details, the only table that needs to be changed would be the new table. Nothing else in the database needs changing. This just doesn't happen if you have the FK in the details table. Anybody with a better database solution? Oh, and constraint checking; such as making sure that a single details record has only one association with either videos, ebooks, or musics, should be done in the business logic. The database platform simply does not have that kind of information (or would be quite hard to implement with SQL). -Original Message- From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Mikee Freedom Sent: 10 Nopember 2006 10:29 To: cake-php@googlegroups.com Subject: Location of foreign key Afternoon all, This may be a stupid question but I would like to know as it would make life somewhat simpler at the end of the day. In a hasOne relationship address: e.g. User hasOne UserDetail Where the users table includes core user information and the user_details table includes additional information (just an example). Normally I would put the user_id in to the user_details table yes? and the hasOne association set in the User model would always return the UserDetail data. What if I wanted a single table to act as the one to many tables (if that makes sense). For example: donations orders payments will be three different methods that a user can pay money on a particular site I'm working on. Each of these will be using the same payment gateway which has supplies certain information that I would like to record. I like to record this in a seperate table in case I need to switch gateways at any point. So, I would usually have just the one table, like so: orders -> recording amount paid, and other information order_gateway_details -> recording particular gateway stuff for this order [bad table names I know but it's late on a friday afternoon] now i would be forced to create three seperate gateway_details tables. order_gateway_details donation_gateway_details payment_gateway_details is it acceptable to put the id of the gateway details in to the orders, donations, and payments table? that way I could record all of the details in the one table where they belong. yet still reference them from their respective payment methods. I would be reversing the relationship I realise - gateway_details doesn't ever have one donation (etc). but it would make life easier... this is not cool is it? penny for your thoughts. cheers, mikee --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
RE: Quest for the holy grail of the cakePHP-Eclipse setups
I just tried your link and it seems that the PHP IDE plugin hosted on eclipse.org IS the Zend PHP IDE for Eclipse. I'm sorry for the confusion created from my previous mail. -Original Message- From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Bert Van den Brande Sent: 09 Nopember 2006 18:36 To: cake-php@googlegroups.com Subject: Re: Quest for the holy grail of the cakePHP-Eclipse setups I use the Zend Eclipse ( http://www.zend.com/phpide ). Since I prefer not to have 1 shared Cake framework for all my projects I haven't really tested the possibility of defining the Cake framework as a project and then making my projects dependent on the Cake-project. But I've seen some tutorial instructions somewhere on how to do it ... The Zend Eclipse IDE works pretty good for me with functions and class lookups, code completion, templates and such ... alltough I still need to tackle the debugging features. Haven't really tried some unit testing integration. On 11/9/06, Adrian Godong <[EMAIL PROTECTED]> wrote: > Hi, > > I'm using Eclipse 3.2.0 + PHP plugin from Eclipse (not PHPEclipse) > > Local workspace setup is just like your number 1. I will have one cake lib > for each project. > > Source control is using CVS. Currently no problem accessing, updating, or > comitting. > > BTW about test suites, any links on how to use it? It's not stated at all in > the manual. > > > On 11/9/06, Sonic Baker < [EMAIL PROTECTED]> wrote: > > There has been some talk on the list about the kinds of editors people use > for cakePHP development. Some people have mentioned Eclipse (among others) > for a good all round IDE. I personally have been using both 'kate' and > 'Quanta' (built on top of kate) for my cakePHP development and while I have > no real complaints, these would probably fall in the category of Editors > rather than IDE's. So, in my continuing quest to become ever more efficient, > and taking into account that there was a mention of EasyEclipse, I've > decided to give it a shot and see what advantages an IDE like Eclipse has to > offer. One other reason for going with Eclipse over others is the fact that > it's open source. > > However, I'm pretty much a total noob at Eclipse and although the nice > people over at EasyEclipse have made it easier to get you up and running, > managing cake projects is not as obvious as it would first seem. > > > > Some of the things I'd like to get out of eclipse are: > > (1) Integration with the cakePHP test suite > > - At present it works with SimpleTest but how would the cakePHP > version sit with it? > > > > (2) Integration with subversion > > > > (3) Integration with the cakePHP itself > > > > The first thing that struck me was where to start a workspace and where to > start a project? > > > > Presently I'm using the trunk core checkout from the subversion repository > and so my directory structure is: > > > > /var/www/workspace/cake/1.x.x.x/app > > > > I thought this way I could keep all my cake projects within the same > workspace. So I defined my workspace as '/var/www/workspace' hoping to > create a project in 'cake/1.x.x.x/project_name'. > > This gives me the error: > > 'Project contents cannot be inside workspace directory' > > Wah > > > > From talking to the guys over on the EasyEclipse IRC channel I've > discovered that this kind of layout will not be possible till the soon to be > released 1.2 version. > > > > However, since others here are already using Eclipse it makes me think > that perhaps I'm going about it the wrong way altogether. Talking to our own > guys on the #cakephp IRC channel I've found two alternatives. > > > > (1) Put the entire cake core in a project of it's own, so you would have > '/var/www/workspace/project1'. The 'project1' directory would contain the > entire cake framework and of course your 'app' directory. However, if I > wanted to create a second cakePHP project I would have to make 'project1' > which would also contain the entire framework and would not allow me to > share my cakePHP core across multiple projects. > > > > (2) Edit app/webroot/index.php and move the cake core to the root of the > workspace. So I'd have '/projects/cake', '/projects/app1', and > '/projects/app2'. In order to deploy this to the server I'd have to either > use the same directory structure on the server, or use a second branch for > the live application. > > > > Another thing that struck m
Re: Quest for the holy grail of the cakePHP-Eclipse setups
Hi,I'm using Eclipse 3.2.0 + PHP plugin from Eclipse (not PHPEclipse)Local workspace setup is just like your number 1. I will have one cake lib for each project.Source control is using CVS. Currently no problem accessing, updating, or comitting. BTW about test suites, any links on how to use it? It's not stated at all in the manual.On 11/9/06, Sonic Baker < [EMAIL PROTECTED]> wrote:There has been some talk on the list about the kinds of editors people use for cakePHP development. Some people have mentioned Eclipse (among others) for a good all round IDE. I personally have been using both 'kate' and 'Quanta' (built on top of kate) for my cakePHP development and while I have no real complaints, these would probably fall in the category of Editors rather than IDE's. So, in my continuing quest to become ever more efficient, and taking into account that there was a mention of EasyEclipse, I've decided to give it a shot and see what advantages an IDE like Eclipse has to offer. One other reason for going with Eclipse over others is the fact that it's open source. However, I'm pretty much a total noob at Eclipse and although the nice people over at EasyEclipse have made it easier to get you up and running, managing cake projects is not as obvious as it would first seem. Some of the things I'd like to get out of eclipse are:(1) Integration with the cakePHP test suite - At present it works with SimpleTest but how would the cakePHP version sit with it?(2) Integration with subversion (3) Integration with the cakePHP itselfThe first thing that struck me was where to start a workspace and where to start a project?Presently I'm using the trunk core checkout from the subversion repository and so my directory structure is: /var/www/workspace/cake/1.x.x.x/appI thought this way I could keep all my cake projects within the same workspace. So I defined my workspace as '/var/www/workspace' hoping to create a project in 'cake/1.x.x.x/project_name'. This gives me the error:'Project contents cannot be inside workspace directory'WahFrom talking to the guys over on the EasyEclipse IRC channel I've discovered that this kind of layout will not be possible till the soon to be released 1.2 version.However, since others here are already using Eclipse it makes me think that perhaps I'm going about it the wrong way altogether. Talking to our own guys on the #cakephp IRC channel I've found two alternatives. (1) Put the entire cake core in a project of it's own, so you would have '/var/www/workspace/project1'. The 'project1' directory would contain the entire cake framework and of course your 'app' directory. However, if I wanted to create a second cakePHP project I would have to make 'project1' which would also contain the entire framework and would not allow me to share my cakePHP core across multiple projects. (2) Edit app/webroot/index.php and move the cake core to the root of the workspace. So I'd have '/projects/cake', '/projects/app1', and '/projects/app2'. In order to deploy this to the server I'd have to either use the same directory structure on the server, or use a second branch for the live application. Another thing that struck me was using subversion with eclipse. Usually, when using svn you import your new project, delete the old one and check a working copy out from the repository. So with Eclipse, I create a project (which creates the '.project' file), maybe bake or copy in my 'app' directory, check it into the repo, delete the whole lot and then check a wc out of the repo again. This seems like and awful waste to me. How do you do it? To all Eclipse users out there: How do you have your Eclipse setup working with cakePHP? Have you integrated the test suite? How do you handle Subversion?As I'm new to Eclipse, I'm sure there are tons of stuff I'm missing here. If you point me in the right direction of even one of them I'd be very greatfull. Cheers,Sonic -- Adrian Godong[EMAIL PROTECTED]Microsoft Student Ambassador --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
RE: How to display Child categories of self-pointed Model?
You should change the name of the 'association'. E.g.: ... var $belongsTo = array( 'ParentCategory' => array('className' => 'Category', ... And ... var $hasMany = array( 'ChildCategory' => array('className' => 'Category', ... Good luck! -Original Message- From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Apprentice Sent: 04 Nopember 2006 19:54 To: Cake PHP Subject: How to display Child categories of self-pointed Model? Hi all, I have a Model Category: VALID_NOT_EMPTY, 'description' => VALID_NOT_EMPTY, ); //The Associations below have been created with all possible keys, those that are not needed can be removed var $belongsTo = array( 'Categories' => array('className' => 'Category', 'conditions' => '', 'fields' => '', 'order' => 'Categories.ord ASC', 'foreignKey' => 'category_id', 'counterCache' => ''), ); var $hasMany = array( 'Categories' => array('className' => 'Category', 'foreignKey' => 'category_id', 'conditions' => '', 'fields' => '', 'order' => 'Categories.ord ASC', 'limit' => '', 'offset' => '', 'dependent' => '', 'exclusive' => '', 'finderSql' => '', 'counterSql' => ''), 'Post' => array('className' => 'Post', 'foreignKey' => '', 'conditions' => '', 'fields' => '', 'order' => '', 'limit' => '', 'offset' => '', 'dependent' => '', 'exclusive' => '', 'finderSql' => '', 'counterSql' => ''), ); } ?> And the table that serves Category: CREATE TABLE `categories` ( `id` int(10) NOT NULL auto_increment, `category_id` int(10) NOT NULL default '0', `name` varchar(50) collate utf8_bin NOT NULL, `description` varchar(255) collate utf8_bin NOT NULL, `created` datetime NOT NULL, `modified` datetime NOT NULL, PRIMARY KEY (`id`), KEY `category_id` (`category_id`,`name`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Categories' AUTO_INCREMENT=8 ; By doing: $this('categories', $this->Category->findAll()) I can only display the Parent Category, which is containted in the array $categories['Categories'] I don't know how to find, retrieve & display Child Categories. Please give a hint. Any help is appreciated. Thank you in advance! Apprentice. --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
RE: how to call a function when somebody click a link?
Mm... Not quite right. To put it easily, here’s how: First, read about MVC in the CakePHP manual. It gives a big picture about the whole web thing. From what I understand, what you’re trying to do is to add a logic (code that processes objects and stuff) into your view (the THTML file). While possible, this is NOT a preferred way. All of the logic (including any functions) need to be placed on the controller. The controller will pass data to the view via $this->set(‘key’, ‘value’) method. The view will never need to process anything but the values set from the above method. The less the client (or the view) need to know about how to process data, the better your solution would be. Don’t hesitate to send back the data/tag/extra info to the server (using POST - or GET - ). That’s just the way the web works. From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of ??? Yang Su Li Sent: 04 Nopember 2006 15:43 To: cake-php@googlegroups.com Subject: Re: how to call a function when somebody click a link? thanks & ki :) so you think the form and _javascript_ thing didnot work out because of arguements missing? 2006/11/4, Adrian Godong <[EMAIL PROTECTED]>: Your second solution (the one setting up a flag) is the best way to do that. Don't forget to set any additional data you need in the session. What you need to understand is like this: the client does not anything about your program. Period. It does not even know the original data (the one that resides in $this->blablabla). This is called stateless. Therefore, the server must maintain the data within the session variable for cross-page functions. On 11/4/06, [EMAIL PROTECTED] < [EMAIL PROTECTED]> wrote: 555 i want to redirect the user back to the page they were just on,with calling a function in advance:( maybe i should learn more about basic php? -- Adrian Godong [EMAIL PROTECTED] Microsoft Student Ambassador --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: how to call a function when somebody click a link?
Your second solution (the one setting up a flag) is the best way to do that. Don't forget to set any additional data you need in the session.What you need to understand is like this: the client does not anything about your program. Period. It does not even know the original data (the one that resides in $this->blablabla). This is called stateless. Therefore, the server must maintain the data within the session variable for cross-page functions. On 11/4/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: 555i want to redirect the userback to the page they were just on,with calling a function in advance:(maybe i should learn more about basic php?-- Adrian Godong[EMAIL PROTECTED]Microsoft Student Ambassador --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: ERROR_Adding an RSS feed using FeedCreator
You're not alone. I'm looking at the same problem.I think it's because the wiki documentation is outdated. The sample from bitfolge.de (the creator of feedreader) mentioned something called saveRss function. Just tried, it works! Change the last line in your rss.thtml: $rss->outputFeed();to $rss->saveFeed();On 11/1/06, Eric <[EMAIL PROTECTED]> wrote: http://wiki.cakephp.org/tutorials:blog_tutorial_-_2Adding an RSS feed using FeedCreatorI follow the steps.There is an error message: Fatal error: Call to undefined methodUniversalFeedCreator::outputFeed() in D:\ProgramFiles\xampp\htdocs\cake\app\views\posts\rss.thtml on line 31Why call to undefined method?Thanks! Microsoft Student Ambassador --~--~-~--~~~---~--~~ 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: Cake PHP Help
More information about the error? From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Gayathiri Balachandran Sent: 31 Oktober 2006 13:43 To: cake-php@googlegroups.com Subject: Cake PHP Help Hello! Please help me in finding answer to this. I am new to Cake PHP. I have downloaded the Cake PHP and worked out the example show in the site http://www.sitepoint.com/article/application-development-cakephp. I had done all the coding as per in the example, - Create a table (notes), - database.php (app/config), - note.php (app/models), - notes_controller.php (app/controllers). Creating *.thtml leads to an error. I just copy the code and save it as index.thtml (app/views/notes) and run in the browser (http://localhost/cake/app/views/notes ), it simply displays the coding. The database is configured correctly. http://localhost/cake/ shows "Your database configuration file is present. Cake is able to connect to the database." Cake Version: 3632 PHP Version: PHP5 Database: MySQL Thanks in advance for all your help!! Regards, Gayathiri. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---