Re: any way to omit app/webroot when request image file or directory inside it
Is there a primary reason you are scared of users figuring out that you are using cake? To the point you disregard the frameworks conventions? On Feb 25, 5:42 am, mohammad Al-Ani alani.moham...@gmail.com wrote: thanks for all but i stile looking for some settings or code to solve that On 25 February 2011 16:40, mohammad Al-Ani alani.moham...@gmail.com wrote: thanks Miles J But on top of that, anyone can see that you are sing Cake by checking your form structure, or that you are using named params. I already get over that by using $this-params['form'] to get the data from users On 24 February 2011 21:30, Miles J mileswjohn...@gmail.com wrote: You can try setting up some apache mod_rewrite rules. But on top of that, anyone can see that you are sing Cake by checking your form structure, or that you are using named params. On Feb 24, 9:52 am, mohammad Al-Ani alani.moham...@gmail.com wrote: hi all.. hope you do well I use cakephp from along and I faced a problem that I think it's a security issue when I request any file or directory that settle inside webroot directory. The URL automatically show the app/wedroot slug ex: request * *www.mydomian.com/css/main.css change in browser to www.mydomian.com/*app/webroot*/css/main.css I thing this shows up that I used cakephp. and I find it unprofessional way to leave such behavior any suggestions, idea... thanks for your time : ) -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php -- محمد العاني -- محمد العاني -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: any way to omit app/webroot when request image file or directory inside it
You can try setting up some apache mod_rewrite rules. But on top of that, anyone can see that you are sing Cake by checking your form structure, or that you are using named params. On Feb 24, 9:52 am, mohammad Al-Ani alani.moham...@gmail.com wrote: hi all.. hope you do well I use cakephp from along and I faced a problem that I think it's a security issue when I request any file or directory that settle inside webroot directory. The URL automatically show the app/wedroot slug ex: request * *www.mydomian.com/css/main.css change in browser to www.mydomian.com/*app/webroot*/css/main.css I thing this shows up that I used cakephp. and I find it unprofessional way to leave such behavior any suggestions, idea... thanks for your time : ) -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: file upload with miles johnsons upload plugin - without model
Your form is posting to a completely different url. Try setting this: echo $form-create('Model', array('type' = 'file', 'url' = array('controller'='pages','action'='display', 'upload'))); On Feb 24, 9:05 am, soymartinus mschenk@gmail.com wrote: Hi i'm new to cakephp and can't get miles johnsons upload plugin (http://www.milesj.me/resources/script/uploader-plugin) to work. i don't use/need a database for the upload form. so i created the upload.ctp in app/views/pages echo $form-create('Model', array('type' = 'file')); echo $form-input('fileName', array('type' = 'file')); echo $form-end('Upload'); and added to the pages_controller the function upload() like explained in the tutorial on miles webpage. in routes.php i put Router::connect('/upload', array('controller'='pages','action'='display', 'upload')); thats what i added to the pages_controller: //uploader plugin var $components = array('Uploader.Uploader'); var $actsAs = array('Uploader.FileValidation'); function upload() { //http://www.milesj.me/resources/script/uploader-plugin $this-set('testvar', hello world); $this-Uploader-uploadDir = 'files/uploads/'; $this-Uploader-enableUpload = true; $this-Uploader-maxFileSize = '8M'; // 8 Megabytes $this-Uploader-maxNameLength = 40; //$this-Uploader-mime('image', 'gif', 'image/gif'); //$this-Uploader-delete('files/uploads/filename.jpg'); if (!empty($this-data)) { if ($data = $this-Uploader-upload('fileName', array('overwrite' = true, 'name' = 'new_fileName'))){ debug($data); } } } when i now want to upload a file, i get always the error: Error: ModelsController could not be found. thank you very much in advance for any help regards from spain, martin -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Benchmark
There is a plugin called the DebugKit. It monitors benchmarks, SQL, variables, session, etc. https://github.com/cakephp/debug_kit On Feb 22, 11:36 pm, Chris DB cdbardemori...@gmail.com wrote: I am a new comer and fresh patissier for CakePHP. My Question: CakePHP use the concept of benchmarking to assess the performance of cake defined actions or methods of framework classes in response time? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: cakephp Messaging sysytem
This is the structure I have used in the past. id user_id - Sending recipient_id - Receiving status userFolder recipientFolder subject content created modified With the following enums (not mysql enums, but class integer/ constants). status = 0 unread, 1 read, 2 replied, 3 forwarded userFolder/recipientFolder = 0 inbox, 1 outbox, 2 spam, 3 saved, 4 deleted This allows you to use a single message for 2 users within a single row/table. Each user will see the same status as that information is shared, but the folder for each user will be different. Ala, one sent the message (outbox) while the other receives (inbox). Also when a user deletes the message, its not actually deleted, you just hide all deleted messages from the user, or place in the trash can. If both users set the message to deleted, delete the row literally. On Feb 23, 12:31 pm, Josh josha...@gmail.com wrote: Hey euromark, That looks like exactly what I'm trying to do. Could you also let us know what columns are in each table? I'm sort of following your logic, but not 100% and I think seeing the table columns would help a lot. ~Josh -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: configuration values in database?
I accomplished this using a model and the Configure class, like so: Configure::write('Forum.settings', ClassRegistry::init('Forum.Setting')-getSettings()); Place that in your bootstrap or AppController. The technique is being used in my 2.0 forum plugin. https://github.com/milesj/cake-forum/blob/2.0/forum_app_controller.php On Feb 20, 10:31 am, kdubya kenwin...@winanstech.com wrote: My suggestion would be to create a Model (maybe called Configuration with a DB table called configurations) for your configuration data then add the Model to your app_controller ($uses = array('Configuration');) so that it is available in all controllers. Depending on what you want to do with he configuration data, you may not need a controller. The Model class Configuration should probably have methods like get() and put() for accessing and adding/changing your settings. To learn about adding an app_controller.php to your app, see:http://book.cakephp.org/#!/view/957/The-App-Controller HTH, Ken -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Same code in controller, model and view
Or not use a helper, controller or behavior. Just because you are using Cake doesnt mean you have to ditch PHP conventions all together. Just create a static class, include it, and use it statically anywhere in your application. DateFormat::convert(); On Feb 16, 10:01 am, 100rk lubomir.st...@gmail.com wrote: And another correction (it was written right here, sorry): public function prettyDate($Model, $timestamp) { $alias = $this-_getAlias($Model); return date($this-settings[$alias], $timestamp); } return date($this-settings[$alias]['format], $timestamp); -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Loading components inside components and keeping the initialize() stack order
Why don't you just place the specialMethod() code into initialize()? Since thats basically what you are trying to achieve. On Feb 16, 2:51 am, Pixelastic timcc.pe...@gmail.com wrote: Hello, I'm writing a MainComponent that will need a SecondaryComponent in order to correctly work. I want to call some of SecondaryComponent::specialMethod() in MainComponent::initialize(), but this method can only correctly work if SecondaryComponent::initialize() is itself called first. Diving into code-land, here is what I mean. class FoosController extends AppController { var $components = array('MainComponent); } class MainComponent extends Object { var $components = array('SecondaryComponent'); function initialize($controller, $options) { $this-SecondaryComponent-specialMethod(); } } class SecondaryComponent extends Object { function initialize($controller, $options) { // Some really important stuff must go here } function specialMethod() { // This method can't work properly if the initialize() method hasn't be fired first } } I expected the stack order to call SecondaryComponent::initialize() then MainComponent::initialize() but it appears to call MainComponent::initialize() and then SecondaryComponent::initialize(), causing SecondaryComponent::specialMethod() to fail. I fixed it by manually calling $this-SecondaryComponent-initialize() in MainComponent::initialize(), but I still wonder if there would be a more cakish way of doing that. I'm not sure if this behavior is a bug, a design decision, an ommission or simply a wrong approach of myself. Has anyone some insight of this ? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Spot the difference
Its because you are redirecting before setting the data. Try this, assuming you are using the Auth component. function login() { $this-set('error', false); if ($this-Auth-user()) { $this-Session-setFlash('You are logged in!'); $this-Session-write('user.email', $this-Auth-user('email')); $this-redirect('/', null, false); } } But at that point, you can use use this everywhere if a user is logged in. $this-Auth-user('email') On Feb 16, 3:54 pm, barricades davow...@googlemail.com wrote: Hey there, I have a login function in which I had added some code to write a users email to the session. For some reason when I used this code: function login() { $this-set('error', false); //see if the user is already logged in /*if ($this-Session-read('Auth.User')) { $this-Session-setFlash('You are logged in!'); $this-redirect('/', null, false); } */ if($this-data){ $this-Session-write('user.email', $this-data['User']['email']); } } It wouldn't write the email to session (it does the check to see if the user is logged in ok), but when I used the following, it did. I don't understand, whats the difference? Can you only have one if statement in the login function or something? /*function login(){ $this-set('error', false); if($this-data){ $this-Session-write('user.email', $this-data['User'] ['email']); } }*/ -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: $this-Html vs $html
It sounds as if 1.3 isn't really running. I would check your paths and everything to make sure they are correct and are in fact running 1.3. On Feb 15, 10:18 am, Tan Cheng davidtan...@gmail.com wrote: Hi everyone, I'm a newbie to cakePHP, a question I always have is in the tutorial in 1.3 cookbook, the html helper always appears as $this-Html, but it never worked in my application. But when I change it to $html, it works just fine. This is the same with all the other helpers. I only added the $helpers in the app_controller file, nowhere else I overwrote the helper. Also, the neither the $html-script() nor the $this-Html-script works, it always tells me Method HtmlHelper::script does not exist. I have tried the 1.2.9, 1.3.2, 1.3.7. Anyone has some idea about this? Does it have anything to do with the php configuration? Any help is really appreciated. Thanks, -David -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: How to define a global constant which is available through whole app?
Like AD7 said, you cant use functions on class properties. Do it in the constructor. On Feb 15, 3:36 pm, Alejandro Gómez Fernández agom...@gmail.com wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Another way to do this is using session variables, in this case, a constant. You can always access this var in every module. Alejandro. El 15/02/2011 10:52, sanjibdhar...@gmail.com escribi : I tried Configure::write('company', 'xxx); in bootstrap.php and to access the constant I wrote var $company = Configure::read('company'); in AppController but it gives syntax error.Can somebody tell me how to access the constant or there is another way of to define a global constant through whole app. -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (MingW32) Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJNWw3oAAoJEHQn9CmeN9DJjAkH/2wj9WUQsjAxsr/AacdUT2BP 0dwi9JE7otI/UBpPcEYzax6OfQBGn4MtT4vGv6DOoz6gzQtufg8ZGHPw5Gq0wLzx ICqszm8+PbQCZd3+ht/V5yjuLWYNXJ+zCCGSaBCtZxk0LfEKJ41+enxxxNBf+jL+ 2Wr7x4kWf1wN0I1UaHicKKYhMLrID/mj/SIeMQK0WiQO2E2eCyq9XtU2iUQwUWEY OhLRz+GnUvQMn1vXtT3H8fkAkyj36Stx6+Pox7G2/gchM2slljC3UgDVNyeKPQu6 RQ5ANsW4WLTA2Ey4Qz8+beoQW/2E7dJl8r/DBuDp8k4/QqntR634tRTP0VVPSbM= =XhXQ -END PGP SIGNATURE- -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Validate from the controller
I believe you have to use saveAll() in this instance, validates() only supports 1 array dimension. On Feb 14, 9:23 am, Dee Johnson devario...@gmail.com wrote: I'm not 100% sure I understand what you are going for here, but if all you want to do is validate the input THEN save, which is what I gather from your question (please correct me if I'm wrong) then you need to move your validation code to the model and anything else if you want to do before a save you can put it in a callback. i.e beforeSave in the model as well I hope this helps -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: reading new cake book is painful than the old one.
There is a tree structure and search on the left sidebar. It requires JS enabled to work correctly. On Feb 13, 10:36 pm, andy_the ultimate baker anandghaywankar...@gmail.com wrote: hi, i am very sory to say that the new cake book is not helping as it was before, so many issues, its not even user friendy. it sah no proper search box, no tree structure index fo containts, and not even eye catching view. what u say gyes?? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Global Variable
You can use constants or the Configure class. Place the code within your bootstrap file and it should be available everywhere. On Feb 9, 6:50 pm, ShadowCross adri...@jps.net wrote: You can try adding it to your app_model: config/core.php: Configure::write('BRAND_NEW', '-24 hours'); Configure::write('NEW', '-48 hours'); Configure::write('RECENTLY_NEW', '-96 hours'); app_model.php: function rowNewness($data = null) { if (!$data) { $data = $this-data; } foreach ( array( 'BRAND_NEW', 'NEW', 'RECENTLY_NEW' ) as $newness ) { if ( $data[$model-alias]['created'] date('Y-m-d H:i:s', strtotime(Configure::read($newness))) ( { return $newness; } } return 'NOT_NEW'; } somethings_controller.php: ... switch ( $this-Something-rowNewness() ) { case 'BRAND_NEW': // fun stuff for brand new records break; case 'NEW': // other fun stuff for new records break; case 'RECENTLY_NEW': // still other fun stuff for recently new records } This should work if you are only testing the newness of records at the Model and Controller level, but not at the View level. If you want to be able to test at the View level as well, you can try creating a global function in config/bootstrap.php (see:http://book.cakephp.org/view/954/Bootstrapping-CakePHPfor additional details and configurations). On Feb 9, 5:54 pm, Krissy Masters naked.cake.ba...@gmail.com wrote: No, if that’s in 15 places then that’s of no use to me changing it in 15 places New USERS, POSTS, EVENTS various models / controller All have created dates, now I want a standard set of “time” definitions to define if each of these is new, brand_new, recently_new…so if I say 2 months from now NEW is now less than 12 hours I don’t have to go everywhere looking for if this $created less than 24 hours and make it 12, I just want to change it in 1 spot. $created less than NEW / BRAND_NEW / RECENTLY_NEW...so on so on. From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf Of Angel Robert Marquez Sent: Wednesday, February 09, 2011 9:51 PM To: cake-php@googlegroups.com Subject: Re: Global Variable interface when{ public function new(); } class shtuff implements when { function new($type); if ($type=helluv){...blah1} ifelse($type=retro){..blah2} } $now = new shtuff; $now-new('recent'); On Wed, Feb 9, 2011 at 5:13 PM, Krissy Masters naked.cake.ba...@gmail.com wrote: Quick question. I have 3 types / classifications of NEW Brand new = less than 24 hours New more than 24 but less than 48 hours And recently new more than 48 but less than 96 hours Now how can I define these globally so if I have in the code anywhere NEW or RECENT rather than tracing back all the spots where -24 hours so I can simply change the NEW, BRAND_NEW and RECENTLY_NEW if I want to increase or decrease their values later on So I can use something like this in the code: if ( $created BRAND_NEW ){ //fun stuff here } So I can change them in 1 spot and reflect on the site throughout. Configure::write('BRAND_NEW', date( 'Y-m-d H:i:s', strtotime( -24 hours ) ) ); Thanks -- Our newest site for the community: CakePHP Video Tutorialshttp://tv.cakephp.org Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorialshttp://tv.cakephp.org Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: do I need $this-Auth-userModel = 'User'; in every controller beforefilter or not?
Most of those settings are default, so now you do not have to add them as long as you follow conventions. For easier convenience, place in your AppController. However, you do need to allow() in every controllers beforeFilter(). On Feb 9, 12:03 pm, barricades davow...@googlemail.com wrote: I'm new to learning cakephp so firstly thanks to the developers (esp the core team) who have put so much effort into cake, it looks like it's going to be great when I finally figure it all out. I'm following the tutorialhttp://book.cakephp.org/view/1549/An-Automated-tool-for-creating-ACOs... - I have to admit that I'm loosely following it and suiting bits to my needs but I'm basically following it. I'd set it all up but it wasn't working properly in that it wasn't allowing me to access any functions in the posts controller when it was supposed to be allowing me. I just kept getting 'you are not authorized...' messages. In another tutorial I then read through it said that I should have $this-Auth-userModel = 'User'; in the beforefilter of my users controller and posts controller. When I put that line in things started to work. So I'm confused now. Is the tutorial wrong or have I got the wrong end of the stick? do I need $this-Auth-userModel = 'User'; in every controller beforefilter or not? Or can I stick it in the beforefilter of app_controller? Do I need it at all? thanks -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: simple page request
Your questions are so vague. You can put anything you want on each page. Form processing, file uploads, read/write of database data, i/o of the filesystem, xml parsing, whatever. On Feb 8, 10:00 am, zer0_gravity zr...@hotmail.com wrote: Could you give some examples/tutorial of what other task I could using page request... On Feb 7, 9:54 pm, Miles J mileswjohn...@gmail.com wrote: Anything. On Feb 7, 5:16 pm, cricket zijn.digi...@gmail.com wrote: On Mon, Feb 7, 2011 at 12:23 AM, zer0_gravity zr...@hotmail.com wrote: Using the controller to do a simple page request that show the results from find()/read() after passing the $id of the record being queried , what else can I do using a simple page request? Say again?- Hide quoted text - - Show quoted text - -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: simple page request
Anything. On Feb 7, 5:16 pm, cricket zijn.digi...@gmail.com wrote: On Mon, Feb 7, 2011 at 12:23 AM, zer0_gravity zr...@hotmail.com wrote: Using the controller to do a simple page request that show the results from find()/read() after passing the $id of the record being queried , what else can I do using a simple page request? Say again? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Users name / changes
Let them allow changes. I hate Facebooks restriction on name changes. Why should the site owners dictate how a user wants to be known? On Feb 3, 12:14 pm, Ryan Schmidt google-2...@ryandesign.com wrote: On Feb 2, 2011, at 22:06, Jeremy Burns | Class Outfit wrote: I usually make a username an email address because it is a no brainer for the user to come up with and remember FWIW, I hate sites that require me to use an email address as a username, because I have an infinite number of email addresses available to me via the catch-all rule at my domain name, and I can never remember which email address I used to register at any particular site. Plea to all site designers: Allow me to pick a username that I can remember. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Cake loads FALSE values as (empty)
Well, why are you even using 2.0? On Feb 2, 8:59 am, euromark dereurom...@googlemail.com wrote: nope, tilen its tinyint(1) !!! ideally unsigned (cant be negative anyway) thats what booleans are stored as tinyint(2) is for pseudo enum fields or small integer values On 2 Feb., 15:05, Tilen Majerle tilen.maje...@gmail.com wrote: for values like this, cake uses in database tinyint(2) fieldtype, where 1 means true and 0 means false (compatible with form helper) -- Lep pozdrav, Tilen Majerlehttp://majerle.eu 2011/2/2 Ernesto e.fanz...@gmail.com Hello. i noticed that Cake loads boolean values stored in DB as (empty value) instead of 0 (zero). is that intended? is there a way to avoid this? i'm using 2.0-dev -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.comcake-php%2Bunsubscr...@googlegroups.c omFor more options, visit this group at http://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: How much is too much?
Just cache the result. Then each time you try to access the data, it grabs from the cache instead of the DB. On Feb 2, 7:41 am, Ed Propsner crotchf...@gmail.com wrote: I'm working on part of my app where I'm harvesting a list of ID's from the db and passing the list to my view. It's a bit of work to get the initial list so to minimize the load and NOT have to repeat the process with each successive page load I would just like to pass the initial list back and forth to the controller via Ajax. Right now I'm using $ajax-remoteFunction() but it doesn't like an array as one of it's parameters so I'm imploding the array, passing it through as a string, and exploding it again back in the controller. This seems to work well for now but what happens if the list I'm passing back and forth grows to the tens of thousands? Can I safely pass that large of a string through $ajax-remoteFunction()? I could be overlooking the obvious here but I'm sure there must be another solution to this. example: $list = array(1, 2, 3, 4, 5, 6, 7, 8, 9); $list = implode(',', $list); $ajax-remoteFunction( array( 'url' = array('controller' = 'someController', 'action' = 'someAction', $list), 'update' = 'someElement') ); -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Problem in simple file upload
View the source of your HTML and make sure the form action is pointing to the right URL. Also what version of the Uploader are you using? You should download the latest version off of Github. Furthermore, your file type must be supported, if it is not, you have to add it to the mime types array. On Feb 1, 3:11 pm, newguy aimanparv...@gmail.com wrote: I checked the _mime types but couldnt find a error in there, am stuck guys please suggest something. On Feb 1, 2:50 pm, Stephen step...@ninjacodermonkey.co.uk wrote: Nope, you called the field aiman. So when checking for the file, check the field named aiman for example $this-data['Model']['aiman']['tmp_name'] On 1 February 2011 22:43, newguy aimanparv...@gmail.com wrote: Stephen one simple question, this line in upload.cpt echo $form-input('aiman', array('type' = 'file')); means that I can upload only file named aiman?? On Feb 1, 2:17 pm, Stephen step...@ninjacodermonkey.co.uk wrote: This error tells me that your form is successfully reaching the correct action upload. Check that $this-__mimeTypes is valid, it sounds like it isn't. The syntax is correct enough. On 1 February 2011 21:55, newguy aimanparv...@gmail.com wrote: I tried that, this time no call was made to add action but I got this warning: Invalid argument supplied for foreach() [APP/plugins/uploader/ controllers/components/uploader.php, line 1084] This is the foreach in which warning is coming: foreach ($this-__mimeTypes as $grouping = $mimes) { if (isset($mimes[$this-__data[$this-__current]['ext']])) { $validExt = true; } also I could not find the file uploaded in tmp folder under app. On Feb 1, 1:44 pm, Stephen step...@ninjacodermonkey.co.uk wrote: Try ?php echo $form-create('User',array('action' = 'upload', 'type'='file')); ? ? On 1 February 2011 21:41, newguy aimanparv...@gmail.com wrote: Hi I am following this uploader plugin to implement simple file upload on my site: http://www.milesj.me/resources/script/uploader-plugin but the problem is that when I press the upload button call to a unknown action add is made, I dont have any action by the name of add, here is my code: After log in user is directed to index.cpt which has the option to upload score: / index.cpt pHello, ?php echo($user['first_name'] . ' ' . $user['last_name']); ? /p pWelcome to Game Web Site/p ul li?php echo $html-link('Downloads',array('action'='downloads')); ? /li li?php echo $html-link('Upload Score',array('action'='upload')); ? /li li?php echo $html-link('logout', array('action' = 'logout')); ?/ li /ul On clicking Upload score link upload action is called upload.cpt // ?php echo $form-create('User',array('type'='file')); //echo $form-file('File'); echo $form-input('aiman', array('type' = 'file')); //echo $form-submit('Upload'); echo $form-end('Upload2'); ? now when I press upload2 button I get the following error: Missing Method in UsersController Error: The action add is not defined in controller UsersController Error: Create UsersController::add() in file: app/controllers/ users_controller.php. ?php class UsersController extends AppController { var $name = 'Users'; function add() { } } ? /// Here is my controller: ?php class UsersController extends AppController { var $name = 'Users'; var $helpers = array('Html', 'Form'); var $components = array('Uploader.Uploader'); function register() { if (!empty($this-data)) { $this-data['User']['password'] = md5($this-data['User'] ['password']); if ($this-User-save($this-data)) { $this-Session-setFlash('Your registration information was accepted'); $this-Session-write('user', $this-data['User']['username']); $this-redirect(array('action' = 'index'), null, true); } else { $this-data['User']['password'] = ''; $this-Session-setFlash('There was a problem saving this information'); } } } function login()
Re: php statement as to appear replaced in views
Your pages should be on different actions? /resume/add /resume/edit /resume/delete And within each of those you show the context specific links. On Jan 24, 11:10 am, chris...@yahoo.com chris...@yahoo.com wrote: Hi Sam, thanks for help... and how do I do that...? Here is another example, what I have is a video to be favorite. And once its favorite it, the button Add to Favorites should not be seen. The table for favorites I have is: id int(11) UNSIGNED No auto_increment video_id int(11) UNSIGNED No 0 user_id int(11) No 0 video_user_id int(11) UNSIGNED No 0 created where video_user_id is original video poster. I need to create this statement e.g. ?php if(($favorite['VideoFavorite']['user_id'] == )): ? ...?? I don't know how... lol Thank You All for Your Help... Chris On Jan 23, 8:45 pm, Sam Sherlock sam.sherl...@gmail.com wrote: make your nav display links dependent on the action. On 24/01/2011, chris...@yahoo.com chris...@yahoo.com wrote: No cricket,... no,.. no,... there is no java issue that I have. All I want is to make a statement to hide Create Resume link when resume is created, and show links to Edit Resume and Delete Resume . Please,... anyone help... Thanks Chris On Jan 23, 4:21 pm, cricket zijn.digi...@gmail.com wrote: On Sun, Jan 23, 2011 at 5:59 PM, chris...@yahoo.com chris...@yahoo.com wrote: Hi guys, I wanna to make a statement in ../views/resume/view.ctp I have a table named: resume id int(11) UNSIGNED No auto_increment user_id int(11) Yes NULL name varchar(120) latin1_swedish_ci No content text latin1_swedish_ci No and in view... when resume is created, link to Create Resume will be replaced with Edit Resume and Delete Resume How do I do that...? What I have is manage to do is just a links: span style=float: right; margin: 0 5px 0 0; ?php echo $html-link(ucfirst(__('create Resume', true)), '/resumes/ create', array('class' = 'album'), false, false, false) ? ?php echo $html-link(__('edit Resume', true), '/resumes/ edit/' . $resume['Resume']['id'], array('class' = 'edit'), false, false) ? ?php echo $html-link(__('delete Resume', true), '/resumes/ delete/' . $resume['Resume']['id'], array('class' = 'delete'), false, false) ? /span This is a javascript issue; nothing to do with CakePHP. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php -- - S +44 (0)7908 069 219 -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: CakePHP 1.3.7 released
Awesome, great work! I just realized I am on 1.3.4 still, time to upgrade, haha. On Jan 20, 8:12 am, mark_story mark.st...@gmail.com wrote: On Jan 20, 1:22 am, keymaster ad...@optionosophy.com wrote: Firstly, Mark - a tremendous thank you and feelings of admiration for your tremendous skills, good ideas, and all the time you and the rest of the team are putting in, to make this great community what it is. Leave a comment with your thoughts on the proposed documentation changes. Ability to download in other formats is important, agreed. Does Sphinx support the ability to do the following (as we have in the current cookbook, but I don't see in the Python /Django docs): - ability for users to comment on the sections? I hate to say this in public, but the comments on the book have not been successful in my eyes. They are filled with incorrect information, misleading information and content that should have been edits instead. - ability for users to contribue docn? Yes all the docs will be on github. Contributing will be as simple as forking, editing and sending pull requests. There is also some thought being put towards creating a web editing interface behind sphinx generated docs as well. The web interface would probably work somewhat similarly to the existing book, with using git instead of a database for documentation content. - ability to see recent changes? git log is great for that. Not only would you be able to see the logs for changes, but also the exact content changed as well. In general, I agree with a general philosophy of outsourcing (eg. github, lighthouse, sphinx, etc.) all stuff which is not core business as it just drains time. Me too, we're not experts in the realms we 'outsource' and using quality tools makes everyones life easier and simpler. -Mark -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Server Preference?
Nginx is fast in general, who ever said it was for static content? I use Nginx with memcache/apc and get a good 10k hits a day with no speed penalty. Want kind of traffic are you expecting where none of these would suffice? Even the largest of sites use apache. On Jan 14, 2:29 am, Dave Maharaj m...@davemaharaj.com wrote: I am trying to get the best suited server going for my app I am building and so far From what I read: . Apache seems to be the dead horse / big and clumsy . Lighttpd is not as supported / updated as it once was . Nginx is fast with static content . Cherokee leaves me wondering. The site im working on has maybe 5 - 10 static nothing changing pages(just welcome / register / login / contact) but once you login everything is per user since there are a lot of custom settings so caching pages / parts seems like not the best solution for nginx (sure Apache backend but if 95% would be processed thru Apache whats the point for nginx for the few pages really?) All my data / queries are cached for dynamic pages since each users page consists of various modules that constantly changing entire view caching is impossible. So that basically leaves me with Cherokee left to try. Anyone use it? Reviews? Good bad? I just installed nginx and tuned it up tried this and that, APC, Memcache but its not much faster pushing out my the dynamic content over Apache so I was thinking of giving Cherokee a go and just looking for opinions / feedback? Thanks, Dave 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: Fatal error: Allowed memory size of 134217728 bytes... When calling a simple static text element?
I may be wrong, but it looked like an infinite loop? On Jan 13, 11:48 am, OldWest jason.wy...@gmail.com wrote: I've got this solved by changing the way I was calling in the element. 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: Opening controller data in new Window w/ ajax-link call
I personally would just write the links yourself, instead of having to go through Cake. Manual links + event binds = better. On Jan 12, 11:56 am, OldWest jason.wy...@gmail.com wrote: I found a solution that works using Modalbox like: echo $html-link('Benefit Schedule',array('controller' = 'plan_details', 'action' = 'view', $plan['PlanDetail']['id'] ), array('title' = 'Benefit Schedule', 'onclick' = Modalbox.show(this.href, {title: this.title, width: 850}); return false;)); 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: Convention: Underscore / Camelcase mixture?
Fields don't have casing conventions that I am aware, the only caveat is that IDs/foreign keys must be underscore: user_id instead of userId. Agreed that underscore file names and tables are weird, I would much rather have them camel case. Especially seeing as how its a great standard to have filenames cased the same way as the class name for easy autoloading, ala Java syntax. The same can go for tables, especially with HABTM tables. teams, teamRoster, teams_teamRoster Is better than: teams, team_roster, teams_team_roster I am hoping these are resolved in 2.0 or at least give us the option of what casing we want. On Jan 12, 1:46 pm, Matthias matthias.gruetz...@googlemail.com wrote: Hi all, does anyone else find it strange, that there is a mixture of Underscore and Camelcase in the conventions? I mean, I have a table called workshop_description (underscore), the filename is workshop_description.php (underscore), but the model name is WorkshopDescription (Camelcase) and so are the variables ($result['WorkshopDescription']). But then, the field names are underscored (description_text) but don't change, so you are accessing them with $result['WorkshopDescription'] ['description_text']. So why is this, and is it supposed to be fixed in the future? I think when it comes to coding guidelines, Camelcase writing is preferred over underscore, but something you should always avoid is to mix both. Or not? Is it the same with other frameworks? And when I invent a new field (e.g. in the model's afterFind()), should I use an Underscored or Camelcase name? What do you use? 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: Cake source code optimization
The 2.0 branch wont be anytime soon. On Jan 11, 5:15 am, euromark dereurom...@googlemail.com wrote: there is none :) i already asked myself the same question we got to be patient (but since dev is already released in can only be a matter of a few months) On 11 Jan., 10:04, Adrian Arnautu arnautu.adr...@gmail.com wrote: I'm not tracking the dev progress, could you tell me when the 2.0 release is to be scheduled? Thanks, Adrian On Tue, Jan 11, 2011 at 1:10 AM, euromark dereurom...@googlemail.comwrote: thats what i remarked at the end :) i suppose it does as for the other bottlenecks we will have to wait for 2.0 (and lazy loading for all kinds of stuff) On 10 Jan., 17:05, Jon Bennett jmbenn...@gmail.com wrote: i would have liked that cake offered some kind of packed core (like CI - code igniter - does) all relevant core files that are required on every single request (30-40?) combined and minified directly included by the dispatcher or whatever although opcode cache should already minimize the include process delay doesn't using an opcode cache like APC makes minifying php source completely pointless? j -- jon bennett -www.jben.net-blog.jben.net Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp 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.c omFor 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: php echo alternative/shorthand
Dont use: ? Only use: ?php However, shorthand only works if its enabled in your ini settings and should rarely be used (templates are an exception): ?= On Jan 10, 3:45 am, euromark dereurom...@googlemail.com wrote: you should read:http://stackoverflow.com/questions/200640/are-php-short-tags-acceptab... On 10 Jan., 05:55, cricket zijn.digi...@gmail.com wrote: On Sun, Jan 9, 2011 at 9:56 PM, zer0_gravity zr...@hotmail.com wrote: Question I have noticed that the following statement works interchangeable. Is the equal sign '=' that shorthand version to using the echo function? ?=$variableName['value1'] ;? or ? echo $variable['value1']; ? Yes, although the semi-colon should not be used in the first example. Also, both of those are actullay using the shorthand. All of these are equivalent: ?php echo $foo; ? ? echo $foo; ? ?= $foo ? Also (and this is really important), the short_open_tag directive must be enabled in php.ini to use the shorthand. You should never use the shorthand if the code may be run on a server that you do not control. And, even if it will be, you need to consider that short_open_tag may be disabled sometime in the future. Personally, I much prefer to use the shortcut than echo. But ONLY with stuff running on servers I control, and which I'm not particularly concerned about having to move elsewhere. http://php.net/manual/en/ini.core.php#ini.short-open-tag Google php short_open_tag if you're in the mood for religious wars. 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: Explain the empty function
Why are you attempting to do that? !empty() checks to make sure the POST data exists, empty() checks to make sure the POST data is empty. On Jan 7, 9:10 am, zer0_gravity zr...@hotmail.com wrote: function add(){ if(!empty($this-data)){ ///why does this statement works /// if(empty($this-data)){ why does this statement do nothing if($this-Post-save($this-data)){ $this-Session-setFlash('Your post has been saved.'); $this-redirect(array('action' = 'index')); } } } 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: Bootstrap access to a model?
Why are you allowing users to define routes? On Jan 6, 8:59 am, majna majna...@gmail.com wrote: http://mark-story.com/posts/view/using-custom-route-classes-in-cakephp But this will break reverse routing, if used. All routes must be connected for reverse routing to work. On Jan 6, 4:57 am, Greg Skerman gsker...@gmail.com wrote: Hi, So i've ditched the idea of having one controller call another. Instead, i've decided a better approach might be to use routes, and have custom routes stored in a database, added at runtime in bootstrap.php, and of course cached. This will allow people to define their own simple routes for site map organization. So, I know I can probably use App::Import('Controller', 'CustomRoutes'); in bootstrap, and manually initialize the class, but are there any reasons why i shouldn't do this? I'd appreciate thoughts on whether bootstrapping a controller/model is a good thing or a bad thing. Have at it :) 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: Bootstrap access to a model?
I guess I still don't understand why a database is needed for this? Are they not going to be editing the PHP files themselves? If they aren't, then just save the routes as a serialized array into the filesystem and load that everytime instead of hitting the database. On Jan 6, 3:41 pm, Greg Skerman gsker...@gmail.com wrote: Miles, not users, site admins. The reason i want them to be able to define routes is so they can define their URL structure themselves, and not have it imposed on them by the content management system suppose they have /articles/1 /articles/2 /articles/3 but want them to be accessed as: /products /products/services /about ...basically i want a way that they can add content to the site, and then arrange the URLs in anyway they see fit. On Fri, Jan 7, 2011 at 4:24 AM, Miles J mileswjohn...@gmail.com wrote: Why are you allowing users to define routes? On Jan 6, 8:59 am, majna majna...@gmail.com wrote: http://mark-story.com/posts/view/using-custom-route-classes-in-cakephp But this will break reverse routing, if used. All routes must be connected for reverse routing to work. On Jan 6, 4:57 am, Greg Skerman gsker...@gmail.com wrote: Hi, So i've ditched the idea of having one controller call another. Instead, i've decided a better approach might be to use routes, and have custom routes stored in a database, added at runtime in bootstrap.php, and of course cached. This will allow people to define their own simple routes for site map organization. So, I know I can probably use App::Import('Controller', 'CustomRoutes'); in bootstrap, and manually initialize the class, but are there any reasons why i shouldn't do this? I'd appreciate thoughts on whether bootstrapping a controller/model is a good thing or a bad thing. Have at it :) Check out the new CakePHP Questions sitehttp://cakeqs.organd 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: Bootstrap access to a model?
Saving the routes to a file will probably be much easier and less error prone then trying to connect to the database during the bootstrap process. Most likely less logic required also. On Jan 6, 4:13 pm, Greg Skerman gsker...@gmail.com wrote: they wont be editing the php files themselves, no unless they want to.. but i'm trying to provide an option that doesn't require them to know how to code to do it I intended on caching the result from the DB which would be akin to serializing an array and saving to the file system.db just seemed like a logical place to persist it On Fri, Jan 7, 2011 at 9:44 AM, Miles J mileswjohn...@gmail.com wrote: I guess I still don't understand why a database is needed for this? Are they not going to be editing the PHP files themselves? If they aren't, then just save the routes as a serialized array into the filesystem and load that everytime instead of hitting the database. On Jan 6, 3:41 pm, Greg Skerman gsker...@gmail.com wrote: Miles, not users, site admins. The reason i want them to be able to define routes is so they can define their URL structure themselves, and not have it imposed on them by the content management system suppose they have /articles/1 /articles/2 /articles/3 but want them to be accessed as: /products /products/services /about ...basically i want a way that they can add content to the site, and then arrange the URLs in anyway they see fit. On Fri, Jan 7, 2011 at 4:24 AM, Miles J mileswjohn...@gmail.com wrote: Why are you allowing users to define routes? On Jan 6, 8:59 am, majna majna...@gmail.com wrote: http://mark-story.com/posts/view/using-custom-route-classes-in-cakephp But this will break reverse routing, if used. All routes must be connected for reverse routing to work. On Jan 6, 4:57 am, Greg Skerman gsker...@gmail.com wrote: Hi, So i've ditched the idea of having one controller call another. Instead, i've decided a better approach might be to use routes, and have custom routes stored in a database, added at runtime in bootstrap.php, and of course cached. This will allow people to define their own simple routes for site map organization. So, I know I can probably use App::Import('Controller', 'CustomRoutes'); in bootstrap, and manually initialize the class, but are there any reasons why i shouldn't do this? I'd appreciate thoughts on whether bootstrapping a controller/model is a good thing or a bad thing. Have at it :) Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp 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.com cake-php%2bunsubscr...@googlegroups.comcake-php%252bunsubscr...@googlegroups.comFor more options, visit this group at http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions sitehttp://cakeqs.organd 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: Bootstrap access to a model?
Yeah, I have done exactly this before :] https://github.com/milesj/cake-forum/blob/master/models/setting.php On Jan 6, 5:00 pm, Greg Skerman gsker...@gmail.com wrote: is it worth wrapping it all up in a DB tableless model to take advantage of validation magic and so forth? On Fri, Jan 7, 2011 at 10:44 AM, Miles J mileswjohn...@gmail.com wrote: Saving the routes to a file will probably be much easier and less error prone then trying to connect to the database during the bootstrap process. Most likely less logic required also. On Jan 6, 4:13 pm, Greg Skerman gsker...@gmail.com wrote: they wont be editing the php files themselves, no unless they want to.. but i'm trying to provide an option that doesn't require them to know how to code to do it I intended on caching the result from the DB which would be akin to serializing an array and saving to the file system.db just seemed like a logical place to persist it On Fri, Jan 7, 2011 at 9:44 AM, Miles J mileswjohn...@gmail.com wrote: I guess I still don't understand why a database is needed for this? Are they not going to be editing the PHP files themselves? If they aren't, then just save the routes as a serialized array into the filesystem and load that everytime instead of hitting the database. On Jan 6, 3:41 pm, Greg Skerman gsker...@gmail.com wrote: Miles, not users, site admins. The reason i want them to be able to define routes is so they can define their URL structure themselves, and not have it imposed on them by the content management system suppose they have /articles/1 /articles/2 /articles/3 but want them to be accessed as: /products /products/services /about ...basically i want a way that they can add content to the site, and then arrange the URLs in anyway they see fit. On Fri, Jan 7, 2011 at 4:24 AM, Miles J mileswjohn...@gmail.com wrote: Why are you allowing users to define routes? On Jan 6, 8:59 am, majna majna...@gmail.com wrote: http://mark-story.com/posts/view/using-custom-route-classes-in-cakephp But this will break reverse routing, if used. All routes must be connected for reverse routing to work. On Jan 6, 4:57 am, Greg Skerman gsker...@gmail.com wrote: Hi, So i've ditched the idea of having one controller call another. Instead, i've decided a better approach might be to use routes, and have custom routes stored in a database, added at runtime in bootstrap.php, and of course cached. This will allow people to define their own simple routes for site map organization. So, I know I can probably use App::Import('Controller', 'CustomRoutes'); in bootstrap, and manually initialize the class, but are there any reasons why i shouldn't do this? I'd appreciate thoughts on whether bootstrapping a controller/model is a good thing or a bad thing. Have at it :) Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp 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.com cake-php%2bunsubscr...@googlegroups.comcake-php%252bunsubscr...@googlegroups.com cake-php%2bunsubscr...@googlegroups.comcake-php%252bunsubscr...@googlegroups.com cake-php%252bunsubscr...@googlegroups.comcake-php%25252bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp 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.com cake-php%2bunsubscr...@googlegroups.comcake-php%252bunsubscr...@googlegroups.comFor more options, visit this group at http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions sitehttp://cakeqs.organd 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
Re: CakePHP + nginx + VPS
Ive done this many times, here's my nginx setup: domain1.com/ ---public/ --app/ ---private/ ---logs/ domain2.com/ ---public/ --app/ ---private/ ---logs/ The public folder contains the cake/php app files. Private contains anything that's shouldn't be accessible, and logs is logs. The nginx root should point to /public/app/webroot/. My cake folder is set outside of all these folders and is setup like so: /cake/cake (primary) /1.3/cake /1.3.5/cake This way anytime theres a new version, you just update the core cake folder instead of having to update the constants in the php files. If you need different apps to use different versions, you still can. On Jan 5, 4:44 pm, Jon Bennett jmbenn...@gmail.com wrote: Just curious if any one has set this type of install up. Cake on nginx? So far just getting everything set up and ended up with srv/www/domain.com/public_html/app = all my files I want to keep cake folder outside web access so I was going to use lib/{cakeversions}/cake Any tips / pointers. I will deal with the absence of htaccess files after. Just for now getting the proper structure. I do: project (svn repository) trunk - libs - - cakephp - - - cakephp-version - app (named after the project usually) - - webroot - this is the nginx doc root. All you need in webroot/index.php for the above to work is to point cake at the correct version, eg: define('CAKE_CORE_INCLUDE_PATH', ROOT.'/libs/cakephp/cakephp-1.3.1'); My good pal Andy has a blog post with an nginx conf on ithttp://andy-gale.com/cakephp-view-memcache.html hth, J -- jon bennett -www.jben.net- blog.jben.net 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: How do you guys structure your shared components/behaviors/plugins repository (Subversion)? --psybear
@Joshua - Yes but if you put everything into a single plugin, then the problem is solved. You are *not* including all those files in the app, you are just making them available. They are included once you add them to the $helpers, $components array, etc. A great example is the CakeDC utils plugin: https://github.com/CakeDC/utils On Jan 4, 7:42 am, Joshua Muheim psybea...@gmail.com wrote: @Mark: this does seem very pragmatic. But what if you want to provide your stuff to others so that they can use different parts of your tools and don't want to include everything into your project? But certain parts are depending on each other, so you can't just provide a download to every single file? Maybe soft links are the solution? Can SVN/GIT manage something like that? On Tue, Jan 4, 2011 at 4:14 PM, euromark dereurom...@googlemail.com wrote: yep, i use a tools plugin containing all those files one svn:external for all :) On 4 Jan., 13:24, Joshua Muheim psybea...@gmail.com wrote: Short answer! I will look into it. Thanks. :-) On Tue, Jan 4, 2011 at 1:12 PM, AD7six andydawso...@gmail.com wrote: On Jan 4, 12:33 pm, psybear83 psybea...@gmail.com wrote: Hey everybody I wonder how to structure my shared components, behaviors, plugins etc. in my Subversion repository? I include them as externals in many different projects, and because I can't point to single files as externals (but only to directories) I can't simply use a structure like - components/ - behaviors/ - plugins/ etc. So at the moment my repository is cluttered up with folders and subfolders but misses a clean structure... Are there any rules of thumb or best practices on how to structure it? How do you guys do it? use plugins. AD Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp 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 athttp://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 athttp://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: How to dynamically call model methods?
That looks correct to me. What does $func look like when you echo it? Also, name needs quotes around it: $this-set('name') or $this- set($catfield['name']) On Jan 3, 5:29 am, herly P itssher...@gmail.com wrote: I have a list of functions defined in my model which i want to call dynamically. I'm saving the method names in variable for eg. foreach($catfields['Fields'] as $catfield) { $func = get.str_replace(' ','',ucwords(str_replace('_',' ', $catfield['name']))); $this-set(name, $this-Modelname-{$func}()); } This throws a Fatal error: Method name must be a string in .. 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: IDE
Netbeans all the way. Just download the one without all the java plugins. On Dec 21, 4:07 pm, Felipe Roman roman.fel...@gmail.com wrote: On Tue, Dec 21, 2010 at 2:28 PM, Kristofer krishop...@gmail.com wrote: Ah, I saw NetBeans several years ago but forgot about it! I will give it another look. Thanks! I got used to use NetBeans for Java development several years ago but this year I started for PHP and it is very good. I've been using Eclipse PHP for a while too. For me both are very good IDEs but a little bit slow(in my computer). -- Best Regards, Felipe Roman Phone 55 51 8454 8110 LinkedInhttp://au.linkedin.com/in/feliperoman 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: FormHelper Problem
@Cricket - Since when is that possible? I know you can use action as a parameter, but if you want to define a full route, you must use url. On Dec 20, 12:06 pm, cricket zijn.digi...@gmail.com wrote: You don't need to specify url: echo $this-Form-create( 'ContactRequest', array('controller' = 'contact_requests', 'action' = 'add') ); On Sun, Dec 19, 2010 at 10:15 PM, georgeman confidentia...@gmail.com wrote: I built a simple contact request form using FormHelper. The form is located on 'pages/contact' and the form action is located on 'contact_requests/add'. The form handler will email the request to the address set by the administrator, and will save a copy of the request to the database. To create the form I wrote the following: ?php echo $this-Form-create('ContactRequest', array('url' = array('controller' = 'contact_requests', 'action' = 'add')); ? When I click submit, instead of being brought to 'contact_requests/ add' I am brought to 'contact_requests/'. I have tried to write the url in the form of address and this didn't help. The only other info I can give is the first few times I tested the form it worked as expected, but after a few times, the new (wrong) behavior came along and won't go away. Here is the rest of the code for the form. Does anyone know what the problem could be? ?php echo $this-Form-create('ContactRequest', array('url' = 'http://localhost/trial/contact_requests/add', 'div' = false));? ?php echo $this-Form-input('ContactRequest.name', array('label' = 'Name:', 'type' = 'text', 'maxLength' = '50', 'div' = false));? ?php echo $this-Form-input('ContactRequest.email', array('label' = 'Email:', 'type' = 'text', 'maxLength' = '50', 'placeholder' = '@email.com', 'div' = false));? ?php echo $this-Form-input('ContactRequest.phone', array('label' = 'Phone:', 'type' = 'tel', 'maxLength' = '13', 'placeholder' = 'XXX- XXX-', 'div' = false));? ?php echo $this-Form-input('ContactRequest.ext', array('label' = 'Extension:', 'type' = 'text', 'name' = 'ext', 'maxLength' = '5', 'div' = false));? ?php echo $this-Form-label('Message:');? ?php echo $this-Form-textarea('ContactRequest.message', array('maxLength' = '100', 'wrap' = 'soft', 'placeholder' = 'maximum 100 characters', 'div' = false));? ?php echo $this-Form-button('Submit');? ?php echo $this-Form-end();? ?php echo $this-Form-input('ContactRequest.name', array('label' = 'Name:', 'type' = 'text', 'maxLength' = '50', 'div' = false));? ?php echo $this-Form-input('ContactRequest.email', array('label' = 'Email:', 'type' = 'text', 'maxLength' = '50', 'placeholder' = '@email.com', 'div' = false));? ?php echo $this-Form-input('ContactRequest.phone', array('label' = 'Phone:', 'type' = 'tel', 'maxLength' = '13', 'placeholder' = 'XXX- XXX-', 'div' = false));? ?php echo $this-Form-input('ContactRequest.ext', array('label' = 'Extension:', 'type' = 'text', 'name' = 'ext', 'maxLength' = '5', 'div' = false));? ?php echo $this-Form-label('Message:');? ?php echo $this-Form-textarea('ContactRequest.message', array('maxLength' = '100', 'wrap' = 'soft', 'placeholder' = 'maximum 100 characters', 'div' = false));? ?php echo $this-Form-button('Submit');? ?php echo $this-Form-end();? Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 athttp://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: Defining php functions in views
@euromark - He answered that in his post. @ojonam - Scope issure for sure, just do. function getLink($view, $x) { return $view-Html-link($x,#.$x); } echo getLink($this, $x); On Dec 17, 4:47 am, euromark dereurom...@googlemail.com wrote: is there a reason why you dont want to stick to the cake pattern and create helpers for that? On 17 Dez., 13:41, Ryan Schmidt google-2...@ryandesign.com wrote: On Dec 17, 2010, at 05:15, ojonam wrote: $getLink = function($x){return $this-Html-link($x, '#'.$x);}; $alphabet = array_map($getLink, array_merge(range('a','z'))); In PHP 6.x or possibly 5.4.x you should be able to do this: $getLink = function($x)use($this){return $this-Html-link($x, '#'.$x);}; $alphabet = array_map($getLink, array_merge(range('a','z'))); However, it's not possible for an anonymous function to use $this in PHP 5.3.x; see this bug report: http://bugs.php.net/bug.php?id=49543 Until then, you have to copy $this to a temporary variable; here, I copy it to $view: $view = $this; $getLink = function($x)use($view){return $view-Html-link($x, '#'.$x);}; $alphabet = array_map($getLink, array_merge(range('a','z'))); 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: How to disable the previously loaded model
The student() method is not being called since it is another action. Secondly, why should it be disabled? Another object isn't going to slow down your application. On Dec 14, 3:51 am, Amit Badkas amit.sanis...@gmail.com wrote: Hi, Please elaborate what you want to do as from the given code, it's not clear enough. Also why your controller starts from tests_controller(){...? Amit Badkas PHP Applications for E-Biz:http://www.sanisoft.com On Tue, Dec 14, 2010 at 2:35 PM, Smile vanishr...@gmail.com wrote: HI Friends, Can any of you please let me know how to disble previously loaded model ?? I am describing my doubt through an example below. EX: I Am using a controller , test_contoller(){ //here 2 functions am using function student(){ $this-loadmodel('student'); } function parent(){ $this-loadmodel('parent'); //loads the parent model $this-loadmodel('relationship'); //loads the relationship model } } Once my execution picks up parent function that time , previously loaded model student in student function should be disabled. Thanks in advance. Check out the new CakePHP Questions sitehttp://cakeqs.organd 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: using Cake's Form helper in non-Cake apps?
Its not really possible without a lot of hacking of the class. However, I do have something similar written for a stand alone PHP script (the example file is correct, the docs are out of date). https://github.com/milesj/php-formation On Dec 8, 11:16 pm, park park@gmail.com wrote: Hi all, I'm looking to migrate part of a Cake project into a non-Cake app. Is there a way to use Cake's form helper in a non-Cake environment? Is there any existing solutions or best practice? Thank you. 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: Cache data question / opinion
Cache anything that shouldn't be dynamic (example pagination is dynamic, or user data). I have some cached files that just represent a number, example: 1234345 Instead of querying the database how many users I have, just cache the number every 24 hours. On Dec 7, 1:27 pm, Dave Maharaj m...@davemaharaj.com wrote: Just public opinion question here. When you cache data I'm wondering when is not worth cache'ing if it's just a small bit of data to grab from the db. For example this is a small cached file I have: 1294435116 a:1:{s:8:Groupset;a:6:{s:2:id;s:1:9;s:5:group;s:16:Operations;s:4: name;s:21:Team Unit;s:4:slug;s:7:team_unit;s:9:masters;s:1:1;s:4:indi;s:1:1;}} Now looking at it I'm wondering is it even worth Caching? Does the process to check if its cached /if so if not do this that read write or get, is that more demand that would be to simply just go get it with such a small bit of data. I have full large sets of data with joins / contains that are well worth caching since they get viewed over and over so that's a sure winner, but these small tid bits got me wondering here. Thanks, Dave 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: use APC Memcached at the same tim
Just give them different keys. Cache::config('memcache', array('engine' = 'Memcache')); Cache::config('apc', array('engine' = 'Apc')); Then write the data. Cache::write('key', 'value', 'memcache'); Cache::write('key', 'value', 'apc'); On Dec 6, 4:58 am, pang y...@tagroup.se wrote: Ok,now I know opcode is enabled automatically when apc is on. I guess why cakephp has a apc section is because: apc also provide the ability to cache variables, so if we need to cache variable by apc, it requires code changes. The question now is : if I want to separate variable caching, like what facebook does: cache local variables in apc, while caching database query by memcached. how could this be done as both apc and memcached need to be configured and class Cache is the only handler for cakephp cache? If I want to use both apc and memcache, does that mean I have to create a extra Cache handler for apc and assign the default handler Cache for memcached, or vise versa ?? On Dec 6, 11:55 am, Ma'moon phpir...@gmail.com wrote: I am not really sure why we do have an APC section in core.php, APC should run automatically and it doesn't really need any code changes to have it running, the other caching engines need to be configured in core.php, AFAIK! On Mon, Dec 6, 2010 at 5:51 AM, pang y...@tagroup.se wrote: you mean I don't even have to enable apc in core config file ?? On Dec 3, 7:32 pm, Miles J mileswjohn...@gmail.com wrote: Install APC and memcache. APC will run automatically and cache your opcode. Use memcache on the CakePHP side to cache query data. On Dec 3, 6:04 am, Ma'moon phpir...@gmail.com wrote: All configuration items that you need to edit takes place in core.php, right there you will have the ability to enable, disable, and/or configure your caching engines/levels On Fri, Dec 3, 2010 at 3:07 PM, pang y...@tagroup.se wrote: Thank you for your answer. I know that apc and memcache has different usage, I can make them working respectively in Cake. But I don't know how to configure to make them working together. Do you know how to do it? On Dec 3, 1:14 pm, Ma'moon phpir...@gmail.com wrote: APC performs (byte code caching or intermediate code) which means that it caches the binary form of your PHP script and once this script is being called, the cached version of the script is the one that will be executed, this will save a lot of performance and server resources, on the other hand, memcached is being used to cache objects of several forms, like caching the results of a database query a model operation in CakePHP's case, an array, or someother forms of objects, you can use both of them for your application caching, each for its own task, take a look here to configure the desired cache engines that you would like to use in your CakePHP applicationhttp://book.cakephp.org/view/156/Caching On Fri, Dec 3, 2010 at 12:16 PM, pang y...@tagroup.se wrote: CakePHP offer both APC and Memcached cache engine for cache purpose, but each of them has different preferred usage, I am wondering is it possible to config Cake to work with both of them? and how can It be achieved? Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp 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.c om cake-php%2bunsubscr...@googlegroups.c om cake-php%2bunsubscr...@googlegroups.c omFor more options, visit this group at http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp 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.c om cake-php%2bunsubscr...@googlegroups.c omFor more options, visit this group at http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp 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
Re: SessionComponent not always available
I believe the core Controller class had the session removed, but the AppController within cake still has the Session. You overwrote their AppController so it reset. On Dec 6, 11:58 am, Ryan Schmidt google-2...@ryandesign.com wrote: On Dec 6, 2010, at 08:57, McBuck DGAF wrote: What version are you using? My understanding was that SessionComponent and SessionHelper no longer autoloaded in 1.3: http://book.cakephp.org/view/1564/Controller-Components It appears that the documentation is conflicting. Sorry, I should have mentioned I am using CakePHP 1.3.6. On Dec 6, 2010, at 09:04, Tilen Majerle wrote: http://book.cakephp.org/view/1564/Controller-Componentson this link, in yellow you can see this: SessionComponent and SessionHelper are not automatically loaded. you need to add them in app_controller.php Thanks, both of you, for the pointer to the Migrating to 1.3 section; it would not have occurred to me to look there since I'm not migrating; I'm learning CakePHP for the first time using version 1.3.6. Also, I assure you SessionComponent was there and working fine, until I added my own AppController with the line var $components = array('Auth');. When I did not have my own definition of $components, SessionComponent was loaded for me automatically. So the statement in the documentation above does not appear to be totally accurate. Perhaps I would have a better appreciation and understanding for the statement if I had used CakePHP 1.2.x and could now see how 1.3.x differs, but since I'm new to CakePHP, I cannot. 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: Saving Whole array to database
There are two ways (assuming this is within a loop). $this-SavedNews-save(array('title' = $title, 'description' = $desc), false); Or you can save the whole array. $this-SavedNews-save($data, false, array('title', 'description')); On Dec 6, 11:53 am, NB r.szta...@gmail.com wrote: 'm out of ideas here is my controller: class GoogleNewsController extends AppController { var $name = 'GoogleNews'; var $uses = array('GoogleNews', 'SavedNews'); var $helpers = array('Html','Form'); function index() { $saved = $this-set('news',$this-GoogleNews-find('all')); Im reading data from 'GoogleNews' and they are in my array. Array looks like this: array(10) { [0]= array(1) { [GoogleNews]= array(12) { [title]= string(32) FIFA 11 für 25,49€ aus Jersey [link]= string(54) http://feedproxy.google.com/~r/myDealZ/~3/ HuNxRhQJraQ/ [pubDate]= string(31) Mon, 06 Dec 2010 10:53:22 + [creator]= string(5) admin [guid]= array(2) { [value]= string(30) http://www.mydealz.de/?p=15137; [isPermaLink]= string(5) false } [description]= string(355) And I want to save elements to my database 'SavedNews' I need to save description and title. Can anybody tell me how should I write it? $this-SavedNews-set(array('description' =$this-GoogleNews- find('description'))); 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: Memcache Set up Help
How did you install memcache? Through a package within SSH? On Dec 5, 12:03 pm, cricket zijn.digi...@gmail.com wrote: On Sat, Dec 4, 2010 at 8:59 PM, Dave Maharaj m...@davemaharaj.com wrote: Its just never there. /etc/init.d/memcached restart -bash: /etc/init.d/memcached: No such file or directory Added extension=memcache.so to php.ini even found a tip on google to make a memcache.ini tried that and same result. It goes thru installing. Its there in the server...its in phpinfo it just will not run. You have the PHP module, but do you have memcached installed? I'd assume that trying to install the former would throw up the latter as a dependency, but I'm not overly familiar with CentOS. How did you install the module, anyway? Did you use a package manager (eg. yum)? Try: which memcached It should be in /usr/bin (although maybe that's different on CentOS). 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: Memcache Set up Help
I use MT but I run an Ubuntu Lenny installation. I have APC and memcache working fine. On Dec 5, 1:58 pm, Dave Maharaj m...@davemaharaj.com wrote: Thanks for the tip I will try it. Yes I used YUM install. Updated YUM first just for the sake of saying I tried that too, Grabbed the rpgforge files they get installed memcached appears loaded in phpinfo added / verified memcached.so extension in ini file restart. I know I can not telnet into port 11211 which is the default port for it so I guess I have to figure out why I can not. Media Temple seems to have weird permission problems I am finding on the web from others so they are no help either telling me too bad pretty much so looking for a new host maybe if that's their response. People like yourself on Cake are more help than the people getting paid to be helpful so that says a lot about the group on here. Thanks guys for all your time and ideas. Dave -Original Message- From: cricket [mailto:zijn.digi...@gmail.com] Sent: December-05-10 4:33 PM To: cake-php@googlegroups.com Subject: Re: Memcache Set up Help On Sat, Dec 4, 2010 at 8:59 PM, Dave Maharaj m...@davemaharaj.com wrote: Its just never there. /etc/init.d/memcached restart -bash: /etc/init.d/memcached: No such file or directory Added extension=memcache.so to php.ini even found a tip on google to make a memcache.ini tried that and same result. It goes thru installing. Its there in the server...its in phpinfo it just will not run. You have the PHP module, but do you have memcached installed? I'd assume that trying to install the former would throw up the latter as a dependency, but I'm not overly familiar with CentOS. How did you install the module, anyway? Did you use a package manager (eg. yum)? Try: which memcached It should be in /usr/bin (although maybe that's different on CentOS). Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 athttp://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: Memcache Set up Help
Check your memcached is running from within SSH. Run: telnet localhost 11211 On Dec 4, 5:48 am, cricket zijn.digi...@gmail.com wrote: On Fri, Dec 3, 2010 at 11:52 PM, Dave Maharaj m...@davemaharaj.com wrote: I have setup memcached on the server. Check php info and its there memcache support enabled Active persistent connections 1 Version 2.2.5 Revision $Revision: 1.111 $ so on.. So I changed the setting in core.php to memcache and end up with Notice (8): Memcache::get() [memcache.get]: Server 127.0.0.1 (tcp 11211) failed with: Connection refused (111) [CORE/cake/libs/cache/memcache.php, line 144] Does anyone have any tips or insight? Ideas? Are you sure memcached is running? And, that it's listening to localhost port 11211? The phpinfo() entry only shows that the module is installed. Google memcache Connection refused and you should find some more insight. 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: Memcache Set up Help
Have you tried running: /etc/init.d/memcached restart Or startup (i think) On Dec 4, 2:45 pm, cricket zijn.digi...@gmail.com wrote: On Sat, Dec 4, 2010 at 4:18 PM, Dave Maharaj m...@davemaharaj.com wrote: Thanks for your help Cricket and Miles...really appreciated! So telnet localhost 11211 returns Connection refused. I am on media temple and follow http://kb.mediatemple.net/questions/1693/Installing+memcached I run make test after the install goes thru like the command says which says build successful make bogus test (no idea what that is) /etc/init.d/memcached status returns -bash: /etc/init.d/memcached: No such file or directory I am on Linux CentOs So its there installed since I see it in phpinfo but not running obviously. When I run memcached -d -m 512 -l 127.0.0.1 -p 11211 -u nobody I get -bash: memcached: command not found I am looged in as root thru the shell so everything is at admin level. Just lost here. Something not going as planned that’s forsure. Any other ideas to try guys? Search online for centos memcached? 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: What is a__constructor
I would suggest learning the basics of PHP and OOP programming before jumping into something like this. http://php.net/manual/en/language.oop5.php On Dec 3, 9:38 am, Ryan Schmidt google-2...@ryandesign.com wrote: On Dec 2, 2010, at 14:09, João Moura wrote: i dont found a good explanation about what is a constructor and how it works Have you tried: http://www.google.com/search?q=php+__construct The first link in the results is to the PHP documentation about constructors and destructors, which is a good place to start. This is not a cakephp-specific question. 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: Use CakePHP in NetBeans IDE 6.8
No reason to be. People like this need to learn to do things themselves at some point. On Dec 3, 1:31 am, Jeremy Burns | Class Outfit jeremybu...@classoutfit.com wrote: I feel a little bad for being harsh with him now... Jeremy Burns Class Outfit jeremybu...@classoutfit.comhttp://www.classoutfit.com On 3 Dec 2010, at 09:30, keymaster wrote: Seyed, No prob, dude. We'll fly a couple of the cakephp core developers to your apartment. They'll walk you through everything, step by step, just like you wanted. You'll be editing cakephp files in no time. Don't worry. Just a thought, would you like some Netbeans staff to be there too? You never know what questions might come up. Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 athttp://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: use APC Memcached at the same tim
Install APC and memcache. APC will run automatically and cache your opcode. Use memcache on the CakePHP side to cache query data. On Dec 3, 6:04 am, Ma'moon phpir...@gmail.com wrote: All configuration items that you need to edit takes place in core.php, right there you will have the ability to enable, disable, and/or configure your caching engines/levels On Fri, Dec 3, 2010 at 3:07 PM, pang y...@tagroup.se wrote: Thank you for your answer. I know that apc and memcache has different usage, I can make them working respectively in Cake. But I don't know how to configure to make them working together. Do you know how to do it? On Dec 3, 1:14 pm, Ma'moon phpir...@gmail.com wrote: APC performs (byte code caching or intermediate code) which means that it caches the binary form of your PHP script and once this script is being called, the cached version of the script is the one that will be executed, this will save a lot of performance and server resources, on the other hand, memcached is being used to cache objects of several forms, like caching the results of a database query a model operation in CakePHP's case, an array, or someother forms of objects, you can use both of them for your application caching, each for its own task, take a look here to configure the desired cache engines that you would like to use in your CakePHP applicationhttp://book.cakephp.org/view/156/Caching On Fri, Dec 3, 2010 at 12:16 PM, pang y...@tagroup.se wrote: CakePHP offer both APC and Memcached cache engine for cache purpose, but each of them has different preferred usage, I am wondering is it possible to config Cake to work with both of them? and how can It be achieved? Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp 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.com cake-php%2bunsubscr...@googlegroups.c omFor more options, visit this group at http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions sitehttp://cakeqs.organd 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: Use CakePHP in NetBeans IDE 6.8
Netbeans doesn't have CakePHP support, its just an IDE. I also love how your asking for step by step images on how to do everything, try to figure it out yourself. On Dec 2, 5:48 am, Jeremy Burns | Class Outfit jeremybu...@classoutfit.com wrote: Sure - I'll drop everything and just knock you up a quick training course. NetBeans is just a glamourous text editor used for managing the text files that make up CakePHP. It should be fairly elementary for even a novice developer to work it out. Jeremy Burns Class Outfit jeremybu...@classoutfit.comhttp://www.classoutfit.com On 2 Dec 2010, at 05:07, Seyed Mahmood Hosseini wrote: Hello Please Help Me To Use CakePHP Famework In NetBeans IDE 6.8 Please Help Me Step-By-Step ( Training with images ) Thanks. Bye. Web Site : Http://WwW.NewAge.Ir Mail : i...@newage.ir web@gmail.com Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 athttp://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: Validation Rules Help
This is merely off the top of my head and only for the domain part, not the username or the @. /^([a-zA-Z0-9\-]+)\.([a-zA-Z]{2,3})(\.[a-zA-Z]{2,3})?$/ On Nov 28, 4:17 pm, Dave Maharaj m...@davemaharaj.com wrote: This one I have been putting off for a while and finally getting around to trying to solve it. Maybe I just do not know enough about international domain extensions but what I need is a domain to match the email. So take me for example m...@davemaharaj.com would match davemaharaj.com easy enough. But getting into international domain some end in .com.au yet their email ends in .com so sure break the url apart at the (.) Now the problem kicks in. No subdomains are allowed as a requirement for validation so any domain with something.some.extension are not valid. So I have been playing around with getting DNS MX records to make sure the domain is actually real but it seems almost impossible to determine if a domain is actually a sub-domain or if it is actually just a domain with an extended international domain. And to make things just that much better just finding random foreign sites with international domain extension like the .com.au I see their contact email is the same as the domain minus the .au.it ends in .com whats up with that? Why would the domain be .com.au on the web yet email be .com? I tried just typing in the url minus the .au and it directs to the full extension. Like I said maybe I just do not know enough about how the extensions work. Any and all insight would be great. Thanks, Dave 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: Common Punctuation
Off the top of my head: /^[\-\.a-zA-Z]+$/ Regex is probably the easiest approach. Just set it as a custom validation rule. On Nov 28, 1:30 pm, Dave Maharaj m...@davemaharaj.com wrote: I know its not so much Cake question so forgive me ahead of time. But does anyone know a regex for common punctuation? I want to put validation on my City field where it's a-z and also allow ' - and . City should not have any numbers. Open to any other ideas that you have used also as I hate regex. I do not want people putting in crazy fake names. Almost impossible to verify the name they enter (imagine that db table of every possible name of every city / town in the world) so I would like to ensure its within the realm of being real. St.Louis has (.) St.John's (. And ' ) And other have the - separating words of the name. Cant think of any else? Any help would be great. Thanks, Dave 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: Common Punctuation
Forgot spaces: /^[\-\.\sa-zA-Z]+$/ On Nov 28, 4:08 pm, Miles J mileswjohn...@gmail.com wrote: Off the top of my head: /^[\-\.a-zA-Z]+$/ Regex is probably the easiest approach. Just set it as a custom validation rule. On Nov 28, 1:30 pm, Dave Maharaj m...@davemaharaj.com wrote: I know its not so much Cake question so forgive me ahead of time. But does anyone know a regex for common punctuation? I want to put validation on my City field where it's a-z and also allow ' - and . City should not have any numbers. Open to any other ideas that you have used also as I hate regex. I do not want people putting in crazy fake names. Almost impossible to verify the name they enter (imagine that db table of every possible name of every city / town in the world) so I would like to ensure its within the realm of being real. St.Louis has (.) St.John's (. And ' ) And other have the - separating words of the name. Cant think of any else? Any help would be great. Thanks, Dave 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: conversion of mysql query to cakephp query
$this-id = 1; $this-save(array('balance' = $balance - 5)); On Nov 26, 12:58 am, Vivi Vivi vivianbog...@gmail.com wrote: http://book.cakephp.org/view/1031/Saving-Your-Data On Fri, Nov 26, 2010 at 10:19 AM, Biplab Subedi bipla...@gmail.com wrote: Help me in converting this mysql query to cakephp query $query=UPDATE tbl_user SET balance=(balance-5) WHERE id='1; Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 -- Vivihttp://photos.vr-3d.net 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: Controller::__mergeVars() automatically adds model class to Controller::uses that doesn't exist! --psybear
Cake automatically adds a model to your controller based on your controllers name. To disable that, pass an empty $uses. public $uses = array(); On Nov 23, 8:47 am, AD7six andydawso...@gmail.com wrote: On Nov 23, 5:02 pm, psybear83 psybea...@gmail.com wrote: Hey everybody Because I need it in every controller. which is IMO a classic mistake. Don't you have $this-OtherModel-User always available? AD 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: How to determine whether there's an $id passed to an action? --psybear
Personally, I would just set it on an action basis. public function edit($id) { $this-Model-id = $id; } Your getting into muddy territory going with that approach. On Nov 18, 10:20 am, psybear83 psybea...@gmail.com wrote: Hi all I'd like to have a beforeFilter in my AppController which - whenever the view, edit or delete is accessed - automatically fills the AppController::model variable with the data of the passed $id. So I need to get the ID of the model from the URL in the beforeFilter. Sadly the $this-params variable doesn't have any 'id' named passed parameter: Array ( [pass] = Array ( [0] = 1 ) ) Is it safe just to use the key 0 or is there a way to put up a default route or something which would name the key? So I wouldn't be dependent from the order in which the ID is passed? Thanks Josh 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: Trying to test a controller but autoRender=false doesn't seem to stop rendering!
I usually do: $this-autoLayout = $this-autoRender = false; On Nov 17, 1:57 am, psybear83 psybea...@gmail.com wrote: Hi all That's my automatically generated controller test: ?php /* Comments Test cases generated on: 2010-11-17 10:11:59 : 1289987639*/ App::import('Controller', 'Comments'); class TestCommentsController extends CommentsController { var $autoRender = false; function redirect($url, $status = null, $exit = true) { $this-redirectUrl = $url; } } class CommentsControllerTestCase extends CakeTestCase { var $fixtures = array('app.comment', 'app.user', 'app.group', 'app.active_user'); function startTest() { $this-Comments = new TestCommentsController(); $this-Comments-constructClasses(); } function endTest() { unset($this-Comments); ClassRegistry::flush(); } } When running it, I'm getting errors from the default layout view: Notice (8): Undefined variable: users [APP/views/layouts/default.ctp, line 41] etc. I tried to set var $layout = false; but this didn't work, too. What's wrong here? Thanks Josh 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: location of php file where values are posted by jquery file
Like cricket said, you aren't even using Cake correctly, nor a framework correctly. Your auction file should be turned into a controller. On Nov 17, 4:48 pm, cricket zijn.digi...@gmail.com wrote: On Wed, Nov 17, 2010 at 9:10 AM, Biplab Subedi bipla...@gmail.com wrote: i am new to cakephp and and trying to write my penny auction code in cakephp i have index.php inside auction folder of view, and i call function residing at JavaScript/Jquery file commom.js (webrootjscommon.js). Now i have to post values from common.js to one php page(say ajaxauction.php). jQuery.post(.ajaxauctionphp, { all_auctions: auctions , pg_name: page_name, hr_delay: hr_delay} , function(data) { } so that the value of $data is returned from that php page. and i can add events to change the respective value of div at index.php like jQuery('#item_price_'+jQuery.trim(auc_det[0])).html(auc_det[1]); So what i was intended to know that, where should i make the php file ajaxauction.php. or in which location i should create the file. hoping to get suitable answer It doesn't appear that you're using Cake properly. For one thing, the only index.php is the one in the app/webroot directory, which catches all requests (there's another inside app/ but that simply points to the one inside webroot). You shouldn't be pointing to a ajaxauction.php file, either. Instead, all of your request code should be handled by a controller. I suggest you get acquainted with how Cake works before diving into AJAX requests. It's possible that Cake doesn't even suit your needs. 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: action redirect not working
So whats line 746? It seems you are echoing code before the redirect somewhere. On Nov 17, 5:28 pm, Briko03 nathanrlar...@gmail.com wrote: I have an form/action that I am trying to get to redirect based on submitted values For some reason when I try to get my form to redirect to my url I get: Warning (2): Cannot modify header information - headers already sent by CORE/cake/libs/controller/controller.php, line 746 My goal is to get the form to redirect to the action and eventually include parameter values in the redirect as well. I hope I made this clear to everyone. I have included my code below. - action code: if (!empty($this-data['Result']['location'])) { $this-redirect(array(controller = results, action = $this-data['Result']['location'])); } -- form code: ?php echo $form-create('Result', array('action' = 'findrace')); echo $form-input('location',array('type'='select','options'= $locations,'label'='Location*')); echo $form-input('season',array('type'='select','empty'='Select One','options'=$seasons)); echo $form-input('racenum',array('type'='select','empty'='Select One','options'=$races,'label'='Race #')); echo $form-input('sex',array('type'='select','empty'='Select One','options'=array('M'='Male','F'='Female'))); echo $form-input('class',array('type'='select','empty'='Select One','options'=$classs)); echo $form-submit(); echo $form-end(); print 'small*required field/small'; ? 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: CakePHP should be more strict with unclean configuration, e.g. when specifying missing components! --psybear
Well you're going to hate Cake 2.0 which is getting rid of the error system in place of exceptions :P On Nov 16, 12:47 am, Joshua Muheim psybea...@gmail.com wrote: Thank you for your replies. I was not aware that false is returned, so I'm taking back my accusation that CakePHP is lazy. Still I'd like to have an option that CakePHP automatically cries when in development mode... On Sat, Nov 13, 2010 at 5:32 PM, mark_story mark.st...@gmail.com wrote: Also App::import() returns false when an import fails. If you are interested in whether or not things succeed, you could check the return value of the method. -Mark On Nov 12, 5:05 am, psybear83 psybea...@gmail.com wrote: Hi all I don't get it why CakePHP doesn't complain about stuff like when one specifies missing components or fixtures: var $components = array('SomeNotExistingComponent'); var $fixtures = array('app.this_fixture_does_not_exist'); App::import('Lib', 'TheresNoSuchFileInLib'); All the three lines do not result in any error, and I guess there's more of that like $uses or stuff, but I didn't investigate this any further. Can anyone tell me why CakePHP just doesn't care about stuff like that? Seems vry unresponsible to me... Thanks for any hints Josh Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 athttp://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: Why only pass $data to view instead of model instance?
@Cricket - How so? Just because the model has database access? It really doesn't matter if you pass the model to the view if you are using it for convenience methods. I think you are completely missing the point, this isn't about passing data to the view. On Nov 16, 11:24 am, cricket zijn.digi...@gmail.com wrote: On Tue, Nov 16, 2010 at 2:09 PM, Jamie jamie@gmail.com wrote: No - the point of MVC is really to separate the manipulation of model data from the view through the use of a controller. There's nothing wrong with reading data from a model in a view, unless you like needless overhead. Lots of respected frameworks do it (like the Zend Framework). Right, and so making the model available for reading from the view would NEVER lead to its manipulation. Sure. And what needless overhead? There are several simple (and cheap) ways to get your data to the view without passing the model to it. 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: Why only pass $data to view instead of model instance?
Actually that's wrong. If this was a pure OOP framework, then we would be passing the model or some kind of object to the view, but we are not since Cake uses array as its primary data structure. Say you had a method like this in your User model: public function isActive() { return $this-data['User']['active'] == User::STATUS_ACTIVE; } Then all you would need to do in the view is: if ($model-isActive()) That cuts out the whole problem of having to manually write that condition every time its used. It also cuts out the need of a helper that handles this function when its unnecessary. Furthermore, Cake models are used incorrectly in my opinion. Models should represent a single entity of data (getters and setters for a row in the database), while Cakes approach is a global model to database table relation. On Nov 16, 3:28 pm, cricket zijn.digi...@gmail.com wrote: On Tue, Nov 16, 2010 at 5:22 PM, Miles J mileswjohn...@gmail.com wrote: @Cricket - How so? Just because the model has database access? It really doesn't matter if you pass the model to the view if you are using it for convenience methods. I think you are completely missing the point, this isn't about passing data to the view. Not sure I understand what you mean, either. Not providing a model (by default) to the view is a design decision based on separation of concerns (google it). In a well-designed MVC framework, it not only isn't necessary but would likely also be detrimental. And the point I was trying to make is that having a model available for convenience methods is no different from having it available for DB writes. ... Which goes against the principles of the MVC pattern. IOW, this isn't a those Cake devs and their crazy notions thing, but borne of a decision to utilise the MVC pattern. However, as Andy will remind us, it's just PHP, and so it's a simple matter to shoot oneself in the foot if one wants. 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: Why only pass $data to view instead of model instance?
I guess it all boils down to personal preference then :P On Nov 16, 8:20 pm, cricket zijn.digi...@gmail.com wrote: On Tue, Nov 16, 2010 at 9:44 PM, Miles J mileswjohn...@gmail.com wrote: Actually that's wrong. If this was a pure OOP framework, then we would be passing the model or some kind of object to the view, but we are not since Cake uses array as its primary data structure. I didn't mention OOP. But, now that you have, note that View is an object. Among its attributes is an array of data. I thought this was awkward at first, also, until I realised that it doesn't matter because View really needn't have that close a relationship with the data members themselves. That is, it wouldn't make much sense to do View::getX() or View::getY() when $x and $y are attributes of Model. Of course, I'm not going to sell anyone on that argument if they're still convinced that Model should be the object passed to the view. :-) Say you had a method like this in your User model: public function isActive() { return $this-data['User']['active'] == User::STATUS_ACTIVE; } Then all you would need to do in the view is: if ($model-isActive()) That cuts out the whole problem of having to manually write that condition every time its used. It also cuts out the need of a helper that handles this function when its unnecessary. But it's easy enough to adjust the data array in afterFind(), so that argument doesn't sway me. Think of $data as an encapsulation of your model instance. Not the entire model itself, with all of its behaviors and business logic, but the face it should present to the View. So, $data doesn't provide an isActive() method but, instead, includes the *information* that the View requires. Another example would be date formatting. Say a business needs their dates all formatted 'd-m-Y'. That's something that definitely should be handled by the model because, after all, it's the model that should deal with business logic. But it's unnecessary to call a formattedDate() method when we can just add a 'formatted_date' field to $data in afterFind(). Something like that could be put in AppModel, in fact. Either way, it's a cinch to just push it onto the array. (Another site might need to format dates according to users' locale. In that case, the logic should probably be handled in the view, perhaps with a helper.) Furthermore, Cake models are used incorrectly in my opinion. Models should represent a single entity of data (getters and setters for a row in the database), while Cakes approach is a global model to database table relation. I'd argue that Cake's ORM makes more sense. There are always going to be trade-offs when attempting to map objects to relational data, but Cake's DB table to array scheme has worked very well so far. Remember that the model's $data is not the entirety of the model. It's just the encapsulation for the View. If the latter requires more than what's been given to it, you simply have to add it in. That's business logic. 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: CakePHP Two Step View Pattern
This isn't possible in Cake. You can only have 1 content, which is the HTML rendered based on the action/controller. If you want to display additional content, use an element include or requestAction. On Nov 15, 9:31 am, Rey Philip reyphilipre...@gmail.com wrote: Hi guys I'm new here in CakePHP. How can I implement a two step view pattern in CakePHP? Example I have a layout there are two content divs namely content1 and content2. The code is like this html head titleMy Cake Blog Application/title ?=$html-css('styles');? /head body div id=container div id=content ?=$content_for_layout;? /div /div div id=container2 div id=content2 ?=$content_for_layout2;? /div /div /body /html Can I do this in CakePHP? Cause in CodeIgniter we setup a layout and then in the layout we could display many views. How can I do that here in CakePHP? Thanks in advance.. 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: CakePHP should be more strict with unclean configuration, e.g. when specifying missing components! --psybear
It will error out when you try to access a component that doesn't exist. Adding an invalid string to an array should not cause CakePHP to barf errors. On Nov 12, 10:09 am, cricket zijn.digi...@gmail.com wrote: On Fri, Nov 12, 2010 at 5:05 AM, psybear83 psybea...@gmail.com wrote: Hi all I don't get it why CakePHP doesn't complain about stuff like when one specifies missing components or fixtures: var $components = array('SomeNotExistingComponent'); var $fixtures = array('app.this_fixture_does_not_exist'); App::import('Lib', 'TheresNoSuchFileInLib'); All the three lines do not result in any error, and I guess there's more of that like $uses or stuff, but I didn't investigate this any further. It would have taken you all of ... four seconds? ... to add 'Foo' to some controller's $uses array and load up a route pointing to it. For those who can't bear the suspense: Cake will complain that the table for the model is missing. Remember that Cake can virtualize a model, so a missing model class is not necessarily a show-stopper. Can anyone tell me why CakePHP just doesn't care about stuff like that? Seems vry unresponsible to me... It's not that Cake doesn't care--it'll simply return false when, eg. failing to load a missing component. What's unresponsible is listing components, plugins, etc. that don't exist. 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: Is there a reason why I shouln't make $this-Html available in views as $html? --psybear
It was mainly so that user variables don't overwrite helper variables. I ran into this problem a few times during my 1.2 days. If it really bothers you that much. $f = $this-Form; On Nov 12, 5:25 am, Joshua Muheim psybea...@gmail.com wrote: I don't see the big deal, too. I just wondered whether there's a knockout argument for doing it the CakePHP-way. But I guess I will stick to the CakePHP-way now for some time and see later if I still want to change it... :-) On Fri, Nov 12, 2010 at 2:23 PM, Jeremy Burns | Class Outfit jeremybu...@classoutfit.com wrote: I like the way Cake does it, regardless of what else others do. I can imagine that if you had a helper function called display and then you added another helper that had a function with the same name you *could* isolate and rectify the clashes, but I'd rather avoid that extra work in the first place by just pre-pending the helper name in the first place. I don't see the big deal. Jeremy Burns Class Outfit jeremybu...@classoutfit.com http://www.classoutfit.com On 12 Nov 2010, at 08:18, Joshua Muheim wrote: I'd really like to know why it has switched to $this-Html. Is there a decision log or something for CakePHP? Coming from the RoR world (which is far more widespread in the webworld than CakePHP, I guess) I like things as simple as anyhow possible, even if you have to stick to some conventions for its sake. I haven't worked with RoR since 2 years or so, so maybe things have changed now, but up then as far as I remember things like helper methods had been mixed right into the view *without* anything like a $helper method or so. E.g. a helper Bla with methods abc and xyz were accessible in the view directly by calling abc and xyz, so you had to see for yourself that no collisions appeared (and if one did, I guess you would still have been able to distinguish your helpers by prepending the helper's name, e.g. Bla.abc or Foo.abc). So RoR went the way that's the most convenient to use, and by having a good test battery in the background conflicts like the mentioned above were located and fixed easily while still having all the convenience in those spots that didn't have collisions (which are in most cases many more than the ones that do). Well, just writing some thoughts down here, no intention to blame CakePHP or something... I'm just curious about some stuff... ;-) On Fri, Nov 12, 2010 at 1:41 PM, euromark dereurom...@googlemail.com wrote: actually its the other way around it used to be $html and NOW is $this-Html (cake =1.3) and yes, there are plenty reasons why this is now a view object (and not just an object variable) it is a bad idea to want to go back to the old syntax and your argument is bad: For the sake of simplicity $this-Html makes more sense (no collisions in the view anymore) hope that clears things up On 12 Nov., 11:42, psybear83 psybea...@gmail.com wrote: Hi everybody For the sake of simplicity I'd like to make my helpers available in my views not as $this-Helper but as $helper using the set(...) method in the controller. Is there any reason why this could be a bad idea? Or is there already an option to tell CakePHP to make the helpers available this way? Thanks for help Josh Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 athttp://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 athttp://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 athttp://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
Re: Why only pass $data to view instead of model instance?
I dislike this also. Cake really should have more than 1 model type: DAOModel and DataModel. One deals with database interactions, while the other manipulates a dataset for the view. However, there is nothing stopping you creating these extra models. $this-set('data', new UserDataModel($this-User-find())); On Nov 12, 5:23 am, Joshua Muheim psybea...@gmail.com wrote: I'd like to warm up this topic again. :-) I decided to pass model instances to the views instead of just their $data attributes. So is there a way to tweak the paginator to do exactly this? Thanks, Josh On Thu, Oct 28, 2010 at 8:26 PM, euromark dereurom...@googlemail.com wrote: i tend to do those things on demand using a behavior to add new keys or even doing it in the model afterFind() etc often results in additional work without actually needing this information but of course this depends on the particular case On 28 Okt., 20:10, cricket zijn.digi...@gmail.com wrote: On Thu, Oct 28, 2010 at 10:03 AM, euromark dereurom...@googlemail.com wrote: thats not correct for PHP5 anymore in PHP4 you needed to do this but in PHP5 it is passed by reference by default, afaik Agreed on passing the model to the view. But this could also be accomplished in afterFind(), adding new key = value to the data array. Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 athttp://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: beforeFilter() after initialization of components but before beforeRender? --psybear
Components are initialized before they get to beforeFilter(), so beforeFilter() should work fine. https://github.com/cakephp/cakephp/blob/master/cake/libs/controller/controller.php#L525 On Nov 11, 9:24 am, Bogdan Bursuc bogdanbursu...@gmail.com wrote: Why do you need one ? On Thu, Nov 11, 2010 at 7:18 PM, psybear83 psybea...@gmail.com wrote: Hi all Is there a filter that runs after the initialization of components but before beforeRender? Thanks for help Josh Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 -- Thanks, Bogdan Iulian Bursuc 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: beforeFilter() after initialization of components but before beforeRender? --psybear
Also forgot to mention that there is an afterFilter() as well. On Nov 11, 10:30 am, Miles J mileswjohn...@gmail.com wrote: Components are initialized before they get to beforeFilter(), so beforeFilter() should work fine. https://github.com/cakephp/cakephp/blob/master/cake/libs/controller/c... On Nov 11, 9:24 am, Bogdan Bursuc bogdanbursu...@gmail.com wrote: Why do you need one ? On Thu, Nov 11, 2010 at 7:18 PM, psybear83 psybea...@gmail.com wrote: Hi all Is there a filter that runs after the initialization of components but before beforeRender? Thanks for help Josh Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp 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 -- Thanks, Bogdan Iulian Bursuc 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: Design Pattern???
Can you be more specific? It does use ActiveRecord and some Observer pattern. On Nov 10, 7:56 am, dr43058 dr43...@gmail.com wrote: What design pattern does CakePHP use in the data access portion of the MODEL? 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: Simple jquery script
You could just write the Javascript manually. I never found a benefit in using a PHP helper that generates your JS code, when you can just write the JS code. On Nov 8, 9:00 am, Dobrogor alexc...@gmail.com wrote: Yes, I working with jQuery helper that i can use in Cake. Because original jquery code dont working in files with extensions .ctp. I files with extensions .html or .php jquery work perfecty. 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: Security Component
Most of the time it will not validate and blackhole (throw a whitepage), it was easiest to just disabled it in AJAX calls. $this-Security-validatePost = false; We dont need validation in AJAX anyways as we usually need some sort of json response. On Nov 8, 2:18 pm, Dave Maharaj m...@davemaharaj.com wrote: Ok from what I have read using Security Component with AJAX request will not work. So I never added it to my app_controller, then today I decided lets see what happens so sure enough my forms all get the security div div style=display: none;input type=hidden value=POST name=_methodinput type=hidden id=Token1607686768 value=6ed5415b7526befab1ec093cac8ccd45255daba7 name=data[_Token][key]/div Now just for fun I tested my forms that use ajax and they all submit fine. So what I was reading saying it will not work are they saying it will not work as in the security feature will not work (it wont secure the forms) or it will not work as in your forms will never submit? Dave 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: Security Component
It has been a while but usually the response would just be empty, even if I was setting data. On Nov 8, 3:49 pm, Dave Maharaj m...@davemaharaj.com wrote: All my responses are JSON with true / false then do something like you said. I was just curious as everything I seem to have found says Security Component will not work so just trying to get an answer on what exactly will not work means. ? The component will add the Token / hash but its not checked ? ? The whole thing will fail ? ? The component does nothing ? So far in my testing everything still works but if I edit the form with firebug it still submits (my validation returns JSON response error ) so I guess the security component does nothing. So far no blackhole / whitepage errors though. Just curious is all. Thanks, Dave -Original Message- From: Miles J [mailto:mileswjohn...@gmail.com] Sent: November-08-10 7:58 PM To: CakePHP Subject: Re: Security Component Most of the time it will not validate and blackhole (throw a whitepage), it was easiest to just disabled it in AJAX calls. $this-Security-validatePost = false; We dont need validation in AJAX anyways as we usually need some sort of json response. On Nov 8, 2:18 pm, Dave Maharaj m...@davemaharaj.com wrote: Ok from what I have read using Security Component with AJAX request will not work. So I never added it to my app_controller, then today I decided lets see what happens so sure enough my forms all get the security div div style=display: none;input type=hidden value=POST name=_methodinput type=hidden id=Token1607686768 value=6ed5415b7526befab1ec093cac8ccd45255daba7 name=data[_Token][key]/div Now just for fun I tested my forms that use ajax and they all submit fine. So what I was reading saying it will not work are they saying it will not work as in the security feature will not work (it wont secure the forms) or it will not work as in your forms will never submit? Dave Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 athttp://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: Cake without write permission to file systems?
Just change the cache setting in config/core.php Example: Cache::config('default', array( 'engine' = 'Memcache', 'duration' = 86400, 'probability' = 100, 'servers' = array('localhost:11211'), 'compress' = false )); On Nov 8, 7:06 pm, park park@gmail.com wrote: Hi all, I tried to deploy a Cake app to a cloud hosting service ( similar to GAE but supports PHP and MySQL ) which does NOT allow write access to the file system. The caching is supposed to be taken care of by Memcache. Is it possible to get Cake to work in such an environment? I did change Session.save to PHP and enabled Memcache. But it still threw out errors saying the tmp dir is not writable. Many thanks. 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: Best way to route old fashioned PHP url to cake style
I would do it in the htaccess file. No need to leverage PHP logic for this. On Nov 7, 10:24 pm, pz zhangpe...@gmail.com wrote: Hi All, I am rewriting my old site with Cake 1.2. The old site has may urls that people bookmarked and search engines indexed. I want to keep those url working. What's the best way to handle them? in httpaccess file? or cake route file? for example: if someone type inwww.example.com/contacts.php, I wantwww.example.com/contacts/add to handle that. I don't want to do a redirect if possible. thanks, pz 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: Get the last insert id
@Kevando - If you want the ID of something that happened 20 days ago, you cant get the last insert ID. That only applies when you literally just ran a query and need to get the ID. If you want it from 20 days ago, do a find query and order by DESC limit 1. On Nov 4, 8:36 am, euromark dereurom...@googlemail.com wrote: you could use find-first() with order: id=DESC this would get you the last insert id, no matter how many days passed although the above race conditions might result in problems (depending on the usage of this id) On 4 Nov., 16:28, AD7six andydawso...@gmail.com wrote: On Nov 4, 3:50 pm, Mike Karthauser mi...@brightstorm.co.uk wrote: On Wed, November 3, 2010 7:05 pm, kevando wrote: What about if my last insert/save was 20 days ago? why don't you insert and then update if you want to do that. you can easily wrap that in a transaction. anything else you do just risks a race condition. Basically -- I want to get the value of the current (or latest) id in the beforeSave function $this-Model-getLastInsertId(); http://book.cakephp.org/view/312/Models does what it says on the can. which is return null unless you just inserted something. 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: Can i send email through mysql/cakephp when the users are offline?
No there isn't such functionality. Furthermore, how are you detecting an offline user? On Nov 2, 9:03 pm, Jerin K Alexander jerin.kalexan...@gmail.com wrote: My objective is to send a mail when the users are offline. It depends on a particular row or value inserted in the table. if such an option provide by cake or mysql,please help me.. 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: Help with array
Wouldnt this work? Havent tried. var data = { Model: { username: 'miles'; } } On Nov 3, 6:57 pm, Dave Maharaj m...@davemaharaj.com wrote: I think so! It has a model. Im using a jquery plugin and where the user slides something I have a #id which corresponds to a field and a value so I want to save it but it has no built in way to save that data so that's what im trying to do! So I want to mimic what that looks like. I only asked a question! If you want to be a comic maybe you should give that a try. It is a help forum is it not? If we were all as skilled as you then who would you insult? From: Matt Murphy [mailto:mattyh...@gmail.com] Sent: November-03-10 11:21 PM To: cake-php@googlegroups.com Subject: Re: Help with array Am I being moronic, everyone? Matt On Wed, Nov 3, 2010 at 9:50 PM, Matt Murphy mattyh...@gmail.com wrote: It's your data. Make a model for it. On Wed, Nov 3, 2010 at 8:18 PM, Dave Maharaj m...@davemaharaj.com wrote: Does anyone know how to manually create an array in js that would mimic the data sent normally? I simply need to send off 1 key = value pair so it looks like data['model']['field'] = 0 since that is what the controller is expecting Not using a form as what is being done is not possible.. The js has field value passed to it.just cant seem to get the array right. SCRIPT (NOT CONTROLLER) function update ( field , value ) { var user_data= new Array() $.ajax({ type: POST, cache:false, url: '/user/update', data: user_data }); } Thanks, Dave Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 mailto:cake-php%2bunsubscr...@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 athttp://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: Anything wrong with this?
Just for convenience sake. I do the same thing for a lot of my tables and in most cases the numbers get out of sync. Either a profile fails to create, or creates dupes, or something terrible happens. Its best to just keep inserting rows (and delete broken ones) then to try and fix the table to sync. On Nov 1, 6:23 pm, Dave Maharaj m...@davemaharaj.com wrote: Everything has the ID field. My point is that create a User and Profile at the same time as in my case User.id is 123 for example and Profile.id is 123 also Why would I want to create Profile.id = 123 and Profile.user_id 123 That’s what I was getting to..redundant to have Profile.user_id if I'm setting up a hasOne no? My Profile hasMany Gallery which uses profile_id, basically everything is linked back to the Profile not the User (even though User and Profile are the share the same ID) If I am wrong just let me know. Dave -Original Message- From: Jean-Francois Bibeau [mailto:jfbib...@gmail.com] Sent: November-01-10 10:43 PM To: CakePHP Subject: Re: Anything wrong with this? Everything in your database should have an id column, regardless of if it's in a relationship or not. This is the only thing that can uniquely identify your row if you want to edit it, delete it, etc... :) Then, to follow cake conventions, any relationship should have a foreign key column of parentmodel_id . Following these conventions will make your life a 100 times easier in the long run, and is generally good practice! Cheers! On Nov 1, 8:58 pm, Dave Maharaj m...@davemaharaj.com wrote: User hasOne Profile , Profile belongsTo User But in my Profile table I do not have user_id, I just have id which is the User.id created automatically when the User creates an account. To me it seems like why give the Profile a separate ID when essentially its just an extension of the User. Everything else is related to the Profile Profile: var $belongsTo = array( 'User' = array( 'className' = 'User', 'foreignKey' = 'user_id') ); User: var $hasOne = array( 'Role' = array( 'className' = 'Role', 'foreignKey' = 'id', 'dependent' = false), 'Profile' = array( 'className' = 'Profile', 'foreignKey' = 'id', 'dependent' = false) ); Is this set up wrong? Thanks, Dave Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 athttp://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: Opening New Window from Controller
Why would you ever need to do this? It is impossible anyways, that is a browser feature. On Oct 26, 12:18 pm, Tilen Majerle tilen.maje...@gmail.com wrote: opening new windows from controller???...so you want with php??...impossible :D -- Tilen Majerlehttp://majerle.eu 2010/10/26 Xandornot inqu...@whateverworks.ws Does anyone know how to open a new window with a given URL from the controller (not javascript)? Check out the new CakePHP Questions sitehttp://cakeqs.organd 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: Build Query
Why are you setting $results twice? If you want pagination, use paginate(), you dont need the other query. On Oct 25, 11:39 am, Briko03 nathanrlar...@gmail.com wrote: It looks like the first query is working as it should. I am positive there is a location field. Here is a snapshot of the table When I run the first query it works fine and returns 2615 records. I think it has something to do with the pagination perhaps? On Oct 25, 1:50 pm, Jeremy Burns | Class Outfit jeremybu...@classoutfit.com wrote: Are you certain you have a row in your database that matches that criteria? The SQL looks right, but the count is zero. What happens when you run the SQL directly against the database? Jeremy Burns Class Outfit jeremybu...@classoutfit.comhttp://www.classoutfit.com On 25 Oct 2010, at 13:46, Briko03 wrote: I have a field named location. This is what is coming throu from cake SHOW FULL COLUMNS FROM `results` 14 14 3 2 SELECT CHARACTER_SET_NAME FROM INFORMATION_SCHEMA.COLLATIONS WHERE COLLATION_NAME= 'utf8_general_ci'; 1 1 1 3 SELECT `Result`.`id`, `Result`.`racenum`, `Result`.`bib`, `Result`.`fname`, `Result`.`lname`, `Result`.`sex`, `Result`.`class`, `Result`.`team`, `Result`.`firstrun`, `Result`.`secondrun`, `Result`.`best`, `Result`.`points`, `Result`.`season`, `Result`.`location` FROM `results` AS `Result` WHERE `Result`.`location` = 'Sundown' 2615 2615 7 4 SELECT COUNT(*) AS `count` FROM `results` AS `Result` WHERE 1 = 1 1 1 0 5 SELECT `Result`.`id`, `Result`.`racenum`, `Result`.`bib`, `Result`.`fname`, `Result`.`lname`, `Result`.`sex`, `Result`.`class`, `Result`.`team`, `Result`.`firstrun`, `Result`.`secondrun`, `Result`.`best`, `Result`.`points`, `Result`.`season`, `Result`.`location` FROM `results` AS `Result` WHERE 1 = 1 LIMIT 100 100 100 1 Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp 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 athttp://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: A little help with auth. :)
Just check $this-params['action'] and do different logic based on specific actions. On Oct 19, 7:12 pm, xtraorange xtraora...@gmail.com wrote: Is there any way to do that at the action level, rather than the controller level? Different actions may have different userlevel requirements. On Oct 19, 7:18 pm, jsalonen joni.salo...@gmail.com wrote: The easiest way to do it is probably simpler than you think: set the $authorize variable of AuthComponent to controller, and add isAuthorized method to your controllers, kind of like: function beforeFilter() { $this-Auth-authorize = 'controller'; } function isAuthorized() { // get access level from user's profile $accessLevel = $this-Auth-user('access_level'); // find the required access level for $this-action $requiredLevel = xxx($this-action); return $accessLevel = $requiredLevel; } You could implement xxx with an array of numbers or what ever you like... By the way you could use ACL for the same effect: ACOs don't have to be actions. They can just as well be user roles, and then you use ACL to check if a given user has access to the required role. More flexible but probably not worth the effort for the simpler cases. On Oct 20, 1:48 am, xtraorange xtraora...@gmail.com wrote: Howdy all, ACL seems to just be too complicated for what I'm doing, particularly with all the actions I have... the table is hard to keep organized, and it's way too hard to edit permissions. So I'm looking for something else. The site I'm building has need for multiple user levels, but the user would only need to belong to one of these levels (for example, user, moderator, admin, site master). Here's what I'm thinking: An auth function I can put at the top of an action that I can either pass a number to, or an array of numbers to, as a minimum level for the user to access that action (or in the case of an array, each level defined as true/false). Each user would then simply have a number in their user data that would indicate their level. Questions: 1. Is there anything wrong with this (other than the fact that it goes against the grain of typical ACL)? 2. What would be the easiest way to implement this? Extend the auth class with a custom class and add my functions, or a new class, or just a function? 3. Any other suggestions that would handle what I'm looking for that I'm not considering? Thank you! xtraorange 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: How can i Optimize i18n ?
I18n already caches the strings after it has been parsed. Make sure you actually have caching enabled. On Oct 19, 10:08 am, Adrian Arnautu arnautu.adr...@gmail.com wrote: Oh, now I see that you gave us the output, my bad :). Thank you. On Tue, Oct 19, 2010 at 8:06 PM, Adrian Arnautu arnautu.adr...@gmail.comwrote: Hi, I've not done this yet, I'm thinking to do it (I have also a multilanguage app that needs to be fast), cache the output. I'm not saying to cache every __() result, that will be childish :). Maybe your content is in an element, if you can cache it, do it. Maybe you have content that isn't so dynamic, it can be refreshed every few hours or at some events, try to cache it. When possible, try to remove calls to __() from loops. Like I said, so far I haven't done profiling. Can you please tell us, based on your results, what are the most used functions/classes/methods, in general, where are the bottlenecks? Thank you, Adrian On Tue, Oct 19, 2010 at 12:37 PM, CakeME mohammed.dastagirk...@gmail.comwrote: My website is very slow and i managed to install xdebug And after looking at the profile generated by the xdebug using kcachedgrind i found i18n::Translate took more inclusive , self and more counts compare to others i am thinking what to do how can i optimize this. can some one tell me how can i do this Here is my generated profile: http://yfrog.com/f/n8xdebugprofilingp/ Check out the new CakePHP Questions sitehttp://cakeqs.organd 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: So methods that are not an action should have a _ in front of it?
The _ is just to make it easier unlike Symfony: function executeIndex() { } Or unlike Zend: function indexAction() { } The callbacks are just restricted internally from being called. On Oct 19, 9:12 am, Joshua Muheim psybea...@gmail.com wrote: Hrhr, as said before, I will just have to accept stuff in future. ;-) On Tue, Oct 19, 2010 at 5:42 PM, Jeremy Burns | Class Outfit jeremybu...@classoutfit.com wrote: Are you rewriting Cake, PHP or just building your own stuff? ;-) Jeremy Burns Class Outfit jeremybu...@classoutfit.com http://www.classoutfit.com On 19 Oct 2010, at 16:37, Joshua Muheim wrote: Yeah I knew that, but still IMHO they should have been named with a _ prefix. I guess sometimes I'm searching for too much sense in stuff... I'd rather should just accept it as given and don't think too much about it... But I often feel like a child: I wanna know WHY something is the way it is... :-) On Tue, Oct 19, 2010 at 5:05 PM, euromark dereurom...@googlemail.com wrote: those are callbacks - special methods belonging to the controller logic thats why On 19 Okt., 16:07, Joshua Muheim psybea...@gmail.com wrote: OK, so why do several CakePHP methods don't have an underscore? Like beforeFilter()? I know, CakePHP will probably be smart enough to not allow this to be called as an action through the browser, but still...? :-P On Tue, Oct 19, 2010 at 4:00 PM, Joshua Muheim psybea...@gmail.com wrote: Thanks for the hint with the components! :-) On Tue, Oct 19, 2010 at 3:59 PM, euromark dereurom...@googlemail.com wrote: yep, thats right (for example from the acl shell) or YOU could accidently misinterpret it as an action so either way it is still helpful to use the underscores :) but in most cases you usually can put that could in a component doesnt have to be a controller _function... On 19 Okt., 15:44, psybear83 psybea...@gmail.com wrote: As mentioned before, I have taken over an existing CakePHP application... and it's not a very good one. I'm working since a month or more on things like writing tests (there haven't been any before), cleaning and rewriting code etc. So now I stumbled over some methods in a controller that aren't actions, but they don't have underscores _ in front of their names... so I ask you: they *really should have*, right?? I know the conventions, that protected and private methods and attributes should have an underscore (or even two in some conventions) for visual reasons back from the days of PHP4, but that's not what's really important here, right? It's important here because when not having an underscore, it will be mistaken by CakePHP for an available action, right? So aside from that, are you following the convention mentioned above? Should I use it when coding a CakePHP application? Or is it somewhat outdated? Thanks Josh Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp 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 athttp://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 athttp://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 athttp://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 athttp://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
Re: Easiest way to get data from a model (better way than $model-data['modelname']['field'])?
You can use read. $this-read('column'); If the data doesnt exist yet, pass an ID. $this-read('column', $id); But usually best to just grab the who result, then use read() afterwards. On Oct 19, 8:40 am, Joshua Muheim psybea...@gmail.com wrote: Accepted. :-) Thanks for your opinion. On Tue, Oct 19, 2010 at 5:37 PM, Jeremy Burns | Class Outfit jeremybu...@classoutfit.com wrote: I hate to be contrary, but I disagree. Whatever else you come up with would be great for some, awkward for others. It works and I think it's very precise. Jeremy Burns Class Outfit jeremybu...@classoutfit.com http://www.classoutfit.com On 19 Oct 2010, at 16:34, Joshua Muheim wrote: Thanks for your explanations, sounds good. Still I think $model-data['Model']['field'] is very awkward. ;-) On Tue, Oct 19, 2010 at 4:26 PM, Jeremy Burns | Class Outfit jeremybu...@classoutfit.com wrote: I think this is a mute point - it works really well as it is. If a model has a self join relationship with itself you give it a different model alias, so it will appear with that name in the data array, not the name of the model. For example, an employees table might have a self join to denote a management structure. So the field employees.manager_id would join back onto employees.id. Your model would be something like this: Employee... var $belongsTo = array( 'Manager' = array( 'className' = 'Employee', 'foreignKey' = 'manager_id' ) ); If you did a find containing the employee and his/her manager, you'd have a whole leaf of data under the Manager key. This makes much more sense than grouping the data elements by the type of join. It also means that you can change the join type in your model and all of your finds and so on will still work. Jeremy Burns Class Outfit jeremybu...@classoutfit.com http://www.classoutfit.com On 19 Oct 2010, at 14:59, Joshua Muheim wrote: Maybe I don't really understand your point, but as far as I see that's exactly what I've written here: Then I saw that every related model has its own key there, so it makes a bit sense. But why is the key in the array the model's name? Wouldn't it be better to have the name of the association in there? Because what when I have multiple associations to the same model? Or a HABTM with myself? On Tue, Oct 19, 2010 at 3:56 PM, euromark dereurom...@googlemail.com wrote: i think you are missing the obvious point is there a reason why this is done this way in cake? yes, there is trust the guys that work with since several years one example: you have a BelongsTo relationshop cake can easily get this data as well now you can do: $this-Model-recursive = 0; $m = $this-Model-findById(1); echo $res['Model']['something]; echo $res['OtherModel']['something]; without any additional stuff going on. thats why you always have the model name first. On 19 Okt., 14:30, Joshua Muheim psybea...@gmail.com wrote: It looks really clumsy to me. What about the following? class AppModel extends Model { function data($field) { return $this-data[$this-name][$field]; } } First I was not sure why in the $data array there is a key 'ModelName', I would have expected something like this: array( 'id' = 1, 'name' = 'bla' ) instead of array( 'ModelName' = array( 'id' = 1, 'name' = 'bla' ) ) Then I saw that every related model has its own key there, so it makes a bit sense. But why is the key in the array the model's name? Wouldn't it be better to have the name of the association in there? Because what when I have multiple associations to the same model? Or a HABTM with myself? Aside of this, I guess retrieving the immediate data of the model (not of it's related models') should have a special status and should be able to be retrieved in a faster way, like the one above... On Tue, Oct 19, 2010 at 1:15 PM, euromark dereurom...@googlemail.com wrote: nope but thats already a very neat way to do it what is your problem with it? On 19 Okt., 11:53, psybear83 psybea...@gmail.com wrote: Hi everybody Sorry for this newbish question, but I don't seem to find much about this (although I should, I guess). $m = $this-Model-find(1); echo $m-data['Model']['something]; Is there a better way of getting a model's data fields instead of this? I always thought this could be done with $m-field(), but this retrieves the data from the database, what is not what I want. Thanks Josh Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp 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
Re: PersistModel problem
I ran into this problem many times and never found a solution. It only seemed to happen on apps with large sets of models and relations, so I am assuming that the serialization of the objects is causing the model relations to break or not work properly. I had to disable persistModel and just stich with caching. On Oct 18, 7:27 am, sherzo shahrzad.azimi...@gmail.com wrote: Hi all Today I noticed that the registration part of my web site stopped working! I turned on the debug mode and I saw this error message: The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition Registration of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in xxx I google it and I found out its related to the persistModel. I deleted the whole cache and nothing changed! the I change the persistModel value from true to false and then the site started to work! but I need the persistModel to be on! Any one knows how can I solve this problem? Thanks Sherry -- View this message in context:http://cakephp.1045679.n5.nabble.com/PersistModel-problem-tp3217510p3... Sent from the CakePHP mailing list archive at Nabble.com. 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: Missing Controller
So what does your controller code look like? And what is the filename? etc. On Oct 15, 8:18 pm, Syed Badar Bin syed...@hotmail.com wrote: HI GUYS i have added a new folder on my server and its has got all the files in it including index but i get this error, Can any one help please Missing Controller Error: LivezillaController could not be found. Error: Create the class LivezillaController below in file: app/ controllers/livezilla_controller.php ?php class LivezillaController extends AppController { var $name = 'Livezilla';} ? Notice: If you want to customize this error message, create app/views/ errors/missing_controller.ctp 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: Suggestion for upload large files
If you have upload/memory limit issues, use a flash or java uploader. On Oct 15, 8:11 am, Sanza mass...@creativebrains.it wrote: Hi everybody, anyone can suggest to me a solution to upload large files without change the php.ini setting upload_max_filesize? Thank you Massimo 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: Framework benefit?
Easy: fast development. Also, caching will improve everything. For example, my APC can deal with about 120 cache requests per second and my memcache about 90 per second. Site loads blazingly fast. On Oct 13, 11:41 pm, Andrei Mita andrei.m...@gmail.com wrote: Plus, hardware is MUCH cheaper then software. On Wed, Oct 13, 2010 at 6:34 PM, WW wadewill...@gmail.com wrote: Thank you Jeremy for taking the time to write and hearing the main benefit if for cutting down the bulk of code. On Oct 13, 11:14 am, Jeremy Burns | Class Outfit jeremybu...@classoutfit.com wrote: It depends what your priorities are, your personal experiences with frameworks and who you believe. The major benefit of a framework is that it cuts down the bulk of the code you need to write, and that code will (probably) be better than you could write yourself. So if time to market is critical, a framework is a good head start. And that core code is always being worked on and improved, so your code will benefit from that development effort. If you are a master whizz bang bleeding edge developer that might not be attractive to you. And you might have heard of bad experiences with frameworks and might well want to muddy the waters because you can or you feel like it. But a framework is just a set of tools with which you can build something bigger and better. If you use them badly you'll get a bad site, and that might lead to bad publicity for the framework - which is probably unjust. I have sites that peak at 200,000 hits per hour without breaking a sweat and without running on stupid hardware. So my experiences with frameworks (well, having looked at most frameworks I've only ever used CakePHP) have been totally satisfactory. So you pick who you believe. There has been quite a bit of banter on this forum about Cake's capacity and trying to measure performance relative to other frameworks, but I've yet to see anything that makes me think that it isn't up to the job or that it is the best thing since sliced bread. In fact it's all probably an intellectual w*nk and a complete waste of time. My advice? Don't think about it too much, give it a go yourself and form your own opinion. Jeremy Burns Class Outfit jeremybu...@classoutfit.comhttp://www.classoutfit.com On 12 Oct 2010, at 20:33, WW wrote: Hi everyone, I could use some help on a question. Question: What is benefit of coding with a framework if frameworks only deliver between 55 to 210 req/sec? (see Paul Jones report below) With only being able to deliver between 55 to 210 req/sec using a framework this would mean I would need a monster expensive server to keep the CPU usage down to a minimum. Where if you code in native PHP I can get 1413 req/sec. -Reported by Paul Jones…http://paul-m-jones.com/archives/238 - Webserver itself – delivers 2328 req/sec Invoking PHP – delivers 1413 req/sec Invoking a Framework – delivers between 55 to 210 req/sec -- Thank you for taking the time to share your thoughts. Best, WW Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp 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 athttp:// groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions sitehttp://cakeqs.organd 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: Loading a cookie inside a model's constructor
You should be passing the cookie from the controller to the model. $this-Model-cookie = $this-Cookie-read('cookieName'); But to answer your question, you need to initialize the cookie component. $cookie = new CookieComponent(); $cookie-initialize($this, array()); On Oct 14, 4:15 pm, cricket zijn.digi...@gmail.com wrote: On Thu, Oct 14, 2010 at 4:38 PM, Raisen weys...@gmail.com wrote: So I want to read a cookie using the Cakephp's Cookie class. First, I tried to import only the cookie class and read the cookie, but I was getting an error stating that the cipher key cannot be null. So I imported the Configure class, set the key property of the cookie instance to the respective cipher key, but the cookie is returning a different result from what it's set to. Any ideas?\ The override constructor class looks like: class Member extends AppModel { function __construct( $id = false, $table = NULL, $ds = NULL ) { App::import('Component','Cookie'); App::import('Core','Configure'); $conf = new Configure(); $cookie = new CookieComponent(); $cookie-key = $conf-read(Security.cipherSeed); var_dump($cookie-read('sel_app')); ... parent::__construct($id,$table,$ds); You should read write to cookies in the controller (or component) not the model. 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: Help with converting user generated content into cakephp friendly code
My suggestion, don't do any of what you asked in your first post. Either do straight HTML without connecting to Cake, or use a custom markup like BBCode and parse it yourself. On Oct 11, 5:29 pm, Greg Skerman gsker...@gmail.com wrote: Figured it out - well at least the process.. going to have the users 'insert' elements via ajax - rendered ajax response containing the element will be inserted into the page (straight HTML and javascript) - that way the pages effectively cache the elements. means I can't have users insert dynamic content but thats no big loss, landing pages probably shouldn't have/need dynamic content. On Mon, Oct 11, 2010 at 9:13 AM, Greg Skerman gsker...@gmail.com wrote: The users will be administrators..not any-old-person who wants to create pages. I'm open to *not* including the php...as obviously this isn't very secure. I guess what i'm asking, is where would i throw a regular expression/replace to take a comment such as !---Element(name,params)--- to replace with the correct cake code? beforeRender? And where is the view output stored? On Mon, Oct 11, 2010 at 8:46 AM, cricket zijn.digi...@gmail.com wrote: On Sun, Oct 10, 2010 at 9:18 AM, Greg Skerman gsker...@gmail.com wrote: Hi, I'm writing a little content manager, and for this i've decided to rewrite the pages controller so that it is database driven. I'm using TinyMCE and markitup as the editors to allow content to be created. My issue is, how do I go about getting cakephp's automagic elements working with this? obviously when a user creates an img tag, I would like to convert this to a HTMLHelper tag to get around relative paths etc, Use img tags with absolute paths and be done with it. but I also want to be able to allow the users to include elements and other helper code in their pages. Now you're looking for trouble. Is it a case of parsing the stored page and converting it on the fly to include these elements, or is there a way to safely store and later evaluate saved php code? How much do you trust these users? Check out the new CakePHP Questions sitehttp://cakeqs.organd 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: passing data to controller via POST makes trouble
Ok so whats the URL that saveRating() points to? And what does the action look like. On Oct 12, 2:40 pm, Tomfox Wiranata tomfox.wiran...@gmail.com wrote: hi, when a user clicks on a product link a url like this opens: products/ show/45 45 is the products id. this id is part of a select statement to retrieve the correct information from the database. controller function: show($id=null){ some code... SELECT * from products WHERE products.id=$id...; some code... } now the user has the opportunity to rate this product. after the user rated i wanna show the new result and the new count. of course with ajax feeling. so I use JQUERY to pass the rating value to a function named rate. $(#lkbl_rating_stars_list).stars({ inputType: select, cancelShow: false, callback: function(value, link){ saveRating(); } }); function saveRating() { var ui = $(#lkbl_rating_stars_list).data(stars); var ratingValue = ui.options.value; $('#ratingt').load('rate', {data: ratingValue}); } now cake throws error Warning 512: SQL error. cant find column rate. looking at the sql statement that is generated: SELECT * from products WHERE products.id=rate...; that tells me, that jquery send the data thru the URL and somehow the $id is replaced by rate...which makes no sense :) HOW do I have to pass data with jquery to my controller without screwing with the url? is .load not correct? appreciate it. thanks 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: Plug-in Models
That is how you use it. If you want to use plugin models within a plugin, you must define the plugin. public $uses = array('User' = array('className' = 'Member.User')); On Oct 7, 6:46 pm, Dave Maharaj m...@davemaharaj.com wrote: I have various controllers such as confirmations, passwords, members that I would like to package as a plugin to keep them in 1 spot. So going thru the cookbook it mentions nothing about using existing models within a plugin. My Member plugin will use the regular User model. How can this be done? ?php class MemberConfirmation extends MemberAppModel { var $name = 'MemberConfirmation'; var $uses = array('User'); } ? Something like that? Any insight would be great. First attempt so bare with me. Thanks, Dave 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: Best way to handle sub-tabs
And again, what your saying is exactly what a controller and action is for. How is that different than your setup? On Oct 4, 7:30 am, Joey Mukherjee joe...@gmail.com wrote: In retrospect, I guess I didn't explain as well as I should have. I have each subtab as an element now and every subtab is rendered via ajax (i.e. $js-link ($html-tag ('span', $side_button ['title']), array ('action'= 'display/'.$side_button ['name']), $options). The controller action display just has a $this-render (/elements/ $tabname/$whatToDisplay); So, when the user goes tohttp://system/tabname, the initial view sets up the element specific to that tab that views/layouts/default.ctp did not setup. Each subtab element just has stuff specific to that subtab (in my case, mainly just text). However, I'd like people to go tohttp://system/tabname/subtaband directly render the specific text to that subtab. That's what I can't figure out?? Anyway, does this sound right to everyone? I feel like I am the only one having this problem on something which seems pretty common (tabs/ subtabs). Is there a better way of doing the above? I'd welcome all ideas! Thanks for the response! Joey On Oct 1, 1:49 pm, Miles J mileswjohn...@gmail.com wrote: Just use the default MVC architecture? tabname = controller subtab = action On Sep 30, 12:05 pm, Joey Mukherjee joe...@gmail.com wrote: I have some tabs along the top of my CakePHP site and some sub-tabs along the left side of my page. When I switch tabs, it goes to a URL such ashttp://system/tabname. When I go to a sub-tab, I use $this-render to update the content of the view to what the user clicked on. However, I'd like a URL such ashttp://system/tabname/subtabto go directly to the subtab. How might I accomplish this? Basically, I want to redirect to tabname/ index and then render the subtab. My tabname index view sets up the side menu. The subtab just modifies the inner content. The views/layouts/default.ctp has the top tabs defined in them. Obviously, the side tabs change from tab to tab. Hope that makes sense! Thanks, Joey 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: Best way to handle sub-tabs
Furthermore, you can make it the index action with arguments. public function index($subtab) { $this-set('subtab', $subtab); } On Oct 4, 10:15 am, Miles J mileswjohn...@gmail.com wrote: And again, what your saying is exactly what a controller and action is for. How is that different than your setup? On Oct 4, 7:30 am, Joey Mukherjee joe...@gmail.com wrote: In retrospect, I guess I didn't explain as well as I should have. I have each subtab as an element now and every subtab is rendered via ajax (i.e. $js-link ($html-tag ('span', $side_button ['title']), array ('action'= 'display/'.$side_button ['name']), $options). The controller action display just has a $this-render (/elements/ $tabname/$whatToDisplay); So, when the user goes tohttp://system/tabname, the initial view sets up the element specific to that tab that views/layouts/default.ctp did not setup. Each subtab element just has stuff specific to that subtab (in my case, mainly just text). However, I'd like people to go tohttp://system/tabname/subtaband directly render the specific text to that subtab. That's what I can't figure out?? Anyway, does this sound right to everyone? I feel like I am the only one having this problem on something which seems pretty common (tabs/ subtabs). Is there a better way of doing the above? I'd welcome all ideas! Thanks for the response! Joey On Oct 1, 1:49 pm, Miles J mileswjohn...@gmail.com wrote: Just use the default MVC architecture? tabname = controller subtab = action On Sep 30, 12:05 pm, Joey Mukherjee joe...@gmail.com wrote: I have some tabs along the top of my CakePHP site and some sub-tabs along the left side of my page. When I switch tabs, it goes to a URL such ashttp://system/tabname. When I go to a sub-tab, I use $this-render to update the content of the view to what the user clicked on. However, I'd like a URL such ashttp://system/tabname/subtabto go directly to the subtab. How might I accomplish this? Basically, I want to redirect to tabname/ index and then render the subtab. My tabname index view sets up the side menu. The subtab just modifies the inner content. The views/layouts/default.ctp has the top tabs defined in them. Obviously, the side tabs change from tab to tab. Hope that makes sense! Thanks, Joey 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: models: fundamental question referring to member variables
Theres no point for getters and setters if they dont do anything to the property. If it just sets and gets without modifying the data in any way, you might as well just use public properties. However, Cake does support the active record approach. $user = new User(); $user-username = 'miles'; $user-email = 'em...@domain.com'; $user-save(); On Oct 3, 1:12 pm, DerBjörn b.unkh...@googlemail.com wrote: Hi, as a newbie to cakephp for me it looks like that 'normal' models don't have any more common member variables, but associative arrays. For example I have a model 'Person' with firstname, lastname, age etc. Generally i would solve this with member variables $firstname, $lastname and $age and their common getters and setters setFirstname($value), getAge(), etc., but this still does have sense? When i save a person i have to use an associative array, so with my technique i need to create first an array ($data = array()) out of my common member variables to pass it to model's function -save($data) Does it mean that the common member variables are obsolete and i actually only have to use one member variable $data and use it then like: function setFirstname($value){ $this-data['firstname'] = $value;}; or function getAge(){ return $this-data['age']; }; ? The same when i want to make a new instance of a Person and retrieve their variables from the database: Does it has to look like following then? $person = new Person(); $person-retrieve(5); // ID and the model Person has a function retrieve($id) when i get then its data from the database and set it to $this-data?? I hope i made me explain at least a little and you understand my question :) Thanks for any advice or example! 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