Adding Javascript to $html->link?
How do you add javascript events using $html->link? There is a confirmation dialog that can be passed as one of the fields, so it puts "onclick='confirm(etc)'", but I want onclick="if(confirm('test'){somejsfunction();}" What the function call does is essentially ajax, but looking at the $ajax helper doesn't provide an obvious solution (from what I can tell) I'm beginning to become annoyed with some of the helper functions for the views. It seems that every time I try to add customization I have to read the cookbook over and over to try to figure out how to do what I could easily do with straight html. I absolutely love the model and controller implementation, but is anyone other than me starting to think that the only cake functions I want to use in the views is form creation and creating (automagic) input fields? Thanks, Will --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Login form in layout ie( on everypage) doesn't work with Auth
I added a login form to my layout(so people could login from any page). But submitting that login form does not authenticate. Why might that be? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
DataSources - External MySQL
Hello, I am new to CakePHP. I am attempting to setup a data source to a non- cakephp mysql database that I can read data from. I cannot find an example of how to do this. I found external data sources for GoogleAnalytics and XML. Can anyone point me to a link for mapping to an external sql table. 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: Uploader Plugin now does Model attachments
http://www.milesj.me/resources/script/uploader-plugin On Nov 7, 7:18 pm, oka muharam wrote: > On Sat, Oct 31, 2009 at 12:29 AM, Miles J wrote: > > > Well whats your problem? The documentation is about as detailed as > > possible. > > > im confiusing for step 2 on configuration, where i pute the code?. can you > > give me some example --~--~-~--~~~---~--~~ 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: Uploader Plugin now does Model attachments
Hi miles, where is the demo page or screenshot, i will post this great plugin to my own blog. On Sun, Nov 8, 2009 at 10:18 AM, oka muharam wrote: > > > On Sat, Oct 31, 2009 at 12:29 AM, Miles J wrote: >> >> Well whats your problem? The documentation is about as detailed as >> possible. >> > im confiusing for step 2 on configuration, where i pute the code?. can you > give me some example > > > > -- Mufti Ali 087831163105 http://wordtaps.com http://blogfreakz.com --~--~-~--~~~---~--~~ 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: Uploader Plugin now does Model attachments
On Sat, Oct 31, 2009 at 12:29 AM, Miles J wrote: > > Well whats your problem? The documentation is about as detailed as > possible. > > im confiusing for step 2 on configuration, where i pute the code?. can you give me some example --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Opinion on Google's Closure Library?
I wanted to ask everyone's opinion on the javascript library Google just released. http://googlecode.blogspot.com/2009/11/introducing-closure-tools.html All of these new libraries would be wonderful to use, but do you think it would work in conjunction with JQuery or require all the javascript to be rewritten? If that's the case, do you think the features they offer in the library are worth the learning curve and redesigns? I'm just curious as to your thoughts in general on this and whether or not it is worth learning to use. I'm just starting to design a fairly large application and at the point where it might be worth it to incorporate this new stuff since I'm early in the design stages. I've read some of the docs, I'm just curious to hear anyone's opinion on features they are excited about or not. Thanks! Will P --~--~-~--~~~---~--~~ 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: Just learning Cake PHP - Top & Bottom Banners Missing
Hi, Its Windows Vista, with Zend Server installed. Thanks On Nov 6, 7:22 pm, Jonathan wrote: > Peter, > It sounds like mod_rewrite isn't working correctly on your webserver. > I had the same problem, and never realized it. The default CakePHP > screen should have the banners. What server OS are you running? I had > to turn mod_rewrite on for my Ubuntu 8.10 box. > > Jonathan > > On Nov 6, 8:57 am, JonesyPeter wrote: > > > Hi, > > > I'm learning Cake with the PACKT Publishing book 'CakePHP Application > > Development', and all the screenshots show a nice 'Cake' banner top > > and bottom of the page. > > > However with the version I am using 'Downloaded 5th November 2009', I > > have got as far as downloading, copying to my webserver and displaying > > the index page, the nice top and bottom banner are not there. > > > Am I doing something wrong? > > > Kind regards > > > Peter Jones --~--~-~--~~~---~--~~ 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: Help returning JSON
Because your sending the wrong header, if your returning JSON it should be the JSON header... header("Content-type: application/json"); On Nov 7, 8:06 am, "Dave" wrote: > Thanks for your response. > > I did take a look at your tutorial. But in my situation I don't think a lot > of what you have there will apply to me. I have everything to a point > working. Right now I am only trying to validate one field using validate: > remote option to check if a user email is already registered. > > The data[User][email] = myt...@dummy.com gets sent to Cake . If I debug > error I see > > Array > ( > [email] => This email account is already registered. > ) > > I just need a way to get the error or success back to the js remote part of > the script...thats where I am lost. > > I am not sure how to send back the message if there is an error or if valid > do nothing. > > I tried using your suggestion with layout ajax but all I ended up getting > was an error messages showing {valid : false} where "This email account is > already registered." Should go. > > My js validate rule looks like: > > var validate_profile = { > > rules: { > 'data[Profile][email]':{required: true, email:true, > remote: {url: "/manage/profiles/validate",type: "post"}}, > }, > messages: { > > 'data[Profile][email]': { > required: '* JS required email address.', > email: '* JS email address.', > remote: '* this message is remote from JS.'} > }}; > > And my controller: > > function manage_validate() { > Configure::write('debug', 2); > if ($this->RequestHandler->isAjax()) { > $this->Profile->set($this->data); > if ($this->Profile->validates()) { > //nothing to do > > } else { > //header("Content-type: text/plain"); > $errors = $this->Profile->invalidFields(); > //debug($errors); > > $array = array("valid" => false); > > return json_encode($array); > > //$this->set('output' , $output); > //echo json_encode($array); > //$this->layout = 'ajax'; > //$this->render ('/elements/errors/ajax_fields'); > } > > } > } > > Ajax_fields.ctp : > > object($output);?> > > Any ideas? > > Thanks again > > Dave > > -Original Message- > From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf > Of Kyo > Sent: November-06-09 10:43 PM > To: CakePHP > Subject: Re: Help returning JSON > > You don't have to use header() and json_encode() to get JSON values back > with Cake. > Use $this->layout = 'ajax' in your controller and $javascript->object > () in your view. > Try out my > way:http://jamnite.blogspot.com/2009/05/cakephp-form-validation-with-ajax > html > > hth, > > Kyo --~--~-~--~~~---~--~~ 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: using javascript within $ajax->remoteFunction
I'm sorry I think you misunderstood my question I am trying to figure out how to pass a javascript value from the page which calls the ajax function. I was able to do this by copying and pasting the javascript generated by the CakePHP Ajax helper and modifying it, but I am looking for a way to do this within the framework because from what I gather pretty much anything you need to do you can do with the CakePHP built in methods. On Sat, Nov 7, 2009 at 10:09 AM, Marcelo Andrade wrote: > > On Fri, Nov 6, 2009 at 9:52 PM, Dave wrote: > > > > Hello all, > > > > I have a textbox that, onblur, needs to use ajax to call an action > > with its value as a parameter. > > > > now ideally this would be accomplished with > > > > onblue="remoteFunction(array('url'=>array > > ('controller'=>'ratings','action'=>'rateItem',VALUE_GOES_HERE))); ?>" > > > > I've tried replacing VALUE_GOES_HERE with 'this.value', this.value, > > $javascript->codeBlock('this.value') and none of them work properly. > > > > It seems like there would be a way to do this with cake. I've > > currently solved the problem with a work around by taking the > > javascript code generated by cake and copying and pasting it in place > > of the $ajax->remoteFunction code. This way I can use this.value. > > > > The result looks like this: > > > > onblur = "new Ajax.Request('/charity/ratings/rateItem/' + this.value, > > {asynchronous:true, evalScripts:true})" > > > > This works... but I don't like breaking cake convention and it seems > > as though there should be a "correct" way of doing this. > > > > Does anybody know if there is? > > > > Thanks in advance! > > With the corresponding view to the remote function > call set a variable in a hidden field. And then, in the > "oncomplete" attribute, use something like > Form.Element.setValue('YourField', $F('HiddenField')); > > Best regards. > > -- > MARCELO DE F. ANDRADE > Belem, PA, Amazonia, Brazil > Linux User #221105 > > > > --~--~-~--~~~---~--~~ 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: Table join confusion...
You can include other tables in the query using the 'joins' option of the Model->find method. On Sat, Nov 7, 2009 at 4:48 PM, jakobjp wrote: > > I need a little assistance with a join over 3 tables. > > I have the following Models (User > Profile > Infogroup > > Information): > - User (hasMany Profile) > - Profile (belongsTo User, hasMany Infogroup) > - Infogroup (belongsTo Profile, hasMany Information) > - Information (belongsTo Infogroup) > > The relationships are defined in the model classes, and there is no > problem getting the associated data, when for example fetching a User. > > However, what do I need to do to get all Information that belongs to a > specific User? > > I.e. all rows from the informations table "where > Information.infogroup_id = Infogroup_id AND Infogroup.profile_id = > Profile.id AND Profile.user_id = XYZ"? > > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Table join confusion...
I need a little assistance with a join over 3 tables. I have the following Models (User > Profile > Infogroup > Information): - User (hasMany Profile) - Profile (belongsTo User, hasMany Infogroup) - Infogroup (belongsTo Profile, hasMany Information) - Information (belongsTo Infogroup) The relationships are defined in the model classes, and there is no problem getting the associated data, when for example fetching a User. However, what do I need to do to get all Information that belongs to a specific User? I.e. all rows from the informations table "where Information.infogroup_id = Infogroup_id AND Infogroup.profile_id = Profile.id AND Profile.user_id = XYZ"? --~--~-~--~~~---~--~~ 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: XML cannot be read [CORE/cake/libs/xml.php, line 883] ???
Before anyone attempts to answer this, what is your understanding of the error and its cause? The error is in a CakePHP class, so start there. On Nov 7, 6:04 am, "Dave" wrote: > I get this error only in Google Chrome > > I simply click a link and that sends an ajax request to render an element > into a div. No errors in FF or IE. Anyone seen this? > > Thanks > Dave --~--~-~--~~~---~--~~ 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: Drop down assocations
Have another review of the concept of normalising, then read http://book.cakephp.org/view/81/belongsTo You have normalised your tables to a HABTM relationship, when what you seem to be after is a hasMany/belongsTo relationship. Post belongsTo Category Category hasMany Post When that is done, the dropdown can be automatically generated for you in your Post views using: input('Category'); ?> On Nov 7, 6:52 am, "supergee...@gmail.com" wrote: > I'm new to cakePhp (and database design...I've been lazy over the > years and want to learn the "right" way to do things) and have a > question about saving the contents of a form that has a drop down > field. > > Here are the tables that I have setup in my database: > > Table 1: posts (contains id,title,description) > > Table 2: categories (contains id,category_name) > > Table 3: categories_posts (contains 2 foreign keys: > category_id,post_id) > > I have 3 fields in the form I'm building > > Field 1 (Category): Drop down field containing a list of categories. > The category id is the value and the category name is shown on the > drop down. > > Field 2 (Title): text field > > Field 3 (Description): textarea field > > I'm having trouble figuring out how to save the Title and Description > fields to one database table, and save the category id and post id to > an assocation table, called categories_posts. > > I have tried everything I can find an example of, and nothing has > seemed to work. I'm also not really sure if I need to use the save or > saveAll method. > > In the past, I would have just saved the category name to the post > data table and been done with it, but I would like to at least attempt > to normalize my database (which is really foreign to me at this > point...I understand the basic idea but that's about it at this > point). > > Can someone please point me in the right direction? If I need to > further explain myself, please let me know. Thank you. --~--~-~--~~~---~--~~ 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.org hacked?
I agree with the "Let's just all relax crowd". Of all the things going on in the world, to complain about the developers of Cake putting up a fun and IMO very tasteful theme seems quite ridiculous. The bottom line is Cake never stopped running on my machine because the theme was changed. People didn't stop posting help on the forum, baking apps or developing the newest version for our benefit. If anyone did leave for CI or ZEND, they would have a leg up on others because of the vast knowledge that Cake provides. Rock on CakePHP!! I for one thank you! On Nov 7, 4:03 am, Adrenalin wrote: > There are a lot of boring frameworks with boring websites and luckily > cakephp is not one of them ;) Hooray to cakephp ! Can we have a cool > theme for the New Year too ? :) > > On Thu, Nov 5, 2009 at 3:31 PM, jacmoe wrote: > > > Frameworks are serious?? :) > > Well, I don't know.. > > > Sri Sri Ravi Shankar wrote: > >> Life is nothing to be very serious about. > > > On Nov 3, 11:50 pm, on24 wrote: > >> Hmmm, I just don't like this "funny" theme. My first thought was > >> "CakePHP gone?! Too bad. Let's check Code Igniter then". Serious > >> things like frameworks should not try to be funny. I really can't > >> promote a halloween framework to my colleagues. --~--~-~--~~~---~--~~ 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: Validate a single field
I am getting closer but still no message shows up in the form. I get the error div appearing but no message. The response sent to the page looks like: FIREFOX JSON TAB: {"valid":false,"data[Profile][email]":{"messages":{"remote":"from cake"}}} I will worry about the actual cake error message later so I just hard coded "from cake" to see if it shows up but I get no message ever. If its valid the error div still shows up. I modified my validate options so they now look like: var validate_options = { rules: { "data[Profile][email]":{remote: {url: "/manage/profiles/validate",type: "post", data: {fieldname: 'email'}}}, }, messages: { } }; Any ideas how why my messages: are not papering or why it error div appears when valid? Any help or suggestions would be great. Thanks Dave -Original Message- From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf Of euromark (munich) Sent: November-07-09 1:56 PM To: CakePHP Subject: Re: Validate a single field just submit only that field the model validation is only triggered for fields that are beeing passed so if there is only one passed form field, only this one will be validated PS: dont use "required''=>true" in your rules or you screw it up On 7 Nov., 17:43, "Dave" wrote: > How can I validate a single field using Ajax? > > I am attempting to use jquery remote feature to check fields for validity. > But its checking the entire model and reporting fields that have not > had data entered. If a form has 3 fields and the user types into the > second field for example i only want to check if that field is valid, > not the entire form. > > I am trying to validate an email to start off with so > data[Profile][email] = mytestem...@something.com gets sent to cake to > validate > > How can I validate only Profile.email? I want to use the same function > eventually to validate other fields so i do not want to hard code 'email' > into the function. Is there a way to get the field name [email] as a > variable and then validate just that rule in the model and return a > true or false? > > Thanks > > Dave --~--~-~--~~~---~--~~ 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: the white screen of death
So many times that I get the WSOD it is because I have forgotten to add a ) at the end of a line or there are too many. On Nov 7, 4:53 am, Bruno Bergher wrote: > From previous experience the main cause for this is when > debug_backtrace() is called, in the global debug() declaration > (basics.php:114). > It chokes with undefined variables (in some installations, such MAMP, > this is a pain) and sometimes with very deep associative arrays. > > This message is not too helpful since I have no idea how to solve > this, other than using var_dump() or print_r() in WSOD situations. > > On Nov 6, 8:28 pm, Pedro Nascimento wrote: > > > I got one after copying some config options on files as database.php, > > core.php and app_controller.php using wrong symbols such as ` instead of '. > > It's a stupid mistake, but I have done it once or twice already. :> > > > On Fri, Nov 6, 2009 at 20:08, Tonu Tusk wrote: > > > > OK, I doubt this will be of too much help, but the main causes of WSOD > > > I have encountered have been models not being declared in a > > > controllers $uses var > > > (where a controller is using other than its standard related model) > > > > OR some bad relationships declared in model classes > > > > (I am still a bit unsure of it all, but if i had model A hasOne modelB > > > and modelB belongs to modelA, that really seems to bomb things out for > > > me even though it seems quite intuitive to do so) > > > > Oh yeah, and on one of my other recent posts I was getting random WSOD > > > which turned out to be mod_security installed on my shared host which > > > did not seem to like the combination of either large or a large number > > > of input in post data in combination with being routed through > > > mod_rewrite. > > > > Go figure. > > > > Has anyone else got any "d'oh" obvious and common errors which have > > > led to WSOD to share? > > > > On Nov 6, 9:04 pm, "gimperdan...@gmail.com" > > > wrote: > > > > Yep, > > > > > I already do debug($variable), but when code gets long, it can get > > > > pretty frustrating to test everything. Not to mention that if I get > > > > the white screen than I can't see anything including debug(var). > > > > > My debug option is set to 3. Which is the max, but it doesn't change > > > > anything. > > > > > On Nov 6, 3:14 pm, Céryl wrote: > > > > > > In addition, if the debug level is 2 you can add debug($variable) > > > > > (Either in controller or view) to your code to check that var... So > > > > > you can see if it's an improperly set variable that causes you to > > > > > white-out... > > > > > > On 6 nov, 21:00, jacmoe wrote: > > > > > > > Open app/config/core.php and set the debug level to 1 or 2. :) > > > > > > > On Nov 6, 4:16 pm, "gimperdan...@gmail.com" > > > > > > wrote: > > > > > > > > More often that I would like to I get the "white screen of death", > > > > > > > which tells me something is wrong with my cold. Is there a way to > > > get > > > > > > > printed errors? instead of the white screen? --~--~-~--~~~---~--~~ 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: Validate a single field
just submit only that field the model validation is only triggered for fields that are beeing passed so if there is only one passed form field, only this one will be validated PS: dont use "required''=>true" in your rules or you screw it up On 7 Nov., 17:43, "Dave" wrote: > How can I validate a single field using Ajax? > > I am attempting to use jquery remote feature to check fields for validity. > But its checking the entire model and reporting fields that have not had > data entered. If a form has 3 fields and the user types into the second > field for example i only want to check if that field is valid, not the > entire form. > > I am trying to validate an email to start off with so data[Profile][email] = > mytestem...@something.com gets sent to cake to validate > > How can I validate only Profile.email? I want to use the same function > eventually to validate other fields so i do not want to hard code 'email' > into the function. Is there a way to get the field name [email] as a > variable and then validate just that rule in the model and return a true or > false? > > Thanks > > Dave --~--~-~--~~~---~--~~ 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: javascript helper adding slashed to JSON object output
ah- echo stripslashes($javascript->object($data)); seems to do the trick unless there is a better way? On Nov 7, 9:09 am, mlecho wrote: > hi, i am using the javascript helper to generate JSON feeds. It works > great, except for one thing...if a json property has a value that is > an absolute url, cakephp wants to escape all the slashes...exampe: > > {"flag_img":"http:\/\/www.website.com\/themes\/images\/country\/ > countryimage.png"} > > how can i get that url without escapes? I just need it as a straight > string. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
javascript helper adding slashed to JSON object output
hi, i am using the javascript helper to generate JSON feeds. It works great, except for one thing...if a json property has a value that is an absolute url, cakephp wants to escape all the slashes...exampe: {"flag_img":"http:\/\/www.website.com\/themes\/images\/country\/ countryimage.png"} how can i get that url without escapes? I just need it as a straight string. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
call a controller's action from shell as an authorized user
Hari, My service http://sociall.cc sends and receivesmessages from and to more social networks like twitter, facebook, etc. I would like to add a timed messages service where users could set messages to send in a future time. For this I need to have my own cake shell and run it by a crontask. At a certain point I want to call $this->requestAction('/messages/send'); But messages controller's send action is available if there is an authenticated user. So before I call this somehow the shell should authenticated itself as a user. Than it could send the message, and the shell could reauthenticate itself as a different user and send messages belongs to that user. The question is how could I authenticate the shell as a particular user? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Validate a single field
How can I validate a single field using Ajax? I am attempting to use jquery remote feature to check fields for validity. But its checking the entire model and reporting fields that have not had data entered. If a form has 3 fields and the user types into the second field for example i only want to check if that field is valid, not the entire form. I am trying to validate an email to start off with so data[Profile][email] = mytestem...@something.com gets sent to cake to validate How can I validate only Profile.email? I want to use the same function eventually to validate other fields so i do not want to hard code 'email' into the function. Is there a way to get the field name [email] as a variable and then validate just that rule in the model and return a true or false? Thanks Dave --~--~-~--~~~---~--~~ 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: Help returning JSON
Thanks for your response. I did take a look at your tutorial. But in my situation I don't think a lot of what you have there will apply to me. I have everything to a point working. Right now I am only trying to validate one field using validate: remote option to check if a user email is already registered. The data[User][email] = myt...@dummy.com gets sent to Cake . If I debug error I see Array ( [email] => This email account is already registered. ) I just need a way to get the error or success back to the js remote part of the script...thats where I am lost. I am not sure how to send back the message if there is an error or if valid do nothing. I tried using your suggestion with layout ajax but all I ended up getting was an error messages showing {valid : false} where "This email account is already registered." Should go. My js validate rule looks like: var validate_profile = { rules: { 'data[Profile][email]':{required: true, email:true, remote: {url: "/manage/profiles/validate",type: "post"}}, }, messages: { 'data[Profile][email]': { required: '* JS required email address.', email: '* JS email address.', remote: '* this message is remote from JS.'} }}; And my controller: function manage_validate() { Configure::write('debug', 2); if ($this->RequestHandler->isAjax()) { $this->Profile->set($this->data); if ($this->Profile->validates()) { //nothing to do } else { //header("Content-type: text/plain"); $errors = $this->Profile->invalidFields(); //debug($errors); $array = array("valid" => false); return json_encode($array); //$this->set('output' , $output); //echo json_encode($array); //$this->layout = 'ajax'; //$this->render ('/elements/errors/ajax_fields'); } } } Ajax_fields.ctp : object($output);?> Any ideas? Thanks again Dave -Original Message- From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf Of Kyo Sent: November-06-09 10:43 PM To: CakePHP Subject: Re: Help returning JSON You don't have to use header() and json_encode() to get JSON values back with Cake. Use $this->layout = 'ajax' in your controller and $javascript->object () in your view. Try out my way: http://jamnite.blogspot.com/2009/05/cakephp-form-validation-with-ajax-using. html hth, Kyo --~--~-~--~~~---~--~~ 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: using javascript within $ajax->remoteFunction
On Fri, Nov 6, 2009 at 9:52 PM, Dave wrote: > > Hello all, > > I have a textbox that, onblur, needs to use ajax to call an action > with its value as a parameter. > > now ideally this would be accomplished with > > onblue="remoteFunction(array('url'=>array > ('controller'=>'ratings','action'=>'rateItem',VALUE_GOES_HERE))); ?>" > > I've tried replacing VALUE_GOES_HERE with 'this.value', this.value, > $javascript->codeBlock('this.value') and none of them work properly. > > It seems like there would be a way to do this with cake. I've > currently solved the problem with a work around by taking the > javascript code generated by cake and copying and pasting it in place > of the $ajax->remoteFunction code. This way I can use this.value. > > The result looks like this: > > onblur = "new Ajax.Request('/charity/ratings/rateItem/' + this.value, > {asynchronous:true, evalScripts:true})" > > This works... but I don't like breaking cake convention and it seems > as though there should be a "correct" way of doing this. > > Does anybody know if there is? > > Thanks in advance! With the corresponding view to the remote function call set a variable in a hidden field. And then, in the "oncomplete" attribute, use something like Form.Element.setValue('YourField', $F('HiddenField')); Best regards. -- MARCELO DE F. ANDRADE Belem, PA, Amazonia, Brazil Linux User #221105 --~--~-~--~~~---~--~~ 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 hosting problem....
On Fri, Nov 6, 2009 at 8:23 AM, Jay wrote: > > Hi, > > I have a cakephp application running properly on localhost. but wen > hosted to hosting account giving 404 not found error. > > and .htaccess files are not uploading... > > can anyone tell me wats the problem? You said. Your .htaccess files are not uploading. Maybe you should try use CakePHP without mod_rewrite. Uncomment the App.baseUrl configuration key in your app/config/core.php file. Best regards. -- MARCELO DE F. ANDRADE Belem, PA, Amazonia, Brazil Linux User #221105 --~--~-~--~~~---~--~~ 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: the white screen of death
>From previous experience the main cause for this is when debug_backtrace() is called, in the global debug() declaration (basics.php:114). It chokes with undefined variables (in some installations, such MAMP, this is a pain) and sometimes with very deep associative arrays. This message is not too helpful since I have no idea how to solve this, other than using var_dump() or print_r() in WSOD situations. On Nov 6, 8:28 pm, Pedro Nascimento wrote: > I got one after copying some config options on files as database.php, > core.php and app_controller.php using wrong symbols such as ` instead of '. > It's a stupid mistake, but I have done it once or twice already. :> > > On Fri, Nov 6, 2009 at 20:08, Tonu Tusk wrote: > > > OK, I doubt this will be of too much help, but the main causes of WSOD > > I have encountered have been models not being declared in a > > controllers $uses var > > (where a controller is using other than its standard related model) > > > OR some bad relationships declared in model classes > > > (I am still a bit unsure of it all, but if i had model A hasOne modelB > > and modelB belongs to modelA, that really seems to bomb things out for > > me even though it seems quite intuitive to do so) > > > Oh yeah, and on one of my other recent posts I was getting random WSOD > > which turned out to be mod_security installed on my shared host which > > did not seem to like the combination of either large or a large number > > of input in post data in combination with being routed through > > mod_rewrite. > > > Go figure. > > > Has anyone else got any "d'oh" obvious and common errors which have > > led to WSOD to share? > > > On Nov 6, 9:04 pm, "gimperdan...@gmail.com" > > wrote: > > > Yep, > > > > I already do debug($variable), but when code gets long, it can get > > > pretty frustrating to test everything. Not to mention that if I get > > > the white screen than I can't see anything including debug(var). > > > > My debug option is set to 3. Which is the max, but it doesn't change > > > anything. > > > > On Nov 6, 3:14 pm, Céryl wrote: > > > > > In addition, if the debug level is 2 you can add debug($variable) > > > > (Either in controller or view) to your code to check that var... So > > > > you can see if it's an improperly set variable that causes you to > > > > white-out... > > > > > On 6 nov, 21:00, jacmoe wrote: > > > > > > Open app/config/core.php and set the debug level to 1 or 2. :) > > > > > > On Nov 6, 4:16 pm, "gimperdan...@gmail.com" > > > > > wrote: > > > > > > > More often that I would like to I get the "white screen of death", > > > > > > which tells me something is wrong with my cold. Is there a way to > > get > > > > > > printed errors? instead of the white screen? --~--~-~--~~~---~--~~ 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.org hacked?
There are a lot of boring frameworks with boring websites and luckily cakephp is not one of them ;) Hooray to cakephp ! Can we have a cool theme for the New Year too ? :) On Thu, Nov 5, 2009 at 3:31 PM, jacmoe wrote: > > Frameworks are serious?? :) > Well, I don't know.. > > Sri Sri Ravi Shankar wrote: >> Life is nothing to be very serious about. > > On Nov 3, 11:50 pm, on24 wrote: >> Hmmm, I just don't like this "funny" theme. My first thought was >> "CakePHP gone?! Too bad. Let's check Code Igniter then". Serious >> things like frameworks should not try to be funny. I really can't >> promote a halloween framework to my colleagues. > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Last retrieved data accessible in model?..
I wonder whether data retrieved by last query (as a result of Model- >find() for example) is accessible in some internal Model variable? I'm trying to build custom datasource and one of the ideas was to store last retrieved data in there somewhere, but I'm not sure whether this is established practice. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---