Re: Having trouble "breaking out" of CakePHP via various HREF attributes
Thank's for your response! I have to get on a plane in a few hours so I won't be able to test that out tonight, but I will as soon as I can. I will let you know how it goes. Cheers! Daniel --~--~-~--~~~---~--~~ 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 change default home page?
You're right, that's the bad thing about copy & paste ;) Glad to know it's working. -MI --- Remember, smart coders answer ten questions for every question they ask. So be smart, be cool, and share your knowledge. BAKE ON! -Mensaje original- De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre de Tazz Enviado el: Miércoles, 20 de Diciembre de 2006 03:09 a.m. Para: Cake PHP Asunto: Re: How do i change default home page? $Route->connect('/', array('controller' => 'homes', 'action' => 'display', 'index')); Should be... $Route->connect('/', array('controller' => 'homes', 'action' =>'index', 'index')); display function does not exist in homes controller ;) Thanks I have it all working now... --~--~-~--~~~---~--~~ 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 change default home page?
$Route->connect('/', array('controller' => 'homes', 'action' => 'display', 'index')); Should be... $Route->connect('/', array('controller' => 'homes', 'action' =>'index', 'index')); display function does not exist in homes controller ;) Thanks I have it all working now... Mariano Iglesias wrote: Yes, you can tell CakePHP that your controller doesn't use a model. On your HomesController add the following variable: var $uses = null; Like so: class HomesController extends AppController { var $uses = null; function index() { $this->set('title', 'Home Page'); } } -MI --- Remember, smart coders answer ten questions for every question they ask. So be smart, be cool, and share your knowledge. BAKE ON! -Mensaje original- De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre de Tazz Enviado el: Miércoles, 20 de Diciembre de 2006 02:31 a.m. Para: Cake PHP Asunto: Re: How do i change default home page? Humm when I create the HomesController, it then requires me do build the Homes Model and then that requires an actual database table... Is there a way so I can just create a home page and display different data from different models regardless of their relation? --~--~-~--~~~---~--~~ 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: How do i change default home page?
Yes, you can tell CakePHP that your controller doesn't use a model. On your HomesController add the following variable: var $uses = null; Like so: class HomesController extends AppController { var $uses = null; function index() { $this->set('title', 'Home Page'); } } -MI --- Remember, smart coders answer ten questions for every question they ask. So be smart, be cool, and share your knowledge. BAKE ON! -Mensaje original- De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre de Tazz Enviado el: Miércoles, 20 de Diciembre de 2006 02:31 a.m. Para: Cake PHP Asunto: Re: How do i change default home page? Humm when I create the HomesController, it then requires me do build the Homes Model and then that requires an actual database table... Is there a way so I can just create a home page and display different data from different models regardless of their relation? --~--~-~--~~~---~--~~ 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 change default home page?
Humm when I create the HomesController, it then requires me do build the Homes Model and then that requires an actual database table... Is there a way so I can just create a home page and display different data from different models regardless of their relation? Mariano Iglesias wrote: Create a controller and an action. Let's say: 1. Create a file called app/controllers/homes_controller.php with the following: class HomesController extends AppController { function index() { $this->set('title', 'Home Page'); } } 2. Create the view on file app/views/homes/index.thtml. 3. Edit app/config/routes.php and look for following line: $Route->connect('/', array('controller' => 'pages', 'action' => 'display', 'home')); Change it to: $Route->connect('/', array('controller' => 'homes', 'action' => 'display', 'index')); After this your home page will be the index() action on your Homes controller, so you can use your models there and stuff. PS: I called the controller Homes instead of Home because as per CakePHP recommendations controllers are to be plural. -MI --- Remember, smart coders answer ten questions for every question they ask. So be smart, be cool, and share your knowledge. BAKE ON! -Mensaje original- De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre de Tazz Enviado el: Lunes, 18 de Diciembre de 2006 03:10 a.m. Para: Cake PHP Asunto: How do i change default home page? Please confirm if this is the right thing to do... On my front page I want to show data from various models! Obviously, the default home page created by the bake.php script is just a static page... --~--~-~--~~~---~--~~ 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 change default home page?
ok I think I got it now when I put the uses then it searched for that particular model instead cool! Mariano Iglesias wrote: Create a controller and an action. Let's say: 1. Create a file called app/controllers/homes_controller.php with the following: class HomesController extends AppController { function index() { $this->set('title', 'Home Page'); } } 2. Create the view on file app/views/homes/index.thtml. 3. Edit app/config/routes.php and look for following line: $Route->connect('/', array('controller' => 'pages', 'action' => 'display', 'home')); Change it to: $Route->connect('/', array('controller' => 'homes', 'action' => 'display', 'index')); After this your home page will be the index() action on your Homes controller, so you can use your models there and stuff. PS: I called the controller Homes instead of Home because as per CakePHP recommendations controllers are to be plural. -MI --- Remember, smart coders answer ten questions for every question they ask. So be smart, be cool, and share your knowledge. BAKE ON! -Mensaje original- De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre de Tazz Enviado el: Lunes, 18 de Diciembre de 2006 03:10 a.m. Para: Cake PHP Asunto: How do i change default home page? Please confirm if this is the right thing to do... On my front page I want to show data from various models! Obviously, the default home page created by the bake.php script is just a static page... --~--~-~--~~~---~--~~ 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: Errors in the View
You can view the files at: HolidaysController: http://bin.cakephp.org/saved/1308 ProductsController: http://bin.cakephp.org/saved/1309 Holiday Model: http://bin.cakephp.org/saved/1310 Product Model: http://bin.cakephp.org/saved/1311 Christmas.thtml: http://bin.cakephp.org/saved/1312 There are the files that I have been using. As for the code in Christmas.thtml, I forgot to update it with $data['Product'].So, if you go to: http://www.decorbee.com/app/Holidays/christmas, you will see the outcome that I get. --~--~-~--~~~---~--~~ 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: Ajax, controller and good practice
Ok, one thing that I tried is the following... I copied the code from my index.thtml file that displayed the users and put it into it's own file: ajax_index.thtml. In my index action, added the following: if( $this->RequestHandler->isAjax()) { $this->layout = 'ajax'; $this->render( NULL, NULL, 'ajax_index' ); } but that isn't working. I'm getting a missing view error. If instead I do $this->render( 'ajax_action' ); I get a mission action error. I've looked in the manual and the API. How can you make it so that an action uses a different view file? I could have sworn that the above is correct...? thnx, Christoph --~--~-~--~~~---~--~~ 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: Accessing the main applications models from a plugin
To answer one of my own question 1. Do plugins have direct access to the core application's models? Having looked through the ACM plugin code it appears to directly access the models of the base application (the Aros and Acos for instance) in the normal way that you would access a model in the base application. Regards, Langdon --~--~-~--~~~---~--~~ 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: Populating Pulldowns in forms
$this->set('manufacturersArray',$this->Product->Manufacturer->generateList()); On 12/19/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: Hey, I'm pretty new to CakePHP and had a question: I have two tables, Products and Manufacturers, and products has a foreign key that joins them. I wanted to have a select tag that maps to Products to put the value in the foreign key field, but that pulls the name and id from manufacturers for the display. Any idea how to accomplish this? > -- == 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: Having trouble "breaking out" of CakePHP via various HREF attributes
I think maybe you need to adjust your rewrite rules set in /store/.htaccess If you used standard cake dist, the 5th line will look like RewriteRule ^(.*)$ index.php?url=$1 [QSA,L] Changing it to RewriteRule ^/store(.*)$ index.php?url=$1 [QSA,L] Should make sure only the cake uri's get rewritten. I'm hardly a mod_rewrite wizard, so you might need to tweak or it might be something else entirely. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Populating Pulldowns in forms
Hey, I'm pretty new to CakePHP and had a question: I have two tables, Products and Manufacturers, and products has a foreign key that joins them. I wanted to have a select tag that maps to Products to put the value in the foreign key field, but that pulls the name and id from manufacturers for the display. Any idea how to accomplish 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?hl=en -~--~~~~--~~--~--~---
Re: Accessing the main applications models from a plugin
I just realised that I didn't finish question 2. It should have read: 2. Do plugins have access to resources like images in webroot/ Regards, Langdon --~--~-~--~~~---~--~~ 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: Creating custom forms
That doesn't work. I think Cake can only assign one name per Model/field combination. In one of the other threads someone suggested putting "][" after the fieldname like: $html->checkbox('Option/id][', $option['id'], array('id' => 'option'.$option['id'], 'value' => $option['id']) ); This was better since the various checkboxes had a name that was formatted as an array - data[Option][id][]. However, hidden fields with the same name were also generated, each with a value zero and so extra elements were added to the data[Option][id][] array. --~--~-~--~~~---~--~~ 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: Ajax, controller and good practice
and one more thing... [EMAIL PROTECTED]is actually!$ajax_call --~--~-~--~~~---~--~~ 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: Errors in the View
perhaps you can post at http://bin.cakephp.org/ the controller, relevent models and views and we can get a whole picture, my old brain just can't get a hold of all these snippets or seemingly unproblematic code. On 12/19/06, the_woodsman <[EMAIL PROTECTED]> wrote: > > Without a copy of the exact line that's giving the error, we can only > speculate. > Is the foreach loop you mentionthe one giving the error, or is it a > nested one inside this? > > Either way, dumping the arrya just before the error should give you all > the insight you need... > > > > > -- == 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: Errors in the View
Without a copy of the exact line that's giving the error, we can only speculate. Is the foreach loop you mentionthe one giving the error, or is it a nested one inside this? Either way, dumping the arrya just before the error should give you all the insight you need... --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Accessing the main applications models from a plugin
Hi I am considering compartimentalising the functionality of an application that I am building using plugins. The aim is to allow users to choose the functionality that they need The application will have a core of data management features. The extended functionality of the application will be provided by the plugins. Plugins will all need to have access to the models of the core application My questions: 1. Do plugins have direct access to the core application's models? 2. Do plugins have access to resources like images in 3. Is this a logical way to structure a Cake application? Or am I missing the point of how plugins are meant to be used? Thanks in advance for any assistance. Regards, Langdon --~--~-~--~~~---~--~~ 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 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: Form into an Element. How to autopopulate ?
Sorry, there was a cAsE problem in my code. You can populate any form field rendered by the html helper setting $this->data['Model']['field'] = 'value'; on the controller. Even when you're rendering it inside an element. On 19 dez, 17:06, "guigouz" <[EMAIL PROTECTED]> wrote: > Hello > I've created some forms using the html helper, then, I set something > like $this->data['User'] = $someuser; on the controller, and it gets > populated automatically. Now I've created an element that renders a > form. Is there any way to autopopulate it ? Which variable should I set > when calling renderElement() ? > > thanks > > gui --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Form into an Element. How to autopopulate ?
Hello I've created some forms using the html helper, then, I set something like $this->data['User'] = $someuser; on the controller, and it gets populated automatically. Now I've created an element that renders a form. Is there any way to autopopulate it ? Which variable should I set when calling renderElement() ? thanks gui --~--~-~--~~~---~--~~ 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: Creating custom forms
Uh, maybe $html->checkBox("Option/id", "theoptionid"); have a lot of those, then save them ? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Creating custom forms
Hello, I'm getting my feet wet with Cake and wanted to see if there's a better way of doing what I'm trying to achieve. I have a Product model and an Option model. A Product can have many Options. I've already defined the relationships in the respective models. I'm trying to create a view Product page where a user can see the product, select any number of Options, which are represented by checkboxes, and add the item to their shopping cart. The conventional way of doing this would be to create checkboxes with the same name attributes, e.g. options[] and then process the options array within $_POST. This would require me to hardcode "http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Including a cakephp action result in another site
anselm wrote: > See http://www.php.net/manual/en/function.file-get-contents.php That's really not such a good idea. You should read up on allow_url_fopen, and the *huge* security risk it poses if you're not careful. You should never use any filesystem functions on remote resources, especially if you don't control them. --~--~-~--~~~---~--~~ 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: Ajax, controller and good practice
The HTML i wrote looks like layout view because of the , and tags... it's just an example you can put it in your own view, but be careful... when you render the updata you must specify an empty layout. $this->set('ajax_call', true); $this->render('index','ajax'); the ajax.thtml layout should look like this: And one other thing to do... you can disable the render time which is generated if you're in debug set to >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?hl=en -~--~~~~--~~--~--~---
Re: Ajax, controller and good practice
I've been thinking on this too. I didn't want to write 2 different views, one for the whole index page and one just for the updated table. I did sth. like this. . bla bla bla the content which will be updated And i have 2 actions in the controller in which i initialize the data and set the $ajax_call to false or true. So the 'index' action renders the whole html and the 'index_update' action renders the same file 'index.thtml' ($this->render('index')) and updates the 'updatable' . Also.. if you want you can do this just in one action with extra parametes: function index($update = false){ init(); if($update){$this->set('ajax_call',true)} else{$this->set('ajax_call',false)} } You should know that i'm a beginner so... what i'm saying is a way to deal with ajax updates, but i'm not sure that this is the right way. the good thing in this method is that you change only one view an one action --~--~-~--~~~---~--~~ 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: Including a cakephp action result in another site
No way, curl is much faster than file_get_contents(). http://monitor.trucex.com/curltest.php Some examples of that test output: --- Calculating 10 queries to http://www.flickr.com/ ..cURL took 0.953103 seconds. ..file_get_contents() took 2.283331 seconds. Calculating 10 queries to http://www.yahoo.com/ ..cURL took 0.713752 seconds. ..file_get_contents() took 1.592310 seconds. Calculating 10 queries to http://www.ebay.com/ ..cURL took 0.831023 seconds. ..file_get_contents() took 2.827789 seconds. Calculating 10 queries to http://www.godaddy.com/ ..cURL took 0.359577 seconds. ..file_get_contents() took 8.521148 seconds. Calculating 10 queries to http://www.php.net/ ..cURL took 0.710871 seconds. ..file_get_contents() took 1.958811 seconds. --- -MI --- Remember, smart coders answer ten questions for every question they ask. So be smart, be cool, and share your knowledge. BAKE ON! -Mensaje original- De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre de anselm Enviado el: Martes, 19 de Diciembre de 2006 07:53 a.m. Para: Cake PHP Asunto: Re: Including a cakephp action result in another site If you just want to grab the content, and display it as it is the fastest way is to use file_get_contents (provided you have fopen wrappers installed) : --~--~-~--~~~---~--~~ 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: Keeping unbindModel out of your controllers
Ok let's try debugging to fix this. Also can you send me the calls you are using (i.e: from your first call to your expects() to later findAll() or whatever call)? Use this as your expects() method and put an exit or a die() just before you do your findAll() so you can write down the results, send them after doing that: function expects() { $models = array(); $arguments = func_get_args(); foreach($arguments as $index => $argument) { if (is_array($argument)) { if (count($argument) > 0) { $arguments = array_merge($arguments, $argument); } unset($arguments[$index]); } } if (count($arguments) == 0) { $models[$this->name] = array(); } else { foreach($arguments as $argument) { if (strpos($argument, '.') !== false) { $model = substr($argument, 0, strpos($argument, '.')); $child = substr($argument, strpos($argument, '.') + 1); if ($child == $model) { $models[$model] = array(); } else { $models[$model][] = $child; } } else { $models[$this->name][] = $argument; } } } echo $this->name . '.models (all): '; print_r($models); echo ''; foreach($models as $model => $children) { if ($model != $this->name && isset($this->$model)) { echo 'CALLING ' . $model . '.expects() with '; print_r($children); echo ''; $this->$model->expects($children); } } if (isset($models[$this->name])) { foreach($models as $model => $children) { if ($model != $this->name) { $models[$this->name][] = $model; } } $models = array_unique($models[$this->name]); echo $this->name . '.models: '; print_r($models); echo ''; $unbind = array(); $relations = array ('belongsTo', 'hasOne', 'hasMany', 'hasAndBelongsToMany'); foreach($relations as $relation) { if (isset($this->$relation)) { foreach($this->$relation as $currentModel) { $currentModelClass = (isset($currentModel['className']) ? $currentModel['className'] : $currentModel['classname']); if (!in_array($currentModelClass, $models)) { $unbind[$relation][] = $currentModelClass; } } } } if (count($unbind) > 0) { $this->unbindModel($unbind); } } } -MI --- Remember, smart coders answer ten questions for every question they ask. So be smart, be cool, and share your knowledge. BAKE ON! -Mensaje original- De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre de
Re: Including a cakephp action result in another site
If you want to pass data through/have cookies/etc. then PEAR HTTP_Client is probably the way to go. If you just want to grab the content, and display it as it is the fastest way is to use file_get_contents (provided you have fopen wrappers installed) : echo file_get_contents('http://www.example.com'); See http://www.php.net/manual/en/function.file-get-contents.php --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Having trouble "breaking out" of CakePHP via various HREF attributes
Hi All, I have scoured the group and the cake manual, but I have not found what I am looking for (and hacking out a workaround yielded no positive results). I have CakePHP sitting in a sub-directory ('store') for the root of one of my web projects (server is running latest wamp + latest cake w/ default config) such that the hierarchy is as follows: web_root |_repository |_ project0.ext |_ css |_scripts |_ ... |_store |_app |_cake |_ ... |_ ... |_ project1.ext |_ project2.ext |_ ... Once I navigate to the cake-enabled content, the url is: 'http://{server}:{port}/repository/project0.ext/store/' Now, the default view has links to the non-cake content which sits above the 'store' folder. When I click on a link (that is, any HTML element with an HREF attribute) that has 'http://{server}:{port}/repository/project0/foo.php' as the (absolute) value of the HREF attribute, the browser is redirected to 'http://{server}:{port}/repository/project0/store/' even though the target is OUTSIDE the 'store' folder. Links with HREF set to values like 'http://www.google.com', however, break out of cake just fine. I am lost, frustrated, tired, and I would GREATLY appreciate any help that can be offered. Thanks, Daniel --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Ajax, controller and good practice
I'm curious about what good/best practice is when setting up an action that will be utilizing ajax updates. Let's say we are working with the users/index controller/action that will be listing out all the users in the system. The table of users will be updated via ajax as the user pages through the list. Is it best to have 2 actions in the controller? One that sets up the whole index page and another (using just the ajax layout) that is doing the actual querying of the users? The latter being accessed by the former via requestAction() I ask because if only a part of a page is going to be updated, I would think that it would be best to seperate that part into it's own action. That way, I can minimize the amount of data that is coming back from the server using the ajax layout. Otherwise, the whole page would be refreshed. Or am I thinking about this the wrong way? thnx, Christoph --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Having trouble "breaking out" of CakePHP via various HREF attributes
Hi All, I have scoured the group and the cake manual, but I have not found what I am looking for (and hacking out a workaround yielded no positive results). I have CakePHP sitting in a sub-directory ('store') for the root of one of my web projects (server is running latest wamp + latest cake w/ default config) such that the hierarchy is as follows: web_root |_repository |_ project0.ext |_ css |_scripts |_ ... |_store |_app |_cake |_ ... |_ ... |_ project1.ext |_ project2.ext |_ ... Once I navigate to the cake-enabled content, the url is: 'http://{server}:{port}/repository/project0.ext/store/' Now, the default view has links to the non-cake content which sits above the 'store' folder. When I click on a link (that is, any HTML element with an HREF attribute) that has 'http://{server}:{port}/repository/project0/foo.php' as the (absolute) value of the HREF attribute, the browser is redirected to 'http://{server}:{port}/repository/project0/store/' even though the target is OUTSIDE the 'store' folder. Links with HREF set to values like 'http://www.google.com', however, break out of cake just fine. I am lost, frustrated, tired, and I would GREATLY appreciate any help that can be offered. Thanks, Daniel --~--~-~--~~~---~--~~ 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: Filtering HABTM associations using columns in both models
> Anyone has suggestions for this on? I'm having similar problems. hmm, I don't think you can with a vanilla HABTM, you need to fake it by creating a hasMany and belongsTo association with a JoinTable model, check out: http://www.thinkingphp.org/2006/10/26/modeling-relationships-in-cakephp-faking-rails-throughassociation/ hth jb -- jon bennett t: +44 (0) 1225 341 039 w: http://www.jben.net/ iChat (AIM): jbendotnet Skype: jon-bennett --~--~-~--~~~---~--~~ 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: Filtering HABTM associations using columns in both models
Anyone has suggestions for this on? I'm having similar problems. On Nov 24, 2:46 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I've seen topics that describe how to do something like find all posts > with a given tag: > > $this->Post->Tag->findAll("Tag.id = $id"); > > I'm running into a problem now where I need to find all posts with a > given tag and the posts must also have certain values of a certain > field. So the models look like: > > Post > - id > - title > - body > - published (DATETIME field) > > Tag > - id > - name > > PostHABTMTag > TagHABTMPost > > So what I'd like to do is find all the posts that match two conditions: > 1) Tag.id = $id > 2) Post.published <= NOW() > > Any idea how to get both conditions into a single call to findAll? --~--~-~--~~~---~--~~ 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: Dependent model, call delete model
Yes, this seems to work. Nevertheless it's strange that the beforeDelete and afterDelete methods are being invoked, but the delete-method itself isn't. I'd expect a (in this case) Photo to be deleted using it's own delete-method. What would be the reason this isn't working like that? Another curious thing: when I do pr($this) in beforeDelete, 'id' contains the id, so this->id =99, but when I pr(this) in afterDelete, this->id contains an array: this->id=array(0=>99)... --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---