Re: How to manage URLs that doesn't require access to Database
Woodsman, I'm not sure when it was added but the first time I used it was in 1.1.13. So I know it was prior to 1.2. It's a pretty sweet 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: How to manage URLs that doesn't require access to Database
If you preface any function in your controller with cpanel_ then it will have the path you are desire. For example, in your users_controller file you will have a function called cpanel_add(). Then that will be avaliable at www.mysite.com/cpanel/users/add like you want. If you want the URL www.mysite.com/cpanel/users/ to be a list page, simply make your index function in users_controller cpanel_index(). Hope that helps. --~--~-~--~~~---~--~~ 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: Yet another 'hasMany/belongTo' question...
Humm, let me give it a shot. If I understand you correctly you want to see the users that belong to a specific network when you are viewing the network information generated from the scaffold? From what I know (and I'm still cutting my teeth on cake so I may be wrong) the scaffold won't show all the related records for the $hasMany side, but it will show you (and give you select menus in create/update pages) the related Network when you view a user (the $belongsTo side). Once you move past scaffolding, you can easily add the functionality to view all Users associated with a network. You just need to set: $this->Network->recursive = 1; In your Network controller, and then you can call the user data in your view by doing something similar to: $user): ?> I hope that helps. > My question is: if I have the DB tables populated (there is a user > which belongs to network 0), shouldn't I get > to see that user listed on the screen when I view network 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: Help with a $hasMany, $belongsTo association...
Wow. I knew it had to be something easy that I was completely overlooking. Thank you so much Eric. I read the manual chapter on models multiple times, but I guess that part just didn't sink in (maybe next time I should read more carefully). Anyway, Thanks. This is my first shot at Cake and I love it so far, but that really had me confounded. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Help with a $hasMany, $belongsTo association...
Okay, I think this should work, but it doesn't. I've read through the documentation and it all appears that I am doing the correct thing, but it just isn't working for me. I'm really hoping that someone can point out the "obvious" error that I'm completely missing here. :) I'm trying to pull back a list of all my blogs along with all of the associated comments for each blog. This is what I currently have: table definitions: (I left out the data, but it is in there, trust me...) --- CREATE TABLE `blogs` ( `id` int(11) NOT NULL auto_increment, `title` varchar(50) default NULL, `text` text, `post_date` datetime default NULL, `active` int(1) default NULL, `sort` int(11) default NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=19 ; -- -- Table structure for table `comments` -- CREATE TABLE `comments` ( `id` int(11) NOT NULL auto_increment, `title` varchar(75) NOT NULL default '', `text` text NOT NULL, `date` date NOT NULL default '-00-00', `author` varchar(100) NOT NULL default '', `blog_id` int(11) NOT NULL default '0', CONSTRAINT fk_comments_blog foreign key (blog_id) references blogs(id), PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; --- comment.php --- class Comment extends AppModel { var $name = 'Comment'; //The Associations below have been created with all possible keys, those that are not needed can be removed var $belongsTo = array( 'Blog' => array('className' => 'Blog') ); } --- blog.php --- class Blog extends AppModel { var $name = 'Blog'; var $hasMany = array('Comment' => array('className'=>'Comment') ); var $validate = array( 'title' => VALID_NOT_EMPTY, 'text' => VALID_NOT_EMPTY, 'sort' => VALID_NUMBER, ); } --- >From blogs_controller.php --- function cp_index() { $this->Blog->recursive = 0; $this->set('blogs', $this->Blog->findAll()); $this->set('page_header', "Shoe Sole - List Blogs"); $this->layout = 'list'; } --- Now I would expect the $this->Blog->findAll() call to pull back an array of blogs that has an array of comments within each respective blog. However, this isn't the case. Instead it only pulls back blogs. And don't worry, I do actually have comments that are related to these blogs, In fact, the $belongTo portion of the comments section works perfectly and associates one blog to each comment exactly as I would expect. So any help/guideance would be GREATLY appreciated. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---