Re: Bookmarkable AJAX URLs
Afaik using # is the way to go. Changing any other aspect of the url besides what comes after the # will result in a load of the changed url by the browser. You don't need Cake to change the url's, just some javascript code that you execute every time the user navigates using your ajax links. On Fri, Apr 16, 2010 at 5:41 PM, Dmitry Shevchenko dmitr...@gmail.comwrote: Hi! I use ajax link (by ajax helper) in my current app almost everywhere. I now, when user navigate throw the site, URLs in the browser address line didn't changed. That's why user can't create bookmarks. Does anyone knew, how to push browser change address line, or some other workaround. p.s. I knew one way - add # to each url. Browser will automatically add this parameter to address line. But seems that this is too ugly workaround. (And I don't know how to implement it by using Cake) Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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.comcake-php%2bunsubscr...@googlegroups.comFor more options, visit this group at http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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: File serving?
Okay, that could also work :) On Fri, Oct 23, 2009 at 8:46 AM, Miles J mileswjohn...@gmail.com wrote: Or you know, use the built in Media view. http://book.cakephp.org/view/489/Media-Views --~--~-~--~~~---~--~~ 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: has many validation
http://book.cakephp.org/view/150/Custom-Validation-Rules On Wed, Oct 21, 2009 at 10:24 PM, kangur91 kangu...@gmail.com wrote: Hello, I've got table with Fields Name and file_id If I add data to the table, should execute validation. And not add to the table if this 2 fields will repeat. Anyone knows how make this way validation(two fields together)??? --~--~-~--~~~---~--~~ 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: Question Concerning Nested Relationships
Use the Containable behavior : http://book.cakephp.org/view/474/Containable On Wed, Oct 21, 2009 at 7:32 PM, Andrew and...@websitesthatdostuff.comwrote: I've got a Post model set up that has a BelongsTo relationship to a Group model. This Group is related by HABTM to 1+ Media models. The Post model has other BelongsTo and HABTM relationships to other classes. What I'd like to do is in the Post model retrieve the Media models related to it through the Group model without retrieving any more of the other relationships in the Post model. In other words, I'd like to set recursive=2 for the Group model and recursive=1 for other relationships. What's the best way to do this? Thanks! ~Andrew --~--~-~--~~~---~--~~ 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: Setting cookie for cached pages?
I haven't done this before, but I think you need to do your caching manually in each controller. http://book.cakephp.org/view/764/Cache This way you can set the cookie in your controller and then display the cached content. On Wed, Oct 21, 2009 at 3:22 PM, Kana kana@gmail.com wrote: I need to set a cookie every time a page is opened. When a page is not cached, this is no problem. But for cached pages this is. What must I do to be able to a cookie as soon as I open a cached file? Kana --~--~-~--~~~---~--~~ 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: File serving?
Below a code extract from a site that serves files not available in the webroot. The key part is setting the right headers and then using fpassthru() to stream the contents. Maybe other options are available but this has worked fine for me. ?php $artikel = null; $dataId = isset($_GET['id']) ? beveilig($_GET['id']) : ''; if ( is_numeric($dataId) ) { if ( $artikel = $db-GetRow('SELECT * FROM artikelen WHERE id = '.$dataId) ) { $path = '../artikelen/'.$artikel['folder']; // Outside webroot $fileName = $artikel['naam']; $file = fopen($path.'/'.$fileName,'r'); } } if ( LOGGED_IN $artikel!=null $file ) { header(Content-Type: application/octet-stream); header(Content-Disposition: attachment; filename=\$fileName\); header(Content-Length: .filesize($path/$fileName)); header(Cache-control: private); header(Pragma: public); header(Expires: 0); fpassthru($file); exit(); } else { // Smarty weer starten voor andere tempate $view_smarty = new Smarty(); $view_smarty-template_dir = 'templates/'; $view_smarty-config_dir = SMARTY_DIR.'configs/'; $view_smarty-compile_dir = SMARTY_DIR.'templates_c/'; // Vertalingen $view_smarty-assign('lng', $lng); $content = $view_smarty-fetch('artikelen/artikelen_viewError.html'); } ? On Thu, Oct 22, 2009 at 9:56 AM, xtraorange xtraora...@gmail.com wrote: Howdy all, First of all, let me apologize for the awkward wording of my subject, but I don't know what the technical term is for what I want to do (I'd be most appreciative if someone happened to know the right word and could share that). Basically, what I'm looking to do is securely serve files to logged in users, so that they are not getting a direct link to the file. I can handle the user management/authentication portion, the part I'm wondering is how to do the actual serving of the file. I essentially want to place the file somewhere that a user wouldn't normally be able to access (either because it's beneath the web directory or in a .htaccess protected folder). Then I want to use php to provide that file to the user, if they have the proper credentials. I know how to do this in php itself, but I'm wondering if there's a handy plugin or something pre-built in cakephp that would make this easier? Thanks! x.o. --~--~-~--~~~---~--~~ 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: Before render being called twice?
I remember a similar question some time ago on this mailing list, in the end it turned out that the use of 'requestAction' was triggering this behavior ... On Thu, Oct 22, 2009 at 7:17 AM, jacmoe jac...@mail.dk wrote: I am not a CakePhp expert, but if one or more controllers have this: function beforeRender() { parent::beforeRender(); } then it will be calling AppController::beforeRender (one more time). :) On Oct 21, 4:22 pm, euromark (munich) dereurom...@googlemail.com wrote: i used to have this problem as well with almost all before/after functions dunno what causes this On 21 Okt., 15:10, Aivaras faifas1...@gmail.com wrote: Hey, we can't unless you provide us more details. Aivaras On Wed, Oct 21, 2009 at 16:09, Amit Rawat rawatami...@gmail.com wrote: Hello friends, I am having a problem my before render function in app controller is being called twice. can anyone tell me why is this happening? --~--~-~--~~~---~--~~ 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: File serving?
No I haven't tested this code inside a Cake project :) On Thu, Oct 22, 2009 at 10:39 PM, xtraorange xtraora...@gmail.com wrote: I see, yes that would work. So there's not really a CakePHP solution? On Oct 22, 3:22 am, Bert Van den Brande cyr...@gmail.com wrote: Below a code extract from a site that serves files not available in the webroot. The key part is setting the right headers and then using fpassthru() to stream the contents. Maybe other options are available but this has worked fine for me. ?php $artikel = null; $dataId = isset($_GET['id']) ? beveilig($_GET['id']) : ''; if ( is_numeric($dataId) ) { if ( $artikel = $db-GetRow('SELECT * FROM artikelen WHERE id = '.$dataId) ) { $path = '../artikelen/'.$artikel['folder']; // Outside webroot $fileName = $artikel['naam']; $file = fopen($path.'/'.$fileName,'r'); } } if ( LOGGED_IN $artikel!=null $file ) { header(Content-Type: application/octet-stream); header(Content-Disposition: attachment; filename=\$fileName\); header(Content-Length: .filesize($path/$fileName)); header(Cache-control: private); header(Pragma: public); header(Expires: 0); fpassthru($file); exit(); } else { // Smarty weer starten voor andere tempate $view_smarty = new Smarty(); $view_smarty-template_dir = 'templates/'; $view_smarty-config_dir = SMARTY_DIR.'configs/'; $view_smarty-compile_dir = SMARTY_DIR.'templates_c/'; // Vertalingen $view_smarty-assign('lng', $lng); $content = $view_smarty-fetch('artikelen/artikelen_viewError.html'); } ? On Thu, Oct 22, 2009 at 9:56 AM, xtraorange xtraora...@gmail.com wrote: Howdy all, First of all, let me apologize for the awkward wording of my subject, but I don't know what the technical term is for what I want to do (I'd be most appreciative if someone happened to know the right word and could share that). Basically, what I'm looking to do is securely serve files to logged in users, so that they are not getting a direct link to the file. I can handle the user management/authentication portion, the part I'm wondering is how to do the actual serving of the file. I essentially want to place the file somewhere that a user wouldn't normally be able to access (either because it's beneath the web directory or in a .htaccess protected folder). Then I want to use php to provide that file to the user, if they have the proper credentials. I know how to do this in php itself, but I'm wondering if there's a handy plugin or something pre-built in cakephp that would make this easier? Thanks! x.o. --~--~-~--~~~---~--~~ 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 - Can't write the SQL query in CakePHP style
Don't know if it helps but you map two sums to the same column alias 'amount' , I think you should make them unique ... On Thu, Oct 15, 2009 at 3:13 PM, logout stefano...@gmail.com wrote: Guys, I have a problem. I tried to write one SQL query useing the CakePHP style, but I failed. Can someone help? Here are the tree models: 1. Currency with fields: id name 2. Invoice with fields id amount currency_id (the FK) ... some other fields 3. Writedown with fields id amount invoice_id (the FK) ... some other fields The relations between these models are: Currency hasMany Invoice Invoice hasMany Writedown Invoice belongsTo Currency Writedown belongsTo Invoice Now I want to get the sums of the amounts of all invoices and all writedowns and grouping them by the currency In the Invoices controller I use this query to do the job: $sums = $this-Invoice-query( 'SELECT `Currency`.`name`, `Currency`.`id`, SUM(`Invoice`.`amount`) as amount, SUM(`Writedown`.`amount`) as wd_amount FROM `currencies` as `Currency`, `invoices` as `Invoice`, `writedowns` as `Writedown` WHERE `Invoice`.`id` = `Writedown`.`invoice_id` AND `Invoice`.`currency_id` = `Currency`.`id` GROUP BY `Currency`.`id`' ); So I get this result: Array ( [0] = Array ( [Currency] = Array ( [name] = EUR [id] = 1 ) [0] = Array ( [amount] = 1000 [wd_amount] = 0 ) ) [1] = Array ( [Currency] = Array ( [name] = USD [id] = 2 ) [0] = Array ( [amount] = 1500 [wd_amount] = 300 ) ) ) and it is exactly what I want. I tried to use the find('All') function: $sums = $this-Invoice-find('all', array( 'conditions' = $invoiceConditions, 'fields'=array('Currency.name', 'SUM(Invoice.amount) as amount', 'SUM(Writedown.amount) as amount'), 'group' = array('Currency.id'), 'order' = array('Currency.id') ) ); (The $invoiceConditions contains some conditions for period and other stuff) but without any success. The error is SQL Error: 1054: Unknown column 'Writedown.amount' in 'field list' Whatever I try, it doesn't work. I can live with the query(), but I want to know how can I write it in the CakePHP style. I also looked at the resulting query and found that it left joins only the Currency model and it doesn't do anything about the Writedown model. If I remove the 'SUM(Writedown.amount) as amount' field, I get this result: Array ( [0] = Array ( [Currency] = Array ( [name] = EUR [id] = 1 ) [0] = Array ( [amount] = 1000 ) ) [1] = Array ( [Currency] = Array ( [name] = USD [id] = 2 ) [0] = Array ( [amount] = 1500 ) ) ) just to show you that it works at some point. --~--~-~--~~~---~--~~ 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: Notice+error after file upload
Setting debug to 0 will work around your problem since PHP notices won't be shown then. Of course, the real root of the problem is the fact that the uploader tries to access an array with a var that doesn't exist. Have a look at the script on line 695 and try to figure out why it's not set. Possibly it's a small bug, then you should contact Miles :) On Wed, Oct 7, 2009 at 11:28 PM, emmexx emmeics...@gmail.com wrote: I use Miles Johnson's Uploader plugin in a model. http://www.milesj.me/resources/script/uploader-plugin On my pc I have no problem. On the host where I'm testing my application after saving a record a receive the following messages. The page seems partially broken, it is not the index page, but I verified that the file has been uploaded and the record saved. How can I remove this message? thank you maxx Notice (8): Undefined index: group [APP/plugins/uploader/controllers/ components/uploader.php, line 695] Code | Context $this = uploadercomponent uploadercomponent::$_log = NULL uploadercomponent::$version = 2.1 uploadercomponent::$data = array uploadercomponent::$logs = array uploadercomponent::$current = filename uploadercomponent::$enableUpload = true uploadercomponent::$maxFileSize = 5M uploadercomponent::$maxNameLength = 40 uploadercomponent::$scanFile = false uploadercomponent::$tempDir = /a_path/cake2/app/tmp/ uploadercomponent::$uploadDir = files/uploads/ uploadercomponent::$mimeTypes = array uploadercomponent::$enabled = true uploadercomponent::$Controller = resourcescontroller object uploadercomponent::$Folder = folder object uploadercomponent::$finalDir = /a_path/cake2/app/webroot/files/ uploads/ $file = filename $options= array( name = null, overwrite = false, multiple = false ) $defaults = array( name = null, overwrite = false, multiple = false ) upload - [internal], line ?? uploadercomponent::upload() - APP/plugins/uploader/controllers/ components/uploader.php, line 695 resourcescontroller::add() - APP/controllers/resources_controller.php, line 26 resourcescontroller::dispatchmethod() - CORE/cake/libs/object.php, line 115 dispatcher::_invoke() - CORE/cake/dispatcher.php, line 227 dispatcher::dispatch() - CORE/cake/dispatcher.php, line 194 [main] - APP/webroot/index.php, line 88 Warning (2): Cannot modify header information - headers already sent by (output started at /a_path/cake2/cake/basics.php:111) [CORE/cake/ libs/controller/controller.php, line 640] --~--~-~--~~~---~--~~ 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: Notice+error after file upload
Well to find out why it is behaving differently you first need to find out what is causing the problem ... On Thu, Oct 8, 2009 at 8:45 AM, emmexx emmeics...@gmail.com wrote: On 8 Ott, 08:01, Bert Van den Brande cyr...@gmail.com wrote: Setting debug to 0 will work around your problem since PHP notices won't be shown then. I presumed that... :-) My question was about the different behaviour on my laptop and on my web host. The debug level is the same: 2. On my pc the notice is only present in the debug.log. Of course, the real root of the problem is the fact that the uploader tries to access an array with a var that doesn't exist. Have a look at the script on line 695 and try to figure out why it's not set. Possibly it's a small bug, then you should contact Miles :) Or Miles should contact me! ;-) Thank you maxx --~--~-~--~~~---~--~~ 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: how to create drop-down list
You can use the FormHelper : http://book.cakephp.org/view/728/select On Thu, Oct 8, 2009 at 1:09 AM, gopallal gopal...@gmail.com wrote: Hi, I am new for cakephp. I have a requirement which is very common. I have to create drop-down list of locality in a form where that form belongs to a table which has locality_id as a foreign key. How locality name should be displayed in drop-down list and locality_id value should be saved after submitting that form. Any pointer will be very appreciable. Thanks in advance. Regards, Gopal --~--~-~--~~~---~--~~ 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 cant find XML view data
It looks for ajax.ctp because it detects the ajax request header in the request when you make your call for that page : http://book.cakephp.org/view/174/Request-Handling *By default RequestHandler will automatically detect Ajax requests based on the HTTP-X-Requested-With header that many javascript libraries use. When used in conjunction with Router::parseExtensions() RequestHandler will automatically switch the layout and view files to those that match the requested type.* Glad to help, enjoy your Cake coding :) On Mon, Oct 5, 2009 at 6:51 PM, bRuNuShky marcelo.stan...@gmail.com wrote: Hi, Bert Thanks... !!! .. I was using level 1 in debug... but don't consider that up this to 2 will give me any details in this particular case... (I missing the point that although it's call through javascript debug will show somethign) ...also I foget that I set debug to 0 in the controller function... :( Anyway you recomendation open my eyes... and I found that it was looking for view/layout/xml/ajax.ctp and not the default view view/ layout/xml/default.ctp ... This could be because I did the call with Javascript? ... so I try with ajax.ctp and everything works fine, but I ended adding layout = 'default' to my controller..and it works view/layout/xml/default.ctp ...So both ways works fine now, but Im a bit curious about why So lesson learned, if something goes wrong... up debug level !!! ;) Thanks Bert I really appreciate your 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 cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Different Validation for same model.
Add some custom validation methods to your model , and inside these methods you can perform a check to determine if the validation really needs to be executed or if you can simple return true. On Tue, Oct 6, 2009 at 7:22 AM, #2Will willjbar...@gmail.com wrote: Hi all, Is it possible to have different validation for a form for the same model, depending on circumstance. ? eg, if a user leavers a comment when not logged in, entering their email address is required - but when logged in it isn't. So in the Admin area, i don't want to require it (because some records won't have a email address, so the validation will stop me saving changes to the record) but on the web site, i do. --~--~-~--~~~---~--~~ 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: Different Validation for same model.
I don't prefer manually changing $validate since this moves the validation logic out of the model to the controller. Then if you start using the same model in a second controller you need to re-implement the validation logic all over again. Didn't know about the existance of MultivalidatableBehavior nice tip ! On Tue, Oct 6, 2009 at 10:35 AM, Dr. Loboto drlob...@gmail.com wrote: You can change $validate array yourself before save. Or use Multivalidate behavior: http://bakery.cakephp.org/articles/view/multivalidatablebehavior-using-many-validation-rulesets-per-model On Oct 6, 12:22 pm, #2Will willjbar...@gmail.com wrote: Hi all, Is it possible to have different validation for a form for the same model, depending on circumstance. ? eg, if a user leavers a comment when not logged in, entering their email address is required - but when logged in it isn't. So in the Admin area, i don't want to require it (because some records won't have a email address, so the validation will stop me saving changes to the record) but on the web site, i do. --~--~-~--~~~---~--~~ 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: Recherche un composant Date (calendrier)
I don't think most people on this list speak French, so please post in English in the future. As far as I know there is no Date component , but since Cake is a PHP framework you can use the Zend_Date component inside Cake ? 2009/10/6 Bouti boutiarz...@hotmail.fr Bonjour à tous, Existe t-il un composant date pour cakephp équivalent au composant Zend_Date du framework Zend Framework. Je souhaite aller plus loin avec les calculs sur les dates, par exemple : - récupérer tous les 3éme vendredi du mois à partir du 01/10/2009 jusqu'au 02/05/2010 - enlever de mon calendrier toutes les séances prévue sur un jour férié - inscrire des périodes de congés et si une séance y est inscrite la reporter - j'ai besoin d'un composant qui va pouvoir gérer un calendrier de séances en prenant en compte les jour fériés et les périodes de congés. merci d'avance --~--~-~--~~~---~--~~ 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: PHP tracking when an external domain uses an image from your server
Do a var_dump($_SERVER); in tracker.php and see what you can use ... On Mon, Oct 5, 2009 at 5:21 PM, Dustin dustingri...@gmail.com wrote: I've tried searching for this but no luck, please let me know if you've seen this posted before. I want to let some other sites use my images. (http://example.com/ sample.jpg http://example.com/%0Asample.jpg) and keep track of each time they use the image. So I write track.php to save the request into a DB, then return the image requested from a URL parameter (http://example.com/track.php? returnimage=sample.phphttp://example.com/track.php?%0Areturnimage=sample.php) Now any of these external sites can use my image in their HTML img src=http://example.com/track.php? returnimage=sample.phphttp://example.com/track.php?%0Areturnimage=sample.php and I get my tracking. Works great. Now I want to also keep track of which URL or domain has requested an image. I thought I could use $_SERVER['HTTP_REFERER'] in track.php to see what URL it is coming from, although no luck. It doesn't look like any of the server/environment variables will return domain info I am looking for from this external site. I would like to hold off on adding an addition parameter to the request (http://example.com/ track.php?returnimage=sample.phpexternalsite=example.comhttp://example.com/%0Atrack.php?returnimage=sample.phpexternalsite=example.com ) Any ideas/possible? I really appreciate any help. Thank you very much! -Dustin --~--~-~--~~~---~--~~ 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 cant find XML view data
Have you edited your routes.php file to match the pattern '/mycontroller/myfunction/1' ? You need something like this : $Route-connect('/mycontroller/myfunction/*', array('controller' = 'mycontroller', 'action' = 'myfunction')); On Mon, Oct 5, 2009 at 8:12 AM, bRuNuShky marcelo.stan...@gmail.com wrote: Hi, I really need help to understand something...( also finish it) I was reading some notes from http://www.littlehart.net/atthekeyboard/2007/03/13/how-easy-are-web-services-in-cakephp-12-really-easy/ . about web service So after read this I work my own test... I created controller function like in the example with all the data I need... also the xml view under the same controller view folder ... so if I point my browser to mycontroller/myfunction/1 .. I get the render of a nice XML file ...so everything if ok here but when I set the same path in my javascript file (where I need to read this XML) I get a ugly The requested address strong'/mycontroller/myfunction/1'/strong was not found on this server. If I change my code like some users said in tutorial... I end that I can read mycontroller/myfunction.xml with my javascript but I'm unable to set the extra parameter I need (/1)... here is my javascript call (I use all the alternatives in URL and nothing change) $.get('/mycontroller/myfunction/1', function(data) { alert(data); }) So if some one can help me to understand this or give me and advise about it I will realy appreciate it ... 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: sorting records with order by and group by
Do you mean that you executed the query from the Cake debug information directly on your mysql-server ? If that is the case I have no idea where the difference in results is coming from ... On Mon, Oct 5, 2009 at 8:32 AM, vekija vedran.konto...@gmail.com wrote: Hi, I'm having a problem with sorting the recordset with order by and group by statements. Would appreciate any help. There are 2 models, Team and Vote (Team has many Votes) and I want to order teams based on the number of votes they got. Here's the find call: $teams = $this-find('all', array('fields' = 'Vote.team_id', 'order' = 'COUNT('Vote.team_id'), 'group' = 'Vote.team_id')); At the moment there' s only one team in the database with 3 votes. However, the above query returns 2 (duplicate) records but when I place the same query directly in the mysql it works as expected and I get only one. Any ideas? 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 don't execute model trigger plugin's
Can't find anything wrong that would relate to LikecontentSection::beforeSave() not being executed. A quick debug using XDebug should help you solve this :) On Sun, Oct 4, 2009 at 4:29 PM, AgBorkowski andrzejborkow...@gmail.comwrote: for eg. ?php class SectionsController extends LikecontentAppController { public $helpers = array ('Html', 'Form', 'Text'); public $uses = array ('Likecontent.LikecontentSection','Likecontent.LikecontentContent'); [...] function admin_edit($id = null) { $this-layout = 'admin'; if (! $id empty ( $this-data )) { $this-Session-setFlash ( __ ( 'Invalid LikecontentSection', true ) ); $this-redirect ( array ('action' = 'index' ) ); } if (!empty ( $this-data )) { if ($this-LikecontentSection-save ( $this-data )) { $this-Session-setFlash ( __ ( 'The LikecontentSection has been saved', true ) ); $this-redirect ( array ('admin' = true, 'action' = 'index' ) ); } else { $this-Session-setFlash ( __ ( 'The LikecontentSection could not be sa [] ? On 3 Paź, 23:26, Bert Van den Brande cyr...@gmail.com wrote: Can you show some code where the save() is called ? On Sat, Oct 3, 2009 at 7:55 PM, andrzejborkow...@gmail.com andrzejborkow...@gmail.com wrote: save section is ok, but this triger beforeSave don't execute and dont return any value, only working trigers are in LikecontentAppModel whats going one ? ?php class LikecontentSection extends LikecontentAppModel { public $validate = array( 'title' = array('notempty'), 'text' = array('notempty') ); //The Associations below have been created with all possible keys, those that are not needed can be removed public $hasMany = array('Likecontent.LikecontentContent'); public function beforeSave(){ echo 'dupa'; exit; if(empty($this-data['LikecontentSection']['text']) || empty($this- data['LikecontentSection']['url']) || $this-data ['LikecontentSection']['subpage'] == 0){ $this-data['LikecontentSection']['text'] = ''; $this-data['LikecontentSection']['url'] = ''; } return true; --~--~-~--~~~---~--~~ 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 cant find XML view data
Have you set debug to 1 or 2 in core.php ? 'Page not found' is the default error message you get from if anything at all goes wrong while rendering the requested page. Setting debug to 1 or 2 will show you more information on the reason why the page can't be rendered. On Mon, Oct 5, 2009 at 4:49 PM, bRuNuShky marcelo.stan...@gmail.com wrote: Hi, Mmmm ok but this is to redirect the call to an specific controller action... actually its works fine ... outside the javascript call anyway I try what you said but javascript still have problems to find the page... for more details http://mysite.com/mycontroller/myfunction/1 return an XML its works fine node datadata/data /node but if I call it with javascript using http://mysite.com/mycontroller/myfunction/1 or simply /mycontroller/myfunction/1 i get a not page found If I change the code the URL change something like this but result is the same http://mysite.com/mycontroller/myfunction.xml...in this way javascript now find the url..but I cant understand how to send extra data with the URL... Thanks Bert --~--~-~--~~~---~--~~ 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: Access Classes In Layout Help??
It probably is a $ conflict. Try assigning $j or something like that to the JQuery var and see if it resolves your problem. For reference : http://docs.jquery.com/Using_jQuery_with_Other_Libraries On Tue, Oct 6, 2009 at 12:15 AM, hahmadi82 hahmad...@gmail.com wrote: Nevermind, I got it all to work. Thank you guys a ton! I learned so much and I finally achieved what I was looking for. One last question if it's not too much a bother... Our website uses JQuery and for this ajax observeField thing to work I use a javascript-link('prototype'). However, if prototype is enabled, all the JS doesn't work. Any ideas how I can get these two to work together? I read about conflicts with $ but it doesn't seem to apply in my case. brian-263 wrote: Put the select widget in an element. Get the select options with requestAction(). And cache the options so you don't have to fetch them from the DB each time. You don't need to change the target of the AJAX call. It doesn't matter what view you're in. It's just like any other link. On Sat, Oct 3, 2009 at 3:06 PM, hahmadi82 hahmad...@gmail.com wrote: Yea, probably much easier for me to explain what I've done and what I'd like to do. So basically I implemented the ajax select box using the code below: http://www.devmoz.com/blog/2007/04/04/cakephp-update-a-select-box-using-ajax/ My code set up is more less the same as the example posted in that article. The ajax select box I created allows a user to select a car make, then year, then model. Currently, I have this working in index.ctp just like the example, and the ajax calls the update_select.ctp. What I would like to do, is move this ajax selector into my navigation bar so that the user can change is car at any point during his browsing experience. This means that no matter what view he's on, he can still use my ajax selector through the navbar. The complication is that my code is in my car_controller index.ctp and uses update_select.ctp with observefield (like the example). I want to somehow move this code/functionality into my default.ctp. Perhaps you guys can suggest the best strategy? Even if I move the code from index.ctp to default and access the set variable from the app_controller before filter (as suggested), I still have the issue of ajax having to call the update_select function which I have no idea where I would move it to (perhaps in the app_controller?)... I apologize for the constant questions and greatly appreciate the help you guys have been giving me :) And then we scroll back 15 emails : If this works, then I would suggest to add your layout data to the view inside the beforeFilter() method of AppController and then use this data in your layout. Might even consider creating an element for the part that uses this data ... :) On Sat, Oct 3, 2009 at 10:34 AM, Miles J mileswjohn...@gmail.com wrote: Do it in the beforeFilter() of your AppController, that will apply it to all views and layouts. On Oct 3, 1:18 am, hahmadi82 hahmad...@gmail.com wrote: Now I see! So the set variables change depending on which view is showing within the default.ctp. If I add this car action to the app_controller (instead of car model) and set the variables there, will all the views have access to that variable? How can I make a global set variable that comes from a specific query? brian-263 wrote: On Fri, Oct 2, 2009 at 10:55 PM, hahmadi82 hahmad...@gmail.com wrote: Ok so I actually didn't create a layout for each view from my controllers. Instead, all the views use the same layout, which is the default.ctp. Is that incorrect? From my understanding, the default layout is loaded by every view and that's why I have my navigation bar in it. It seems that I can only access those set variables from something like views/layouts/cars/index.ctp but not views/layouts/default.ctp. Is there a difference between the model layouts and the default layout? You *almost* have it. Once again: When a controller's action is run, its render() method is called automatically (yes, you can call it yourself but please ignore that for now). When that happens, Cake will use the View class to render the view template for that action. These templates are in app/views/controller_name_ending_in_s/action_name.ctp Usually, the view template contains some HTML that you have included, along with some variables. Those variables are passed to the View class through the controller's $viewVars class variable. When you call $this-set('foo', 'bar'), you are passing the value, 'bar' to the controller's $viewVars array with a key, 'foo'. When the controller's $viewVars is handed off to the View class, it extracts them,
Re: Auth component loop redirect
Hmm tricky stuff indeed, must remember this one ! On Fri, Oct 2, 2009 at 3:39 PM, brian bally.z...@gmail.com wrote: On Fri, Oct 2, 2009 at 9:36 AM, mathaios mathaio...@gmail.com wrote: Brian you nailed it...I was having a small navigation element in the layout thank you! Yeah, that one was driving me nuts once. I was so happy to find that post! --~--~-~--~~~---~--~~ 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: Access Classes In Layout Help??
And then we scroll back 15 emails : quote If this works, then I would suggest to add your layout data to the view inside the beforeFilter() method of AppController and then use this data in your layout. Might even consider creating an element for the part that uses this data ... quote :) On Sat, Oct 3, 2009 at 10:34 AM, Miles J mileswjohn...@gmail.com wrote: Do it in the beforeFilter() of your AppController, that will apply it to all views and layouts. On Oct 3, 1:18 am, hahmadi82 hahmad...@gmail.com wrote: Now I see! So the set variables change depending on which view is showing within the default.ctp. If I add this car action to the app_controller (instead of car model) and set the variables there, will all the views have access to that variable? How can I make a global set variable that comes from a specific query? brian-263 wrote: On Fri, Oct 2, 2009 at 10:55 PM, hahmadi82 hahmad...@gmail.com wrote: Ok so I actually didn't create a layout for each view from my controllers. Instead, all the views use the same layout, which is the default.ctp. Is that incorrect? From my understanding, the default layout is loaded by every view and that's why I have my navigation bar in it. It seems that I can only access those set variables from something like views/layouts/cars/index.ctp but not views/layouts/default.ctp. Is there a difference between the model layouts and the default layout? You *almost* have it. Once again: When a controller's action is run, its render() method is called automatically (yes, you can call it yourself but please ignore that for now). When that happens, Cake will use the View class to render the view template for that action. These templates are in app/views/controller_name_ending_in_s/action_name.ctp Usually, the view template contains some HTML that you have included, along with some variables. Those variables are passed to the View class through the controller's $viewVars class variable. When you call $this-set('foo', 'bar'), you are passing the value, 'bar' to the controller's $viewVars array with a key, 'foo'. When the controller's $viewVars is handed off to the View class, it extracts them, essentially creating a var named $foo that contains the value 'bar'. Now, after the View has finished using the view template to render something to output it creates a variable called, $content_for_layout. It then renders the layout template. That's a file in app/views/layout/name_of_your_layout.ctp. If you don't specify a layout, Cake uses 'default'. Inside the layout template is (should be) a variable named ... $content_for_layout. This is where the contents of your rendered view are written to the layout. So, try this: In one of your controller actions, add $this-set('foo', 'bar'); In your app/views/layouts/default.ctp add this, just above $content_for_layout echo $foo; You should see 'bar' in there, somewhere. View source and search for it, because your CSS may hide it. Anyway, perhaps you should post the relevant part of your layout file and the controller action. -- View this message in context: http://www.nabble.com/Access-Classes-In-Layout-Help---tp25706283p2572... Sent from the CakePHP mailing list archive at Nabble.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: Session / Security
I'm no expert on the subject, but I think session can be hijacked by : * 'stealing' a sessions id from the url. This is only possible if the user browser doesn't use cookies so the session id is visible in the url * stealing a session cookie In either cases, logging the user's ip would increase security imho. I'm interested in other opinions :) On Sat, Oct 3, 2009 at 10:08 PM, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: Not quite sure how this works but how does one steal a session? I have my session info stored in the database... if i added ip to the session so it also checks that the session ip matches the user ip would that increase the session sucurity? What a safe guards / good practsise to secure session data? 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: Install CakePHP in sub folder ? ? ? How can I ? ? ?
If my memory serves me well this is a sign that your host does not has enabled mod_rewrite or that the .htaccess files are not allowed by Apache config ... On Sat, Oct 3, 2009 at 8:11 PM, Dr. Loboto drlob...@gmail.com wrote: Do you have file named default.css in your app/webroot/css folder? Filename and css filder are lowecase just as href in line you posted? On Oct 3, 5:45 pm, DatacenterHellas merianosni...@gmail.com wrote: Hello all. I have install the CakePHP in a sub folder in my web hosting package (in examplehttp://www.mydomainname.ext/subfoldername/) The Cake is running very cool but I have problem with CSS and propably with other files (such as javascripts and images) tha I have not yet try. From the source code inside the Firefox I see this code for the CSS link rel=stylesheet type=text/css href=/subfoldername/css/ default.css / But my page is not styled What Can I do for ? ? ? Kind regards --~--~-~--~~~---~--~~ 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: Caching dynamic url view
Maybe it's easier in this case to perform cache reading/writing yourself ? A simple example is given here : http://book.cakephp.org/view/766/Cache-read On Sat, Oct 3, 2009 at 7:59 PM, brian bally.z...@gmail.com wrote: I misunderstood what you were looking to do. On Sat, Oct 3, 2009 at 1:16 PM, thinline thinline...@gmail.com wrote: Well most simply because It's not just the 1 page... There are hundreds of these pages posts/badge/:id/size:180x150 thats what the route would be. My issue is being able to use cacheAction to grab dynamic urls. For instance if I wanted to cache /posts/view/* how could this be done? You would not want to manually create routes and cacheAction entries for each post that is created. On Oct 3, 12:29 pm, brian bally.z...@gmail.com wrote: Why not just create a simplified route for that URL? Something like: '/badge', array('controlller' = 'posts', 'action' = 'your_action', 'id' = 23, 'size' = '180x150') On Fri, Oct 2, 2009 at 10:58 PM, thinline thinline...@gmail.com wrote: I am trying to implement full view caching for a specific method in a controller. First I realized that if you set $this-layout = false; then caching will NOT happen. I have no idea why this occurs. I am not sure if this is a bug as I had a hard time debugging out how the cache works. Once, I turned that off I was able to get my view to cache by adding var $cacheAction = 1 hour; Since I don't want to cache everything in the view I need to cache just specific methods. The URL that I would like to cache looks like this: /posts/badge/23/size:180x150 where 23 is the post ID and size is a named parameter (there are 2 variations of size). So my question is what is the proper (if any) match to place in cacheAction to cache all posts/badges/* Here are some examples that I have tried: var $cacheAction = array( 'badge/*' = '+1 hour', 'posts/badge/23/size:180x150' = '1 hour', 'badge/23/size:180x150' = '1 hour', 'posts/badge/:id/:size' = '1 hour', 'badge/:id/:size' = '1 hour', ); None of these seem to match (or at least do not cache for some reason). I do need to cache posts/badge/*/size:* and trap each of the parameters being passed. Again, if I set $cacheAction = 1 hour; then the cache file is created (the file tmp/cache/views/posts_badge_23_size_180x150.php is created) --~--~-~--~~~---~--~~ 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 don't execute model trigger plugin's
Can you show some code where the save() is called ? On Sat, Oct 3, 2009 at 7:55 PM, andrzejborkow...@gmail.com andrzejborkow...@gmail.com wrote: save section is ok, but this triger beforeSave don't execute and dont return any value, only working trigers are in LikecontentAppModel whats going one ? ?php class LikecontentSection extends LikecontentAppModel { public $validate = array( 'title' = array('notempty'), 'text' = array('notempty') ); //The Associations below have been created with all possible keys, those that are not needed can be removed public $hasMany = array('Likecontent.LikecontentContent'); public function beforeSave(){ echo 'dupa'; exit; if(empty($this-data['LikecontentSection']['text']) || empty($this- data['LikecontentSection']['url']) || $this-data ['LikecontentSection']['subpage'] == 0){ $this-data['LikecontentSection']['text'] = ''; $this-data['LikecontentSection']['url'] = ''; } return true; --~--~-~--~~~---~--~~ 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: Deploy a cakePHP work..
1. Develop Cake app locally 2. Get a webhost 3. Use ftp to upload you Cake app done ! On Sat, Oct 3, 2009 at 9:37 AM, Hafsal M 2haf...@gmail.com wrote: Please help me, am a newbie to cakephp... i dont know how a cakephp application should be hosted, how is the deploying process is... thank u 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 cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Validator message not showing
Are you setting that flash message yourself ? You can check if a save has been succesfull or not by looking at the response that comes back from the $model-save() method ... either true or false. On Fri, Oct 2, 2009 at 4:46 PM, Cristian Cassina principess...@gmail.comwrote: Hi everyone, I'm dealing with a little problem that I can't simply get rid of. I have these validation rules in the required model: var $validate = array( 'name' = array( 'rule' = 'notEmpty', 'message' = 'Il campo codice non può essere lasciato vuoto' ), 'customer_name' = array( 'rule' = 'notEmpty', 'message' = 'Il codice cliente non può essere vuoto' ), 'grammatura' = array( 'rule' = array('notEmpty', 'numeric'), 'message' = 'la scheda deve avere una grammatura' ) ); I probably didn't get the thing right, but if I try to submit the view with any of these fields empty, it flashes me Object has been saved correctly, while it didn't save anything. What am I doing wrong? Is the setFlash method totally independent from the error message in the validator? Thank you Cristian --~--~-~--~~~---~--~~ 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: Session / Security
You might want to read this : http://be2.php.net/manual/en/session.security.php On Sat, Oct 3, 2009 at 11:35 PM, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: Right on. In my app nothing is passed in the url all my non-private areas are like /manage/profile or /manage/account as everything related to the user is obtained by auth ID of the logged in user and getting the info based on that. So i was just wondering if someone did get the session, how would they do it and ways to prevent it. Thanks Dave -- *From:* Bert Van den Brande [mailto:cyr...@gmail.com] *Sent:* October-03-09 6:40 PM *To:* cake-php@googlegroups.com *Subject:* Re: Session / Security I'm no expert on the subject, but I think session can be hijacked by : * 'stealing' a sessions id from the url. This is only possible if the user browser doesn't use cookies so the session id is visible in the url * stealing a session cookie In either cases, logging the user's ip would increase security imho. I'm interested in other opinions :) On Sat, Oct 3, 2009 at 10:08 PM, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: Not quite sure how this works but how does one steal a session? I have my session info stored in the database... if i added ip to the session so it also checks that the session ip matches the user ip would that increase the session sucurity? What a safe guards / good practsise to secure session data? 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: Access Classes In Layout Help??
Well, you should test it out, but from what I can see in the source code the controller's view is rendered first and then passed on to the layout $content_for_layout. During this process it merges $this-viewVars , so I would presume that every information you made available for the controller's view will also be available for the layout. If this works, then I would suggest to add your layout data to the view inside the beforeFilter() method of AppController and then use this data in your layout. Might even consider creating an element for the part that uses this data ... Friendly greetings, Bert On Fri, Oct 2, 2009 at 12:14 AM, Miles J mileswjohn...@gmail.com wrote: Just put ?php echo $content_for_layout; ? in your layout file, and then Cake will render your controllers view within that variables location. On Oct 1, 3:05 pm, hahmadi82 hahmad...@gmail.com wrote: Correct, I want to use stuff from my cars controller in the views/layout/default.ctp. The only possible solution I can think is to use ajax to load some of the car stuff. Basically, I'm curious how you can access your database from the layout file. Miles J wrote: Im sorry but I dont understand what you are asking. Layout toolbar? Controller class? Do you mean component? Layout has no controller? Not sure what you mean there. Database in layout? You mean your result right? On Oct 1, 1:52 pm, hahmadi82 hahmad...@gmail.com wrote: Hi, I built a class with controller/views that I want displayed in my layout toolbar. Is this possible? How can I use this queried data in my layout file? Since layout has no controller, I'm not sure how I can use any database stuff in the layout -- View this message in context: http://www.nabble.com/Access-Classes-In-Layout-Help---tp25706283p2570... Sent from the CakePHP mailing list archive at Nabble.com. -- View this message in context: http://www.nabble.com/Access-Classes-In-Layout-Help---tp25706283p2570... Sent from the CakePHP mailing list archive at Nabble.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: How to $model-find for any controller
Glad to help. Just beware of the fact that requestAction adds some performance penalty to the rendering time, especially when used multiple times in a view ... On Fri, Oct 2, 2009 at 8:06 AM, DatacenterHellas merianosni...@gmail.comwrote: First of all I like to thank all of you for your responses ! ! ! ! :) Finaly I used the requestAction and it is perfect for my solution :) Kind Regards Merianos Nikos --~--~-~--~~~---~--~~ 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: Access Classes In Layout Help??
Calling $this-set('someInformation', 'someValue') in the controller will make the var $someInformation available in both the view and the layout ... I think :) On Fri, Oct 2, 2009 at 10:08 AM, hahmadi82 hahmad...@gmail.com wrote: I'm not sure I follow. How do I pass the information into the layout file? Miles J wrote: Just put ?php echo $content_for_layout; ? in your layout file, and then Cake will render your controllers view within that variables location. On Oct 1, 3:05 pm, hahmadi82 hahmad...@gmail.com wrote: Correct, I want to use stuff from my cars controller in the views/layout/default.ctp. The only possible solution I can think is to use ajax to load some of the car stuff. Basically, I'm curious how you can access your database from the layout file. Miles J wrote: Im sorry but I dont understand what you are asking. Layout toolbar? Controller class? Do you mean component? Layout has no controller? Not sure what you mean there. Database in layout? You mean your result right? On Oct 1, 1:52 pm, hahmadi82 hahmad...@gmail.com wrote: Hi, I built a class with controller/views that I want displayed in my layout toolbar. Is this possible? How can I use this queried data in my layout file? Since layout has no controller, I'm not sure how I can use any database stuff in the layout -- View this message in context: http://www.nabble.com/Access-Classes-In-Layout-Help---tp25706283p2570... Sent from the CakePHP mailing list archive at Nabble.com. -- View this message in context: http://www.nabble.com/Access-Classes-In-Layout-Help---tp25706283p2570... Sent from the CakePHP mailing list archive at Nabble.com. -- View this message in context: http://www.nabble.com/Access-Classes-In-Layout-Help---tp25706283p25711954.html Sent from the CakePHP mailing list archive at Nabble.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: Password field is automatically hashed, how to change this?
Automatic mapping will not be possible. You need to copy for example 'password1' to 'password' in the model data before saving it. (Don't forget to hash it using Auth) On Fri, Oct 2, 2009 at 9:50 AM, Mukhamad Ikhsan ikhsan.o...@gmail.comwrote: and how to set new name a form field but different with database fieldname, but still mapping automatically? in my case, password is a field on users table, if i change the code in view $this-input('passwordkey'); that form field is not mapping with password field on users table, how to still mapping both of them? i wan't to change the field on users table, because the $this-Auth-login() hard coded the checking using 'username' and 'password' field name on users table, it's annoying if create own login function. Thank's before for reply On Thu, Oct 1, 2009 at 1:15 PM, Bert Van den Brande cyr...@gmail.comwrote: As far is I know there is no configuration for this, a workaround is to name your password form fields not 'password'. Keep in mind that you have to manually hash the passwords then using $this-Auth-password($your_password) On Thu, Oct 1, 2009 at 7:56 AM, Mukhamad Ikhsan ikhsan.o...@gmail.comwrote: I have a password field that when submiting, the value is already hashed. before, I'm not really concider with this problem, but now i realize because of that, the validation for 'notEmpty' is break. Even i enter the empty, Cake automated hashed the empty value so i never get validation error for notEmpty in password field. There is some configuration for this? -- Mukhamad Ikhsan http://www.diodachi.com -- Mukhamad Ikhsan +6281572181283 Y!id:ikhsan.only http://www.diodachi.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: Help with Multiple Models + Single View required
My idea is ... that's a lot of text ! Ok j/k, what exactly are you asking for ? On Thu, Oct 1, 2009 at 9:28 PM, ashok.b email2...@gmail.com wrote: Hi everyone, I'm new to this group and to cakephp. I'm enjoying writing code with cakephp, and most of times I'm getting help from the bakery, community and googling. But am at a roadblock now, and seems like I can't find what I am looking for. My problem is as follows: Table1: tbl_messages id - integer - Auto Increment Primary Key msg - varchar - A text message Table2: tbl_accounts id - integer - Auto Increment Primary Key username - varchar - User Name of the Account userpass - varchar - Password for the Account Table3: tbl_batches id - integer - Auto Increment Primary Key bname - varchar - Name of the Batch bdesc - varchar - Description of the Batch Table4: tbl_jobs id - integer - Auto Increment Primary Key tbl_messages_id - integer - Foreign key referring to tbl_messages tbl_accounts_id - integer - Foreign key referring to tbl_accounts tbl_batches_id - integer - Foreign key referring to tbl_jobs schedtime - datetime - Date Time when to send the message The table4 contains details of jobs which will be executed using cron job. My problem now is to create a single view, which will: 1. Display a Message 2. Select a single/multiple Account/es 3. Select a single/multiple Batch/es 4. Take input date time On clicking submit, Multiple entries to be inserted in tbl_jobs, depending on number of items selected in Accounts Batches (i.e. if 2 accounts, 2 batches are selected, 4 entries to be made into tbl_jobs with values (x,msgid,accid1,batchid1,datetime) (x,msgid,accid1,batchid1,datetime) (x,msgid,accid2,batchid2,datetime) (x,msgid,accid2,batchid2,datetime) The view is achieved using the Messages Model. But from there, data from the form should be sent to Job Model which should insert in above format. Any ideas please... Thanks for patiently reading the lng post. --~--~-~--~~~---~--~~ 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: habtm limit
The query actually looks ok to me ... in what way are the results incorrect ? On Tue, Sep 29, 2009 at 8:55 PM, bram brammele...@gmail.com wrote: These are the resulting queries: SELECT `User`.`id`, `User`.`username`, `User`.`name` FROM `users` AS `User` ORDER BY `name` ASC SELECT `Event`.`id`, `Event`.`date`, `EventsUser`.`id`, `EventsUser`.`event_id`, `EventsUser`.`user_id` FROM `events` AS `Event` JOIN `events_users` AS `EventsUser` ON (`EventsUser`.`user_id` IN (3, 1, 2) AND `EventsUser`.`event_id` = `Event`.`id`) WHERE 1 = 1 ORDER BY `Event`.`date` DESC LIMIT 1 I actually don't know how to rewrite this query to get the latest associated event (one) for each user... On Sep 29, 3:30 pm, Bert Van den Brande cyr...@gmail.com wrote: Have a look at the query it generates (set debug to 2) , I'm sure this will shine a bright light on the problem ... On Mon, Sep 28, 2009 at 9:48 PM, bram brammele...@gmail.com wrote: In my app, I have a User model that has a habtm association with 'Event'. In one of the views, I want to show a list of Users and their most recent event. I ended up with this definition in the User model: var $hasAndBelongsToMany = array( 'Event' = array( 'className' = 'Event', 'joinTable' = 'events_users', 'foreignKey' = 'user_id', 'associationForeignKey' = 'event_id', 'unique' = true, 'limit' = 1, 'order' = 'Event.date DESC' ) ); find('all') returns the list of all users and only one of them has an associated event. When increasing the limit, it does show associated events, but when some user don't have events associated, some other users will have multiple events returned. Is this a cake bug or do I have the wrong impression of the limit in a habtm association? Cheers, Bram --~--~-~--~~~---~--~~ 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: Password field is automatically hashed, how to change this?
As far is I know there is no configuration for this, a workaround is to name your password form fields not 'password'. Keep in mind that you have to manually hash the passwords then using $this-Auth-password($your_password) On Thu, Oct 1, 2009 at 7:56 AM, Mukhamad Ikhsan ikhsan.o...@gmail.comwrote: I have a password field that when submiting, the value is already hashed. before, I'm not really concider with this problem, but now i realize because of that, the validation for 'notEmpty' is break. Even i enter the empty, Cake automated hashed the empty value so i never get validation error for notEmpty in password field. There is some configuration for this? -- Mukhamad Ikhsan http://www.diodachi.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: How to $model-find for any controller
In your AppController, add something like this : function beforeFilter() { $this-set('allCountries', $this-Country-findAll(); } From then on, every controller will add 'allCountries' to your views. Don't forget to have the model Country loaded one way or another ... Friendly greetings, Bert On Thu, Oct 1, 2009 at 1:51 PM, John Andersen j.andersen...@gmail.comwrote: Suggest you look into requestAction, which can be called from a view, and thus provide the view with the country list when needed! Enjoy, John On Oct 1, 2:46 pm, DatacenterHellas merianosni...@gmail.com wrote: Hello. I need your help ! I like to call some data that must be available for each view in any controller. In my case I have to loading all countries from Database table to each view. How can I do that ? ? ? Kind regards Merianos Nikos --~--~-~--~~~---~--~~ 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: Auth component loop redirect
Add $this-Auth-allow(array('login')); to your beforeFilter() Friendly greetings, Bert On Thu, Oct 1, 2009 at 1:27 PM, mathaios mathaio...@gmail.com wrote: I'm using the Auth component as the example in the manual, but the log- in form keeps redirecting to himself, and Firefox throws the error The page isn't redirecting properly. My app controller is: class AppController extends Controller { var $components=array('Auth','RequestHandler'); function beforeFilter() { $this-Auth-loginAction = array('admin' = false, 'controller' = 'users', 'action' = 'login'); //$this-Auth-allow(array('*')); - if I uncomment this line it works (allow all) } } my users controller (excerpt) is: class UsersController extends AppController { var $name = 'Users'; var $helpers = array('Html', 'Form'); function login() { } function logout() { $this-redirect($this-Auth-logout()); } what I'm doing wrong ? --~--~-~--~~~---~--~~ 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: How to $model-find for any controller
Element would indeed be a good choice if he needs te render the same html over and over again. Anyway, using requestAction for this would be overkill imho. On Thu, Oct 1, 2009 at 3:05 PM, John Andersen j.andersen...@gmail.comwrote: Yes, I agree, it could be done in the AppController, but I would still implement it in an Element in the view, thus allowing the possibility to cache the element for further use in other views. But anyway it depends on the original requirement, so let's see/hear what the OP chooses to do :) Enjoy, John On Oct 1, 3:04 pm, Bert Van den Brande cyr...@gmail.com wrote: In your AppController, add something like this : function beforeFilter() { $this-set('allCountries', $this-Country-findAll(); } From then on, every controller will add 'allCountries' to your views. Don't forget to have the model Country loaded one way or another ... Friendly greetings, Bert On Thu, Oct 1, 2009 at 1:51 PM, John Andersen j.andersen...@gmail.com wrote: Suggest you look into requestAction, which can be called from a view, and thus provide the view with the country list when needed! Enjoy, John On Oct 1, 2:46 pm, DatacenterHellas merianosni...@gmail.com wrote: Hello. I need your help ! I like to call some data that must be available for each view in any controller. In my case I have to loading all countries from Database table to each view. How can I do that ? ? ? Kind regards Merianos Nikos --~--~-~--~~~---~--~~ 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: Where request comes from?
I believe the FormHelper has some 'secure' stuff available for this ... best to consult the documentation ... On Thu, Oct 1, 2009 at 8:50 PM, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: Is there a way to determine / ensure that any requested action comes from the server? I mean more towards the aspect of forms. That when a form is submitted the request is coming from the site and not someone who made a form and trying to submit it to your site. Just curious 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: Access Classes In Layout Help??
I think he means that he has written a controller+view that generates some output. Now he wants to render the same output inside his layout file ... Correct hahmadi ? On Thu, Oct 1, 2009 at 11:41 PM, Miles J mileswjohn...@gmail.com wrote: Im sorry but I dont understand what you are asking. Layout toolbar? Controller class? Do you mean component? Layout has no controller? Not sure what you mean there. Database in layout? You mean your result right? On Oct 1, 1:52 pm, hahmadi82 hahmad...@gmail.com wrote: Hi, I built a class with controller/views that I want displayed in my layout toolbar. Is this possible? How can I use this queried data in my layout file? Since layout has no controller, I'm not sure how I can use any database stuff in the layout -- View this message in context: http://www.nabble.com/Access-Classes-In-Layout-Help---tp25706283p2570... Sent from the CakePHP mailing list archive at Nabble.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: Controller::setAction heads-up
Ok tnx now I understand the problem, though I still can't wrap my head around the core issue. Is it that call_user_func_array() can never call private methods ? I found some comments here and there on the web stating that the new Reflection API will solve this, but nothing concrete on calling private methods ... As far as I can tell it can't be an OO issue, since TransactionsController will inherit the setAction() method from Controller ... therefore calling setAction() on an instance of TransactionsController should be allowed to access the private method error() that is defined in the same TransactionsController class. I love a good quiz now and then :) On Mon, Sep 28, 2009 at 5:35 PM, brian bally.z...@gmail.com wrote: On Mon, Sep 28, 2009 at 11:20 AM, Bert Van den Brande cyr...@gmail.com wrote: I don't entirely understand why moving the target action from private to protected or public results in the $viewVars being set or not set ? The first line in setAction() changes the controller's $action: $this-action = $action; Then, the last line of the method fails on call_user_func_array() because the given action is private: Warning (2): call_user_func_array() [http://php.net/function.call-user-func-array]: First argument is expected to be a valid callback, 'TransactionsController::error' was given [CORE_1.2.5/cake/libs/controller/controller.php, line 697] However, it's not a fatal error and the controller's $action has already been changed, so it's the view for this that is used in render() even though the action is never called. Anyway, it's not a Cake bug. I just wanted to post this for anyone else who might run into it. --~--~-~--~~~---~--~~ 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: Self Join query
Ha On Tue, Sep 29, 2009 at 12:44 PM, hunny saurabh85maha...@gmail.com wrote: Thanks Bert, It works perfectly fine. This is exactly what I was looking for. While going through the manual, I had completely left the Behaviors Section. I think its high time that I go through it. On Sep 28, 4:53 pm, Bert Van den Brande cyr...@gmail.com wrote: I typed this code out of the top of my head, but it might be worth a try : $this-User-Behaviors-attach('Containable'); $this-User-bindModel(array( 'hasOne' = array( // Model linking type is 'hasOne', this forces Cake to make joins 'UserB' = array( // User other name than 'User' to avoid data arrays being mixed up in the result 'className' = 'User', 'foreignKey' = false, // Force conditions in query as defined below 'type' = 'LEFT', 'conditions' = array('User.company_id = UserB.company_id')) ))); $result = $this-User-find('all', array('conditions' = array('User.id' = 2))); Friendly greetings, Bert On Mon, Sep 28, 2009 at 1:43 PM, Bert Van den Brande cyr...@gmail.com wrote: I would use the Containable behavior here, combined with a custom binding that you attach on the fly. Have no idea however how exactly to expres a self-join binding ... try and play around with it :) On Mon, Sep 28, 2009 at 12:04 PM, hunny saurabh85maha...@gmail.com wrote: On Sep 28, 2:19 pm, Aivaras faifas1...@gmail.com wrote: Hey, take a look at this: http://voveris.eu/2009/09/05/left-join-with-cakephp/Iam sure you find this handy. On Mon, Sep 28, 2009 at 12:04, hunny saurabh85maha...@gmail.com wrote: Hi All, I am new to cakephp. I would like to execute the following SELF Join query. SELECT B.* FROM `users` AS A LEFT JOIN `users` AS B ON A.id = 2 where A.company_id = B.company_id Could some one guide or refer some tutorials, on how to achieve this in cake php. Thanks in advance Hi All, Bad me, I think should have explained my problem properly. Lets say following are the contents of my users table: id | name | company id 1 | abc | 123 2 | def | 123 3 | ghi | 124 4 | jkl | 123 Now what I want is to retrieve, for a member (say 'abc') all the people who are working in the same company. Even though company_id is a foreign key, I am not interested in the data of that table. What you suggested above is how to get the data from the company table. The simple sql query if I want all the members working in same company as id = 2 would be: SELECT B.* FROM `users` AS A LEFT JOIN `users` AS B ON A.id = 2 where A.company_id = B.company_id Since this includes JOIN with the table itself, I am not sure how to achieve using Association Type. --~--~-~--~~~---~--~~ 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: Self Join query
Oops clicked 'send' by accident. So what I meant was : Hah it works ? Great :) Yes Containable Behavior is a very important one. Start using it on all your model from the start of your project , it will save you a lot of queries and refactoring of code afterwards. Glad I could help, Bert On Tue, Sep 29, 2009 at 1:11 PM, Bert Van den Brande cyr...@gmail.comwrote: Ha On Tue, Sep 29, 2009 at 12:44 PM, hunny saurabh85maha...@gmail.comwrote: Thanks Bert, It works perfectly fine. This is exactly what I was looking for. While going through the manual, I had completely left the Behaviors Section. I think its high time that I go through it. On Sep 28, 4:53 pm, Bert Van den Brande cyr...@gmail.com wrote: I typed this code out of the top of my head, but it might be worth a try : $this-User-Behaviors-attach('Containable'); $this-User-bindModel(array( 'hasOne' = array( // Model linking type is 'hasOne', this forces Cake to make joins 'UserB' = array( // User other name than 'User' to avoid data arrays being mixed up in the result 'className' = 'User', 'foreignKey' = false, // Force conditions in query as defined below 'type' = 'LEFT', 'conditions' = array('User.company_id = UserB.company_id')) ))); $result = $this-User-find('all', array('conditions' = array('User.id' = 2))); Friendly greetings, Bert On Mon, Sep 28, 2009 at 1:43 PM, Bert Van den Brande cyr...@gmail.com wrote: I would use the Containable behavior here, combined with a custom binding that you attach on the fly. Have no idea however how exactly to expres a self-join binding ... try and play around with it :) On Mon, Sep 28, 2009 at 12:04 PM, hunny saurabh85maha...@gmail.com wrote: On Sep 28, 2:19 pm, Aivaras faifas1...@gmail.com wrote: Hey, take a look at this: http://voveris.eu/2009/09/05/left-join-with-cakephp/Iam sure you find this handy. On Mon, Sep 28, 2009 at 12:04, hunny saurabh85maha...@gmail.com wrote: Hi All, I am new to cakephp. I would like to execute the following SELF Join query. SELECT B.* FROM `users` AS A LEFT JOIN `users` AS B ON A.id = 2 where A.company_id = B.company_id Could some one guide or refer some tutorials, on how to achieve this in cake php. Thanks in advance Hi All, Bad me, I think should have explained my problem properly. Lets say following are the contents of my users table: id | name | company id 1 | abc | 123 2 | def | 123 3 | ghi | 124 4 | jkl | 123 Now what I want is to retrieve, for a member (say 'abc') all the people who are working in the same company. Even though company_id is a foreign key, I am not interested in the data of that table. What you suggested above is how to get the data from the company table. The simple sql query if I want all the members working in same company as id = 2 would be: SELECT B.* FROM `users` AS A LEFT JOIN `users` AS B ON A.id = 2 where A.company_id = B.company_id Since this includes JOIN with the table itself, I am not sure how to achieve using Association Type. --~--~-~--~~~---~--~~ 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 with FatCow hosting provider - mod_rewrite issue?
Verifying with your host if mod_rewrite is enabled would be a good place to start :) On Tue, Sep 29, 2009 at 3:54 AM, DK dku...@gmail.com wrote: Does anyone have a cakephp application running with the FatCow hosing provider? I have the base code installed in my home/cake directory. My URL is below: http://www.laidbacksurf.com/cake/ I get the following on the screen...but the base stylesheet doesn't appear and no images are found... Your tmp directory is writable. The FileEngine is being used for caching. To change the config edit APP/config/core.php Your database configuration file is present. Cake is able to connect to the database. I didn't have to do anything in my local environments and am not familiar with the details of mod_rewrite or detailed Apache setup. Any ideas? Thanks in advance, 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: Oracle 10g
Maybe this example will help : http://liamgraham.wordpress.com/2007/04/19/using-oracle-with-cakephp-15-minute-blog-tutorial/ Google is such a nice tool :) On Mon, Sep 28, 2009 at 5:21 PM, osamo101 osamo...@gmail.com wrote: Hi I have a problem connecting to Oracle 10g database. When I put 'driver' = 'oracle', I got an error in the homepage so I changed it to ODBC but also I am not able to connect. My configuration is as follows: var $default = array( 'driver' = 'odbc', 'persistent' = false, 'host' = 'MyServer', 'login' = 'UserID', 'password' = 'Password', 'schema' = 'MySchema', 'database' = 'orcl', 'prefix' = '', 'encoding' ='' ); I am waiting for a solution from you. 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 cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Controller::setAction heads-up
On Tue, Sep 29, 2009 at 4:14 PM, brian bally.z...@gmail.com wrote: On Tue, Sep 29, 2009 at 2:19 AM, Bert Van den Brande cyr...@gmail.com wrote: Ok tnx now I understand the problem, though I still can't wrap my head around the core issue. Is it that call_user_func_array() can never call private methods ? I found some comments here and there on the web stating that the new Reflection API will solve this, but nothing concrete on calling private methods ... As far as I can tell it can't be an OO issue, since TransactionsController will inherit the setAction() method from Controller ... therefore calling setAction() on an instance of TransactionsController should be allowed to access the private method error() that is defined in the same TransactionsController class. I love a good quiz now and then :) No, the parent cannot access private methods, although it seems somewhat counterintuitive. From the fine manual: -- snip -- The visibility of a property or method can be defined by prefixing the declaration with the keywords public, protected or private. Class members declared public can be accessed everywhere. Members declared protected can be accessed only within the class itself and by inherited and parent classes. Members declared as private may only be accessed by the class that defines the member. -- snip -- http://us2.php.net/manual/en/language.oop5.visibility.php Indeed you're right, programming in Smalltalk for a couple of months made my OO skilz rusty, even though the method setAction() is inherited it is not considered part of the TransactionsController class regarding the private modifiers. Thanks for the training ;) --~--~-~--~~~---~--~~ 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: Self Join query
I would use the Containable behavior here, combined with a custom binding that you attach on the fly. Have no idea however how exactly to expres a self-join binding ... try and play around with it :) On Mon, Sep 28, 2009 at 12:04 PM, hunny saurabh85maha...@gmail.com wrote: On Sep 28, 2:19 pm, Aivaras faifas1...@gmail.com wrote: Hey, take a look at this: http://voveris.eu/2009/09/05/left-join-with-cakephp/I am sure you find this handy. On Mon, Sep 28, 2009 at 12:04, hunny saurabh85maha...@gmail.com wrote: Hi All, I am new to cakephp. I would like to execute the following SELF Join query. SELECT B.* FROM `users` AS A LEFT JOIN `users` AS B ON A.id = 2 where A.company_id = B.company_id Could some one guide or refer some tutorials, on how to achieve this in cake php. Thanks in advance Hi All, Bad me, I think should have explained my problem properly. Lets say following are the contents of my users table: id | name | company id 1 | abc | 123 2 | def | 123 3 | ghi | 124 4 | jkl | 123 Now what I want is to retrieve, for a member (say 'abc') all the people who are working in the same company. Even though company_id is a foreign key, I am not interested in the data of that table. What you suggested above is how to get the data from the company table. The simple sql query if I want all the members working in same company as id = 2 would be: SELECT B.* FROM `users` AS A LEFT JOIN `users` AS B ON A.id = 2 where A.company_id = B.company_id Since this includes JOIN with the table itself, I am not sure how to achieve using Association Type. --~--~-~--~~~---~--~~ 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: Self Join query
I typed this code out of the top of my head, but it might be worth a try : $this-User-Behaviors-attach('Containable'); $this-User-bindModel(array( 'hasOne' = array( // Model linking type is 'hasOne', this forces Cake to make joins 'UserB' = array( // User other name than 'User' to avoid data arrays being mixed up in the result 'className' = 'User', 'foreignKey' = false, // Force conditions in query as defined below 'type' = 'LEFT', 'conditions' = array('User.company_id = UserB.company_id')) ))); $result = $this-User-find('all', array('conditions' = array('User.id' = 2))); Friendly greetings, Bert On Mon, Sep 28, 2009 at 1:43 PM, Bert Van den Brande cyr...@gmail.comwrote: I would use the Containable behavior here, combined with a custom binding that you attach on the fly. Have no idea however how exactly to expres a self-join binding ... try and play around with it :) On Mon, Sep 28, 2009 at 12:04 PM, hunny saurabh85maha...@gmail.comwrote: On Sep 28, 2:19 pm, Aivaras faifas1...@gmail.com wrote: Hey, take a look at this: http://voveris.eu/2009/09/05/left-join-with-cakephp/I am sure you find this handy. On Mon, Sep 28, 2009 at 12:04, hunny saurabh85maha...@gmail.com wrote: Hi All, I am new to cakephp. I would like to execute the following SELF Join query. SELECT B.* FROM `users` AS A LEFT JOIN `users` AS B ON A.id = 2 where A.company_id = B.company_id Could some one guide or refer some tutorials, on how to achieve this in cake php. Thanks in advance Hi All, Bad me, I think should have explained my problem properly. Lets say following are the contents of my users table: id | name | company id 1 | abc | 123 2 | def | 123 3 | ghi | 124 4 | jkl | 123 Now what I want is to retrieve, for a member (say 'abc') all the people who are working in the same company. Even though company_id is a foreign key, I am not interested in the data of that table. What you suggested above is how to get the data from the company table. The simple sql query if I want all the members working in same company as id = 2 would be: SELECT B.* FROM `users` AS A LEFT JOIN `users` AS B ON A.id = 2 where A.company_id = B.company_id Since this includes JOIN with the table itself, I am not sure how to achieve using Association Type. --~--~-~--~~~---~--~~ 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: Getting started with Ajax
Can you show the code where you changed the line ? I always use $this-layout = ajax; in the controller method when I want to render the ajax layout. Friendly greetings, Bert On Mon, Sep 28, 2009 at 4:22 PM, Jürgen jurgen.priv...@gmail.com wrote: Anyone? On 24 sep, 20:01, Jürgen jurgen.priv...@gmail.com wrote: Hi, I've just been getting started with Ajax and I've been able to set up a simple website using the pagesController that comes with cake. As for now I'm not yet using any databases. Today I started to try integrating some Ajax in my site. It's quite simple: I want to load the pages into the 'content' div without reloading the entire layout. So what I tried was the following: I edited the pagesController by copying the display function and naming it display_ajax(); Then all I changed was in the last line in the render() function I added 'ajax'. Now when I press an ajax link that loads the new display_ajax function it displays in the 'content' div an error message saying that it can't find the $javascript variable in my default.ctp layout file. That's on the line where I load the javascript files ajax needs. Now maybe I don't really understand how cake works yet, but I think this is weird. First off, I thought by setting the 'ajax' value in the render function, the layout shouldn't be loaded at all. And even if it should (apparently so, can someone explain?) then why does it return this error, when it doesn't return any errors if I use the standard display() function. The functions are the same! I hope someone can help me with this! 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: autocomplete program
Want me to travel to your city and code the project as well ? Anyway, have a look here : http://bakery.cakephp.org/articles/view/autocomplete It will get you at least half way there ... On Fri, Sep 25, 2009 at 1:46 PM, Jiru jiransl...@gmail.com wrote: Hii CakePHP programmers, Any body can give me the complete source code for Autocompletion in text boxes. i expect the code with whole .ctp in the view and php file in the model , controller php file ajax file and css. Help me. The value should read from the database. regards, jiru --~--~-~--~~~---~--~~ 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: Get keyword from Search Engine
Don't you mean beforeFilter from app_controller ? app_model has no beforeFilter. On Thu, Sep 24, 2009 at 9:01 AM, igorfelluga igor.fell...@gmail.com wrote: Hi I did a component to get/save the search engine keyword if same one arrive from google,msn,yahoo. I call it in app_model with beforeFilter. The problem is that in home page or wherever it save the same keywords group more than one time. I think that happen because the page call 2/3/4 controller. How I must do it? 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: Get keyword from Search Engine
Any way, unless you use 'requestAction' calls inside your view I don't think a controller's beforeFilter method is called multiple times for one http request ... On Thu, Sep 24, 2009 at 9:56 AM, Bert Van den Brande cyr...@gmail.comwrote: Don't you mean beforeFilter from app_controller ? app_model has no beforeFilter. On Thu, Sep 24, 2009 at 9:01 AM, igorfelluga igor.fell...@gmail.comwrote: Hi I did a component to get/save the search engine keyword if same one arrive from google,msn,yahoo. I call it in app_model with beforeFilter. The problem is that in home page or wherever it save the same keywords group more than one time. I think that happen because the page call 2/3/4 controller. How I must do it? 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: Get keyword from Search Engine
If you have XDebug or Zend Debugger, just put a breakpoint at the beforeFilter code and then look at the stacktrace each time you are halted. As said, unless you use 'requestAction' calls inside your view I can't think of any reason why the beforeFilter is called multiple times ... On Thu, Sep 24, 2009 at 10:38 AM, igorfelluga igor.fell...@gmail.comwrote: Sorry you are right, I call in app_controller :) in the only homepage it save the keywords group 5 times On 24 Set, 10:32, Bert Van den Brande cyr...@gmail.com wrote: Any way, unless you use 'requestAction' calls inside your view I don't think a controller's beforeFilter method is called multiple times for one http request ... On Thu, Sep 24, 2009 at 9:56 AM, Bert Van den Brande cyr...@gmail.com wrote: Don't you mean beforeFilter from app_controller ? app_model has no beforeFilter. On Thu, Sep 24, 2009 at 9:01 AM, igorfelluga igor.fell...@gmail.com wrote: Hi I did a component to get/save the search engine keyword if same one arrive from google,msn,yahoo. I call it in app_model with beforeFilter. The problem is that in home page or wherever it save the same keywords group more than one time. I think that happen because the page call 2/3/4 controller. How I must do it? 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: recursive find: related models order
Search the Cake book for 'Containable' behavior , I think you will find your answer there On Thu, Sep 24, 2009 at 10:53 AM, lorenx lor...@gmail.com wrote: hi all. i'm trying to order a deeply related model but the following code gives me an error. $params = array( 'order' = 'RelatedModel.relatedmodel_field DESC', 'recursive' = 3 ); $models_array = $this-Model-find('all', $params); i saw that cakephp do several queries to build $models_array and the order parameter is appended to the first query, the one with no RelatedModel reference. i also tried to set $order in the model but it didn't solve (and i don't want a static order anyway...) how does cakephp handle this issue? thanks to all, very much. --~--~-~--~~~---~--~~ 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: Get keyword from Search Engine
Nice tip ... I'm gonna remember that one :) On Thu, Sep 24, 2009 at 12:22 PM, Dr. Loboto drlob...@gmail.com wrote: Check $this-params['requested'] in beforeFilter. If it is set and true, you are processing requestAction this time. On Sep 24, 2:01 pm, igorfelluga igor.fell...@gmail.com wrote: Hi I did a component to get/save the search engine keyword if same one arrive from google,msn,yahoo. I call it in app_model with beforeFilter. The problem is that in home page or wherever it save the same keywords group more than one time. I think that happen because the page call 2/3/4 controller. How I must do it? 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: eCommerce question
I would only decrease stock value when the shopping cart gets converted to a purchase. Chances are rather slim that many people will buy the book at the same time, and if it does you should try to anticipate this and create a larger stock for popular books :) Also, every formula you invent to calculate stock values will never be accurate ... and I'm pretty sure you don't want to miss out on a sale just because your formula calculated a negative stock but in reality it was only 10 people having it in their shopping cart and not buying the product. Keep it simple :) On Thu, Sep 24, 2009 at 12:44 PM, cakeFreak freakclimb...@gmail.com wrote: Hey guys, my question is about developing an eCommerce solution in PHP, and it about dealing with stock quantities. When you have real products (not services or e-books, for example, but real books instead) how do you deal with the following situation: 1) you have 10 copies of Book Learning CakePHP in stock 2) you have 20 customers in the eCommerce website at the same time 3) 15 customers add a copy of the Book Learning CakePHP to their shopping chart 4) only 5 customers finally biught the book At this point my question is: how do you work with your stock values? Decreasing the stock every time a customer adds to chart, is a bit risky. Maybe using a kinda average purchasing rate (say only 50% of those that added to chart bought the book) it would be less risky to manage stock values? Dunno if I'm overcomplicating the problem. Just Curious about your opinion and solutions to this issue. Daniel --~--~-~--~~~---~--~~ 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: recursive find: related models order
If I understand you question correctly I think you're right :) On Thu, Sep 24, 2009 at 1:27 PM, lorenx lor...@gmail.com wrote: perfect, thanks! just one little question: if i have a deep and complex recursion and i just want a condition on a single model in the middle of the tree... it seems that i also have to specify all the other models not to have them filtered out, am i right? On Sep 24, 11:09 am, Bert Van den Brande cyr...@gmail.com wrote: Search the Cake book for 'Containable' behavior , I think you will find your answer there On Thu, Sep 24, 2009 at 10:53 AM, lorenx lor...@gmail.com wrote: hi all. i'm trying to order a deeply related model but the following code gives me an error. $params = array( 'order' = 'RelatedModel.relatedmodel_field DESC', 'recursive' = 3 ); $models_array = $this-Model-find('all', $params); i saw that cakephp do several queries to build $models_array and the order parameter is appended to the first query, the one with no RelatedModel reference. i also tried to set $order in the model but it didn't solve (and i don't want a static order anyway...) how does cakephp handle this issue? thanks to all, very much. --~--~-~--~~~---~--~~ 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: Number of Affected Rows
You can call getAffectedRows() on any model class. From class Model : /** * Returns the number of rows affected by the last query * * @return int Number of rows * @access public */ function getAffectedRows() { $db = ConnectionManager::getDataSource($this-useDbConfig); return $db-lastAffected(); } On Thu, Sep 24, 2009 at 3:01 PM, blake blake.jor...@gmail.com wrote: I'm running an updateAll and would like to know the number of rows that actually got updated. Is there an easy way to do this? The debug query results at the bottom show me the number of rows affected, so hopefully theres a way for me to access that? Thanks, -Blake --~--~-~--~~~---~--~~ 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: Missing Controller
You can make the short tag ? working by editing the php .ini file : http://be.php.net/manual/en/ini.core.php /me personally never uses short tags :) On Wed, Sep 23, 2009 at 8:24 AM, Selva manickaraja mavle...@gmail.comwrote: Hi, I tried that and ended up with misconfiguration errors. However I did one more look into the code. The beginning on the script for Item and ItemsController was written as ? instead of ?php preprocessor. I copied the script exactly as it was written in the book thinking that Cake would understand the script as default php instead of having to explicitly putting in ?php. So when I changed it to ?php and typed http://localhost/ims/items in the URL it works perfectly. Thank you John for the guidance rendered so far. It has been helpful. Warmest Regards, Selvam On Wed, Sep 23, 2009 at 12:57 PM, John Andersen j.andersen...@gmail.comwrote: Ok, from what I can discern, your application directory is ims, so your cake application content should be in the ims directory, not in the ims/app directory. Move everything from app into ims directory and give it a try! Enjoy, John On Sep 23, 5:02 am, Selva manickaraja mavle...@gmail.com wrote: Yes, I had corrected that all the first time I sent the email. According to the book tutorial, I should be getting the view. But I am still stuck with the error message Missing Controller. Could it be environment setup? Please advice Thank you. On Wed, Sep 23, 2009 at 1:17 AM, John Andersen j.andersen...@gmail.com wrote: Correct also your model class to Item, not Items! Singular in models, plural in controllers. Enjoy, John [snip] 2. Wrote a script called item.php and placed it in app\models directory to define a class called Items. [/snip]e --~--~-~--~~~---~--~~ 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: Missing Controller
The directory is app/controllers , not app/controller :) On Tue, Sep 22, 2009 at 1:58 PM, Selva manickaraja mavle...@gmail.comwrote: Hi, I just got CakePhp up and running. To learn the functionality I created sample php code. I followed the instruction in the book that I bought few days back called Beginning CakePHP published by APress. Following are the steps that I had taken. 1. Created a table in PostgreSQL called *items*. 2. Wrote a script called item.php and placed it in app\models directory to define a class called Items. 3. Wrote a script called items_controller and placed it in app\controller direcrtory to define a class called ItemController. Finally I tryped the URL http://localhost/ims/items in the browser. I get an error message Missing Controller. I tried following all the naming convention. I'm attaching the individual files for your reference. Please check and comment as to what had gone wrong. Thank you. Warmest Regards, Selvam --~--~-~--~~~---~--~~ 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 and scalability
First you need to find out why your application is getting slower, this can be a database issue or a PHP scripting issue ... or a combination of both :) Lots of caching options are provided by Cake, those should get you a long way in improving the performance of your site. Scaling to multiple web- and database servers is imho only a last resort, as this will increase the overhead in maintenance, backup and deploying significantly. Friendly greetings, Bert On Mon, Sep 21, 2009 at 9:56 AM, marco.rizze...@gmail.com marco.rizze...@gmail.com wrote: Hi I have developed my web application with CakePHP. For the moment I use one Apache server and one MySql server. Now I have noted that my application is getting slow because the numbers of users is increasing. So I have decided that is the time to scale my architecture. I have tried to find some suggestions on this forum about how scale CakePHP but I haven't found anything. Can someone help me about this with some example, link, tutorial etc.? Many 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: url parameters + logic + save
You can do all that in a controller. On Sun, Sep 20, 2009 at 11:42 PM, borcho boris.nenc...@gmail.com wrote: Still getting my hands around cakephp. Trying to figure out what the best way is to put together a jump page that performs logic based on url parameters and cookie variables, saves data to model and redirects page without any input fields or user triggered actions. For exampe, www.domain.com/page?user=abxstats=xyz Need to perform some logic with passed variables + cookie variables, save data and then redirects page. Can this be done by running logic and actions in models and controller or do I need to do this in view and use requestaction? 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: How to copy a deep database hierarchy?
I haven't done this before, but I think this can be accomplished by using the saveAll() function : http://book.cakephp.org/view/75/Saving-Your-Data . Have a look at the saveAll() documentation, and also at this section : http://book.cakephp.org/view/75/Saving-Your-Data#Saving-Related-Model-Data-hasOne-hasMany-belongsTo-84 My approach would be to * load the Recipe with it's Ingredients and Tags from database * manipulate the data by removing the 'id' information from the models * pass the manipulated data to the saveAll() method Friendly greetings, Bert On Fri, Sep 18, 2009 at 9:16 PM, Nancy nancy.milli...@gmail.com wrote: Maybe this is more of a database question than a Cakephp question but... I have a database with about 40 tables all related and I'm going to need to make copies of a whole deeply nested database structure, just changing id's be coming the interconnections. Does anyone know of a reasonable way to do this? I'm using MySQL. Many thanks! Nancy Simple Example: Recipe - Ingredients - Tags Lets say I want to copy the Apple Pie recipe and all it's related records to a new structure but none of the data are shared between the two copies. --~--~-~--~~~---~--~~ 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: Subdomains for userpages
I believe this is what you're looking for : http://bakery.cakephp.org/articles/view/subdomaining-with-cake On Fri, Sep 18, 2009 at 11:40 AM, Matt gttc...@gmail.com wrote: I'm searching for a way to make subdomains in cakephp ussable for profilepages of users. Ofcourse I need a wildcard in my DNS and Apache config, which is already done. Because I want to keep this way of subdomains flexible, I don't want to use a .htaccess file so I need to do something with a route that recognizes the subdomain and does something magic. Something like this could work I think: $usernamehost = explode(’.', $_SERVER['HTTP_HOST'], 2); where I should need to change the router.php for sure ? I have found an example for CodeIgniter, but I like the CakePHP way of programming more, so... this way is that I wanna go, but I need some help here. The CI example is shown here: http://andy.sinaptix.com/2007/08/22/username-as-subdomain-in-codeigniter/ Any help is welcome ! --~--~-~--~~~---~--~~ 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: Unable to view Cake Start Page
I think Apache doesn't know that it must server 'index.php' files. Change IfModule dir_module DirectoryIndex index.html /IfModule to: IfModule dir_module DirectoryIndex index.php index.html /IfModule Don't forget to restart Apache. Maybe also test what happens if you visit the url http://localhost/ims/index.php directly. Friendly greetings, Bert On Fri, Sep 18, 2009 at 9:00 AM, Selva manickaraja mavle...@gmail.comwrote: Hi, I tried changing it as recommended. And restarted Apache. But still when I typed the URL, I am getting the directory listing. How else can this be resolved? I am attaching the screenshot. Thank you. Warmest Regards, Selvam On Fri, Sep 18, 2009 at 1:53 PM, Bert Van den Brande cyr...@gmail.comwrote: Try changing Directory /ims at Options Indexes MultiViews AllowOverride All Order deny,allow Deny from all /Directory to Directory /ims Options Indexes MultiViews AllowOverride All Order allow,deny Allow from all /Directory On Fri, Sep 18, 2009 at 6:11 AM, Selvam mavle...@gmail.com wrote: Hi, Before I begin, let me announce that I'm a newbie. I downloaded Cake 1.2. Unzipped it and placed it under a directory called ims under htdocs of Apache 2.2.13 with PHP/5.3.0 in Windows XP Each time I type htttp://localhost/ims, I keep on getting the directory listing rather than the Cake Start Page. I refered to many resources and changed the Directory / to Directory /ims . And each time I type the URL it still shows the directory listing of Cake. I checked the error log and it shows the following : [Fri Sep 18 11:46:55 2009] [error] [client 127.0.0.1] client denied by server configuration: C:/Program Files/Apache Software Foundation/ Apache2.2/htdocs/ims/.htaccess Tried many tricks, it's still not showing the Cake Start Page that I'm longing to see.Please help. I have listed the httpd.conf contents below. Thank you. # # This is the main Apache HTTP server configuration file. It contains the # configuration directives that give the server its instructions. # See URL:http://httpd.apache.org/docs/2.2 for detailed information. # In particular, see # URL:http://httpd.apache.org/docs/2.2/mod/directives.html # for a discussion of each configuration directive. # # Do NOT simply read the instructions in here without understanding # what they do. They're here only as hints or reminders. If you are unsure # consult the online docs. You have been warned. # # Configuration and logfile names: If the filenames you specify for many # of the server's control files begin with / (or drive:/ for Win32), the # server will use that explicit path. If the filenames do *not* begin # with /, the value of ServerRoot is prepended -- so logs/foo.log # with ServerRoot set to C:/Program Files/Apache Software Foundation/ Apache2.2 will be interpreted by the # server as C:/Program Files/Apache Software Foundation/Apache2.2/ logs/foo.log. # # NOTE: Where filenames are specified, you must use forward slashes # instead of backslashes (e.g., c:/apache instead of c:\apache). # If a drive letter is omitted, the drive on which httpd.exe is located # will be used by default. It is recommended that you always supply # an explicit drive letter in absolute paths to avoid confusion. # # ServerRoot: The top of the directory tree under which the server's # configuration, error, and log files are kept. # # Do not add a slash at the end of the directory path. If you point # ServerRoot at a non-local disk, be sure to point the LockFile directive # at a local disk. If you wish to share the same ServerRoot for multiple # httpd daemons, you will need to change at least LockFile and PidFile. # ServerRoot C:/Program Files/Apache Software Foundation/Apache2.2 # # Listen: Allows you to bind Apache to specific IP addresses and/or # ports, instead of the default. See also the VirtualHost # directive. # # Change this to Listen on specific IP addresses as shown below to # prevent Apache from glomming onto all bound IP addresses. # #Listen 12.34.56.78:80 http://12.34.56.78/ Listen 80 # # Dynamic Shared Object (DSO) Support # # To be able to use the functionality of a module which was built as a DSO you # have to place corresponding `LoadModule' lines at this location so the # directives contained in it are actually available _before_ they are used. # Statically compiled modules (those listed by `httpd -l') do not need # to be loaded here. # # Example: # LoadModule foo_module modules/mod_foo.so # LoadModule actions_module modules/mod_actions.so LoadModule alias_module modules/mod_alias.so LoadModule asis_module modules/mod_asis.so LoadModule auth_basic_module modules/mod_auth_basic.so #LoadModule auth_digest_module modules/mod_auth_digest.so #LoadModule authn_alias_module modules/mod_authn_alias.so #LoadModule authn_anon_module modules/mod_authn_anon.so
Re: Validation Errors Displaying on Add but not on Edit?
When data from a form is posted to the controller the code for if (empty($this-data)) should not be executed, as $this-data will not be empty. So I don't understand why this code can interfere with the save() validation. On Fri, Sep 18, 2009 at 8:20 AM, Sarah sarah.e.p.jo...@gmail.com wrote: I realized one of the issues, but am still not sure how to solve it. I use Model's read method to retrieve the data for the edit, however this stops the validation. if (empty($this-data)) { $this-data = $this-User-read(array ('username', 'firstname', 'lastname', 'email', 'animal_id'), $id); } I created a variable to try to limit the loading of data from the database into the form, to allow the validations to occur. Unfortunately, although this did control when the if statement executed, the validations did not appear. Segments of my code: up top I have var $failSave = false; function admin_edit($id = hnull) { if (!$id empty($this-data)) { $this-flash(__('Invalid User', true), array ('action'='index')); } //if form submitted if (!empty($this-data)) { //if password changed //if passwords match //include password in list of fields to be saved $fieldList = ... $match = true; } else { $this-flash(__('Passwords do not match', true), array('action'='index')); $match = false; } } //if password not changed, do not include password in list of fields to be saved else { $fieldList = ... $match = true; } if ($match $this-User-save($this-data, true, $fieldList)) { $this-flash(__('The User has been saved.', true), array('action'='index')); $this-failSave = false; } else { $this-data['User']['password'] = ''; $this-data['User']['password'] = ''; $this-failSave = true; } } //load form if (!$this-failSave empty($this-data)) { debug($this-failSave); $this-data = $this-User-read(array ('username', 'firstname', 'lastname', 'email', 'animal_id'), $id); } I would appreciate any advice. Thanks, ~Sarah On Sep 17, 10:27 pm, Sarah sarah.e.p.jo...@gmail.com wrote: I am not redirecting after an unsuccessful state, I only reset two of the fields to empty strings. The url is the same. Any ideas? Thanks, ~Sarah On Sep 17, 8:29 pm, Dr. Loboto drlob...@gmail.com wrote: Don't do redirect after unsuccessful save, be sure that form URL is same as your edit action. Presence of data in fields may indicate only browser forms cache. On Sep 17, 11:30 am, Sarah sarah.e.p.jo...@gmail.com wrote: I've searched the forum, and I can't find any posts that correspond to my question...unfortunately I haven't had much luck with the manual either. I have user add and edit forms. In my add form the proper validation errors show as they supposed to. However, in the edit form the errors do not show (the page does not validate/save, the page reloads with the data still stored in the form fields, but there are no errors messages). Any idea why the errors show for one but not the other? Thanks in advance, ~Sarah (I understand that you can use FormHelper options to override the error message, but this isn't what I want.) --~--~-~--~~~---~--~~ 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: problem with facebook-like ajax windows submitting forms
I think the problem is that you do a normal HTML submit of the form inside your div popup. Since you don't want the form to be submitted as it would do for a normal page, you need catch the submit action with some javascript code and submit the form by ajax. How to submit forms by ajax using JQuery is explained here : http://net.tutsplus.com/javascript-ajax/submit-a-form-without-page-refresh-using-jquery/ More options exist of course, feel free to Google it :) Friendly greetings, Bert On Fri, Sep 18, 2009 at 10:15 AM, 浪漫様 rohmand...@gmail.com wrote: i don't think that is the problem... facebook can do it without iFrames and works perfectly no matter what browser. moreover... i'm talking about same domain's forms... nothing to do with external domains. if i'm building a facebook-alike social networking, and when clicking on a user's link i want to open a pop-up ajax window to send message to him... where is the cross-domain issue? thanks for the reply : ) just i think you confuse the topic Rohman On Sep 18, 3:50 pm, wirtsi florian.kra...@googlemail.com wrote: I think you are running into the same-origin-issue ... most browsers only allow ajax-requests so the same domain. Check out this posthttp:// www.petefreitag.com/item/703.cfm With iframes you can post data freely to any other domain. I'd just like to mention here, that if you want to post uploaded files, you'll also need an iframe form since you can't upload files via ajax calls On 18 Sep., 09:12, 浪漫様 rohmand...@gmail.com wrote: hello all, i had been successful on sending forms via ajax on a view and updating some divs instead of reloading the page without much problem, however, when the form is located on a facebook-like ajax pop-up div, the page is always reloaded on submission... and that's not what i expected... i found a solution that is to place an iFrame with the ajax form inside the ajax window... however, i would like to be able to do it without iFrames... just like facebook or other sites does. do somebody know any way to accomplish that? all examples, codes, etc... i had been trying or finding online ( even using JQuery plug- ins like Boxy, or doing it myself with same result ) has the same behavior... so i can not do data validation on ajax div-window's forms or just simply send a 'whatever action done' message after submission. thanks in advance. Rohman --~--~-~--~~~---~--~~ 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: problem with facebook-like ajax windows submitting forms
Sorry, but it still sounds to me that the form inside your popup is being submitted like a normal form. Maybe show some code ? On Fri, Sep 18, 2009 at 10:58 AM, 浪漫様 rohmand...@gmail.com wrote: walther, thanks for the reply... but i guess you didn't read well my post neither... I'm able to send the form with ajax ( also using AjaxForm ) from a single view without any problem... the problem comes when you try to do it from a facebook style div-window that pops up... imagine i am reading a post and i want to send the comment with an ajax form... yes... that works without any problem, the form is already located on the main ( post ) view, and form is sent and comments div is updated... no problem. now imagine you are building a facebook-alike social networking, and when clicking on a user's 'send message to xxx' link i want to open a pop-up ajax window to send message to him... but not from the main view's form... from a form located on a div appearing on screen ( i guess you are familliar with facebook or other sites that do that )... then the form is sent, but the page is reloaded while what i want is to refresh the ajax-window div. ( that's the problem ) thanks Rohman On Sep 18, 4:49 pm, Walther waltherl...@gmail.com wrote: Take a look at the AjaxForm plugin for jQuery. You need to submit the form using AJAX as well. On Sep 18, 10:15 am, 浪漫様 rohmand...@gmail.com wrote: i don't think that is the problem... facebook can do it without iFrames and works perfectly no matter what browser. moreover... i'm talking about same domain's forms... nothing to do with external domains. if i'm building a facebook-alike social networking, and when clicking on a user's link i want to open a pop-up ajax window to send message to him... where is the cross-domain issue? thanks for the reply : ) just i think you confuse the topic Rohman On Sep 18, 3:50 pm, wirtsi florian.kra...@googlemail.com wrote: I think you are running into the same-origin-issue ... most browsers only allow ajax-requests so the same domain. Check out this posthttp://www.petefreitag.com/item/703.cfm With iframes you can post data freely to any other domain. I'd just like to mention here, that if you want to post uploaded files, you'll also need an iframe form since you can't upload files via ajax calls On 18 Sep., 09:12, 浪漫様 rohmand...@gmail.com wrote: hello all, i had been successful on sending forms via ajax on a view and updating some divs instead of reloading the page without much problem, however, when the form is located on a facebook-like ajax pop-up div, the page is always reloaded on submission... and that's not what i expected... i found a solution that is to place an iFrame with the ajax form inside the ajax window... however, i would like to be able to do it without iFrames... just like facebook or other sites does. do somebody know any way to accomplish that? all examples, codes, etc... i had been trying or finding online ( even using JQuery plug- ins like Boxy, or doing it myself with same result ) has the same behavior... so i can not do data validation on ajax div-window's forms or just simply send a 'whatever action done' message after submission. thanks in advance. Rohman --~--~-~--~~~---~--~~ 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: Can't email using the Email Component
What I mean is that the EmailComponent uses @mail() , this suppresses the warnings/errors resulting from that function call. Btw the mail() function only returns a boolean , not a message of any kind. On Fri, Sep 18, 2009 at 11:01 AM, Walther waltherl...@gmail.com wrote: If you look at the code, you'll notice that it returns exactly the same thing as php mail() will return. On Sep 18, 7:48 am, Bert Van den Brande cyr...@gmail.com wrote: Have you tested the PHP mail() function directly ? The problem with the EmailComponent is that it hides any indicative mail errors that would help you find the cause for the problem ... I usually debug into the EmailComponents send code ... On Fri, Sep 18, 2009 at 7:00 AM, damanlovett ed...@lovettcreations.org wrote: I have read every tutorial and discussion but I can't get the email to send out. Below is an excerpt from my controller. It redirects fine, but I still get Simple email not sent. Is there some setting in the core or somewhere else that I'm missing? var $components = array('Email'); function sendemail(){ $this-Email-to = 'ed...@myemail.com'; $this-Email-subject = 'Cake test simple email'; $this-Email-replyTo = 'nore...@localhost'; $this-Email-from = 'Cake Test Account nore...@localhost'; $this-Email-delivery = 'mail'; if ( $this-Email-send('Here is the body of the email') ) { $this-Session-setFlash('Simple email sent'); } else { $this-Session-setFlash('Simple email not sent'); } $this-redirect('/offices'); } --~--~-~--~~~---~--~~ 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: problem with facebook-like ajax windows submitting forms
Can't find anything that would trigger the described behavior, though I must say the code is a bit difficult to read ;) Maybe step through the javascript code using FireBug and try to detect at what point the page is reloaded ? 2009/9/18 浪漫様 rohmand...@gmail.com that should be the view div id=formularioajax form id=PreguntaResponderForm ?=$form-textarea('Pregunta.texto',array('rows' = 5,'cols' = 50)); ? ?=$form-end($mb-localizacion(botonEnviar, $idiomaUsuario)); ? ?=$mb-formularioAjax(formularioajax, pregunta, responder, $idPregunta./.$tipoRespuesta, array(texto));? /div 'mb' is a helper, whose 'formularioAjax' creates the ajax form: /* Creacion de un formulario que se enviara por JQuery */ function formularioAjax($divId, $controlador, $funcion, $parametros, $campos, $callbacks = null) { $output = ; $output.= 'script type=text/javascript'; $output.= '$(function(){'; $output.='$(form#'.ucfirst(strtolower($controlador)).ucfirst (strtolower($funcion)).'Form).submit(function() {'; foreach ($campos as $item) { $output.= 'var '.$item.' = $(#'.ucfirst(strtolower ($controlador)).ucfirst(strtolower($item)).').attr(value);'; } $output.= '$(#'.$divId.').html($.ajax({'; $output.= 'type: POST,'; $url = /.strtolower($controlador).s/.strtolower($funcion); if ($parametros != '') { $url.= /.$parametros; } $output.= 'url: '.$url.','; $datos = ; foreach ($campos as $item) { $datos.= '+datar['.ucfirst(strtolower($controlador)).']['. $item.']=+'.$item; } $output.= 'data: '.substr($datos, 3).','; if ($callbacks != '') { $output.= 'complete: function() {'.$callbacks.'},'; } $output.= 'async: false'; $output.= '}).responseText);'; $output.= 'return false;'; $output.= '});'; $output.= '});'; $output.= '/script'; return $output; } // function: formularioAjax it works perfectly on a simple view... but not in the pop-up div thanks Rohman On Sep 18, 5:03 pm, Bert Van den Brande cyr...@gmail.com wrote: Sorry, but it still sounds to me that the form inside your popup is being submitted like a normal form. Maybe show some code ? On Fri, Sep 18, 2009 at 10:58 AM, 浪漫様 rohmand...@gmail.com wrote: walther, thanks for the reply... but i guess you didn't read well my post neither... I'm able to send the form with ajax ( also using AjaxForm ) from a single view without any problem... the problem comes when you try to do it from a facebook style div-window that pops up... imagine i am reading a post and i want to send the comment with an ajax form... yes... that works without any problem, the form is already located on the main ( post ) view, and form is sent and comments div is updated... no problem. now imagine you are building a facebook-alike social networking, and when clicking on a user's 'send message to xxx' link i want to open a pop-up ajax window to send message to him... but not from the main view's form... from a form located on a div appearing on screen ( i guess you are familliar with facebook or other sites that do that )... then the form is sent, but the page is reloaded while what i want is to refresh the ajax-window div. ( that's the problem ) thanks Rohman On Sep 18, 4:49 pm, Walther waltherl...@gmail.com wrote: Take a look at the AjaxForm plugin for jQuery. You need to submit the form using AJAX as well. On Sep 18, 10:15 am, 浪漫様 rohmand...@gmail.com wrote: i don't think that is the problem... facebook can do it without iFrames and works perfectly no matter what browser. moreover... i'm talking about same domain's forms... nothing to do with external domains. if i'm building a facebook-alike social networking, and when clicking on a user's link i want to open a pop-up ajax window to send message to him... where is the cross-domain issue? thanks for the reply : ) just i think you confuse the topic Rohman On Sep 18, 3:50 pm, wirtsi florian.kra...@googlemail.com wrote: I think you are running into the same-origin-issue ... most browsers only allow ajax-requests so the same domain. Check out this posthttp://www.petefreitag.com/item/703.cfm With iframes you can post data freely to any other domain. I'd just like to mention here, that if you want to post uploaded files, you'll also need an iframe form since you can't upload files via ajax calls On 18 Sep., 09:12, 浪漫様 rohmand...@gmail.com wrote: hello all, i had been successful on sending forms via ajax on a view and updating some divs instead of reloading the page without much problem, however, when the form is located on a facebook-like ajax pop-up div, the page is always reloaded on submission... and that's
Re: Common functions
Have a look at Cake Components : http://book.cakephp.org/view/62/Components Though the part about 'select * for all the $uses models every time' might be a bit tricky. On Fri, Sep 18, 2009 at 11:26 AM, Vijay k.vidn...@gmail.com wrote: Hello All, I have one query, i need some data repeatedly in my most of the controllers. So is there any solution for creating a common function for that data then i can use it in my most of the controllers. It is link i need users data in my all pages for display. So i am creating a common function in the app_controller.php calling it in the required controller actions. But for this i have to use $uses in the app_controller, it executes the select * for all the $uses models every time. So is there any better way to follow. 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 cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: problem with facebook-like ajax windows submitting forms
No sorry, I don't have any examples at hand. I still suggest to debug the javascript code with FireBug to detect at which point the browser decides that it needs to leave the current page. 2009/9/18 浪漫様 rohmand...@gmail.com well, the code works perfectly on normal views, just fails when creating the pop-up window... so, i'm wondering if the view is loading correctly there ( if the jquery code is loading correctly )... do you have any working example? something you had try and really work? then i would like to take a look. thanks Rohman --~--~-~--~~~---~--~~ 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: Can't email using the Email Component
I use Eclipse PDT combined with XDebug to step through the code that's being executed to detect where the mail sending fails. In this case I would suggest to simple remove the @ in the __mail() function from the Email Component (/cake/libs/controllers/components/email.php) : function __mail() { $header = implode(\n, $this-__header); $message = implode(\n, $this-__message); if (ini_get('safe_mode')) { return mail($this-to, $this-__encode($this-subject), $message, $header); } return mail($this-to, $this-__encode($this-subject), $message, $header, $this-additionalParams); } This will hopefully show a warning or error from the mail function telling you why the mail isn't being sent out ... Hope this helps. On Fri, Sep 18, 2009 at 7:27 PM, lovettcreati...@gmail.com ed...@lovettcreations.org wrote: What do you emain you usually debug into the Email Components? On Sep 18, 1:48 am, Bert Van den Brande cyr...@gmail.com wrote: Have you tested the PHP mail() function directly ? The problem with the EmailComponent is that it hides any indicative mail errors that would help you find the cause for the problem ... I usually debug into the EmailComponents send code ... On Fri, Sep 18, 2009 at 7:00 AM, damanlovett ed...@lovettcreations.org wrote: I have read every tutorial and discussion but I can't get the email to send out. Below is an excerpt from my controller. It redirects fine, but I still get Simple email not sent. Is there some setting in the core or somewhere else that I'm missing? var $components = array('Email'); function sendemail(){ $this-Email-to = 'ed...@myemail.com'; $this-Email-subject = 'Cake test simple email'; $this-Email-replyTo = 'nore...@localhost'; $this-Email-from = 'Cake Test Account nore...@localhost'; $this-Email-delivery = 'mail'; if ( $this-Email-send('Here is the body of the email') ) { $this-Session-setFlash('Simple email sent'); } else { $this-Session-setFlash('Simple email not sent'); } $this-redirect('/offices'); } --~--~-~--~~~---~--~~ 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: Calling a function inside app_controller
Debug your code to see what's happening ? On Sat, Sep 19, 2009 at 4:05 AM, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: I am trying to call a simple function inside the app_controller but nothing is happening. function afterPaypalNotification($txnId) { if ($transaction['InstantPaymentNotification']['payment_status'] == 'Completed') { //get info from transaction $user_id = $transaction['InstantPaymentNotification']['custom']; $adding = $transaction['InstantPaymentNotification']['quantity']; $credits = $this-User-getCredits($user_id); $addCredits = $adding + $credits; $this-User-id = $user_id; $this-User-saveField('credits', $addCredits); } else { //do something else Not Approved email } } public function getCredits($id) { $params = array( 'conditions' = array( 'User.id' = $id), 'fields' = array('User.id', 'User.credits'), 'contain' = false); $q = $this-User-find('first', $params); return $q['User']['credits']; } Where am I going wrong here? The IPN is being sent back when I test from PayPal sandbox, saved to mydb so there is a record. I am sending a real user id to test so it should be doing something. 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: PayPal Help
Requiring our users to provide all the information for a valid login isn't really a 'Pay Now' option imho. Since it's required anyway to have a site login, I would show the Pay button only when you have validated the account creation form and the new account is created in your database. As a visual trick maybe you can display a 'Pay Now' button that not links to PayPal but only submits your own account creation form. On Sat, Sep 19, 2009 at 12:12 AM, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: I managed to figure out the harder PayPal Pro website gateway integration but cant seem to figure out the simple Pay Now buttons. Basic scenario is if the User is not logged in they have to create an account and pay in 1 shot. Pay Pal has a requirement that you offer customers the option to use Pay Now / Express Checkout without logging into your site I need to figure this out. So the form appears with Create your account username,password, confirm password so submit the form if it validates the user is created, take the newly created User.id and pass that to PayPal in [custom] key value = $id but how do I then send the info to PayPal? If I click on the PayPal buy now button it sends the user to PayPal to log into their PayPal account but at this point its too late because I sent no info. One or the other but I cant seem to figure out how to do both at once. Should I create a regular registration form but point it to PayPal $url, run validation before sending on the User.fields. If validates creates the user , grab the id and then pass that to the info that gets sent to PayPal? But once the form is validated wont it just send off ? Clueless. Can someone who has done something like this point me in the right direction, tips, suggestions. Greatly appreciated. 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: Validation Errors Displaying on Add but not on Edit?
Have you debugged/tested that when you perform an 'edit' the data is actually posted to the correct url ? Another I would verify is that in the controller method the code actually executes at the save() method ... On Fri, Sep 18, 2009 at 7:27 AM, Sarah sarah.e.p.jo...@gmail.com wrote: I am not redirecting after an unsuccessful state, I only reset two of the fields to empty strings. The url is the same. Any ideas? Thanks, ~Sarah On Sep 17, 8:29 pm, Dr. Loboto drlob...@gmail.com wrote: Don't do redirect after unsuccessful save, be sure that form URL is same as your edit action. Presence of data in fields may indicate only browser forms cache. On Sep 17, 11:30 am, Sarah sarah.e.p.jo...@gmail.com wrote: I've searched the forum, and I can't find any posts that correspond to my question...unfortunately I haven't had much luck with the manual either. I have user add and edit forms. In my add form the proper validation errors show as they supposed to. However, in the edit form the errors do not show (the page does not validate/save, the page reloads with the data still stored in the form fields, but there are no errors messages). Any idea why the errors show for one but not the other? Thanks in advance, ~Sarah (I understand that you can use FormHelper options to override the error message, but this isn't what I want.) --~--~-~--~~~---~--~~ 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: Can't email using the Email Component
Have you tested the PHP mail() function directly ? The problem with the EmailComponent is that it hides any indicative mail errors that would help you find the cause for the problem ... I usually debug into the EmailComponents send code ... On Fri, Sep 18, 2009 at 7:00 AM, damanlovett ed...@lovettcreations.orgwrote: I have read every tutorial and discussion but I can't get the email to send out. Below is an excerpt from my controller. It redirects fine, but I still get Simple email not sent. Is there some setting in the core or somewhere else that I'm missing? var $components = array('Email'); function sendemail(){ $this-Email-to = 'ed...@myemail.com'; $this-Email-subject = 'Cake test simple email'; $this-Email-replyTo = 'nore...@localhost'; $this-Email-from = 'Cake Test Account nore...@localhost'; $this-Email-delivery = 'mail'; if ( $this-Email-send('Here is the body of the email') ) { $this-Session-setFlash('Simple email sent'); } else { $this-Session-setFlash('Simple email not sent'); } $this-redirect('/offices'); } --~--~-~--~~~---~--~~ 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: Unable to view Cake Start Page
Try changing Directory /ims Options Indexes MultiViews AllowOverride All Order deny,allow Deny from all /Directory to Directory /ims Options Indexes MultiViews AllowOverride All Order allow,deny Allow from all /Directory On Fri, Sep 18, 2009 at 6:11 AM, Selvam mavle...@gmail.com wrote: Hi, Before I begin, let me announce that I'm a newbie. I downloaded Cake 1.2. Unzipped it and placed it under a directory called ims under htdocs of Apache 2.2.13 with PHP/5.3.0 in Windows XP Each time I type htttp://localhost/ims, I keep on getting the directory listing rather than the Cake Start Page. I refered to many resources and changed the Directory / to Directory /ims . And each time I type the URL it still shows the directory listing of Cake. I checked the error log and it shows the following : [Fri Sep 18 11:46:55 2009] [error] [client 127.0.0.1] client denied by server configuration: C:/Program Files/Apache Software Foundation/ Apache2.2/htdocs/ims/.htaccess Tried many tricks, it's still not showing the Cake Start Page that I'm longing to see.Please help. I have listed the httpd.conf contents below. Thank you. # # This is the main Apache HTTP server configuration file. It contains the # configuration directives that give the server its instructions. # See URL:http://httpd.apache.org/docs/2.2 for detailed information. # In particular, see # URL:http://httpd.apache.org/docs/2.2/mod/directives.html # for a discussion of each configuration directive. # # Do NOT simply read the instructions in here without understanding # what they do. They're here only as hints or reminders. If you are unsure # consult the online docs. You have been warned. # # Configuration and logfile names: If the filenames you specify for many # of the server's control files begin with / (or drive:/ for Win32), the # server will use that explicit path. If the filenames do *not* begin # with /, the value of ServerRoot is prepended -- so logs/foo.log # with ServerRoot set to C:/Program Files/Apache Software Foundation/ Apache2.2 will be interpreted by the # server as C:/Program Files/Apache Software Foundation/Apache2.2/ logs/foo.log. # # NOTE: Where filenames are specified, you must use forward slashes # instead of backslashes (e.g., c:/apache instead of c:\apache). # If a drive letter is omitted, the drive on which httpd.exe is located # will be used by default. It is recommended that you always supply # an explicit drive letter in absolute paths to avoid confusion. # # ServerRoot: The top of the directory tree under which the server's # configuration, error, and log files are kept. # # Do not add a slash at the end of the directory path. If you point # ServerRoot at a non-local disk, be sure to point the LockFile directive # at a local disk. If you wish to share the same ServerRoot for multiple # httpd daemons, you will need to change at least LockFile and PidFile. # ServerRoot C:/Program Files/Apache Software Foundation/Apache2.2 # # Listen: Allows you to bind Apache to specific IP addresses and/or # ports, instead of the default. See also the VirtualHost # directive. # # Change this to Listen on specific IP addresses as shown below to # prevent Apache from glomming onto all bound IP addresses. # #Listen 12.34.56.78:80 Listen 80 # # Dynamic Shared Object (DSO) Support # # To be able to use the functionality of a module which was built as a DSO you # have to place corresponding `LoadModule' lines at this location so the # directives contained in it are actually available _before_ they are used. # Statically compiled modules (those listed by `httpd -l') do not need # to be loaded here. # # Example: # LoadModule foo_module modules/mod_foo.so # LoadModule actions_module modules/mod_actions.so LoadModule alias_module modules/mod_alias.so LoadModule asis_module modules/mod_asis.so LoadModule auth_basic_module modules/mod_auth_basic.so #LoadModule auth_digest_module modules/mod_auth_digest.so #LoadModule authn_alias_module modules/mod_authn_alias.so #LoadModule authn_anon_module modules/mod_authn_anon.so #LoadModule authn_dbd_module modules/mod_authn_dbd.so #LoadModule authn_dbm_module modules/mod_authn_dbm.so LoadModule authn_default_module modules/mod_authn_default.so LoadModule authn_file_module modules/mod_authn_file.so #LoadModule authnz_ldap_module modules/mod_authnz_ldap.so #LoadModule authz_dbm_module modules/mod_authz_dbm.so LoadModule authz_default_module modules/mod_authz_default.so LoadModule authz_groupfile_module modules/mod_authz_groupfile.so LoadModule authz_host_module modules/mod_authz_host.so #LoadModule authz_owner_module modules/mod_authz_owner.so LoadModule authz_user_module modules/mod_authz_user.so LoadModule autoindex_module modules/mod_autoindex.so #LoadModule cache_module modules/mod_cache.so #LoadModule cern_meta_module modules/mod_cern_meta.so LoadModule
Re: app problems after upgrading cake to newer versions.. [within 1.2.4.xx] ?
Interesting to see the basic memory footprint of a basic CakePHP page. Without reference material of course there's way to evaluate this data :) Glad the problem is sorted out ... On Thu, Sep 10, 2009 at 1:19 PM, Tokasa toka...@gmail.com wrote: I did few more testing :) I have put this in my script to see how memory is occupied... http://us2.php.net/manual/en/function.memory-get-usage.php http://us2.php.net/manual/en/function.memory-get-peak-usage.php I have compared 2 use cases: 1) very very simple script BAKED by cakephpit was index page with 4 records in db - no more data displayed! 2) and my issue script commented above...this takes much more records then I mentioned before (1-2 rec.)...I was not correct sorry for confusion. I first case it eats approx 6.75 MB and in second case it eats at the end of script 8.15 MB. From this I see that cake take at least some 6MB to start :) I am ok with that, thanks... On Sep 10, 12:24 pm, Bert Van den Brande cyr...@gmail.com wrote: Is 8MB much ... all depends on the functionality of the scripts. Personally I almost always need higher limits from the moment you start working with shells/scripts that consume lot's of data. Seeing that you only read 2 records from the database I suspect there is some functionality inside the controller/view that consumes lot's of memory. On Thu, Sep 10, 2009 at 11:58 AM, Tokasa toka...@gmail.com wrote: in the element draw_form_item.ctp on line 35 I do only request action to get data and I pass them to render another element but the database is almost empty...I am fetching 1-2 records... is it wrong that I render element from other element? could this increase the memory?? On Sep 10, 11:55 am, Tokasa toka...@gmail.com wrote: Hi Bert, thanks for your reply. I have tried to raise memory limit from 8MB to 9MB and it works then OK Anyway do you have any idea if 9MB memory usage is absolutely NORMAL or I have to optimize something?? I know I can increase it e.g. up to 128MB but I dont know yet what hosting company accepts... Thanks Tomas On Sep 9, 12:25 pm, Bert Van den Brande cyr...@gmail.com wrote: I think it also depends on what your own code is doing in draw_form_item.ctp on line 35 . Possibly the CakePHP upgrade requires a little bit of extra memory, and your script was already near the limit of 8MB using the previous CakePHP version ? Try raising the memory limit a bit and evaluate the outcome. Friendly greetings, Bert On Wed, Sep 9, 2009 at 11:12 AM, toka...@gmail.comtoka...@gmail.com wrote: Hi, I have got some little issue and I would appreciate if anybody can help me out :) In some specific part PHP (not even cake I guess) gives me strange error. Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 19456 bytes) in /Users/tokasa/www/project/app/views/elements/ forms/draw_form_item.ctp on line 35 The thing I do no understand is that it occurs only between upgrade from 1.2.4.8166 to 1.2.4.8284 or even the newest 1.2.5. On spring I started developing an application in cake 1.2.4.8004 - upgrade to 1.2.4.8120 - 1.2.4.8166. and everythin was fine. As I said this problems pops up going to higher version starting the 1.2.4.8284. I have got two teories... my code was wrong and fortunately it worked in older versions DUE to some old bug... OR developers had changed something significant... There is something I have found in my debugging times... It may have something to do with requestAction(...). I i comment that it works... Thanks for any Idea!! I nobody has something I will report that as a bug... Tomas --~--~-~--~~~---~--~~ 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: Smarty
Though Smarty may be handy in some usecases, I also would suggest to use the Cake formhelper ... On Fri, Sep 11, 2009 at 2:37 PM, Smelly Eddie ollit...@gmail.com wrote: Drop Smarty. Cake makes form generation a snap. Please read the book. (@CAKEPHP.ORG) On Sep 11, 1:56 am, Dave nec...@gmail.com wrote: Hi, Trying to use the smartyform helper to create forms. Anyone point me to an example? Completely lost at the moment 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: PHP IDEs
I also use Eclipse PDT. Pro's : * out of the box support for debugging with Zend and XDebug (what developer can live without debugging ?) * code completion * SVN integration (requires plugin) * Mylyn (task based contexts) and the Jira | TRAC connector Con's : * memory usage is rather big * overall performance drops now and then Tried NetBeans a couple of times but couldn't get used to the shortcuts + didn't see any real advantages over Eclipse ... Friendly greetings, Bert On Fri, Sep 11, 2009 at 9:55 AM, Werschinger dinko.ve...@googlemail.com wrote: I want to add to Kornelije's post that there's also free Komodo Edit, which I use under Mac OS and like a lot. Some features I often use: - snippets - custom keyboard combinations - split view (e.g. when editing two parts of a long file) It is available for all major operating systems. The IDE is much more powerful but also costly. --~--~-~--~~~---~--~~ 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: Problem with Security component and form submit
A clean white page suggests an error that can't be shown because you have set the debug level to 0. Try setting it to 1 or 2 and see if the 'white page' now outputs an error message. On Thu, Sep 10, 2009 at 11:32 AM, byqsri marco.rizze...@gmail.com wrote: On 10 Set, 11:16, WebbedIT p...@webbedit.co.uk wrote: How do you know if this is a security component issue as the form is not being submitted to a Controller/Action to be processed?!? Because if I don't use the Security component the form is correctly submit. What should happen if the form submits to the url /test/? It doesn't anything.Simply it reloads the page. --~--~-~--~~~---~--~~ 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: Problem with Security component and form submit
What's the url of the page with the form, and what's the url of the white page ? Maybe inspect traffic with the FireFox plugin Tamper Data to detect what's going on ... On Thu, Sep 10, 2009 at 11:46 AM, byqsri marco.rizze...@gmail.com wrote: I try to set the debug mode to 1 and to 2 but there is no errors On 10 Set, 11:37, Bert Van den Brande cyr...@gmail.com wrote: A clean white page suggests an error that can't be shown because you have set the debug level to 0. Try setting it to 1 or 2 and see if the 'white page' now outputs an error message. On Thu, Sep 10, 2009 at 11:32 AM, byqsri marco.rizze...@gmail.com wrote: On 10 Set, 11:16, WebbedIT p...@webbedit.co.uk wrote: How do you know if this is a security component issue as the form is not being submitted to a Controller/Action to be processed?!? Because if I don't use the Security component the form is correctly submit. What should happen if the form submits to the url /test/? It doesn't anything.Simply it reloads the page. --~--~-~--~~~---~--~~ 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: app problems after upgrading cake to newer versions.. [within 1.2.4.xx] ?
Is 8MB much ... all depends on the functionality of the scripts. Personally I almost always need higher limits from the moment you start working with shells/scripts that consume lot's of data. Seeing that you only read 2 records from the database I suspect there is some functionality inside the controller/view that consumes lot's of memory. On Thu, Sep 10, 2009 at 11:58 AM, Tokasa toka...@gmail.com wrote: in the element draw_form_item.ctp on line 35 I do only request action to get data and I pass them to render another element but the database is almost empty...I am fetching 1-2 records... is it wrong that I render element from other element? could this increase the memory?? On Sep 10, 11:55 am, Tokasa toka...@gmail.com wrote: Hi Bert, thanks for your reply. I have tried to raise memory limit from 8MB to 9MB and it works then OK Anyway do you have any idea if 9MB memory usage is absolutely NORMAL or I have to optimize something?? I know I can increase it e.g. up to 128MB but I dont know yet what hosting company accepts... Thanks Tomas On Sep 9, 12:25 pm, Bert Van den Brande cyr...@gmail.com wrote: I think it also depends on what your own code is doing in draw_form_item.ctp on line 35 . Possibly the CakePHP upgrade requires a little bit of extra memory, and your script was already near the limit of 8MB using the previous CakePHP version ? Try raising the memory limit a bit and evaluate the outcome. Friendly greetings, Bert On Wed, Sep 9, 2009 at 11:12 AM, toka...@gmail.comtoka...@gmail.com wrote: Hi, I have got some little issue and I would appreciate if anybody can help me out :) In some specific part PHP (not even cake I guess) gives me strange error. Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 19456 bytes) in /Users/tokasa/www/project/app/views/elements/ forms/draw_form_item.ctp on line 35 The thing I do no understand is that it occurs only between upgrade from 1.2.4.8166 to 1.2.4.8284 or even the newest 1.2.5. On spring I started developing an application in cake 1.2.4.8004 - upgrade to 1.2.4.8120 - 1.2.4.8166. and everythin was fine. As I said this problems pops up going to higher version starting the 1.2.4.8284. I have got two teories... my code was wrong and fortunately it worked in older versions DUE to some old bug... OR developers had changed something significant... There is something I have found in my debugging times... It may have something to do with requestAction(...). I i comment that it works... Thanks for any Idea!! I nobody has something I will report that as a bug... Tomas --~--~-~--~~~---~--~~ 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: app problems after upgrading cake to newer versions.. [within 1.2.4.xx] ?
I think it also depends on what your own code is doing in draw_form_item.ctp on line 35 . Possibly the CakePHP upgrade requires a little bit of extra memory, and your script was already near the limit of 8MB using the previous CakePHP version ? Try raising the memory limit a bit and evaluate the outcome. Friendly greetings, Bert On Wed, Sep 9, 2009 at 11:12 AM, toka...@gmail.comtoka...@gmail.com wrote: Hi, I have got some little issue and I would appreciate if anybody can help me out :) In some specific part PHP (not even cake I guess) gives me strange error. Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 19456 bytes) in /Users/tokasa/www/project/app/views/elements/ forms/draw_form_item.ctp on line 35 The thing I do no understand is that it occurs only between upgrade from 1.2.4.8166 to 1.2.4.8284 or even the newest 1.2.5. On spring I started developing an application in cake 1.2.4.8004 - upgrade to 1.2.4.8120 - 1.2.4.8166. and everythin was fine. As I said this problems pops up going to higher version starting the 1.2.4.8284. I have got two teories... my code was wrong and fortunately it worked in older versions DUE to some old bug... OR developers had changed something significant... There is something I have found in my debugging times... It may have something to do with requestAction(...). I i comment that it works... Thanks for any Idea!! I nobody has something I will report that as a bug... Tomas --~--~-~--~~~---~--~~ 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: Production server MySQL connection problem...
Does your provider guarantees that a client coming from the address 'www17.jnb2.host-h.net has access to the mysql database ? On Wed, Sep 9, 2009 at 10:25 AM, CapeTownGuycobus.van.aa...@gmail.com wrote: Hi, I keep on getting the following message on my production server and the hosting company asked me to troubleshoot my code... (xxx denotes the correct server config info)... this configuration, when edited on my localhost works fine. Warning (2): mysql_connect() [function.mysql-connect]: Host 'www17.jnb2.host-h.net' is not allowed to connect to this MySQL server [CORE/cake/libs/model/datasources/dbo/dbo_mysql.php, line 374] $config = array( persistent = false, host = xxx, login = xxx, password = xxx, database = xxx, port = 3306, connect = mysql_pconnect, driver = mysql, prefix = ) $connect = mysql_pconnect Can somebody please point me in the right direction? --~--~-~--~~~---~--~~ 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: Problem with find condition and array
I have used array assignment before and it works perfectly : // General conditions for the query $conditions = array( 'Institute.conversions' = 'yes', 'Institute.brochure_pay_amount ' = 0, 'Training.id' = $highestRatedTrainingIds, '1 = 1 GROUP BY Training.id' ); Sorry that I can't tell you why it fails :-/ On Fri, Aug 28, 2009 at 10:50 AM, schneimimichael.schne...@arcor.de wrote: Hi, I have an array with some ids of a model and struggle with getting them into a find condition. This is what I currently use, it works but is not very caky: $audioIds = array('1', '2', '3',); $audios = $this-Audioplaylist-Audio-find('all', array('conditions' = 'Audio.id='.implode(' OR Audio.id=', $audioIds))); I think it should look like this the cake way: $audios = $this-Audioplaylist-Audio-find('all', array('conditions' = array('Audio.id' = $audioIds))); but this results in [...] AND `Audio`.`id`=Array [...] I already had a look into the cookbook and played around alot, but couldn't figure out a proper way, so I hope you can help me. Thx, Michael --~--~-~--~~~---~--~~ 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: store array into session
Afaik you can store arrays into sessions. The documentation says it's type String for Session-write() , but specifies 'mixed' for Session-read() , so I'm guessing it's a documentation glitch. Only one way to find out ... test it :) On Fri, Aug 28, 2009 at 11:30 AM, persianshadowpersiansha...@gmail.com wrote: hi Melgior my website have heavy process and i searching for fast solution that store and read array . On Aug 28, 12:02 pm, Melgior melg...@hotmail.com wrote: As a last resort, you could always use PHP's serialize and unserialize functions to convert the array into a string and back. I think there must be a better way to do it, but I've got no ideas about how currently. If you're building a busy site, then using serialize is performance wise not the best option. On 28 aug, 10:31, persianshadow persiansha...@gmail.com wrote: hi i want store array of ids into session but i explore API of cakephp and see $value ( Session-write($name,$value) ) only get string , i need it for store id of items that user select . anybody have idea for do this ? 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: MVC-way to obtain common data formatting
Hmm I see ... well, I think this can only be accomplished with some kind of helper method/class in the view, just like Jon Bennet says. Imho a class like that will get bloated very quickly , because there will be different options to choose from on how to display the data. A small helper for translating model-specific values would be my personal choice. On Wed, Aug 26, 2009 at 3:51 PM, ark0n3nicolabeg...@gmail.com wrote: @ Bert: yes that's the problem, I'm looking for a way to accomplish in an automatic way and not only for boolean fields (which aren't difficult to implement with an ad-hoc behavior) On 26 Ago, 15:46, Bert Van den Brande cyr...@gmail.com wrote: I don't really understand the problem you present. Either you display a model field as a read-only piece of information in the view, and then there is no problem with data being updated. Or you display model data in a form that can be edited, and in case of for example the boolean you provide a dropdown list or use a radio button that displays a readable string to the user but holds the raw data as the value. On Wed, Aug 26, 2009 at 2:46 PM, ark0n3nicolabeg...@gmail.com wrote: Hi Jon thanks for your kind reply but that's just what I'd avoid: I'm trying to accomplish an automatic way to achieve that result, I know it's not right to use a model function and I asked for an MVC and non- validation-breaking way.. On 26 Ago, 11:23, Jon Bennett jmbenn...@gmail.com wrote: Hi Nicola. I'm trying to understand if and in which way could be possible to achieve such a result. Maybe I've explained the wrong way: I need to format some common fields like boolean value and achieve this adding an afterFind(results) callback in the app_model.php. I'd like to know if this is the best way to accomplish this 'cause I noticed that (of course) it causes problems when trying to edit something: the datas are formatted as I requested in the app_model but this causes validation problems (super simple example: boolean humanized as Yes/ No and no more as 1/0). I would have thought the only time you need to display 1 or 0 as yes or no is in the view. You're quite right that if you adjust the data in app_model, it will break your DB. I have a Config value set in my bootstrap, and output that. eg: // bootstrap.php Configure::write('yesno', array(0='No', 1='Yes'); // View Configure::read('yesno.'.$row[$modelClass]['field']); // outputs 'Yes' for 1, and 'No' for 0. hth Jon -- jon bennett w:http://www.jben.net/ iChat (AIM): jbendotnet Skype: jon-bennett --~--~-~--~~~---~--~~ 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: MVC-way to obtain common data formatting
I don't really understand the problem you present. Either you display a model field as a read-only piece of information in the view, and then there is no problem with data being updated. Or you display model data in a form that can be edited, and in case of for example the boolean you provide a dropdown list or use a radio button that displays a readable string to the user but holds the raw data as the value. On Wed, Aug 26, 2009 at 2:46 PM, ark0n3nicolabeg...@gmail.com wrote: Hi Jon thanks for your kind reply but that's just what I'd avoid: I'm trying to accomplish an automatic way to achieve that result, I know it's not right to use a model function and I asked for an MVC and non- validation-breaking way.. On 26 Ago, 11:23, Jon Bennett jmbenn...@gmail.com wrote: Hi Nicola. I'm trying to understand if and in which way could be possible to achieve such a result. Maybe I've explained the wrong way: I need to format some common fields like boolean value and achieve this adding an afterFind(results) callback in the app_model.php. I'd like to know if this is the best way to accomplish this 'cause I noticed that (of course) it causes problems when trying to edit something: the datas are formatted as I requested in the app_model but this causes validation problems (super simple example: boolean humanized as Yes/ No and no more as 1/0). I would have thought the only time you need to display 1 or 0 as yes or no is in the view. You're quite right that if you adjust the data in app_model, it will break your DB. I have a Config value set in my bootstrap, and output that. eg: // bootstrap.php Configure::write('yesno', array(0='No', 1='Yes'); // View Configure::read('yesno.'.$row[$modelClass]['field']); // outputs 'Yes' for 1, and 'No' for 0. hth Jon -- jon bennett w:http://www.jben.net/ iChat (AIM): jbendotnet Skype: jon-bennett --~--~-~--~~~---~--~~ 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: Differing validation on add and edit methods
Hi, what I do when updating User details without a password is simply removing the validation in the controller before the model 'save' method is called : unset($this-User-validate['password']); Friendly greetings, Bert So by default I validate it, On Fri, Aug 21, 2009 at 7:59 AM, DavidHdjhollingwo...@gmail.com wrote: Thinking about it further the use of 'on' = 'create' isn't going to do it for me because there will be a separate update facility. I guess I could 1. Pass the password through the edit view in a hidden field, or 2. When editing the user details (but not the password) get the current password from the database and inject it into the data, which I think would be much more secure than option 1 I guess that would work. Then I can use the same validation in all cases. David On Aug 20, 8:17 pm, majna majna...@gmail.com wrote: You can set password validation only for add:http://book.cakephp.org/view/127/One-Rule-Per-Field using 'on' = 'create', // or: 'update' Or hack like unset($this-Model-validate['password'] :) On Aug 20, 6:58 pm, DavidH djhollingwo...@gmail.com wrote: Hi Is there a simple way to do this? I have a UsersController and User method that does a dose of validation on the username and passwords fields (as per this excellent tutorialhttp://tinyurl.com/52robw). It works fine on the add; but when invoking the edit I don't want the users passwords to be updated (this will; be done through a separate view) and so I don't want any validation to fire for the password field. I saw that you can turn validation off in the save() method; but that seems to be for all fields. Is there a way to turn of validation on specific fields? Or do I have to write a customer validation method that recognises which action has been invoked? Cheers David --~--~-~--~~~---~--~~ 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: Dying on blank white page
I've had blank pages when : * .htaccess was not working as it should, due to restrictions from Apache (it needed Allow Overwrite All) * a table was missing from the db, and the error couldn't be displayed by Cake because it got into a recursion when trying to output the message html (this is very project specific since we added some magic stuff to /app/config/routes.php) Still it's weird that all of a sudden it started working ... I'm thinking along the line of a browser page cache that just showed you the white page again instead of reloading the requested url ? On Thu, Aug 20, 2009 at 10:00 PM, Arvindarvind.mai...@gmail.com wrote: It has started to work without doing anything moments ago. All i did, i decided to debug through dispatcher and before going into the dispatcher i decided to do some dies around to the dispatcher call in webroot/index.php file to make sure it goes into (which i had tested already; just wanted to double check it) it and after doing 2-3 dies around the code if (!include(CORE_PATH . 'cake' . DS . 'bootstrap.php')) { trigger_error(CakePHP core could not be found. Check the value of CAKE_CORE_INCLUDE_PATH in APP/webroot/index.php. It should point to the directory containing your . DS . cake core directory and your . DS . vendors root directory., E_USER_ERROR); } if (isset($_GET['url']) $_GET['url'] === 'favicon.ico') { return; } else { $Dispatcher = new Dispatcher(); $Dispatcher-dispatch($url); } if (Configure::read() 0) { echo !-- . round(getMicrotime() - $TIME_START, 4) . s --; } and it started to work all at once. And tmp/cache files also started to get generated! VERY STRANGE INDEED!! I think there must be something which i am missing. Please let me know if someone has faced this kind of problem. Some apache server problem? Cake hash validation problem? or caching problem? Please put your thoughts before cakephp ( which i love the most in frameworks ) starts to become a mystery to me. (I wish it were not a cakephp problem though) On Aug 21, 12:21 am, Arvind arvind.mai...@gmail.com wrote: Hi everyone, I uploaded my local controller files, view files and one css file to remote server 2 hrs ago and tried to access the site admin section but it is dying on blank white page without any debug report or any error displayed. The entire system is working fine on my local wamp server and also worked well on the same remote server yesterday but is not working right now. I have checked all files many a times and all files mentioned above are parallel to my local files with one exception. On the remote server there is no cache files being generated inside the app/tmp/cache folder which i noticed today only but i am sure it worked with same settings 1 day ago. I am trying to debug in webroot/ index.php file and it is reaching till the dispatcher alright. I also tried by removing .htaccess but same problem with /webroot/index.php file. Mod rewrite is WORKING just fine. Not sure what is the problem. Anyone with thoughts on this is most welcome as i have already started to pull my hair. Here is the url where it is dying on blank page :http://d1041638.blacknight.com/admin/users/login Thanks in advance, Arvind. --~--~-~--~~~---~--~~ 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: containable behaviour in app_model
Can't think of any reason :) On Fri, Aug 21, 2009 at 2:16 PM, leoponton@gmail.com wrote: Is there any reason why it wouldn't be a good idea to globally add containable behaviour in app_model? viz: class AppModel extends Model { var $actsAs = array('Containable'); It would certainly save time over slavishly adding it to every model. --~--~-~--~~~---~--~~ 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: If Auth isAuthorize() == false, how to redirect user?
Not entirely sure but I think it's loginAction you need : http://book.cakephp.org/view/248/AuthComponent-Variables On Wed, Aug 19, 2009 at 5:42 AM, zotiumzot...@gmail.com wrote: When using the Auth-Authorize = 'controller' method of authorization, and isAuthorized() returns false, how do you set the URL where the user gets redirected? --~--~-~--~~~---~--~~ 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: Certain strings crashing CakePHP - where do I look first?
The redirect method belongs to Controller in /cake/libs/controller.php . That's the cake lib file, you don't want to edit that one. You can either : * define a new class or edit the existing class named 'AppController' in /app/app_controller.php * simply overwrite the 'redirect' function in your own controller class, though I'm not sure this will be sufficient since we are in doubt that Cake ever arrives at your own controller code Good luck with it :) On Mon, Aug 17, 2009 at 5:23 PM, technicaltitchtechnicalti...@gmail.com wrote: App was built Oct 2007 but it's taken the organization this long to find funding for someone to test and work on it, (hence I'm struggling to get my head round stuff again). I will have a go at creating a test subdirectory and adding that debug code- fantastic fantastic ideas thanks - probably blindingly obvious to PHPers but not to me (a decade working with C, Java and .NET but only ever used PHP on volunteer projects). Is it possible that a phpBB install may have had this as a side- effect? Ie, can filters be set up on all form input for a given space on a shared CPanel server? I have commented out my controller method and seen the error, so I'm assuming the redirect is called elsewhere, where do I put the redirect override code pls? As far as I can tell it isn't my code requesting the redirect but perhaps I'm missing something obvious? I commented out my controller method, route.php just has the default page specified. Tried debug level 1 and 2 and nothing is displayed about the error, or anything preceding the current page. Thanks SO much for your help - this is all so useful and despite my wandering off-subject, absolutely exactly how I hoped people would help me and I'm massively grateful, Chris --~--~-~--~~~---~--~~ 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: Certain strings crashing CakePHP - where do I look first?
Are you working in CakePHP debug mode ? I would advise setting the debug level to 2 , this would output performed sql queries which can be usefull in this case to find the cause of the error. Also, come to think of it ... I think Cake gives 404 errors when in production mode (debug level 0), thus hiding the real error message. Good luck ! On Wed, Aug 12, 2009 at 12:45 PM, technicaltitchtechnicalti...@gmail.com wrote: Thanks hugely delocalizer and bert and anyone else who reads this. I am trying to get the site working on Apache locally (I did have it but the hard disk crashed a couple months ago and I'm struggling hence the delay). I hadn't come across debugging PHP before - sounds very useful. What is the generally recommended setup for debugging PHP? I've found a couple Eclipse plugins - EclipsePDT based on xdebug and PHPeclipse which seems more basic. The string length does not seem relevant - the two strings currently isolated are: http://geocities.com/ [ed: this is not a link - this is the text I enter into the text field that creates the error] and the two Spanish sentences in my original post starting Los animales silvestres... - either of the sentences on its own does not crash, just the pair together. I don't specify the string length in the CakePHP, and it happens to both varchar(255) and blob database fields (mysql 5). By 404 I mean that when I press submit, it redirects to the homepage, which is exactly what it does if I type in a non-existent URL. I'm not sure what is doing this but if I can figure it out I'll create a 404 page to confirm. Thanks hugely Chris --~--~-~--~~~---~--~~ 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: Certain strings crashing CakePHP - where do I look first?
What exactly do you mean with 'to do something that looks like a 404 error' ? Can you reproduce the bug on a local development machine ? In any case I would suggest to setup PHP debugging and step through the code so you can detect what exactly causes the error ... Friendly greetings, Bert On Thu, Aug 6, 2009 at 12:23 PM, technicaltitchtechnicalti...@gmail.com wrote: Dear all, Please I'm desperate - if you had a simple CakePHP app, and certain strings in any text field caused it to give up without any error and display the default homepage, where could you look? I'm not asking for possible solutions as I realise this is too obscure for that, but I've absolutely no idea what part of the server could possibly have this effect. Anything that has anything to do with looking at form strings site-wide. I have removed all my controller code, I have removed the TinyMCE controllers and seen the bug in plain text inputs as well as textareas, I have tried GET and POST forms, I have tried entering the text via phpMyAdmin, or on a non-CakePHP site hosted on the same infrastructure and they work fine. Entering this string into any text field causes the error: http://geocities.com/ but entering this doesn't: http://geocities.com (ie, without the last character). Similarly for the string in Spanish in my original post - each sentence on it's own doesn't, but the two together does cause this error. Please ANY tip would be hugely appreciated - my PHP isn't at a level where I can trace through the Cake code, I've spent nearly a week on this, my next step is to rewrite the CMS in plain PHP which is several weeks' unpaid work I've no idea how I'll fit in. Thanks for any time or help whatsoever, Chris www.intiwarayassi.org On Aug 1, 4:20 pm, technicaltitch technicalti...@gmail.com wrote: Dear all, Thanks for your time. I've written a simple CakePHP+TinyMCE CMS and I'm having a horrendous time tracking a very strange error. Specific strings in any of the text fields are causing my website to do something that looks like a 404 error. These are the strings I have found so far - I can paste these into any of my text fields on the site and it causes a complete failure: http://geocities.com/; or Los animales silvestres del refugio fueron sacados de los circos, de los mercados y de las jaulas inhumanas, o fueron una vez de mascotas que muchos fueron muy maltratados por el amo. El proyecto consiste en la rehabilitación y la restauracion de nuevas especies para luego ser devueltos a su hábitat natural (and several others I'm painstakingly tracking down). If I remove even just part of the string it works perfectly. The behaviour is 100% predictable once you isolate the string. If I put a space in the middle, or delete the end '/', the problem disappears. I have commented out all of my controller code including the save and redirect and I still get the error. It happens whether or not model validation is taking place. I am doing nothing clever - just a simple POST form, 'edit' method and redirect to an index/admin page. I can find no error messages anywhere. Where do I start? I'm using CakePHP version 1.1.17.5612 on a standard CPanel-based host. Massive thanks for any tips whatsoever, I am completely lost on this, Chris The website is herewww.intiwarayassi.org- I'm a professional developer but did this for free --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---