Re: CakePHP Setup, Need Help Please
Ok, disregard my last message. All set! On Jan 19, 10:45 pm, longint [EMAIL PROTECTED] wrote: Hi Folks, Brand spankin' new to PHP CakePHP. Coming over from ASP.NET to explore. I'm following the Blog tutorial from the Cake site and here's what happens: 1.) Move it to the webroot. 2.) Checkout localhost and I can see the initial page (with CSS!) 3.) Change my db configuration to connect correctly. 4.) Refresh localhost and the initial page no longer has CSS applied!! This sounds like a mod_rewrite issue (I guess?). I went through the steps of enabling it (or so I think). But the tutorials I've read say that if you see CSS it means it's enabled. So I have no clue why connecting to the db would disable this. Help? --~--~-~--~~~---~--~~ 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 please for ultra-beginner
No good im afraid, same error, except ugroup_id is now ugroupid Notice: Undefined property: UsersController::$Ugroup in C:\server\www \cake\basic_site\plugins\users\controllers\users_controller.php on line 34 Fatal error: Call to a member function findByUgroupid() on a non- object in C:\server\www\cake\basic_site\plugins\users\controllers \users_controller.php on line 34 On Dec 12, 7:31 pm, chad [EMAIL PROTECTED] wrote: try findByUgroupId On Dec 11, 10:08 pm, Sanfly [EMAIL PROTECTED] wrote: Hi Ive only just started mucking around with CakePHP, and am having a little trouble getting my head around the controllers and models thingees. YES - I have tried looking in the manual!! Im trying to make a cake website that will more or less mirror some normal-non-framework php sites I have done. There is a table called users where all normal user data is stored (see below for table structure). The ugroup table contains a ugroup_name and a number of permissions that dictate what the user will be able to access on the site. The ugroup_id field in users indicates which ugroup the user belongs to. When the person logs in, I first want it to check that the user_name and user_pass are valid, then access the ugroups table to set the ugroup data (permissions) as sessions, which can then be called when I like throughout the rest of the site. users_controller.php - ?php class UsersController extends AppController { function login() { $this-set('error', false); if (!empty($this-data)) { $someone = $this-User-findByUser_name($this-data['User'] ['user_name']); if(!empty($someone['User']['user_pass']) $someone['User']['user_pass'] == md5($this-data['User'] ['user_pass'])) { $this-Session-write('User', $someone['User']); // Here is the code that is giving me problems $perms = $this-Ugroup-findByUgroup_id($someone['User'] ['user_group']); if($perms['Ugroup']['perm_admin'] == 1){ $this-redirect('/pages/admin/'); } else{ $this-redirect('/'); } // End Problem code } else { $this-set('error', true); } } } function logout() { $this-Session-delete('User'); $this-redirect('/'); }} ? -- However, this code gives me an error: -- Notice: Undefined property: UsersController::$Ugroup in C:\server\www \cake\basic_site\plugins\users\controllers\users_controller.php on line 34 Fatal error: Call to a member function findByUgroup_id() on a non- object in C:\server\www\cake\basic_site\plugins\users\controllers \users_controller.php on line 34 -- Can anyone point me in the right direction to solve this? Sorry, but my cake knowledge is very limited and Im having trouble finding cake for dummies tutorials :s Thanks for any help :) -- My tables: CREATE TABLE `users` ( `user_id` int(25) NOT NULL auto_increment, `user_name` varchar(70) NOT NULL default '', `user_pass` varchar(70) NOT NULL default '', `ugroup_id` int(25) NOT NULL, `user_email` varchar(50) NOT NULL default '', `user_active` enum('0','1') NOT NULL default '0', `user_logged` datetime NOT NULL default '-00-00 00:00:00', `user_display` varchar(30) NOT NULL default '', `user_joined` datetime NOT NULL default '-00-00 00:00:00', `user_access` enum('0','1') NOT NULL default '0', `user_bio` text NOT NULL, `user_web` varchar(200) NOT NULL, PRIMARY KEY (`user_id`), KEY `ugroup_id` (`ugroup_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ; ALTER TABLE `users` ADD CONSTRAINT `users_ibfk_1` FOREIGN KEY (`ugroup_id`) REFERENCES `ugroups` (`ugroup_id`); CREATE TABLE `ugroups` ( `ugroup_id` int(25) NOT NULL auto_increment, `ugroup_name` varchar(70) NOT NULL default '', `ugroup_rank` int(10) NOT NULL, `perm_admin` enum('0','1') NOT NULL default '0', `perm_configweb` enum('0','1') NOT NULL default '0', `perm_setperm` enum('0','1') NOT NULL default '0', `perm_adduser` enum('0','1') NOT NULL default '0', `perm_edituser` enum('0','1') NOT
Re: Help please for ultra-beginner
The error message you're getting tells you what the problem is... on line 34, you're referring to $this-Ugroup-findByUgroupid(). This would be fine, except that you haven't told cake to give you access to Ugroup in this way. I'm assuming you have a model for Ugroup, and that it's associated with User in the correct way (which would appear to be User belongsTo Ugroup, Ugroup hasMany User). This would allow you to use... $this-User-Ugroup-findByUgroupid() to achieve what you want. Except by the magic of associations, you don't need to make the second query, as Cake's magic will bring in the information you're looking for with the first query, using a join. This should give you an array in your $someone, something like this: $someone = array( 'User' = array( ... user details ...), 'Ugroup' = array( ... usergroup details ...) ); So you'll be able to refer to the Ugroup like this - $someone['Ugroup'] ['perm_admin']. Hope that helps! On Dec 12, 7:37 am, Sanfly [EMAIL PROTECTED] wrote: No good im afraid, same error, except ugroup_id is now ugroupid Notice: Undefined property: UsersController::$Ugroup in C:\server\www \cake\basic_site\plugins\users\controllers\users_controller.php on line 34 Fatal error: Call to a member function findByUgroupid() on a non- object in C:\server\www\cake\basic_site\plugins\users\controllers \users_controller.php on line 34 On Dec 12, 7:31 pm, chad [EMAIL PROTECTED] wrote: try findByUgroupId On Dec 11, 10:08 pm, Sanfly [EMAIL PROTECTED] wrote: Hi Ive only just started mucking around with CakePHP, and am having a little trouble getting my head around the controllers and models thingees. YES - I have tried looking in the manual!! Im trying to make a cake website that will more or less mirror some normal-non-framework php sites I have done. There is a table called users where all normal user data is stored (see below for table structure). The ugroup table contains a ugroup_name and a number of permissions that dictate what the user will be able to access on the site. The ugroup_id field in users indicates which ugroup the user belongs to. When the person logs in, I first want it to check that the user_name and user_pass are valid, then access the ugroups table to set the ugroup data (permissions) as sessions, which can then be called when I like throughout the rest of the site. users_controller.php - ?php class UsersController extends AppController { function login() { $this-set('error', false); if (!empty($this-data)) { $someone = $this-User-findByUser_name($this-data['User'] ['user_name']); if(!empty($someone['User']['user_pass']) $someone['User']['user_pass'] == md5($this-data['User'] ['user_pass'])) { $this-Session-write('User', $someone['User']); // Here is the code that is giving me problems $perms = $this-Ugroup-findByUgroup_id($someone['User'] ['user_group']); if($perms['Ugroup']['perm_admin'] == 1){ $this-redirect('/pages/admin/'); } else{ $this-redirect('/'); } // End Problem code } else { $this-set('error', true); } } } function logout() { $this-Session-delete('User'); $this-redirect('/'); }} ? -- However, this code gives me an error: -- Notice: Undefined property: UsersController::$Ugroup in C:\server\www \cake\basic_site\plugins\users\controllers\users_controller.php on line 34 Fatal error: Call to a member function findByUgroup_id() on a non- object in C:\server\www\cake\basic_site\plugins\users\controllers \users_controller.php on line 34 -- Can anyone point me in the right direction to solve this? Sorry, but my cake knowledge is very limited and Im having trouble finding cake for dummies tutorials :s Thanks for any help :) -- My tables: CREATE TABLE `users` ( `user_id` int(25) NOT NULL auto_increment, `user_name` varchar(70) NOT NULL default '', `user_pass` varchar(70) NOT NULL default '', `ugroup_id`
Re: Help please for ultra-beginner
Hello, My cake knowledge is limited too (2 months), but I think you must specify your 2 models in your controller. Something like that in PHP5 context: ? class UsersController extends AppController { public $uses = array('User','Ugroup'); } ? And maybe you should specify the association in your 2 models... Something like that: ? class User extends AppModel { public $belongsTo = array('Ugroup'); } ? and for the associated model: ? class Ugroup extends AppModel { public $hasMany = array('User'); } ? And finally, you must indicate to your models, the primary key you are using, because by default Cake search for an id key to make associations. ? class Ugroup extends AppModel { public $primaryKey = 'ugroup_id'; } ? I hope this helps you... BR Avairet On 12 déc, 08:37, Sanfly [EMAIL PROTECTED] wrote: No good im afraid, same error, except ugroup_id is now ugroupid Notice: Undefined property: UsersController::$Ugroup in C:\server\www \cake\basic_site\plugins\users\controllers\users_controller.php on line 34 Fatal error: Call to a member function findByUgroupid() on a non- object in C:\server\www\cake\basic_site\plugins\users\controllers \users_controller.php on line 34 On Dec 12, 7:31 pm, chad [EMAIL PROTECTED] wrote: try findByUgroupId On Dec 11, 10:08 pm, Sanfly [EMAIL PROTECTED] wrote: Hi Ive only just started mucking around with CakePHP, and am having a little trouble getting my head around the controllers and models thingees. YES - I have tried looking in the manual!! Im trying to make a cake website that will more or less mirror some normal-non-framework php sites I have done. There is a table called users where all normal user data is stored (see below for table structure). The ugroup table contains a ugroup_name and a number of permissions that dictate what the user will be able to access on the site. The ugroup_id field in users indicates which ugroup the user belongs to. When the person logs in, I first want it to check that the user_name and user_pass are valid, then access the ugroups table to set the ugroup data (permissions) as sessions, which can then be called when I like throughout the rest of the site. users_controller.php - ?php class UsersController extends AppController { function login() { $this-set('error', false); if (!empty($this-data)) { $someone = $this-User-findByUser_name($this-data['User'] ['user_name']); if(!empty($someone['User']['user_pass']) $someone['User']['user_pass'] == md5($this-data['User'] ['user_pass'])) { $this-Session-write('User', $someone['User']); // Here is the code that is giving me problems $perms = $this-Ugroup-findByUgroup_id($someone['User'] ['user_group']); if($perms['Ugroup']['perm_admin'] == 1){ $this-redirect('/pages/admin/'); } else{ $this-redirect('/'); } // End Problem code } else { $this-set('error', true); } } } function logout() { $this-Session-delete('User'); $this-redirect('/'); }} ? -- However, this code gives me an error: -- Notice: Undefined property: UsersController::$Ugroup in C:\server\www \cake\basic_site\plugins\users\controllers\users_controller.php on line 34 Fatal error: Call to a member function findByUgroup_id() on a non- object in C:\server\www\cake\basic_site\plugins\users\controllers \users_controller.php on line 34 -- Can anyone point me in the right direction to solve this? Sorry, but my cake knowledge is very limited and Im having trouble finding cake for dummies tutorials :s Thanks for any help :) -- My tables: CREATE TABLE `users` ( `user_id` int(25) NOT NULL auto_increment, `user_name` varchar(70) NOT NULL default '', `user_pass` varchar(70) NOT NULL default '', `ugroup_id` int(25) NOT NULL, `user_email` varchar(50) NOT NULL default '', `user_active` enum('0','1') NOT NULL default '0', `user_logged` datetime NOT NULL default
Re: Help please for ultra-beginner
Ok, that works! Very nice! But in this case, some of my find() or save() calls become more complex: $this-Model1-Model2-Model3-save(); And the resultsets of my find are now in the DESC order... Avairet On 12 déc, 15:54, avairet [EMAIL PROTECTED] wrote: Hi Mr Tufty, I didn't know that... It's very interesting. I will try it immediately because I've a doubt... that the associated models is known in my controller. I will reply after my test! Avairet On 12 déc, 13:56, MrTufty [EMAIL PROTECTED] wrote: Yes, you can do it that way too. But if you set up the associations, you don't NEED to change $uses to include Ugroup, as it will automatically be included based on it's association with the User model. On Dec 12, 9:22 am, avairet [EMAIL PROTECTED] wrote: Hello, My cake knowledge is limited too (2 months), but I think you must specify your 2 models in your controller. Something like that in PHP5 context: ? class UsersController extends AppController { public $uses = array('User','Ugroup');} ? And maybe you should specify the association in your 2 models... Something like that: ? class User extends AppModel { public $belongsTo = array('Ugroup');} ? and for the associated model: ? class Ugroup extends AppModel { public $hasMany = array('User');} ? And finally, you must indicate to your models, the primary key you are using, because by default Cake search for an id key to make associations. ? class Ugroup extends AppModel { public $primaryKey = 'ugroup_id';} ? I hope this helps you... BR Avairet On 12 déc, 08:37, Sanfly [EMAIL PROTECTED] wrote: No good im afraid, same error, except ugroup_id is now ugroupid Notice: Undefined property: UsersController::$Ugroup in C:\server\www \cake\basic_site\plugins\users\controllers\users_controller.php on line 34 Fatal error: Call to a member function findByUgroupid() on a non- object in C:\server\www\cake\basic_site\plugins\users\controllers \users_controller.php on line 34 On Dec 12, 7:31 pm, chad [EMAIL PROTECTED] wrote: try findByUgroupId On Dec 11, 10:08 pm, Sanfly [EMAIL PROTECTED] wrote: Hi Ive only just started mucking around with CakePHP, and am having a little trouble getting my head around the controllers and models thingees. YES - I have tried looking in the manual!! Im trying to make a cake website that will more or less mirror some normal-non-framework php sites I have done. There is a table called users where all normal user data is stored (see below for table structure). The ugroup table contains a ugroup_name and a number of permissions that dictate what the user will be able to access on the site. The ugroup_id field in users indicates which ugroup the user belongs to. When the person logs in, I first want it to check that the user_name and user_pass are valid, then access the ugroups table to set the ugroup data (permissions) as sessions, which can then be called when I like throughout the rest of the site. users_controller.php - ?php class UsersController extends AppController { function login() { $this-set('error', false); if (!empty($this-data)) { $someone = $this-User-findByUser_name($this-data['User'] ['user_name']); if(!empty($someone['User']['user_pass']) $someone['User']['user_pass'] == md5($this-data['User'] ['user_pass'])) { $this-Session-write('User', $someone['User']); // Here is the code that is giving me problems $perms = $this-Ugroup-findByUgroup_id($someone['User'] ['user_group']); if($perms['Ugroup']['perm_admin'] == 1){ $this-redirect('/pages/admin/'); } else{ $this-redirect('/'); } // End Problem code } else { $this-set('error', true); } } } function logout() { $this-Session-delete('User'); $this-redirect('/'); }} ? --
Re: Help please for ultra-beginner
I add another comment: if you are using Eclipse and PDT Eclipse, the autocompletion for model's methods in controller doesn't work again. On 12 déc, 16:07, avairet [EMAIL PROTECTED] wrote: Ok, that works! Very nice! But in this case, some of my find() or save() calls become more complex: $this-Model1-Model2-Model3-save(); And the resultsets of my find are now in the DESC order... Avairet On 12 déc, 15:54, avairet [EMAIL PROTECTED] wrote: Hi Mr Tufty, I didn't know that... It's very interesting. I will try it immediately because I've a doubt... that the associated models is known in my controller. I will reply after my test! Avairet On 12 déc, 13:56, MrTufty [EMAIL PROTECTED] wrote: Yes, you can do it that way too. But if you set up the associations, you don't NEED to change $uses to include Ugroup, as it will automatically be included based on it's association with the User model. On Dec 12, 9:22 am, avairet [EMAIL PROTECTED] wrote: Hello, My cake knowledge is limited too (2 months), but I think you must specify your 2 models in your controller. Something like that in PHP5 context: ? class UsersController extends AppController { public $uses = array('User','Ugroup');} ? And maybe you should specify the association in your 2 models... Something like that: ? class User extends AppModel { public $belongsTo = array('Ugroup');} ? and for the associated model: ? class Ugroup extends AppModel { public $hasMany = array('User');} ? And finally, you must indicate to your models, the primary key you are using, because by default Cake search for an id key to make associations. ? class Ugroup extends AppModel { public $primaryKey = 'ugroup_id';} ? I hope this helps you... BR Avairet On 12 déc, 08:37, Sanfly [EMAIL PROTECTED] wrote: No good im afraid, same error, except ugroup_id is now ugroupid Notice: Undefined property: UsersController::$Ugroup in C:\server\www \cake\basic_site\plugins\users\controllers\users_controller.php on line 34 Fatal error: Call to a member function findByUgroupid() on a non- object in C:\server\www\cake\basic_site\plugins\users\controllers \users_controller.php on line 34 On Dec 12, 7:31 pm, chad [EMAIL PROTECTED] wrote: try findByUgroupId On Dec 11, 10:08 pm, Sanfly [EMAIL PROTECTED] wrote: Hi Ive only just started mucking around with CakePHP, and am having a little trouble getting my head around the controllers and models thingees. YES - I have tried looking in the manual!! Im trying to make a cake website that will more or less mirror some normal-non-framework php sites I have done. There is a table called users where all normal user data is stored (see below for table structure). The ugroup table contains a ugroup_name and a number of permissions that dictate what the user will be able to access on the site. The ugroup_id field in users indicates which ugroup the user belongs to. When the person logs in, I first want it to check that the user_name and user_pass are valid, then access the ugroups table to set the ugroup data (permissions) as sessions, which can then be called when I like throughout the rest of the site. users_controller.php - ?php class UsersController extends AppController { function login() { $this-set('error', false); if (!empty($this-data)) { $someone = $this-User-findByUser_name($this-data['User'] ['user_name']); if(!empty($someone['User']['user_pass']) $someone['User']['user_pass'] == md5($this-data['User'] ['user_pass'])) { $this-Session-write('User', $someone['User']); // Here is the code that is giving me problems $perms = $this-Ugroup-findByUgroup_id($someone['User'] ['user_group']); if($perms['Ugroup']['perm_admin'] == 1){ $this-redirect('/pages/admin/'); } else{ $this-redirect('/'); } // End Problem code } else
Re: Help please for ultra-beginner
Hi I had tried something similar to this before, using hasOne (ugroup) in the users model, and belongsTo (users) in the ugroup model. The code I had tried, and the one you suggested, both came up with a SQL error. Ive ended up solving this using Tuftys code, with the addition of this from Avairet ? class Ugroup extends AppModel { public $primaryKey = 'ugroup_id'; } ? Thanks both for your help :) On Dec 12, 10:16 pm, MrTufty [EMAIL PROTECTED] wrote: The error message you're getting tells you what the problem is... on line 34, you're referring to $this-Ugroup-findByUgroupid(). This would be fine, except that you haven't told cake to give you access to Ugroup in this way. I'm assuming you have a model for Ugroup, and that it's associated with User in the correct way (which would appear to be User belongsTo Ugroup, Ugroup hasMany User). This would allow you to use... $this-User-Ugroup-findByUgroupid() to achieve what you want. Except by the magic of associations, you don't need to make the second query, as Cake's magic will bring in the information you're looking for with the first query, using a join. This should give you an array in your $someone, something like this: $someone = array( 'User' = array( ... user details ...), 'Ugroup' = array( ... usergroup details ...) ); So you'll be able to refer to the Ugroup like this - $someone['Ugroup'] ['perm_admin']. Hope that helps! On Dec 12, 7:37 am, Sanfly [EMAIL PROTECTED] wrote: No good im afraid, same error, except ugroup_id is now ugroupid Notice: Undefined property: UsersController::$Ugroup in C:\server\www \cake\basic_site\plugins\users\controllers\users_controller.php on line 34 Fatal error: Call to a member function findByUgroupid() on a non- object in C:\server\www\cake\basic_site\plugins\users\controllers \users_controller.php on line 34 On Dec 12, 7:31 pm, chad [EMAIL PROTECTED] wrote: try findByUgroupId On Dec 11, 10:08 pm, Sanfly [EMAIL PROTECTED] wrote: Hi Ive only just started mucking around with CakePHP, and am having a little trouble getting my head around the controllers and models thingees. YES - I have tried looking in the manual!! Im trying to make a cake website that will more or less mirror some normal-non-framework php sites I have done. There is a table called users where all normal user data is stored (see below for table structure). The ugroup table contains a ugroup_name and a number of permissions that dictate what the user will be able to access on the site. The ugroup_id field in users indicates which ugroup the user belongs to. When the person logs in, I first want it to check that the user_name and user_pass are valid, then access the ugroups table to set the ugroup data (permissions) as sessions, which can then be called when I like throughout the rest of the site. users_controller.php - ?php class UsersController extends AppController { function login() { $this-set('error', false); if (!empty($this-data)) { $someone = $this-User-findByUser_name($this-data['User'] ['user_name']); if(!empty($someone['User']['user_pass']) $someone['User']['user_pass'] == md5($this-data['User'] ['user_pass'])) { $this-Session-write('User', $someone['User']); // Here is the code that is giving me problems $perms = $this-Ugroup-findByUgroup_id($someone['User'] ['user_group']); if($perms['Ugroup']['perm_admin'] == 1){ $this-redirect('/pages/admin/'); } else{ $this-redirect('/'); } // End Problem code } else { $this-set('error', true); } } } function logout() { $this-Session-delete('User'); $this-redirect('/'); }} ? -- However, this code gives me an error: -- Notice: Undefined property: UsersController::$Ugroup in C:\server\www \cake\basic_site\plugins\users\controllers\users_controller.php on line 34 Fatal error: Call to a member function findByUgroup_id() on a non- object in
Help please for ultra-beginner
Hi Ive only just started mucking around with CakePHP, and am having a little trouble getting my head around the controllers and models thingees. YES - I have tried looking in the manual!! Im trying to make a cake website that will more or less mirror some normal-non-framework php sites I have done. There is a table called users where all normal user data is stored (see below for table structure). The ugroup table contains a ugroup_name and a number of permissions that dictate what the user will be able to access on the site. The ugroup_id field in users indicates which ugroup the user belongs to. When the person logs in, I first want it to check that the user_name and user_pass are valid, then access the ugroups table to set the ugroup data (permissions) as sessions, which can then be called when I like throughout the rest of the site. users_controller.php - ?php class UsersController extends AppController { function login() { $this-set('error', false); if (!empty($this-data)) { $someone = $this-User-findByUser_name($this-data['User'] ['user_name']); if(!empty($someone['User']['user_pass']) $someone['User']['user_pass'] == md5($this-data['User'] ['user_pass'])) { $this-Session-write('User', $someone['User']); // Here is the code that is giving me problems $perms = $this-Ugroup-findByUgroup_id($someone['User'] ['user_group']); if($perms['Ugroup']['perm_admin'] == 1){ $this-redirect('/pages/admin/'); } else{ $this-redirect('/'); } // End Problem code } else { $this-set('error', true); } } } function logout() { $this-Session-delete('User'); $this-redirect('/'); } } ? -- However, this code gives me an error: -- Notice: Undefined property: UsersController::$Ugroup in C:\server\www \cake\basic_site\plugins\users\controllers\users_controller.php on line 34 Fatal error: Call to a member function findByUgroup_id() on a non- object in C:\server\www\cake\basic_site\plugins\users\controllers \users_controller.php on line 34 -- Can anyone point me in the right direction to solve this? Sorry, but my cake knowledge is very limited and Im having trouble finding cake for dummies tutorials :s Thanks for any help :) -- My tables: CREATE TABLE `users` ( `user_id` int(25) NOT NULL auto_increment, `user_name` varchar(70) NOT NULL default '', `user_pass` varchar(70) NOT NULL default '', `ugroup_id` int(25) NOT NULL, `user_email` varchar(50) NOT NULL default '', `user_active` enum('0','1') NOT NULL default '0', `user_logged` datetime NOT NULL default '-00-00 00:00:00', `user_display` varchar(30) NOT NULL default '', `user_joined` datetime NOT NULL default '-00-00 00:00:00', `user_access` enum('0','1') NOT NULL default '0', `user_bio` text NOT NULL, `user_web` varchar(200) NOT NULL, PRIMARY KEY (`user_id`), KEY `ugroup_id` (`ugroup_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ; ALTER TABLE `users` ADD CONSTRAINT `users_ibfk_1` FOREIGN KEY (`ugroup_id`) REFERENCES `ugroups` (`ugroup_id`); CREATE TABLE `ugroups` ( `ugroup_id` int(25) NOT NULL auto_increment, `ugroup_name` varchar(70) NOT NULL default '', `ugroup_rank` int(10) NOT NULL, `perm_admin` enum('0','1') NOT NULL default '0', `perm_configweb` enum('0','1') NOT NULL default '0', `perm_setperm` enum('0','1') NOT NULL default '0', `perm_adduser` enum('0','1') NOT NULL default '0', `perm_edituser` enum('0','1') NOT NULL default '0', `perm_viewuserhidden` enum('0','1') NOT NULL default '0', `perm_viewusers` enum('0','1') NOT NULL default '0', `perm_addgroup` enum('0','1') NOT NULL default '0', `perm_editgroup` enum('0','1') NOT NULL default '0', `perm_viewgroup` enum('0','1') NOT NULL default '0', PRIMARY KEY (`ugroup_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ; --~--~-~--~~~---~--~~ 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 please! Enumerated fields do not seem to work in admin scaffold view in CakePHP 1.2...
Hi, Last week I gave CakePHP a first try, and then went for the stable 1.17 release. I created some tables, some scaffolded views, and as far as I remember, the enumerated DB fields all showed proper select fields in the edit screens. Now, I've upgraded to the yesterday's 1.2 alpha (marked as pre-beta) release, in order to be able to easily enable the $scaffold = 'admin'; trick, as I have only today left to come up with a (scaffolded) back-office for a prototype application. However... I now run into a very weird situation, in the respect that the scaffolding doesn't pick up my enumerated fields anymore in the edit view. For some reason, these fields display as normal input fields, but nothing can be selected/entered in them. Googling on this issue has not yet lead me to an answer. Does anyone know how I can enable such scaffolded select fields with the enumerated values in the edit view? From a code point of view converting enum DB fields to HTML select fields is not so difficult to achieve, and I have done so previously too. If for some reason it is absolutely impossible to enable properly scaffolded enum select fields in CakePHP 1.2, can anyone tell me how I could best go about sticking in my own code in the scaffold controller? I really hope someone has a (quick and easy) solution for this, as time is running out fast, and I'd lke to get the entire back-office up and running today still...:P Tnx in advance, and cheers, Olafo --~--~-~--~~~---~--~~ 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 please! Enumerated fields do not seem to work in admin scaffold view in CakePHP 1.2...
1. Cake does not officially support the ENUM or SET field type - apparently implementation is too different between database systems. 2. If they display as normal input fields then you would be able to edit them. Are you sure it isn't displaying as a multi-select list (which can look very similar to a textarea). For some reason I found scaffolding did that for me last week when I had a field called text (type TEXT). Renaming the field to contents and it displayed correctly as a textarea. (Strange error, as on another model the text field was fine). Just view the source to double check what you are getting. 3. To use your ENUM values as options in a select list, follow something like http://bakery.cakephp.org/articles/view/baked-enums This will easily generate an associative array suitable for passing to the form/html helper select function. It will mean those actions cannot be scaffolded, though. On Oct 23, 6:09 pm, Olaf Greve [EMAIL PROTECTED] wrote: Hi, Last week I gave CakePHP a first try, and then went for the stable 1.17 release. I created some tables, some scaffolded views, and as far as I remember, the enumerated DB fields all showed proper select fields in the edit screens. Now, I've upgraded to the yesterday's 1.2 alpha (marked as pre-beta) release, in order to be able to easily enable the $scaffold = 'admin'; trick, as I have only today left to come up with a (scaffolded) back-office for a prototype application. However... I now run into a very weird situation, in the respect that the scaffolding doesn't pick up my enumerated fields anymore in the edit view. For some reason, these fields display as normal input fields, but nothing can be selected/entered in them. Googling on this issue has not yet lead me to an answer. Does anyone know how I can enable such scaffolded select fields with the enumerated values in the edit view? From a code point of view converting enum DB fields to HTML select fields is not so difficult to achieve, and I have done so previously too. If for some reason it is absolutely impossible to enable properly scaffolded enum select fields in CakePHP 1.2, can anyone tell me how I could best go about sticking in my own code in the scaffold controller? I really hope someone has a (quick and easy) solution for this, as time is running out fast, and I'd lke to get the entire back-office up and running today still...:P Tnx in advance, and cheers, Olafo --~--~-~--~~~---~--~~ 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 please
Hi, I am using a ajax form( a small box kind..) on the right side of my webpage for login purpose. After user logs in ajax box is updated. But I need the entire page to be refreshed along with the ajax form update when user logs in. How do i do that? Is there a way to refresh a page from controllers instead of views? Can someone help please.. Thanks in advance, 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?hl=en -~--~~~~--~~--~--~---
Re: help please
I'd say just implement the code in this blog post, and then do a redirect upon successful login. http://cakebaker.42dh.com/2006/03/15/redirect-with-ajax/ On Sep 6, 2:38 pm, Gayathiri [EMAIL PROTECTED] wrote: Hi, I am using a ajax form( a small box kind..) on the right side of my webpage for login purpose. After user logs in ajax box is updated. But I need the entire page to be refreshed along with the ajax form update when user logs in. How do i do that? Is there a way to refresh a page from controllers instead of views? Can someone help please.. Thanks in advance, 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?hl=en -~--~~~~--~~--~--~---
How to implement a loading symbol for a html element- someone help please
Hi, I am using a select menu in my webpage. When i select an item, all subitems under that are retrieved from database and is displayed in the select menu. Now, again user has to select a subitem from the menu. Then subsub items under that are retrieved from database again. It happens like this 3-4 times. Since database has many entries, loading of the select menu takes some time. I have to use a loading symbol ( like rotating circle in IE tabs) near the select menu to show the user that the select menu is still loading and they have to wait to select the next entry. How do I find ot the loading time of the select menu? How do I show the loading symbol(a gif animation) until that loading time? How do I implement that in cake php? Can someone help me on this issue please? Thanks in advance, 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?hl=en -~--~~~~--~~--~--~---
Re: How to implement a loading symbol for a html element- someone help please
http://ajaxian.com/archives/ajaxload-custom-loading-indicators and look at the example for http://api.cakephp.org/class_ajax_helper.html#7e2e659c88c9cd4d833d531417d7ae03 and then you just have a div with the animated gif in it with display:none as the style attr. On 8/31/07, Chris Hartjes [EMAIL PROTECTED] wrote: On 8/31/07, Gayathiri [EMAIL PROTECTED] wrote: Hi, I am using a select menu in my webpage. When i select an item, all subitems under that are retrieved from database and is displayed in the select menu. Now, again user has to select a subitem from the menu. Then subsub items under that are retrieved from database again. It happens like this 3-4 times. Since database has many entries, loading of the select menu takes some time. I have to use a loading symbol ( like rotating circle in IE tabs) near the select menu to show the user that the select menu is still loading and they have to wait to select the next entry. How do I find ot the loading time of the select menu? How do I show the loading symbol(a gif animation) until that loading time? How do I implement that in cake php? Can someone help me on this issue please? Well, this is not *really* a CakePHP issue, more an Ajax one. The psuedo-code is pretty easy: 1) create an div that contains whatever graphic you want to use to display the loading symbol and hide it 2) create an onChange event (I'm pretty sure it's onChange) that unhides the div that displays the loading symbol, linking it to an action in your controller that loads the data 3) when the it's done, hide the div Repeat as many times as necessary. An oversimplification? Perhaps, but that's the basics. -- 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 -- (the old fart) the advice is free, the lack of crankiness will cost you - its a fine line between a real question and an idiot http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/ --~--~-~--~~~---~--~~ 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 please
Hey guys I am having problems in using HABTM relationship.I am having problems while saving the data from the form to the three tables.Manual was not that helpful.So can anyone help me in this .Just great a form and show me how to save the data in the association table and the the two other tables. --~--~-~--~~~---~--~~ 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: help please
Hi Checker, see http://manual.cakephp.org/chapter/models section Saving hasAndBelongsToMany for an example. Cheers, AD7six --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: A little help please?
Hi Sean, You need to create a model for your galleries and images (sounds like you did that already), If you define your gallery to hasMany Images, and your image to belongTo Gallery then you would only need code like this in your controller. function view ($id) { // there is no need to directly query the Image model in this example $this-Gallery-setId($id); $this-set('data', $this-Gallery-read()); } and in your view if you just put ?php // this is the whole data just to see what it is pr is a short call for print_r pr ($data); foreach ($data['Image'] as $Image) { ..etc.. } ? You should have the info you are looking for to generate the image tags etc. The 1 1 1 MVC structure is what is determined by default, but you can have 0 models many and 0 views 1 (at a time) HTH, AD7six --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: A little help please?
Fantastic! Thanks for the help, I added in the hasMany and belongsTo and everything works perfectly! Thanks again AD7six --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
A little help please?
Hey guys, today's the first day I started learning CakePHP. I've got extensive experience with PHP and MySQL but some of the components of Cake are throwing me for a loop so maybe someone on here can help clarify. First off I'm just trying to write a quick gallery script that lets users create a gallery and then upload pictures to it. I've accomplished the Add/Edit/Delete/View of the Gallery list, but what I can't seem to figure out is how I can implement the images into the Gallery Here's the quick SQL I threw together: CREATE TABLE Galleries( `id` int NOT NULL, `galleryName` varchar(100) NOT NULL, `creationDate` date NOT NULL, PRIMARY KEY(`id`) )TYPE=MyISAM; CREATE TABLE Images( `id` int NOT NULL, `imageName` varchar(30) NOT NULL, `addedDate` date NOT NULL, `imageLocation` varchar(200) NOT NULL, `gallery_id` int NOT NULL, PRIMARY KEY(`id`) )TYPE=MyISAM; So how could I make it if someone views a specific Gallery (http://127.0.0.1/cake/galleries/view/12), that the images would display? I guess the whole concept of 1 class working with 1 table and 1 structure is throwing me off. How can I use multiple tables in one file? How can I access my Image class inside GalleryController:View()? I hope this isn't too stupid of a question, but I've been looking for tutorials and so forth and I'm just not seeing it and I don't want something this small to make me not stick with Cake as I can definitely see it's potential. Thanks, Sean --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
CakePHP layout help please
I am just getting into Cake, and I really like it so far. It is going to speed up some of the work I do. Here is my problem though. I run a VPS, and since I have clients hosting with us, it's probably a good idea to keep the cake/cake files in a central place, so I put them in /usr/local/lib/php/cake/. I have a client, we'll say his name is Jim. I am going to be running an admin tool for him, so I want http://www.jim.com/admin/ to be the site root for the cake app. Jim's web files live at /home/jim/public_html/ So Jim's admin is at /home/jim/public_html/admin/ Jim's cake app is at /home/jim/public_html/admin/app/ Jim's 'webroot' folder is at /home/jim/public_html/admin/app/webroot/ Does that make sense? Anyhow, I can get cake to say everything is ok, but mod_rewrite doesn't seem to be working. My base site http://www.jim.com/admin/ comes up with proper content, but all the CSS and images are missing. I have changed my routes.php to see if my controller was working (and it is), but if I go to http://www.jim.com/admin/controller_name/ I get a 404 error, as if the server is not re-writing the URL at all. I have modified my /home/public_html/admin/app/webroot/index.php as follows: if (!defined('ROOT')) { //define('ROOT', 'FULL PATH TO DIRECTORY WHERE APP DIRECTORY IS LOCATED DO NOT ADD A TRAILING DIRECTORY SEPARATOR'; //You should also use the DS define to seperate your directories define('ROOT', DS.'home'.DS.'jim'.DS.'public_html'.DS.'admin'); } if (!defined('APP_DIR')) { //define('APP_DIR', 'DIRECTORY NAME OF APPLICATION'; define ('APP_DIR', basename(dirname(dirname(__FILE__; } /** * This only needs to be changed if the cake installed libs are located * outside of the distributed directory structure. */ if (!defined('CAKE_CORE_INCLUDE_PATH')) { //define ('CAKE_CORE_INCLUDE_PATH', FULL PATH TO DIRECTORY WHERE CAKE CORE IS INSTALLED DO NOT ADD A TRAILING DIRECTORY$ //You should also use the DS define to seperate your directories define('CAKE_CORE_INCLUDE_PATH', '/usr/local/lib/php/cake'); } I followed the documentation in the manual, but I can't figure out what's going on. Thanks for any help! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: CakePHP layout help please
I'm no expert on this, but having just tried something similar, I discovered what may appears to be a bug with one of the core cake files: Check out: http://groups.google.com/group/cake-php/browse_thread/thread/a6e45271704f6798 Close to the bottom of the thread is an explanation. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: CakePHP layout help please
Ok, helping myself out here, but just in case anyone else is looking for the same info. I don't know if you can set CakePHP up like how I wanted to, so I went back to how the alternate config is setup in the manual and I did it that way. So in my case, I wanted http://www.jim.com/admin/ to be the root of my app. So what I had to do was copy my /app directory to /home/jim/admin Then I moved /home/jim/admin/webroot/ to the proper location: /home/jim/public_html/admin/ I changed my ROOT to define('ROOT', DS.'home'.DS.'jim'); and my APP_DIR to define('APP_DIR', 'admin'); And things seem to be working as they should be, now http://www.jim.com/admin/controller_name/ works! ..and knowing is half the battle. Yay. If anyone needs a hand, feel free to e-mail me. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: CakePHP layout help please
Why are you not using cake admin routes?Do you plan to have a non admin side to this app also, that will use the same controller names?-- /*** @author Larry E. Masters* @var string $userName * @param string $realName* @returns string aka PhpNut* @accesspublic*/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---