Model-execute custom query (update) in RC3
I have a problem in an application after upgrading from 1.2.0.6311 beta to RC3. The controller has this statement in an action: $this-Advert-execute(update adverts set status='A' where id=1); In RC3, the query that is actually fired to the database is the string: 'execute'. This obviously gives an error. I noticed that the Model-execute method is no longer in the API documentation or in the cookbook. Is the above problem a bug, or has the execute method been deprecated? Replacing execute by query seems to fix the problem: $this-Advert-query(update adverts set status='A' where id=1); Thanks, Mike --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Cake 1.2 RC2: syntax for BETWEEN operator changed?
I am having trouble specifying a paginator condition with the BETWEEN operator after upgrading to RC2. In 1.2.0.6311 beta: $paginatorScope[Advert.status BETWEEN] = A AND B; generates corresponding SQL: `Advert`.`status` BETWEEN 'A' AND 'B' In 1.2.0.7296 RC2 the same condition generates: `Advert`.`status` = 'BETWEEN A AND B' If I change the condition to: $paginatorScope[Advert.status BETWEEN] = A AND B; this generates: `Advert`.`status` BETWEEN 'A AND B' Looks slightly better, but still not valid SQL. What is the correct way to specify the BETWEEN syntax in RC2 ? --~--~-~--~~~---~--~~ 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: reset Session variables without any visible cause
Whether I use: $_SESSION['captcha'] or $this-Session-read('captcha') this does not make a difference in the behavior. The security level was already set to low. To me this definitely looks like a bug in RC1. On Jun 8, 6:27 pm, b logica [EMAIL PROTECTED] wrote: On Sun, Jun 8, 2008 at 4:34 AM,Mike52[EMAIL PROTECTED] wrote: I noticed this problem after upgrading from 1.2.0.6311 beta to 1.2.0.7125 RC1 My captcha check did not work after upgrading. I am using this captchahttp://captcha.ru/en/kcaptcha/in the vendors directory. The render method for the image does this: $this-controller-Session-write('captcha', $kcaptcha- getKeyString()); In the controller action (user registration) the value entered by the user is checked against the value in the session: if ($this-data['User']['captchaCode'] != $_SESSION['captcha']) { In the beta version of CakePHP, this works fine. In the RC version, $_SESSION['captcha'] is not set. This is a clear and reproducable difference between the 2 Cakephp versions. Any suggestions where to look next? $this-controller-Session != $_SESSION Also, if Security.level set to 'high' you might want to bring it down a notch. That's known to cause this sort of problem, as well. Configure::write('Security.level', 'medium'); --~--~-~--~~~---~--~~ 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: reset Session variables without any visible cause
I noticed this problem after upgrading from 1.2.0.6311 beta to 1.2.0.7125 RC1 My captcha check did not work after upgrading. I am using this captcha http://captcha.ru/en/kcaptcha/ in the vendors directory. The render method for the image does this: $this-controller-Session-write('captcha', $kcaptcha- getKeyString()); In the controller action (user registration) the value entered by the user is checked against the value in the session: if ($this-data['User']['captchaCode'] != $_SESSION['captcha']) { In the beta version of CakePHP, this works fine. In the RC version, $_SESSION['captcha'] is not set. This is a clear and reproducable difference between the 2 Cakephp versions. Any suggestions where to look next? -- Mike On Jun 6, 12:09 am, francky06l [EMAIL PROTECTED] wrote: What I have noticed is, in case of Debug 0, if you have error in your code that generates warning or error before you render the view, usually you loose yoursession. Basically you can make an error in view, you will be ok, in model or controller yoursessionis lost. Maybe I am wrong, and this was base to the 1.2 branch few weeks ago. I will make some more tests. As Chris said, I am using checkAgent = false, and security.Level to medium. hth On Jun 5, 9:36 pm, Chris Hartjes [EMAIL PROTECTED] wrote: On Thu, Jun 5, 2008 at 3:27 PM, Jeff [EMAIL PROTECTED] wrote: But, the question is, why does it happen sometimes (randomly) and not other times. I know exactly what the others are going through, because it is happening on my site too. I can do the exact same steps that killed mysession, and it will work. If it was a coding error, then it would be reproducible by doing the exact same thing that caused it to fail the first time. When things happen randomly, there are usually two possible problems: 1) the framework is wrong 2) your own code is wrong While I will concede that from time to time, the framework is wrong, more often than not it is your own code that is wrong. This is not meant as a slight, this is simply reality. I write shitty code all the time and when the app goes kablooey it is my fault, not the framework. None of the people who complained in the thread about having problems bothered to provide code samples, so who the hell knows what the problem really is. Show us a sample inhttp://bin.cakephp.orgofyour code that is not working properly and that might point these people in the right direction. -- Chris Hartjes Internet Loudmouth Motto for 2008: Moving from herding elephants to handling snakes... @TheKeyBoard:http://www.littlehart.net/atthekeyboard --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Validation on fields not in model (1.2)
I have a problem setting the error text on a form field that is not associated with the model. This is my situation: I have a registration form that allows a user to submit his email address. This form contains an input field for a captcha. The captcha text is not part of the model. And nor should it be, in my option, as it is controller logic. The controller validates the value of the captcha field. Currently, my controller action looks like this: function register() { if (!empty($this-data)) { if ($this-data['User']['captcha'] != $_SESSION['captcha']) { $this-Session-setFlash('Incorrect captcha code entered'); $this-data['User']['captcha'] = ''; return; } This works, but it does not display an appropriate error text near the captcha field. How can I set the error message/status on this field? Thanks, Mike --~--~-~--~~~---~--~~ 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: SQL log not showing when debug set to 2 (Cake 1.2)
Hi, I tried your suggestions: 1. I have the default CSS 2. Tried to disable cache, makes no difference 3. I am using MySql 5.0.41. It is part of the WOS package (http:// www.chsoftware.net/en/useware/wos/wos.htm) 4. DboSource::close() is indeed not being called. I put an echo statement in this method, and it does not display anything on screen in the development environment. So the question is: Why is DboSource::close() not being called in my development environment? Any suggestions? Thanks, Mike. On Apr 7, 8:51 pm, b logica [EMAIL PROTECTED] wrote: Could be a number of things. Do you have a CSS rule: .cake-sql-log {display: none; }? Have you tried disabling cache in core.php? Configure::write('Cache.disable', true); What database are you using? I wonder if the wrapper isn't calling DboSource::close() (which, in turn, displays the log table). Also, DboSource::showLog() won't create the table for CLI PHP. Maybe you have some funky setup? ;-) On Sun, Apr 6, 2008 at 4:25 AM,Mike52[EMAIL PROTECTED] wrote: I have a strange problem which is very likely related to my setup. (Running Cake 1.2) When running my application on the production server, the debug level works as expected. On my local development machine however, I have this behavior: Configure::write('debug', 2); // No SQL debug produced Configure::write('debug', 3); // Controller dump produced, No SQL debug produced Any suggestions where the problem may be? Could it be a setting in my PHP or MySQL installation? Thanks, Mike --~--~-~--~~~---~--~~ 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: XML trouble
You could get the value in a quick-and-dirty way by using a regex. The function below takes the xml data as a string and you pass it the name of the tag: function getTagValue($xmldata, $tag) { $pattern = /$tag(.*)\/$tag/; preg_match($pattern, $xmldata, $matches); return $matches[1]; } $coordinate = getTagValue($xmlstring, 'coordinates'); On May 4, 8:54 am, David [EMAIL PROTECTED] wrote: Hey folks, I'm fairly new to Cake, so bear with me. My question is about Cake's XML class: Specifically, I'm trying to parse an XML file like this: kml Response name723 Chestnut Street, Philadelphia, PA 19106/name Status code200/code requestgeocode/request /Status Placemark id=p1 address723 Chestnut St, Philadelphia, PA 19106, USA/address AddressDetails Accuracy=8 Country CountryNameCodeUS/CountryNameCode AdministrativeArea AdministrativeAreaNamePA/AdministrativeAreaName Locality LocalityNamePhiladelphia/LocalityName Thoroughfare ThoroughfareName723 Chestnut St/ThoroughfareName /Thoroughfare PostalCode PostalCodeNumber19106/PostalCodeNumber /PostalCode /Locality /AdministrativeArea /Country /AddressDetails Point coordinates-75.153277,39.949768,0/coordinates /Point /Placemark /Response /kml Trick is I only want the coordinates. I'm also somewhat new to working with XML, so I might be missing something completely obvious here. Anywho, I can get the XML to load fine with $feed = new XML($url); I just can't figure out how to parse it and get to that one piece of data. You're help is greatly appreciated. Thanks in advance. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
SQL log not showing when debug set to 2 (Cake 1.2)
I have a strange problem which is very likely related to my setup. (Running Cake 1.2) When running my application on the production server, the debug level works as expected. On my local development machine however, I have this behavior: Configure::write('debug', 2); // No SQL debug produced Configure::write('debug', 3); // Controller dump produced, No SQL debug produced Any suggestions where the problem may be? Could it be a setting in my PHP or MySQL installation? Thanks, Mike --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Cake Translation Project: where are the files
On http://translation.cakephp.org/ a list of supported languages can be found. I would expect that this means that the default validation messages have been translated. Is this correct? Where can we then find these translations? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
debug=2 = page doesn't render in IE6 (cake 1.2)
Using Cake 1.2 (1.2.0.5427alpha) On Firefox, no problems, but on IE6, I get a blank screen. If I change debug=1, then I DO get my page in IE 6. So it is the combination debug=2 and browser=IE6 that causes the problem. In IE6, the View | Source shows an empty HTML body, but this this not reliable for what is really transmitted over http. So I installed Fiddler (http://www.fiddler2.com, highly recommended) to debug what was really going on. I see here that is page really *is* transmitted. The only strange thing I see, is that the page has an irregular structure. It starts with: pre class=cake_debug ...(44 lines of html deleted) ... !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http:// www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd html xmlns=http://www.w3.org/1999/xhtml; head So there are many lines before the !DOCTYPE tag. I have a feeling that this messes up the parsing/rendering in IE6, but this is really hard to prove. If I save the same content as an HTML file (after capturing it from the http proxy), then this file renders fine in IE6. Suggestions anyone? Thanks, Mike --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
HTML tables without borders - How?
Hi, for layout purposes, I need a table that will display without borders, or any other table attributes defined in the cakephp stylesheet. Before you object to using tables for layout purposes: the guy that makes the layouts does it this way. Getting him to use pure css is a fifferent discussion. So a regular table in a view, is displayed with borders. I tried adding this to the stylesheet: .plain table { border-top: none; border-left: none; border-bottom: none; } And then defining a table as: table class=plain But this has no effect whatsoever. The only way that I have gotten to work is this: table style=border:none trtd style=border:noneCELL_CONTENTS/td/tr /table Having to suppress the border for each TD tag is a pain. There must be an easier way. Suggestions anyone? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Reduce font size in cake.generic.css
I would like to reduce the font size, for all styles. The effect should be similar to reducing the font size via ctrl- scrollwheel in the browser. Can this be easily done in the stylesheet? I tried adding this to the body selector in the css: font-size: 80%; But this only affected the body text (i.e. not the text enclosed in other styles). Do I really need to modify every style in cake.generic.css? Or is there a way to reduce the base font size, so that all styles keep their relative size to this base font? I know that this is more a CSS question than a cakephp question. Apologies. Thanks, Mike --~--~-~--~~~---~--~~ 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 change name of view in controller?
In a controller action, I want to set the name of the view that will be auto-rendered after the action. The render() method renders the view immediately. I only want to set the name. The reason is this: I have two views for editing a widget. The action looks like this: read widget if condition { set view to edit_small.ctp } else set view to edit_large.ctp } if condition1 { return } if condition 2 { return } So the action has multiple exit-points. If I were to use the render() method, I would have to do this at each exit point. It can be done, of course. But I was wondering whether there is a more elegant way. Thanks. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Cake 1.2: Displaying checkboxes in view-screens
Hi, In my Users table I have a boolean field named active and defined as a tinyint(1). The Edit screen nicely shows this field as a checkbox. This seems to be some magic of: $form-input('active') Now, this field is simply displayed as a 1 or a 0 in the View or List screens. The scaffolded code reads: echo $user['User']['active'] I would like to have the field displayed here as a checkbox also. I tried a few things, and they are puzzling me: echo $form-checkbox('User.active', array('checked' = $user['User'] ['active'] )) I would expect this to work, but the checkbox is always unchecked, regardless of the value of the active field. Next attempt: echo $form-checkbox('User.active', array('checked' = $user['User'] ['active']==1 )) Although this seems equivalent to the previous one, it does work. Displays the field correctly. But you can edit the field in the View screen (of course it will not save). So making it display as a disabled checkbox: echo $form-checkbox('User.active', array('checked' = $user['User'] ['active']==1 ,'disabled' = 'disabled')) OK, this works. Thanks for your attention so far. Now my question: This is a lot of code for each checkbox. Is there a shorter or more elegant way to achieve this? Thanks, Mike PS: I am using the nightly build of 1.2 which I grabbed a few days ago. So if you cannot find $form-checkbox you may need to grab a more recent version. PPS: If you want to suggest html-checkbox, it has been deprecated. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
One application, different views for each virtual host
Hi, I want to have one CakePHP application serving several sites. Each site has its own virtual host. I want each site to have its own look. I have done this before in Smarty by simply setting the template directory and the compiled-template directory. Something like this: class AppSmarty extends Smarty { function AppSmarty() {// Constructor $this-template_dir = 'templates/' . $_SERVER['SERVER_NAME']; $this-compile_dir = 'templates_c/' . $_SERVER['SERVER_NAME']; } } How can I do something similar in Cake? I know I can explicitly render a particular view in a controller action. But is there an easier way? And what about: - /app/views/pages/home.thtml - /app/views/layouts/default.thtml. And is there a caching issue to take into account/? Thanks, Mike --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---