Re: Newbie questions about model relations
Yeah cake its strict on everything so you can't name your id "design_id" stupid? Yes I know. On Sat, Oct 18, 2008 at 11:06 AM, Marritza <[EMAIL PROTECTED]> wrote: > > > Ok, let me clarify finally. (Never used newsgroups before so pardon lack of > complete information :P ) > > class Design extends AppModel { > >var $primaryKey = 'designs_id'; >var $useTable = 'design'; > } > > class Status extends AppModel { > >var $primaryKey = 'status_id'; >var $useTable = 'status'; > } > > I'm not using foreign keys. The db schema has been posted in the first > message. > > > teknoid-3 wrote: > > > > > > If you cannot alter db structure, that's fine. Cake works perfectly > > well with legacy DB's, but you have to ensure that you specify any > > settings that do not follow conventions. That includes table names, > > primary keys as well as foreign keys. > > > > You didn't provide your model definitions, so it's hard to guess as to > > what could be culprit. > > > > On Oct 18, 7:45 am, Marritza <[EMAIL PROTECTED]> wrote: > >> Forgot to mention - I am using $prmaryKey syntax in each model, because > I > >> have limited possibilities to alter the db structure. Tho, it is > possible > >> for me to create a sample table using cake conventions, I'll try again > >> then. > >> > >> > >> > >> teknoid-3 wrote: > >> > >> > You shouldn't break conventions when naming your primary keys. > >> > Cake will expect your primary key to be named 'id'... So Design.id and > >> > Status.id. > >> > >> > Of course you can override those by setting a $prmaryKey = 'myOwnKey'; > >> > in the model, but why make your life more difficult? > >> > >> > On Oct 17, 8:17 pm, Marritza <[EMAIL PROTECTED]> wrote: > >> >> Hello! > >> > >> >> I'm using Cake for several days now, I'm still under big impression > of > >> >> its > >> >> capabilities. > >> > >> >> Nevertheless, I have faced a problem, to which solution, which I have > >> >> found, > >> >> feels not logical in the Cake ways of doing things. First, let me > show > >> >> you > >> >> my table structure: (btw, I'm using PostgreSQL 8.3 on Debian Etch). > >> > >> >> table DESIGNS > >> >> designs_id serial <- primary key > >> >> job_name > >> >> status_id > >> >> ...etc > >> > >> >> table STATUS > >> >> status_id serial <- primary key > >> >> name > >> > >> >> The expected outcome is simple - I'm querying the Design model to > >> >> retrieve > >> >> data about a job, and I expect to see the status name which is > related > >> >> thru > >> >> Design.status_id => Status.status_id. > >> > >> >> Now, when I tried to accomplish it with $hasOne in the Design model > >> the > >> >> result is that Status is joined not on the forementioned basis, but > on > >> >> Design.design_id -> Status.status_id. > >> > >> >> to my surprise, it works using $belongsTo relation. > >> > >> >> Perhaps there is something wrong with my understanding of the Cake > >> >> relation > >> >> ways, perhaps I'm simply overlooking some basic stuff. > >> > >> >> Anyhow, any help greatly appreciated. > >> > >> >> -- > >> >> View this message in > >> >> > >> context: > http://www.nabble.com/Newbie-questions-about-model-relations-tp200418... > >> >> Sent from the CakePHP mailing list archive at Nabble.com. > >> > >> -- > >> View this message in > >> context: > http://www.nabble.com/Newbie-questions-about-model-relations-tp200418... > >> Sent from the CakePHP mailing list archive at Nabble.com. > > > > > > > > > -- > View this message in context: > http://www.nabble.com/Newbie-questions-about-model-relations-tp20041894p20048173.html > Sent from the CakePHP mailing list archive at Nabble.com. > > > > > -- Join cleanscript.com Come here for professional PHP coding. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: jquery validation
Oops.. var validator = $("#UserSignupForm").validate({ rules: { firstname: "required", lastname: "required", data[User][username]: { required: true, minlength: 2, remote: "users.php" }} }); Fixed.. On Sat, Oct 11, 2008 at 9:59 AM, Lamonte(Scheols/Demonic) <[EMAIL PROTECTED] > wrote: > Ever tried the Error Console in FireFox? > > var validator = $("#UserSignupForm").validate({ >rules: { >firstname: "required", >lastname: "required", >data[User][username]: { >required: true, >minlength: 2, >remote: "users.php" >}} > } > > Make sure you close your braces correctly when making inline objects. > > > On Sat, Oct 11, 2008 at 8:20 AM, bookme <[EMAIL PROTECTED]> wrote: > >> >> Hi, >> >> I am using jquery validation for signup form. But facing problem when >> I am using CakePHP helper class. >> >> if I used > maxlength="50" /> instead of >> >> text('username')); ?> that's generate "> name="data[User][username]" value="" id="UserUsername" type="text"> " >> it's working fine. >> >> Jquery validation code is >> >> var validator = $("#UserSignupForm").validate({ >>rules: { >>firstname: "required", >>lastname: "required", >>data[User][username]: { >>required: true, >>minlength: 2, >>remote: "users.php" >>}, >> >> >> I could not replace data[User][username] because it's need in form >> submission. so what should I changed either in >> text('username')); ?> or jquery function . >> >> I think problem is creating from data[User][username]. >> >> Please help me >> >> Thanks >> >> >> >> >> >> >> >> >> > > > -- > Join cleanscript.com Come here for professional PHP coding. > -- Join cleanscript.com Come here for professional PHP coding. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: jquery validation
Ever tried the Error Console in FireFox? var validator = $("#UserSignupForm").validate({ rules: { firstname: "required", lastname: "required", data[User][username]: { required: true, minlength: 2, remote: "users.php" }} } Make sure you close your braces correctly when making inline objects. On Sat, Oct 11, 2008 at 8:20 AM, bookme <[EMAIL PROTECTED]> wrote: > > Hi, > > I am using jquery validation for signup form. But facing problem when > I am using CakePHP helper class. > > if I used maxlength="50" /> instead of > > text('username')); ?> that's generate " name="data[User][username]" value="" id="UserUsername" type="text"> " > it's working fine. > > Jquery validation code is > > var validator = $("#UserSignupForm").validate({ >rules: { >firstname: "required", >lastname: "required", >data[User][username]: { >required: true, >minlength: 2, >remote: "users.php" >}, > > > I could not replace data[User][username] because it's need in form > submission. so what should I changed either in > text('username')); ?> or jquery function . > > I think problem is creating from data[User][username]. > > Please help me > > Thanks > > > > > > > > > -- Join cleanscript.com Come here for professional PHP coding. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Custom views based on action parameters?
No sorry thats not what I'm looking for, basically I want to use more then 1 view for a single action, I already sorted on how to change views for an action based on its parameter, but how do I manage to do the same thing but with more then one view, a guy on IRC said something about "Partial Views", google didn't turn up with any results. On Sat, Oct 4, 2008 at 10:47 AM, GrandiJoos <[EMAIL PROTECTED]> wrote: > > Would a simple redirect suffice? > > Then you could something like $this->redirect('controller/action', > null, true); > In your case $this->redirect('profile/edit', null, true); > > Hope this helps. > > GrandiJoos > > On 4 okt, 17:41, Lamonte <[EMAIL PROTECTED]> wrote: > > How do you switch "views" within a controller action? I have something > > setup like the following example.com/users/profile then I might want > > to do example.com/users/profile/edit I want to change views inside the > > profile action based on the parameter which is set, possible? It yes, > > How do you do it. > > > -- Join cleanscript.com Come here for professional PHP coding. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Trouble with the HtmlHelper and $scripts_for_layout
Just to help others who might help you, are you running the latest version of Cake? On Mon, Oct 6, 2008 at 10:34 AM, Marc Campeau <[EMAIL PROTECTED]> wrote: > > Hi everyone, > > I'm having trouble with the HtmlHelper and the $scripts_for layout. > Basically, I use the helper to add CSS inline ($html- > >css(array('someCss'), null, null, false);) from within the different > elements (/views/elements/) that the view needs to render. I would > have expected these CSS to show up in the HTML Head by echoing > $scripts_for_layout in default.ctp but unfortunately they don't? If I > echo the CSS inline then they do show up in the markup. > > Anyone knows what I'm doing wrong? > > Side notes: > Doing the $html->css() inline call from /views/default.ctp doesn't > work either. > Doing the $html->css() inline call from the view that's rendered (/ > views/users/login.ctp for instance), works. > > Thanks for taking the time to read this, > > Marc > > > > -- Join cleanscript.com Come here for professional PHP coding. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Custom views based on action parameters?
Got it. On 10/6/08, Fran Iglesias <[EMAIL PROTECTED]> wrote: > > > Hi, > > El 04/10/2008, a las 17:41, Lamonte escribió: > > > How do you do it. > > > controller->render('view_name'); > > > -- > Fran Iglesias > [EMAIL PROTECTED] > > > > > > > > -- Join cleanscript.com Come here for professional PHP coding. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
hasMany unsure
Hi, I'm trying to connect 2 tables together with "has" many, basically what I want to do is select all the votes from the votes table and order them by total votes. How exactly am I supposed to do that using cakes hasMany relation. I have the following: array( 'classname' => 'Votes', 'foreignKey' => 'website_id', 'fields' => array('COUNT(votes.*) as TOTAL','votes.id'), ) ); } ?> Then I just call the find function get all errors, blah people said don't use the query function so I'm giving this hasmany thing a try and it failed. Any ideas on how to do what I'm trying to do? -- Join cleanscript.com Come here for professional PHP coding. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Custom views based on action parameters?
Okay so I got it working using $this->render(view) from someone in the IRC, how do I work with multiple views ? On Sat, Oct 4, 2008 at 10:41 AM, Lamonte <[EMAIL PROTECTED]> wrote: > > How do you switch "views" within a controller action? I have something > setup like the following example.com/users/profile then I might want > to do example.com/users/profile/edit I want to change views inside the > profile action based on the parameter which is set, possible? It yes, > How do you do it. > > > > -- Join cleanscript.com Come here for professional PHP coding. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---