Re: Authenticate user to only add/edit/view with their user_id
http://bakery.cakephp.org/articles/view/how-to-use-acl-in-1-2-x On Sep 14, 3:58 pm, seans9 <[EMAIL PROTECTED]> wrote: > I've read so many tutorials on Authenticating and not one has the > answer to my questions. > > How can I authenticate a user and have that user only able to edit/add/ > view their own records (attached with user_id)? > > I know I can follow a simple authentication tutorial and write some > conditionals to make it work - but there has to be an easier DRY > way. > > Any ideas? --~--~-~--~~~---~--~~ 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: Using 2 models in 1 controller? (or in 1 view? I'm confused...)
in controller: $uses = array('News', 'Testimonial'); You'll have access to both models. On Sep 14, 3:47 pm, AliBabNet <[EMAIL PROTECTED]> wrote: > Hello > > I'm turning crazy, I've been over the manual 50 times, read tutorials, > I just can't find out how to use 2 models in 1 controller. > > Let's say on my homepage I want to list my NEWS, and list my > TESTIMONIALS. > Both of them are models, but if I follow the examples, I would have to > declare something like > var $name = 'News'; > at the beginning of my controller... so I just can't use Testimonials > anymore after that... or how does it work?? > > Sorry for this question, probably sounds dumb... but I'll persist!! :) > > Thanks > Philippe --~--~-~--~~~---~--~~ 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: Cake Pages w/Multiple Actions, Multiple Models
Ryan, This is a pretty standard question from people just getting started, so don't worry. The simple answer is in your controller, add the variable: $uses = array('Post, 'Comment'); You can then access both $this->Post->save(); and $this->Comment- >save(); from that controller. Of course any model function is accessible, not just save() Hope that helps. On Sep 14, 5:39 pm, nryan <[EMAIL PROTECTED]> wrote: > Hello everyone, > > I've been working with Cake and I understand exactly how everything > works to create pages which are tied to one particular action with one > particular model. > > However, I am building a web application which requires pages that can > perform multiple actions on multiple models, depending on requests > from the user. And it's not clear to me the "right way" to do this > with Cake. > > Can someone give me an example or perhaps point me to documentation > that discusses this? Perhaps I have missed it but I don't think this > topic is specifically addressed in the docs. > > thank you, > ryan --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
/app/webroot/ as home link ...
Hi all, I have used url('/'); ?> to link the logo to home page and instead to go to www.site.com it goes to www.site.com/app/webroot/ it works but is ugly .. does anybody knows what i need to do ? thanks! Claudiu --~--~-~--~~~---~--~~ 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: get access from one controller to another
Try requestAction: http://manual.cakephp.org/chapter/controllers Regards, Ryan Rose Vice President Digiwize, Inc. One Technology Drive Tolland, CT 06084 e: [EMAIL PROTECTED] p: 860.730.2631 http://www.digiwize.com -Original Message- From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of millZ Sent: Friday, September 14, 2007 7:25 PM To: Cake PHP Subject: get access from one controller to another Hello, how is it possible to call functions of a Controller (EventsController) in another Controller (VisitsController)? The models are connected with visits:belongsto Events events: hasMany Visits I've tried to call "$this->Visit->Event->isFriendEvent($eID)", but this ends with an error, because of an acces to the models. So what is the way to call the function "isFriendEvent" (defined in Eventscontroller) in VisitsController - i need it there. 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 -~--~~~~--~~--~--~---
get access from one controller to another
Hello, how is it possible to call functions of a Controller (EventsController) in another Controller (VisitsController)? The models are connected with visits:belongsto Events events: hasMany Visits I've tried to call "$this->Visit->Event->isFriendEvent($eID)", but this ends with an error, because of an acces to the models. So what is the way to call the function "isFriendEvent" (defined in Eventscontroller) in VisitsController - i need it there. 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 -~--~~~~--~~--~--~---
Cake Pages w/Multiple Actions, Multiple Models
Hello everyone, I've been working with Cake and I understand exactly how everything works to create pages which are tied to one particular action with one particular model. However, I am building a web application which requires pages that can perform multiple actions on multiple models, depending on requests from the user. And it's not clear to me the "right way" to do this with Cake. Can someone give me an example or perhaps point me to documentation that discusses this? Perhaps I have missed it but I don't think this topic is specifically addressed in the docs. thank you, ryan --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Authenticate user to only add/edit/view with their user_id
I've read so many tutorials on Authenticating and not one has the answer to my questions. How can I authenticate a user and have that user only able to edit/add/ view their own records (attached with user_id)? I know I can follow a simple authentication tutorial and write some conditionals to make it work - but there has to be an easier DRY way. Any ideas? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Using 2 models in 1 controller? (or in 1 view? I'm confused...)
Hello I'm turning crazy, I've been over the manual 50 times, read tutorials, I just can't find out how to use 2 models in 1 controller. Let's say on my homepage I want to list my NEWS, and list my TESTIMONIALS. Both of them are models, but if I follow the examples, I would have to declare something like var $name = 'News'; at the beginning of my controller... so I just can't use Testimonials anymore after that... or how does it work?? Sorry for this question, probably sounds dumb... but I'll persist!! :) Thanks Philippe --~--~-~--~~~---~--~~ 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: Models /HABTM references
Ooops. Wrong button. Sorry! I wondered why the message didn't appear! SQL: CREATE TABLE `images` ( `id` int(10) unsigned NOT NULL auto_increment, `file_name` tinytext NOT NULL, `created` date NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Stored reference to file system images' AUTO_INCREMENT=1 ; -- -- -- Table structure for table `images_tags` -- CREATE TABLE `images_tags` ( `image_id` int(10) unsigned NOT NULL, `tag_id` int(10) unsigned NOT NULL, PRIMARY KEY (`image_id`,`tag_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='Link Table'; -- -- -- Table structure for table `tags` -- CREATE TABLE `tags` ( `id` int(10) unsigned NOT NULL auto_increment, `tag` varchar(30) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='Stores tags relating to images in the images table' AUTO_INCREMENT=1 ; CONTROLLER: class ImagesController extends AppController { var $layout = 'blank'; var $helpers = array('cache', 'javascript'); var $uses = array('Image', 'Tag'); function generate_browser() { print_r($this->Image->findAll();); } function upload() { $image = $this->data['Image']['gallery_browse_file']; // Check for a file if (empty($image['name'])) { $this->set('status', 'Upload Failed: No file specified'); $this->render(); return; } // What directory should we be in? $dir = date('Y/m'); chdir('img/uploads'); // If directory doesn't exist then make it if (!file_exists($dir)) { $this->set('status', 'Making directory'); $this->render(); mkdir($dir, 0755, true); } // If file exists, stop and give instructions if (file_exists($dir . DIRECTORY_SEPARATOR . $image['name'])) { $this->set('status', 'Upload Failed: Filename exists. Try renaming then upload again.'); $this->render(); return; } // So far, so good. Now try to move it if (move_uploaded_file($image['tmp_name'], $dir . '/' . $image['name'])) { $this->set('status', 'Saving '. $image['name']); $this->render(); // Finally insert a reference in the database, along with the tags $this->data['Image']['file_name'] = $image['name']; $this->data['Tag']['Tag'] = explode(',', trim(strtoupper($this->data['Image']['tag']))); // Check if it is a new tag, otherwise just use the existing ID foreach ($this->data['Tag']['Tag'] as $item) { if ($id = $this->Tag->field('id', "tag='$item'")) { $tag_id[] = $id; } else { if($item) { $this->Tag->create(); $this->Tag->save(array('Tag' => array('tag' => $item))); $tag_id[] = $this->Tag->getLastInsertId(); } } } // Fill ModelName/ModelName with an array of tag id's. // The HABTM will then auto-populate the join-table if (isset($tag_id)) { $this->data['Tag']['Tag'] = $tag_id; } // Save the Image $this->Image->save($this->data); $this->set('last_image_id', $this->Image- >getLastInsertId()); $this->set('status', $image['name'] . ' Uploaded Successfully'); $this->render(); return; } $this->set('status', 'Upload Failed'); $this->render(); } } MODELS: class Tag extends AppModel { var $name = 'Tag'; var $table = 'tags'; } class Image extends AppModel { var $name = 'Image'; var $table = 'images'; var $hasAndBelongsToMany = array( 'Tag' ); } The generate_browser() function in the controller is where things are falling over. The goal is simply for an uploaded image to have many tags associated with it, which the user can enter as comma separated list in a textbox. In the future, I want to be able to search for a Tag and get a list of Images with that Tag associated to them. I also just wish to be able to get a list of Images (with or without associated Tag data). (All the $this->render() is a bit of a dirty hack to update the status in the Upload box via JS.) Cheers for all the help. I really like CakePHP but there is a bit of a learning curve! Dave On Sep 14, 4:32 pm, "Jon Bennett" <[EMAIL PROTECTED]> wrote: > Hi Dave, > > > Yup :) Each Tag is unique. Uploads are working great now. > > If each Tag is unique, then I think a HABTM association is incorre
Re: unset unwanted fields
The fields are not in the edit.ctp but using form injection a knowledgeable user could add them. Here are the fields in edit.ctp: create('User');?> input('id'); echo $form->input('person_name_id'); echo $form->input('username'); echo $form->input('email'); ?> end('Submit');?> Running a simple test with the Web Developer plugin for Firefox, I was able to edit and post the form to update nologin. This was done by adding into the form the line: and then checking the box and submitting the form. Gary Dalton On 9/14/07, RichardAtHome <[EMAIL PROTECTED]> wrote: > > I may be misunderstanding your query, but can't you just remove the > fields from edit.ctp ? > > Admin will still be able to change them in admin_edit.ctp > > On Sep 14, 4:42 pm, bujanga <[EMAIL PROTECTED]> wrote: > > I think my question is just the result of a Friday brainlock but anyway. > > > > Is there a cake way to prevent unwanted fields being inserted into an > > edit form post? > > * Admin user is allowed to set $nologin to TRUE or FALSE > > * but Manager user is only allowed to view it. > > * Manager user is however allowed to change other items on the User model > > * Admin submits via admin_edit.ctp > > * while Manager submits through edit.ctp. > > > > Normally, I would discard all unwanted values. I can certainly do this > > here but is there a cake specific way that I am missing? > > > > Gary Dalton > > > > > --~--~-~--~~~---~--~~ 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: unset unwanted fields
Hi there I have added a two-dimensional array to each model which for each action states the fields that are allowed to be saved in this action. When I call $this->model->save() in an action, I supply the respective array entry as second parameter to the save() function which limits the fields that are used during the save. I don't know whether there is a cake specific way to do this, so if you find one, please post it here. @RichardAtHome: If you just remove the form fields from the ctp file a malicious user could still post to the form action using his own form and thus his own form fields. You could of course add some checks to verify the integrity of the form but this can get complicated really quick. Claudia --~--~-~--~~~---~--~~ 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: Connecting to multiple backends
It sure has been covered. Thanks. Using search terms like "multiple databases" was perfect. I was using "multiple backends". Just thinking with my backend I guess. Thanks again for the fast response. mc On Sep 14, 3:05 pm, "Chris Hartjes" <[EMAIL PROTECTED]> wrote: > On 9/14/07, sologroupmc <[EMAIL PROTECTED]> wrote: > This has been discussed a few times here, so I suggest you use the > Google Groups interface for the list and search for threads about it. > Should be at least two I can think of. --~--~-~--~~~---~--~~ 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: Connecting to multiple backends
On 9/14/07, sologroupmc <[EMAIL PROTECTED]> wrote: > > Newbie here, starting on a pilot project, hoping to use cake as main > front end. > > We will have a main db, could be in mysql (preferred), or shared ms > sql server. The app will need to run on it's own database, but pull > from two others running on separate ms sql servers. Is it possible to > mix and match db backends with cake? The other ms sql servers will be > used strictly for pulling data and saving in main mysql db, but the > mingling of data needs to be transparent. > > Any examples available of doing this sort of thing? Thanks much. > This has been discussed a few times here, so I suggest you use the Google Groups interface for the list and search for threads about it. Should be at least two I can think of. -- Chris Hartjes Senior Developer Cake Development Corporation My motto for 2007: "Just build it, damnit!" @TheBallpark - http://www.littlehart.net/attheballpark @TheKeyboard - http://www.littlehart.net/atthekeyboard --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Connecting to multiple backends
Newbie here, starting on a pilot project, hoping to use cake as main front end. We will have a main db, could be in mysql (preferred), or shared ms sql server. The app will need to run on it's own database, but pull from two others running on separate ms sql servers. Is it possible to mix and match db backends with cake? The other ms sql servers will be used strictly for pulling data and saving in main mysql db, but the mingling of data needs to be transparent. Any examples available of doing this sort of thing? Thanks much. Mike --~--~-~--~~~---~--~~ 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: EmailComponent: UTF-8 and text-only mail
Solved the Problem, added the patch to Ticket #2970: https://trac.cakephp.org/ticket/2970 Regards, Christoph On 13 Sep., 23:32, Preloader <[EMAIL PROTECTED]> wrote: > Hello Bakers, > > I try to send a text only mail via the EmailComponent in Cake 1.2: > > $this->Email->sendAs = 'text'; > $this->Email->charset = 'utf-8'; > > But the mail seems to be sent as ISO-8859-1, not UTF-8 > > If i send both, html AND text ... > > ... $this->Email->sendAs = 'both'; ... > > ... all works fine. > > When I look into the source of the EmailComponent the charset setting > seems to affect only the > > if($this->sendAs === 'both') > > section in the __renderTemplate function. > > So, is there anybody else having issues with that? Is this a bug, a > feature or simply uncompleted code? > > Regards, 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: Very cool dynamic Ajax timelines
That looks pretty cool. I would look forward to seeing that tutorial :-) On Sep 14, 6:36 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hi All, > > I've just implemented the SIMILE Timeline as found > herehttp://simile.mit.edu/timeline/ > It is licensed under the BSD license. > > Since it uses a very simple XML input file, you can simply create an > XML view, point the Javascript file to it and voila!! Very slick, > sliding active timeline. > > Very handy. > If I get a chance I might whip up a quick tutorial for the bakery. :-) --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
2 basic Problems - Validation and Date Fields
Hi there, i get rid of simple things... (Things which worked already)... I could bang my head to the wall !! My first cake app, and i'm very impressed by cakephp. Tow basic things won't work for me: I think i'm doing all right, but the automagic of validating fields and throwing an error won't work sometimes. My code goes here: http://bin.cakephp.org/view/1802002598 First Problem: No Valiadtion. At other models I'm doing exact the same. But at this point no automagic validation error messages are thrown out. i thought validation works at $this->save($this->data) ... Second Problem: The datetime field. I'm creating event_date_day, event_date_month and event_date_year with the form helper. I thought if i do $this->cleanUpFields() cakephp recognizes the event_date_* fields and put it together automagically. It's not working for me. I need to do it manually (now commented out). Where is my error in recognising? Thanks for any help! Regards, alexander --~--~-~--~~~---~--~~ 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: 500 Errors
Try remove the lines beginning with "php" in the .htaccess file.. For me, works fine after this alteration on a shared webserver... On 9/14/07, jsgriffin <[EMAIL PROTECTED]> wrote: > > > Hi > > I've got Cake running on a VD Server, with PHP5 running through > suexec. It's running quite a large web app which collates and delivers > content to users. The site works mostly fine, until we get to the more > intensive parts, feed processors, layout processors etc, which is > where the server starts to stall. It runs for a while, and then > produces a 500 error, in the error_log we get "Premature End Of Script > Headers", and nothing in the suexec or PHP logs. We've been playing > around with the php.ini and httpd.conf files trying to get this to > work, but to no avail. Our hosts, too, have given up on this issue. > Does anyone know of any Cake issues that could be causing this? Or > indeed, does anyone have any suggestions for our server config? > > Thanks > > James Griffin > > > > > -- Thiago Paes - WebDeveloper - Linux user: #224062 site: http://www.thiagopaes.com.br --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: unset unwanted fields
I may be misunderstanding your query, but can't you just remove the fields from edit.ctp ? Admin will still be able to change them in admin_edit.ctp On Sep 14, 4:42 pm, bujanga <[EMAIL PROTECTED]> wrote: > I think my question is just the result of a Friday brainlock but anyway. > > Is there a cake way to prevent unwanted fields being inserted into an > edit form post? > * Admin user is allowed to set $nologin to TRUE or FALSE > * but Manager user is only allowed to view it. > * Manager user is however allowed to change other items on the User model > * Admin submits via admin_edit.ctp > * while Manager submits through edit.ctp. > > Normally, I would discard all unwanted values. I can certainly do this > here but is there a cake specific way that I am missing? > > Gary Dalton --~--~-~--~~~---~--~~ 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: Case Insensitive Routes
> Here's the solution for anyone who stumples upon this and has the same > question: Good one-off solution... is there a way to make routing in general case-insensitive? Case-sensitive URLs just feel wrong to me (even though I know that officially, according to spec, they are case-sensitive). I'm mainly thinking about URLs that humans may type in. Troy. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
post back
Is there any native functionality for a controller to do something like a redirect but to do it as a form submission? In this situation, it would be submitting all of the fields that were submitted to it... back to a different controller and view. Is this something something that anyone has seen or developed on there own? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
500 Errors
Hi I've got Cake running on a VD Server, with PHP5 running through suexec. It's running quite a large web app which collates and delivers content to users. The site works mostly fine, until we get to the more intensive parts, feed processors, layout processors etc, which is where the server starts to stall. It runs for a while, and then produces a 500 error, in the error_log we get "Premature End Of Script Headers", and nothing in the suexec or PHP logs. We've been playing around with the php.ini and httpd.conf files trying to get this to work, but to no avail. Our hosts, too, have given up on this issue. Does anyone know of any Cake issues that could be causing this? Or indeed, does anyone have any suggestions for our server config? Thanks James Griffin --~--~-~--~~~---~--~~ 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: Models /HABTM references
Hi Dave, > Yup :) Each Tag is unique. Uploads are working great now. If each Tag is unique, then I think a HABTM association is incorrect, as a HABTM is for linking 2 different models that are not unique to each other. You should be using either Image hasOne or Image hasMany Tag Could you paste your models, controller, and SQL so we can investigate further. cheers, jon ps: let's keep onlist eh ;) -- jon bennett - http://www.jben.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 -~--~~~~--~~--~--~---
unset unwanted fields
I think my question is just the result of a Friday brainlock but anyway. Is there a cake way to prevent unwanted fields being inserted into an edit form post? * Admin user is allowed to set $nologin to TRUE or FALSE * but Manager user is only allowed to view it. * Manager user is however allowed to change other items on the User model * Admin submits via admin_edit.ctp * while Manager submits through edit.ctp. Normally, I would discard all unwanted values. I can certainly do this here but is there a cake specific way that I am missing? Gary Dalton --~--~-~--~~~---~--~~ 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 names
var $useTable = 'myNewTable'; in your model definition. Mike On Sep 13, 7:35 pm, thanuja <[EMAIL PROTECTED]> wrote: > Is it a requirement in cakePHP that table names to be plural? If not > how do I tell the model to look for a specific table? > > 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: Cake1.2
Go do the console directory and type cake bake On Sep 14, 4:33 pm, wickass <[EMAIL PROTECTED]> wrote: > How do you bake an app in cake 1.2 --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Very cool dynamic Ajax timelines
Hi All, I've just implemented the SIMILE Timeline as found here http://simile.mit.edu/timeline/ It is licensed under the BSD license. Since it uses a very simple XML input file, you can simply create an XML view, point the Javascript file to it and voila!! Very slick, sliding active timeline. Very handy. If I get a chance I might whip up a quick tutorial for the bakery. :-) --~--~-~--~~~---~--~~ 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: Session - losing value after redirect
...even with security set as LOW. please notice, session array key (not all session array) is lost and only when session is in database. On Sep 14, 9:28 am, AD7six <[EMAIL PROTECTED]> wrote: > On Sep 14, 6:23 am, Grant Cox <[EMAIL PROTECTED]> wrote: > > > > > The issue with lost sessions often comes down to the SessionComponent > > being quite strict, and destroying the session if the user agent > > changes. Of course, the user agent shouldn't really change, but with > > Ajax calls and whatnot it can happen. > > > To test, comment out the lines > > > if (function_exists('ini_set')) { > > ini_set('session.referer_check', > > $this->host); > > } > > > and > > > if ($this->_userAgent == > > $this->read("Config.userAgent") && $this- > > > >time <= $this->read("Config.time")) { > > > from your /cake/libs/session.php . Unfortunately I don't know of a > > way to change this without hacking the core (or making a whole new > > Session component). > > I don't know if the above applies to the OPs problem but that check is > only in place with security set to high in core.php, so one way to > avoid it is to set security to medium. > > hth, > > AD --~--~-~--~~~---~--~~ 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: Cake1.2
check under the header titled console: http://ahsanity.wordpress.com/2007/08/29/cakephp-12-the-romance- continues/ On 14-sep-2007, at 8:33, wickass wrote: > > How do you bake an app in cake 1.2 > > > > -- Tijs Teulings tel: +31645004824 http://blog.tijs.org more: http://www.automatique.nl http://roomwareproject.org http://geekdinner.nl --~--~-~--~~~---~--~~ 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: The forbidden hack? | An attempt to redesign Cake View handling
thanks majna! I sure didn't know you actually can use the same method names in extended classes and that then parent classes use them! I now have renamed back my controller::MYrender() into controller::render() and now cake uses my render method instead the default one. By the way, what exactly do the var $autoRender = true; var $autoLayout = false; both in controller and view classes do? I see them set all the time in controller and set also in view, but I don't see them checked anywhere... Controller says about autoRender: * Automatically render the view (the dispatcher checks for this variable before running render()) But I don't see anything happening really if I turn this off. (that is, anything happening WITHOUT my hack) As this two vars could make the code even more beautiful I would appreciate any Ideas... D On 9/13/07, majna <[EMAIL PROTECTED]> wrote: > > > View this > snippethttp://cakeforge.org/snippet/detail.php?type=packagever&id=44 > There is custom view class cjsView.php. > > On Sep 13, 7:23 pm, DanielSun <[EMAIL PROTECTED]> wrote: > > I am extreemly sorry for this mess. I must say I posted all the > > messages ONCE. even google isn't what it used to be :) > > > > I know that hacking core is not the thing to do. That is why i am > > trying hard to think of the way arround. > > Thanks Cris. But only passing variables TO the view doesn't help much > > here... > > > > I think I have thought out something interesting. Here it goes: > > > > - Copy paste entire controller::render() method into app_controller, > > renamed it (e.g. MYrender()) > >- renamed the instance of viewClass object and renamed the last > > call to the view::render() method (now renderNOT) > > - copy paste entire view::render() function into myCustomView.php and > > renamed it (to e.g. renderNOT) > > - called myCustomView on the beginning of app_controller var > > $view=myCustom; > > - put $this->MYrender($this->action); into afterFilter in > > app_controller > > > > NOW I get all I wanted. I haven't messed with cake core code AND all > > the code (except for app_controller) is now "no-hack" competible. > > > > And the sweetness of the controller controlled layout objects? > > > > any_controller { > > > > function home(){ > > > > $this->leftBlock= render('leftBlockView'); > > $this->rightBlock=render('rightBlockView'); > > > > $this->MainMenu=renderElement('MainMenu'); > > > > $this->PageTitle=$this->action; > > > > } > > } > > > > default.thtml (layout) > > > > *** > > controller->'MainMenu';?> > > > > controller->leftBlock;?> > > > > > > controller->rightBlock;?> > > > > > > ** > > > > Isn't that beautifull?? > > > > I only hope everything else will work. Have to do some testing, will > > comeback. > > > > d > > > > [I hope this is not gonna post 100times again] > > > > On 13 sep., 15:30, "Chris Hartjes" <[EMAIL PROTECTED]> wrote: > > > > > On 9/13/07, DanielSun <[EMAIL PROTECTED]> wrote: > > > > > > Meaning I cannot at all make my own view class and I should instead > > > > use the allready instantiated view object __viewClass? Or should I > > > > make a new instance of view just for the purpose of rendering > layout. > > > > > You can create your own view class if required. Nate is talking about > > > how to use your custom class. Here's a code snippet that might help: > > > > > * in the controller* > > > > > function foo() { > > > $this->view = 'bar'; > > > $this->set('baz', $this->Baz->findAll()); > > > > > } > > > > > This will tell Cake that for this action in the controller, you want > > > to use your 'bar' class for the view, which you should put in a file > > > named 'bar.php' that you place in your views directory. Then you can > > > pass stuff to it just like it was any other view and Cake will then > > > execute your custom view for you. We have used custom views to spit > > > out images for an internal project at CDC so that you can do things > > > like and have it display the image > > > you want. > > > > > > And therefore I cannot bypass hacking of the core? > > > > > Hacking the core is *always* a last resort because 99% of the time it > > > is done by people who do not understand how CakePHP works internally, > > > and 1% of the time it's to handle a legitmate problem with the code. > > > Spend some time learning how to create a custom view (I'm not aware of > > > any links off the top of my head) and I'm pretty sure that will handle > > > everything you need. > > > > > Hope that helps. > > > > > -- > > > Chris Hartjes > > > Senior Developer > > > Cake Development Corporation > > > > > My motto for 2007: "Just build it, damnit!" > > > > > @TheBallpark -http://www.littlehart.net/attheballpark > > > @TheKeyboard -http://www.littlehart.net/atthekeyboard > > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this
Re: Undefined index after query
try to check out the result by this $result = $this->Post->query($sql); print_r($result ); --~--~-~--~~~---~--~~ 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: Undefined index after query
I've tried setting debug level to 3 to dump the controller object as well, and the query seems to be pulling the data out please see ... http://test.courva.co.uk/posts/ --~--~-~--~~~---~--~~ 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: Undefined index after query
Thanks for the quick reply guys. Geoff, in the first instance yes that should work but I'd like to make a more complicated sql query at a later stage so I'd like to work out what was wrong with my syntax here. Samuel, I've set debug to 2 and I get Nr Query Error AffectedNum. rows Took (ms) 1 DESCRIBE `posts` 18 18 2 2 SELECT * FROM posts WHERE title LIKE '%genealogy%' LIMIT 0, 30;1111 4 Thanks again for any help you can give Chris --~--~-~--~~~---~--~~ 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: flash() produces wrong URL
try this one $this->flash("--String message to dispay--","/---Name of controller-/---Name of action---/- perameters---") $this->flash("text,"/article/4545/"); --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Cake1.2
How do you bake an app in cake 1.2 --~--~-~--~~~---~--~~ 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: aro errors in IBM tutorial part 2
Use 0 instead of null for the parent_id. worked for me. eg. php acl.php create aro 0 0 Users php acl.php create aro 0 0 Dealers HTH. On Aug 30, 1:40 pm, "SIXS" <[EMAIL PROTECTED]> wrote: > Hello, > I am running the Cake IBM part 2 and creating the aro files. > I got an error-- running acl and aro > - > failed to startup concurrent users module > -- > and then when trying to create a user in register and click the Register > button I get this eror. > > Warning: Null parent in Aro::create() in > C:\VertrigoServ\www\kake\cake\libs\controller\components\dbacl\models\aclnode.php > on line 82 > > Warning: Cannot modify header information - headers already sent by (output > started at > C:\VertrigoServ\www\kake\cake\libs\controller\components\dbacl\models\aclnode.php:82) > in C:\VertrigoServ\www\kake\cake\libs\controller\controller.php on line 447 > > What is happening? or not ?? > Thanks for any help > > JIM --~--~-~--~~~---~--~~ 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: Case Insensitive Routes
Here's the solution for anyone who stumples upon this and has the same question: Router::connect('/(?i:about)', array('controller' => 'pages', 'action' =>'display', 'about')); -Matt www.pseudocoder.com On Sep 5, 10:00 am, MattC <[EMAIL PROTECTED]> wrote: > Hey all, > I'm tryting to set a couple routes to static pages such as /about. So > far I have: > Router::connect('/about', array('controller' => 'pages', 'action' => > 'display', 'about')); > > This works fine for /about, but I would also like to map /About. Is > there a way I can make the routecaseinsensitve, rather than having > to define a new one? I know you can do regular expressions, but I > don't think the /i syntax works in this scenerio. I'm using cake 1.2 > if it makes a difference. > > Thanks, > Mattwww.pseudocoder.com --~--~-~--~~~---~--~~ 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: flash() produces wrong URL
write $this->flash("text","/article/4545/"); instead od $this->flash("text,"/article/4545/"); On 9/14/07, Sergei <[EMAIL PROTECTED]> wrote: > > > Hello, > > I've encountered situation where > > $this->flash("text,"/article/4545/"); > > produces wrong url on the production web server (not on my local > webserver!): > > \/article\/4545\/ > > You see, it inserts \ before /. > > Anyone knows a solution? > > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
flash() produces wrong URL
Hello, I've encountered situation where $this->flash("text,"/article/4545/"); produces wrong url on the production web server (not on my local webserver!): \/article\/4545\/ You see, it inserts \ before /. Anyone knows a solution? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Session - losing value after redirect
On Sep 14, 6:23 am, Grant Cox <[EMAIL PROTECTED]> wrote: > The issue with lost sessions often comes down to the SessionComponent > being quite strict, and destroying the session if the user agent > changes. Of course, the user agent shouldn't really change, but with > Ajax calls and whatnot it can happen. > > To test, comment out the lines > > if (function_exists('ini_set')) { > ini_set('session.referer_check', > $this->host); > } > > and > > if ($this->_userAgent == > $this->read("Config.userAgent") && $this- > > >time <= $this->read("Config.time")) { > > from your /cake/libs/session.php . Unfortunately I don't know of a > way to change this without hacking the core (or making a whole new > Session component). I don't know if the above applies to the OPs problem but that check is only in place with security set to high in core.php, so one way to avoid it is to set security to medium. hth, AD --~--~-~--~~~---~--~~ 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: Session - losing value after redirect
On 9/14/07, Grant Cox <[EMAIL PROTECTED]> wrote: > > Good point. Is the issue that browsers will see the Location header, > and ignore the Set-Cookie header, or is it that PHP does not even Well I really never bothered to investigate but if you look at the search results - this issue is not even PHP specific. ASP and Java guys also complain of this May be some investigation using HttpLiveHeaders in firefox will help. T -- = Cheesecake-Photoblog: http://cheesecake-photoblog.org PHP for E-Biz: http://sanisoft.com = --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---