database design help - menu, menu items and controllers within
Hello, I am having some issues setting up the database for my base CMS to use for all clients. My thoughts were to have the following: blocks table - this is simply the html, title, description etc for each page (i.e. home, about us) menus table - simply contains the menu name (i.e. top navigation or footer links etc) menu_items table - this would contain the menu_id, the parent_id (from this same table), the title of the link in the menu and then there would be a controller field which would contain the name of the controller i.e. blocks and then the next field to contain the actual block id such as the home id for the link. This is how I can see that I can easily add additional controllers such as galleries, pdfs, blogs etc and they could be within the menus quite easily by adding in contoller = pdfs, controller_id = 3 (the pdf id or whatever) Below is the SQL I have come up with, I wanted to get some advise to see if there was an easy way or better way to do this. Ideally I want to be able to generate the list of controllers on the add/edit field and then their assigning ids when adding menu_items. Thankyou CREATE TABLE IF NOT EXISTS `blocks` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(150) NOT NULL, `title` varchar(150) DEFAULT NULL, `show_title` tinyint(1) DEFAULT '1', `content` longtext, `metadescription` text, `metakeywords` text, `stepback` longtext, `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; # Data exporting was unselected. # Dumping structure for table siteadmin.menus CREATE TABLE IF NOT EXISTS `menus` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; # Data exporting was unselected. # Dumping structure for table siteadmin.menu_items CREATE TABLE IF NOT EXISTS `menu_items` ( `id` int(11) NOT NULL AUTO_INCREMENT, `menu_id` int(11) DEFAULT NULL, `parent_id` int(11) DEFAULT NULL, `name` varchar(255) DEFAULT NULL, `controller` varchar(255) DEFAULT NULL, `controller_id` int(11) DEFAULT NULL, `published` tinyint(1) DEFAULT '0', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; == -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
CakePHP Application Design Help
Hi Guys, I am creating an application that hold user names / passwords and settings. So I have 2 tables in a DB, users and settings They have a hasOne relationship. I have come up to a little problem, When a new user is created i want to have a row in the settings table created too. is this possible through cake? or do I have to code a new class for it? I have enabled the dependant in the model so if the user is deleted the associate settings row gets removed, is there a setting that does the opposite so when a user is created it creates a blank settings row? Hope someone can help. Thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: CakePHP Application Design Help
you dont need to create a controller class for the settings table just create a model for the settings table In case user is not created with its settings (in the same add form), do the following in the User model put this function afterSave($created) { if($created) { $this-Setting-create(); $data['Setting']['user_id']=$this-id; $this-Setting-save($data); } } have a nice baking day --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: CakePHP Application Design Help
A very cool, didnt even think about doing it that way, had even started to look at mysql triggers to do it. Thankyou robustsolution! Tony --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Image Gallery Design Help
Doesn't anyone have anything to add? I dont' know the best way of doing this so any help would be great! Kev On 5 Oct, 11:18, KevinM2k kevin...@yahoo.co.uk wrote: Hi, I am creating a custom image gallery, I have categories and sub categories, then images within each one. I am pretty new to cakephp and I am trying to find out how is the best way of dealing with the administration area. For example lets say I create my new photo album under a category of Holidays/Greece, I then want an ability to put information in about my photo album, so i have a photo_album_controller.php, which allows me to enter all the information about the photo album. However I then want to upload images for this photo gallery (as many as i want), I know I can create image_controller however this will only handle one image at a time and would be a seperate page to the photo album. I want an ability to edit a photo album (so a admin_edit() function), then at the bottom of that page show all the photos that are associated with this album (which I can do), but then with an ability to add more photos or remove existing ones so I dont have any seperate image controller page (as it wouldn't make sense without an album) What would be the best way to do this and can anyone give me any examples or tutorials on how as I seem to find it easier to learn when I see something in action. Thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Image Gallery Design Help
Hi, I am creating a custom image gallery, I have categories and sub categories, then images within each one. I am pretty new to cakephp and I am trying to find out how is the best way of dealing with the administration area. For example lets say I create my new photo album under a category of Holidays/Greece, I then want an ability to put information in about my photo album, so i have a photo_album_controller.php, which allows me to enter all the information about the photo album. However I then want to upload images for this photo gallery (as many as i want), I know I can create image_controller however this will only handle one image at a time and would be a seperate page to the photo album. I want an ability to edit a photo album (so a admin_edit() function), then at the bottom of that page show all the photos that are associated with this album (which I can do), but then with an ability to add more photos or remove existing ones so I dont have any seperate image controller page (as it wouldn't make sense without an album) What would be the best way to do this and can anyone give me any examples or tutorials on how as I seem to find it easier to learn when I see something in action. Thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Database Relationship and Design Help
I'm have a problem on how I should 'design' my database for my current project. This is my current design: http://img264.imageshack.us/img264/4396/coopdbjx7.png (In the image it shows member_int, but the actual field name is member_id with a data type of int) Here is what I want it to be: Each member can apply for zero or more short term loan(s) A short term loan must have 1 or up to 3 comakers A comaker must also be a member. A member could be a comaker. It matters to know which member is the main 'loaner' and which member is the comaker for each loan. Here is what the relationship looks like atm in my source: Member $hasOne = array('ShortTermLoanComaker'); Member $hasMany = array('ShortTermLoan'); ShortTermLoan $belongsTo = array('Member'); ShortTermLoan $hasAndBelongsToMany = array('ShortTermLoanComaker'); ShortTermLoanComaker $belongsTo = array('Member'); ShortTermLoanComaker $hasAndBelongsToMany = array('ShortTermLoan'); I hope someone could help me with this. Thank you everyone. :D --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Database Relationship and Design Help
On Feb 9, 3:11 am, ramonmar...@gmail.com wrote: Here is what I want it to be: Each member can apply for zero or more short term loan(s) A short term loan must have 1 or up to 3 comakers A comaker must also be a member. A member could be a comaker. It matters to know which member is the main 'loaner' and which member is the comaker for each loan. Here is what the relationship looks like atm in my source: Member $hasOne = array('ShortTermLoanComaker'); Member $hasMany = array('ShortTermLoan'); ShortTermLoan $belongsTo = array('Member'); ShortTermLoan $hasAndBelongsToMany = array('ShortTermLoanComaker'); ShortTermLoanComaker $belongsTo = array('Member'); ShortTermLoanComaker $hasAndBelongsToMany = array('ShortTermLoan'); That looks alright to me. To meet that last requirement, maybe you can have a column in ShortTermLoan for the main loaner member ID and force it to be non-null. Then of course all ShortTermLoanComakers associated with that ShortTermLoan that do not have the ID contained in that column, would be the comakers for the loan. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Database Relationship and Design Help
Also, this is just a personal design decision but I would remove the 'id' field on the join table and make both of the other two columns primary keys. That enforces the rule (at the database level anyway) that a member/comaker cannot be associated with the same loan multiple times. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Database Relationship and Design Help
column member_id in ShortTermLoan is the id of the applicant. On Feb 9, 10:27 pm, mscdex msc...@gmail.com wrote: On Feb 9, 3:11 am, ramonmar...@gmail.com wrote: Here is what I want it to be: Each member can apply for zero or more short term loan(s) A short term loan must have 1 or up to 3 comakers A comaker must also be a member. A member could be a comaker. It matters to know which member is the main 'loaner' and which member is the comaker for each loan. Here is what the relationship looks like atm in my source: Member $hasOne = array('ShortTermLoanComaker'); Member $hasMany = array('ShortTermLoan'); ShortTermLoan $belongsTo = array('Member'); ShortTermLoan $hasAndBelongsToMany = array('ShortTermLoanComaker'); ShortTermLoanComaker $belongsTo = array('Member'); ShortTermLoanComaker $hasAndBelongsToMany = array('ShortTermLoan'); That looks alright to me. To meet that last requirement, maybe you can have a column in ShortTermLoan for the main loaner member ID and force it to be non-null. Then of course all ShortTermLoanComakers associated with that ShortTermLoan that do not have the ID contained in that column, would be the comakers for the loan. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Database Relationship and Design Help
I thought I read somewhere that every table has to have an 'id' column in CakePHP. Anyway, I deleted the column and everything seems to be working fine still. I think I got it already. Thanks. On Feb 9, 10:40 pm, mscdex msc...@gmail.com wrote: Also, this is just a personal design decision but I would remove the 'id' field on the join table and make both of the other two columns primary keys. That enforces the rule (at the database level anyway) that a member/comaker cannot be associated with the same loan multiple times. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Invite Application... need some design help..!
Hey all -- new here, new to CakePHP, but loving it so far. I need some design suggestions. I'm writing an application that involves inviting people to a page. The invites will go out to registered users of the application (Friends of the Invitation Owner) and to non-registered users via email address submission. How can I organize invitees associated with any given invitation in my MySQL database since some will be registered (Users model), and some un-registered (list of email addresses)...? Should I use separate tables or models for registered invitees and un-registered invitees? Right now, I've got a working Users model and have a self-referenced HABTM association for Friend lists, that uses a little join table to link Users with their Friends' user_id's. In other words, I'm having trouble designing how my Invite model and database should look like so that registered Users and un-registered Users (that the app will only have email addresses for) are linked together for any given Invite. Thanks! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP 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 -~--~~~~--~~--~--~---
design help.
Hey guys, I've been wokring on a internet site for awhile now but i lost interest in it near february and i want to try and get back into it. So i'm gonna put it into CakePHP (which i did last time i was on it), but the problem i am trying to get rid of is this. I have a left and right side, the right being the control panel/menu, left: the information. So i've been thinking and i was wondering if anyone had any suggestions on how they would do this. 1. have the content_for_layout in the left side, and have a element or just put the menu in the default layout. 2. have content_for_layout in both side and have to update both of them on every view. (doesn't sound so efficient). Those are 2 options i've come up with. I'd really like it if someone had a better idea or maybe something more effiecient. Note: i have one page that would be using that right menu but not statically, should that be with the options above or does anyone have any suggestions. Thank you in advance for any replies and/or any help. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP 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 -~--~~~~--~~--~--~---