Re: Extend a core behavoir
I looked into the core TreeBehavoir and there was this line: App::uses('ModelBehavior', 'Model'); so I thought it is loading the class ModelBehavior AND class Model, but you are right, now I took a look into the docs and saw that the second parameter is the package. again thanks for the help! Regards, MN Java C# desktop developer PHP web developer www.mohamnag.com On Fri, Aug 16, 2013 at 9:42 PM, euromark dereurom...@gmail.com wrote: Where did you find / get the idea that App::uses('ModelBehavior', 'TreeBehavior', 'Model'); is a valid method call? It is App::uses('TreeBehavior', 'Model/Behavior'); as you can easily find out opening some of the core test files Then you can easily extend it in your own app. Am Freitag, 16. August 2013 14:47:02 UTC+2 schrieb Mohammad Naghavi: thanks, I tried to use App:uses but I got a fatal error Class 'TreeBehavior' not found in... I had this following line: App::uses('ModelBehavior', 'TreeBehavior', 'Model'); but anyway using App::import it works as it should. thanks, MN __**__ Java C# desktop developer PHP web developer www.mohamnag.com On Thu, Aug 15, 2013 at 4:02 PM, Rodrigo MourĂ£o rod...@webjump.com.brwrote: I already didi this with tree behavior like Andre recommended. models/behaviors/tree_plus.php ?php App::import('Behavior', 'Tree'); class TreePlusBehavior extends TreeBehavior { } Em quarta-feira, 14 de agosto de 2013 11h36min29s UTC-3, AndrĂ© Luis escreveu: With App::import()... Them you can extend it: class MyTreeBehavior extends TreeBehavior... Em quarta-feira, 14 de agosto de 2013 10h05min03s UTC-3, Mohammad Naghavi escreveu: Hi All, I want to extend the core TreeBehavior without replacing it or copying it to my own behavior folder, I just want to extend it to add some additional functionalists which are based on tree behavior. is there a way to do it? regards, Mohammad -- Like Us on FaceBook https://www.facebook.com/**CakePHPhttps://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+u...@**googlegroups.com. To post to this group, send email to cake...@googlegroups.com. Visit this group at http://groups.google.com/**group/cake-phphttp://groups.google.com/group/cake-php . For more options, visit https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out . -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Make zero or many relation
Dear all, I need to build a zero or many relation. (department has zero or many employees, and employee belongs to zero or one department) I tried to use cake bake, but generated CRUD views mandate selecting a department (drop down list) when adding a new employee. Is there a code modification or tweak that will make selecting a department optional. I still need the drop down for the departments but at least have additional item like or N/A (not applicable) option in the drop down or better solution. Thanks in advance. Nalaka Gamage. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Re: Data validation: Client or Server?
This is not arguable: never rely just on client validation. Let me say it again: never EVER rely on client validation, or trust data sent from client. POST data can be easily manipulated at client level. Javascript should be used always as a enhancement. Also, be very conscious of what you are doing when using * $this-Model-save($this-request-data).* For example, lets say you have a site with a user registration form. in your view you would have: echo $this-Form-create('User'); echo $this-Form-input('name'); echo $this-Form-input('email'); echo $this-Form-end('Submit'); In the controller you would be tempted to just have: $this-User-save($this-request-data); Please be careful with this. If users table has other fields like 'is_admin', 'has_paid', 'role', etc... this could be a HUGE security issue! A malicious user could manipulate the POST data before sending it to add *data[User][admin]=1* or *data[User][role]=admin* You should use: $this-User-create(); $this-User-set('name', $this-request-data['User']['name']); $this-User-set('email', $this-request-data['User']['email']); $this-User-save(); Or better (and cleaner): $this-User-save($this-request-data, true, array('name','email')); On Friday, August 16, 2013 3:15:36 PM UTC+2, Jeremy Burns wrote: I still view jQuery as progressive enhancement. Even if it is mostly on it can still be turned off, which would - if you relied only on client side code - skip your validation. You also never know how your site will be accessed; what if (remote, I know) you wanted to open it up as a web service or API? Then you'd need to load up your validation anyone. Just my 2c. Jeremy Burns Class Outfit http://www.classoutfit.com On 16 Aug 2013, at 12:32:29, jer...@anthemwebsolutions.com javascript:wrote: I wanted to get some opinions on this. Cake's validation structure is easy to apply and works flawlessly (so far, wink,wink). But I've also written some data validation with jQuery which is activated at the client side. Is there still a need to validate at the server if most browsers support javascript? Do some of you leave off the server side validation in lieu of client side? How's that HTML5 data validation working for you? -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+u...@googlegroups.com javascript:. To post to this group, send email to cake...@googlegroups.comjavascript: . Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
How can I install xdebug?
Hi guys... I want to install xdebug for profiling and debugging php application. But something i miss so that phpinfo file not shows xdebug.some basic info about my php confihuration PHP Version 5.4.7 Apache 2.4 what steps i have followed: i have download latest version of xdebug.dll and move this file to the folder C:\xampp\php\ext now i have edit php.ini file add below code to it [XDebug] zend_extension = C:\xampp\php\ext xdebug.remote_enable=1 xdebug.remote_handler=dbgp xdebug.remote_host=127.0.0.1 xdebug.remote_port=9000 xdebug.remote_mode=req xdebug.idekey=xdebug xdebug.remote_log=c:\tmp\xdebug\xdebug.log xdebug.show_exception_trace=0 xdebug.show_local_vars=9 xdebug.show_mem_delta=0 xdebug.trace_format=0 xdebug.profiler_enable = 1 xdebug.profiler_output_dir =c:\tmp\xdebug so can anyone have help me where is the problem? -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Saving geolocation data to session with timeout or better approach?
Hi all. I have a script that retrieves some location data from google api, and store the retrieved data in a Session (Location). All this is working just fine :) (if someone have a better way, better approach to store this data for my website visitors, let me know). The data is saved to session (as of now), with an ajax call from the script. example in controller for Geolocation.Lat: *if ($this-request-data['lat'] != ) {* * $this-Session-write('Location.lat', $this-request-data['lat']); * *}* (the other values are also stored similar; Location.long,Location.city and so on). Now, I am wondering, how can I set a timeout on the session = Location.* I want the visitors location data to be valid for, example 1 hour, before requesting new geolocation. Any suggestion how and where to store the data (the best approach) ?? Thanks for any input on this :) -Tom -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Re: Saving geolocation data to session with timeout or better approach?
oh, and using latest cake 2.3.8 or soemting like that :) -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
RE: bootstrap twitter typeahead , dont work for me in cakephp
But you need to define how to respond no? As HTML, JSON am I wrong? Set the data as a JSON reponse? You have to define it as a response in the correct format FOR THE js or html to act accordingly.. Dave Maharaj Freelance Designer | Developer Description: header_logo www.movepixels.com | mailto:d...@movepixels.com d...@movepixels.com | 709.800.0852 From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf Of euromark Sent: Friday, August 16, 2013 5:10 PM To: cake-php@googlegroups.com Subject: Re: bootstrap twitter typeahead , dont work for me in cakephp Never create a new response object there is already one available in your controller just use $this-response-body($content); as documented Am Freitag, 16. August 2013 19:16:32 UTC+2 schrieb cesar calvo: I use this in my AppController public function jsonResponse($array) { return new CakeResponse(array('body' = json_encode($array))); } Then on a controller call jsonResponse Note: if you are usin Security component on beforeFilter: if ($this-request-is('ajax')) $this-Security-unlockedActions = array($this-request-action); On Thursday, August 15, 2013 11:03:34 PM UTC-3, Renato Bigliazzi wrote: Hi , I can not do the twitter bootstrap component typeahead work with cake. i use https://github.com/rudylee/cbunny , but dont work form me. In my view JS script type=text/javascript $(document).ready(function(){ $('#itemdesc').typeahead({ source: function (query, process) { return $.ajax({ url:' url:'%3c?php ?php echo Router::url(array('controller'='Invoices','action'='localizaprodutos'));? ', type: 'get', data: {q: query}, dataType: 'json', success: function (json) { return process(json); } }); } }); }); /script HTML input type=text name=itemdesc[] class=input-large id=itemdesc data-provide=typeahead/ and controller public function localizaprodutos(){ $this-autoRender = false; $this-RequestHandler-respondAs('json'); // get the search term from URL $term = $this-request-query['q']; $users = $this-Invoice-Invoicedetail-Inventoryitem-find('all',array( 'conditions' = array( 'Inventoryitem.desc LIKE' = '%'.$term.'%' ) )); // Format the result for select2 $result = array(); foreach($produtos as $key = $produto) { array_push($result, $produto['Inventoryitem']['desc']); } $produtos = $result; echo json_encode($produtos); } Thanks Renato -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out. image001.jpg
MVC question in basic design of export csv file
Hello, I'm having some trouble understanding and/or implementing a simple export of some data to a csv file. I had everything working fine with a simple controller that did not allow a view to be rendered by either going back to the referrer or by returning the response... as described in the online help. But reading some more, it looked as if the export function should really be part of the model. So I converted the controller to just call the model function (dumpEventAsCSV) which performed all the data gathering and output logic and then returned to the controller and it in would in turn return to the referrer or return the response. Again, all without using a view. $fn = somefilepath; $ans = $this-dumpEventAsCSV($ev_id, $fn); if ($ans) { $this-response-file($fn); return $this-response; } else { $this-Session-setFlash('Unable to export current event'); $this-redirect($this-referer()); } But two problems later appeared... When I starting using some AppHelper::functions to format some of the output, neither the Controller or Model were able to access them. $this-Form-formatId($ev_id). Now, obviously I can add another copy of the formatting functions to AppModel and I suppose to AppController, but that seems like overkill... Now the question becomes what have I done wrong with the design to get me into this silly circle!? As another question, In the Controller example shown above, the setFlash never shows up when returning to the referer()... but when I proceed to some other controller/action... it appears? Along with that, I don't really want to display the csv file to the user after is has been created, so the $this-response-file() would be replaced by a success setFlash, and just return to the referrer! Thank you for any assistance, glk -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Where are the sites?
Just a curiosity question. So many people are part of the Cake group yet we never see any actual work. No hey check out my site I did this, very little showcase. Sure on the Cake home page there are 5 sites which have been there for a year. Really? And they suck ass! Ni real design just half assed crap! I took a look at cakeDc site and what a joke! Ugliest site ever who did that? Sure code all you li9ke but you still need to appeal to the end user. Hello 1997 html my first web page look. Only thing missing is a animated gif!. For such a great framework why is there a lack luster amount of sites? Dave Maharaj Freelance Designer | Developer Description: header_logo www.movepixels.com | mailto:d...@movepixels.com d...@movepixels.com | 709.800.0852 -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out. image001.jpg
Include count of nested associated object as virtual field.
Hi, I have the following model relationships Question belongs to Chapter Chapter belongs to Unit I want to add a virtual field in the Unit model that counts how many questions a unit has. I tried this: public $virtualFields = array( questionCount = 'SELECT COUNT(*) FROM questions as Question JOIN chapters as Chapter ON (Question.chapter_id = Chapter.id) JOIN units as Unit ON (Chapter.unit_id = Unit.id)' ); The problem here is that it returns the same value for all untis. The issue here is that I want the count for each Unit instance. In other words, I would like to add a where clause so that the query becomes something similar to: public $virtualFields = array( questionCount = 'SELECT COUNT(*) FROM questions as Question JOIN chapters as Chapter ON (Question.chapter_id = Chapter.id) JOIN units as Unit ON (Chapter.unit_id = Unit.id) WHERE Unit.id = CAKE_REPLACE_WITH_CURRENT_ID' ); How do I get cake to CAKE_REPLACE_WITH_CURRENT_ID to be the ID of the current Unit instance that is being retrieved? I hope I have made my question clear. Thanks in advance. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Re: Where are the sites?
A pretty looking site, has very little to do with the backend. On Sun, Aug 18, 2013 at 5:16 AM, Advantage+ movepix...@gmail.com wrote: Just a curiosity question. ** ** So many people are part of the Cake group yet we never see any actual work. ** ** No hey check out my site I did this, very little showcase. ** ** Sure on the Cake home page there are 5 sites which have been there for a year. Really? And they suck ass! Ni real design just half assed crap! I took a look at cakeDc site and what a joke! Ugliest site ever who did that? ** ** Sure code all you li9ke but you still need to appeal to the end user. Hello 1997 html my first web page look. Only thing missing is a animated gif!. ** ** ** ** ** ** ** ** For such a great framework why is there a lack luster amount of sites? ** ** ** ** ** ** *Dave Maharaj* *Freelance Designer | Developer* [image: Description: header_logo] www.movepixels.com | d...@movepixels.com | 709.800.0852 ** ** -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out. -- Simon Males -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out. image001.jpg
RE: Where are the sites?
That's like saying a who cares about the ferrari engine just put it in a box . You need to showcase the goods. That's all I am saying. Front end is what people see, they do not see requests, database optimization, sure good code but people do not see that. They see a website and say well that is nice. Not hum I wonder if it's cached or how mant HTTP requests. Does that make sense? I will put it out there I love Cake, no doubt about it. Fantastic framework but you still need a front end visual. Check out my work! I have worked for some big names. And saying well code is everything is wrong. You need to back up the code with visuals people see! Dave Maharaj Freelance Designer | Developer Description: header_logo www.movepixels.com | mailto:d...@movepixels.com d...@movepixels.com | 709.800.0852 From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf Of Simon Males Sent: Saturday, August 17, 2013 11:34 PM To: cake-php@googlegroups.com Subject: Re: Where are the sites? A pretty looking site, has very little to do with the backend. On Sun, Aug 18, 2013 at 5:16 AM, Advantage+ movepix...@gmail.com wrote: Just a curiosity question. So many people are part of the Cake group yet we never see any actual work. No hey check out my site I did this, very little showcase. Sure on the Cake home page there are 5 sites which have been there for a year. Really? And they suck ass! Ni real design just half assed crap! I took a look at cakeDc site and what a joke! Ugliest site ever who did that? Sure code all you li9ke but you still need to appeal to the end user. Hello 1997 html my first web page look. Only thing missing is a animated gif!. For such a great framework why is there a lack luster amount of sites? Dave Maharaj Freelance Designer | Developer Description: Description: header_logo http://www.movepixels.com www.movepixels.com | mailto:d...@movepixels.com d...@movepixels.com | 709.800.0852 -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com mailto:cake-php%2bunsubscr...@googlegroups.com . To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out. -- Simon Males -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out. image001.jpg