Cakephp 2.4.4 extending ModelValidator?
Is there a way to extend the ModelValidator? I know you can do things like this in the controllers: public $helpers = array( // Core Helpers 'Session', 'Time', 'Html' = array('className' = 'Utilities.HtmlExt'), 'Paginator' = array('className' = 'Utilities.PaginatorExt'), 'Form' = array('className' = 'Utilities.FormExt' ), ); Is there a way to do this with ModelValidator? My goal is to catch the validation error messages, and the posted data which I can with the callback, afterValidate(). However, it doesn't give me the actual validation name (e.g. 'notEmpty', 'alphaNumeric'), or the particular settings for this validation rule. If I can't extend/overload the class instance, can is there another way to grab the above information without having to look for the message in the settings? I can't rely on the message , because it can change based on how the message failed. Example: class EquipmentDetail extends AppModel { public $validate = array( 'mac_address' = array( 'alphaNumeric' = array( 'rule' = 'alphaNumeric', 'required' = true, 'allowEmpty' = false, 'message'= 'This field is required, and only allows numbers and letters. (you may have a space at the end of the string).', ), 'Rule_MacAddress' = array( 'rule' = 'Rule_MacAddress', 'required' = true, 'allowEmpty' = false, //'on'= 'create', //'message'= 'This must be a unique value, there may already be a record with this MAC address.', ), ), ); // public function Rule_MacAddress($check) { if(!isset($check['mac_address'])) { return __('The MAC Address isn\'t set.'); } $mac_address = $check['mac_address']; $mac_address = strtoupper(trim($mac_address)); if($mac_address == 'TBD') return true; // check to make sure it's a mac address using the Extractor Behavior $type = $this-EX_discoverType($check['mac_address']); if($type != 'mac') { return __('The given MAC Address isn\'t detected as a valid MAC Address. (0-9, A-F, no : or -)'); } // check to make sure it's unique if(!$exists = $this-findByMacAddress($mac_address)) { return true; } return __('This must be a unique value, there may already be a record with this MAC Address.'); } } -- 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/d/optout.
Cakephp 2.x - Changing the name of a table within the schema
Is there a way to change the name of a table (tables) within the database schema? reference: (http://book.cakephp.org/2.0/en/console-and-shells/schema-management-and-migrations.html) I was unable to find out how to do this via googling, or searching the api/book. Basically this is what I'm trying to do: 1. I have a table named say 'cars'. I want to change the table name to 'vehicles'. 2. I would like to be able to do this within the built in schema. 3. I don't want to drop the old table and create a new one. The only way have come up with to do this would be to do something in the before() function. and do something like this: http://dev.mysql.com/doc/refman/5.0/en/rename-table.html I haven't tested this idea as I don't want to actually change anything. Is this the only way? Will cakephp recognize the change instead of resorting to looking at it's own cache? -- 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?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: HttpSocket with proxy server
Thanks! I'll try this out and let this group know if it was successful. On Dec 14, 10:04 pm, gianpaulo gcbasa...@gmail.com wrote: Try this: $HttpSocket = new HttpSocket(); $request = $HttpSocket-request(array( 'host'='proxy server address:proxy server port', 'uri'='http://api.yahoo.com/' )); This is how powerful CakePHP is :D On Dec 15, 8:48 am, fr3nch13 fr3nc...@gmail.com wrote: Has anyone tried using a proxy server with HttpSocket? I have been looking all over via the normal channels (google, api, bakery, book, etc.) to no avail. If so, could you please point me in the right direction? 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: HttpSocket with proxy server
It doesn't seem to be working. Any help would be greatly appreciated! Here is some more information/versions/stats to help: Server: RHEL, PHP 5.1.6, cakephp 1.2.3.8166 Proxy: Squid/2.5 stable This is my test shell: ?php class TesterShell extends Shell { function httpsockproxy() { $uri = 'http://www.google.com'; if(isset($this-args[0])) { $uri = $this-args[0]; } App::import('Core', 'HttpSocket'); $HttpSocket = new HttpSocket(); $request = $HttpSocket-request(array( 'method' = 'POST', 'host'='[proxyhostname]:[port]', 'uri'='http://www.google.com' )); print_r($request); print_r($HttpSocket-config); } } the print_r($request) is getting a response from the squid proxy server; however, the proxy is returning it's html error instead of google's homepage: ... H2The requested URL could not be retrieved/H2 HR noshade size=1px P While trying to retrieve the URL: A HREF=///A P The following error was encountered: UL LI STRONG Invalid URL /STRONG /UL the print_r($HttpSocket-config) output is: Array ( [persistent] = [host] = [proxyhostname]:[port] [protocol] = 6 [port] = 80 [timeout] = 30 [request] = Array ( [uri] = Array ( [scheme] = http [host] = www.google.com [port] = 80 ) [auth] = Array ( [method] = Basic [user] = [pass] = ) [cookies] = Array ( ) ) ) On Dec 15, 8:56 am, fr3nch13 fr3nc...@gmail.com wrote: Thanks! I'll try this out and let this group know if it was successful. On Dec 14, 10:04 pm, gianpaulo gcbasa...@gmail.com wrote: Try this: $HttpSocket = new HttpSocket(); $request = $HttpSocket-request(array( 'host'='proxy server address:proxy server port', 'uri'='http://api.yahoo.com/' )); This is how powerful CakePHP is :D On Dec 15, 8:48 am, fr3nch13 fr3nc...@gmail.com wrote: Has anyone tried using a proxy server with HttpSocket? I have been looking all over via the normal channels (google, api, bakery, book, etc.) to no avail. If so, could you please point me in the right direction? 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: HttpSocket with proxy server
Also, some more information. 1. i don't have access to change anything on the squid proxy. 2. trying with curl works: curl --proxy [proxyhostname]:[port] http://www.google.com On Dec 15, 10:18 am, fr3nch13 fr3nc...@gmail.com wrote: It doesn't seem to be working. Any help would be greatly appreciated! Here is some more information/versions/stats to help: Server: RHEL, PHP 5.1.6, cakephp 1.2.3.8166 Proxy: Squid/2.5 stable This is my test shell: ?php class TesterShell extends Shell { function httpsockproxy() { $uri = 'http://www.google.com'; if(isset($this-args[0])) { $uri = $this-args[0]; } App::import('Core', 'HttpSocket'); $HttpSocket = new HttpSocket(); $request = $HttpSocket-request(array( 'method' = 'POST', 'host'='[proxyhostname]:[port]', 'uri'='http://www.google.com' )); print_r($request); print_r($HttpSocket-config); } } the print_r($request) is getting a response from the squid proxy server; however, the proxy is returning it's html error instead of google's homepage: ... H2The requested URL could not be retrieved/H2 HR noshade size=1px P While trying to retrieve the URL: A HREF=///A P The following error was encountered: UL LI STRONG Invalid URL /STRONG /UL the print_r($HttpSocket-config) output is: Array ( [persistent] = [host] = [proxyhostname]:[port] [protocol] = 6 [port] = 80 [timeout] = 30 [request] = Array ( [uri] = Array ( [scheme] = http [host] =www.google.com [port] = 80 ) [auth] = Array ( [method] = Basic [user] = [pass] = ) [cookies] = Array ( ) ) ) On Dec 15, 8:56 am, fr3nch13 fr3nc...@gmail.com wrote: Thanks! I'll try this out and let this group know if it was successful. On Dec 14, 10:04 pm, gianpaulo gcbasa...@gmail.com wrote: Try this: $HttpSocket = new HttpSocket(); $request = $HttpSocket-request(array( 'host'='proxy server address:proxy server port', 'uri'='http://api.yahoo.com/' )); This is how powerful CakePHP is :D On Dec 15, 8:48 am, fr3nch13 fr3nc...@gmail.com wrote: Has anyone tried using a proxy server with HttpSocket? I have been looking all over via the normal channels (google, api, bakery, book, etc.) to no avail. If so, could you please point me in the right direction? 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: HttpSocket with proxy server
I know what gainpaulo post, should be the way it's supposed to work; however, i was able to get it to work with a GET, but not a POST: $request_get = array( 'GET http://www.google.com HTTP/1.1', 'Host: www.google.com', 'Connection: close', 'User-Agent: CakePHP' ); $response = $HttpSocket-request(array( 'host' = $proxyhost:$proxyport, 'line' = implode(\n, $request_get), 'raw' = implode(\n, $request_get), )); print_r($response); print_r($HttpSocket-request); print_r($HttpSocket-config); $request_post = array( 'POST http://www.google.com HTTP/1.1', 'q=cakephp', 'Host: www.google.com', 'Connection: close', 'User-Agent: CakePHP' ); $response = $HttpSocket-request(array( 'host' = $proxyhost:$proxyport, 'line' = implode(\n, $request_post), 'raw' = implode(\n, $request_post), )); print_r($response); print_r($HttpSocket-request); print_r($HttpSocket-config); On Dec 15, 10:21 am, fr3nch13 fr3nc...@gmail.com wrote: Also, some more information. 1. i don't have access to change anything on the squid proxy. 2. trying with curl works: curl --proxy [proxyhostname]:[port]http://www.google.com On Dec 15, 10:18 am, fr3nch13 fr3nc...@gmail.com wrote: It doesn't seem to be working. Any help would be greatly appreciated! Here is some more information/versions/stats to help: Server: RHEL, PHP 5.1.6, cakephp 1.2.3.8166 Proxy: Squid/2.5 stable This is my test shell: ?php class TesterShell extends Shell { function httpsockproxy() { $uri = 'http://www.google.com'; if(isset($this-args[0])) { $uri = $this-args[0]; } App::import('Core', 'HttpSocket'); $HttpSocket = new HttpSocket(); $request = $HttpSocket-request(array( 'method' = 'POST', 'host'='[proxyhostname]:[port]', 'uri'='http://www.google.com' )); print_r($request); print_r($HttpSocket-config); } } the print_r($request) is getting a response from the squid proxy server; however, the proxy is returning it's html error instead of google's homepage: ... H2The requested URL could not be retrieved/H2 HR noshade size=1px P While trying to retrieve the URL: A HREF=///A P The following error was encountered: UL LI STRONG Invalid URL /STRONG /UL the print_r($HttpSocket-config) output is: Array ( [persistent] = [host] = [proxyhostname]:[port] [protocol] = 6 [port] = 80 [timeout] = 30 [request] = Array ( [uri] = Array ( [scheme] = http [host] =www.google.com [port] = 80 ) [auth] = Array ( [method] = Basic [user] = [pass] = ) [cookies] = Array ( ) ) ) On Dec 15, 8:56 am, fr3nch13 fr3nc...@gmail.com wrote: Thanks! I'll try this out and let this group know if it was successful. On Dec 14, 10:04 pm, gianpaulo gcbasa...@gmail.com wrote: Try this: $HttpSocket = new HttpSocket(); $request = $HttpSocket-request(array( 'host'='proxy server address:proxy server port', 'uri'='http://api.yahoo.com/' )); This is how powerful CakePHP is :D On Dec 15, 8:48 am, fr3nch13 fr3nc...@gmail.com wrote: Has anyone tried using a proxy server with HttpSocket? I have been looking all over via the normal channels (google, api, bakery, book, etc.) to no avail. If so, could you please point me in the right direction? 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: mod_rewrite exeption
what does your .htaccess file look like in your webroot? On Dec 15, 10:02 am, Ragnis ragnis.ar...@gmail.com wrote: In my htdocs directory i have files: app, cake, vendors, global Now, when i go example.com/global/, i want to see folder global instead of cake 404 error. 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: HttpSocket with proxy server
I just tried it with cake 1.2.5 stable, and it's still not working like how gainpaulo was describing above. Is this indeed the way it's supposed to be working? 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
HttpSocket with proxy server
Has anyone tried using a proxy server with HttpSocket? I have been looking all over via the normal channels (google, api, bakery, book, etc.) to no avail. If so, could you please point me in the right direction? 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
Boundaris in Email Component
I noticed that when i sent a multipart/alternative (html and text email in 1 using $this-Email-sendAs = 'both') that the boundary is '- alt--' with no boundary generated. I looked at the Email Component's source to see why and it seems a boundary is only generated if an attachment is present. http://api.cakephp.org/view_source/email-component/#line-479 My question is, shouldn't a boundary also be generated if $this-Email- sendAs = both (multipart/alternative)? --~--~-~--~~~---~--~~ 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: Sluggable behaviour issue
I've also noticed this happen when you do a Model::find(); and the recursive is high ($this-User-recursive = 2). If the returned results are large enough, it will throw this as the array is too big. In some cases i have had to set recursive to 0, then do a foreach loop and get only the info i needed and attach it to the array to avoid this. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
With debug = 0, Cache::write isn't writing
I use the cache class in a more 'hands-on' approach then the manual states: In config/core.php i have: Configure::write('Cache.disable', false); Configure::write('Cache.check', true); -- i've set to both true and false, no diff. Cache::config('configname', array('engine' = 'File', 'duration' = (3600 * 24 * 7), // 7 days 'prefix' = 'configname_', )); (i use multiple configs for different things as some need to be cleaned out when 'external situations' happen, so i can remove them based on their prefix) -- Throughout the controllers, etc. I use the cache class like so: Cache::read($key, 'configname'); Cache::write($key, $data, 'configname'); -- I'm using cake version: 1.2.1.8004 When i have debug set to 0, everything seems to be working just fine. When i set it to 0, the cache will be read if the cache file it is present, but it won't write or overwrite the cache file. I did a simple test, and put an echo(); exit(); in cake/libs/ cache.php: 229 function write($key, $value, $config = null) { 230 echo('in cache::write'); exit(); to see if the function was even being called. With debug set to 1, it would show up. With debug set to 0, it wouldn't as if it wasn't even called. So, my question is What am I missing? --~--~-~--~~~---~--~~ 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: With debug = 0, Cache::write isn't writing
On further review, it seems that the Cache::write() works within the libraries, for the internal configs, but not for the configs i have defined in config/core.php Is it not reading these configs? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: File Uploading problem
It may have to do with your form tag missing some attributes. See: http://cgi-lib.berkeley.edu/ex/fup.html --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Suggestion: Custom paginate() method ...in a Behavior
Overwrite the method in any class (controller or even appcontroller/ appmodel) that inherits the library's class (controller/model) On Sep 5, 6:52 am, Jaime [EMAIL PROTECTED] wrote: It is possible to define custom paginate() and paginateCount() methods in a model. But sometimes many models can share that same pagination methods, and therefore they could be defined in a single behavior. However, the core paginate() method in Cake's core (default) controller only calls the custom method when they are found in the model: // From /cake/libs/controller/controller.php, line 990: if (method_exists($object, 'paginate')) { $results = $object-paginate($conditions, $fields, $order, $limit, $page, $recursive); } A workaround for this is to set the custom paginate methods in the AppModel. However, it would be much nicer if the core paginate() method would search for custom methods both in the model AND in it's behavior. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Cake 1.1.19 stable
IMO the RC2 is kind of a misnomer as this is the most stable release candidate of any software i've ever worked with. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: HELP starting Cakephp
http://book.cakephp.org/ I agree, the blog tutorial in the book would be your best place to start as a simple 'hello world' wont show you all of the advantages and options available to you in this framework. IMO, use version 1.2, not 1.1 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Memory leakage
Damn, you beat me too it. :-p There are two ways you can tell if it's a nasty white space: 1. Look at your source code. If there is a space or new line before your dtd/html tag, then you know it's your problem. Just make sure your layout template doesn't contain that space so you know it's not your layout template. 2. use cakephp to generate an image like a thumbnail or something (preferably small). If it doesn't show up, look at the source (ff should let you). If there is a space or new line at the top, it's definitely a space/newline issue. As far as tracking down that space, it can be a real bitch with cakephp even if you know the order of the files being included/ executed. On Sep 4, 3:04 pm, Nelson Cysneros [EMAIL PROTECTED] wrote: Di, Make sure you don't have any white spaces after your model's or controller's closing bracket. If you do remove it and see if that fixes it. Regards On Sep 4, 2:04 pm, Dianne van Dulken [EMAIL PROTECTED] wrote: Hi, I was wondering if anyone had come across this before. I'm having a major problem with memory leakage. It seems to be related to a header already set and thus cannot send session_start warning that i get. The warning is below (and also the memory leak) 7. at end of cakephp findAll id: configuration : we're using (in bytes): 4892936 Warning (2): session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at D:\www \cake_1.2.x.x\cake\libs\model\model.php:1498) [CORE\cake\libs \session.php, line 155] Context | Code $this-__initSession(); session_cache_limiter (must-revalidate); session_start(); header ('P3P: CP=NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM'); session_start - [internal], line ?? CakeSession::__construct() - CORE\cake\libs\session.php, line 155 SessionComponent::__construct() - CORE\cake\libs\controller\components \session.php, line 54 Component::_loadComponents() - CORE\cake\libs\controller \component.php, line 132 Component::init() - CORE\cake\libs\controller\component.php, line 66 Controller::_initComponents() - CORE\cake\libs\controller \controller.php, line 319 Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 230 [main] - APP\webroot\index.php, line 84 Warning (2): Cannot modify header information - headers already sent by (output started at D:\www\cake_1.2.x.x\cake\libs\model\model.php: 1498) [CORE\cake\libs\session.php, line 156] Context | Code $this-__initSession(); session_cache_limiter (must-revalidate); session_start(); header ('P3P: CP=NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM'); $this-__checkValid(); header - [internal], line ?? CakeSession::__construct() - CORE\cake\libs\session.php, line 156 SessionComponent::__construct() - CORE\cake\libs\controller\components \session.php, line 54 Component::_loadComponents() - CORE\cake\libs\controller \component.php, line 132 Component::init() - CORE\cake\libs\controller\component.php, line 66 Controller::_initComponents() - CORE\cake\libs\controller \controller.php, line 319 Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 230 [main] - APP\webroot\index.php, line 84 1. Within cakephp findAll id: position : we're using (in bytes): 8085512 I'm not sure what I should be doing as the errors seem to be within the core cake functionality. Has anyone come across this before, and if so, how did they fix it? Thanks Di --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: html select State/Country dropdown in CakePHP ?
I accomplished something similar to this using ajax calls (ajax helper and cakephp 1.1). This should point you in the right direction: http://calculator.boxcart.com/ On Jun 17, 10:28 am, butangphp [EMAIL PROTECTED] wrote: Hey, I was wondering if there Cake has a way to automatically generate a list of states/countries in the form of a dropdown menu. Maybe using the form helper or html helper ? Any help would be greatly appreciated. Thanks! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: 167+ MB memory size fatal error in .../cake/libs/model/datasources/
Check your model associations. I've ran into this when my associations were returning a huge array. If it's a page where you are listing items and your not using their associations, temporarily remove those associations for that instance of grabbing the list. I think the function is something like unbind http://www.google.com/search?q=cakephp+unbind On May 22, 9:42 am, BioResearch [EMAIL PROTECTED] wrote: We are trying to update a working application from cake1.1 to cake_1.2.0.6311-beta. After fixing all of the bugs we ran into a memory error which can not be fixed via increasing the memory size in PHP.ini: Fatal error: Allowed memory size of 167772160 bytes exhausted (tried to allocate 136 bytes) in /var/www/html/laboratree2/cake/libs/model/ datasources/datasource.php on line 360 Normally this means that there is an infinite loop somewhere but I'm not sure how to track it down since our code isn't being linked to in the Fatal Error page. Any advice? Thanks in advance, Jon --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: session garbage savehandler = cake
By default cakephp uses php to manage sessions so check out the session settings in php.ini check this out http://www.mail-archive.com/cake-php@googlegroups.com/msg17723.html On May 22, 7:54 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hello, when will old session data be deleted when I use cake as sessionhandler (Configure::write('Session.save', 'cake');) ? I set that config in the core.php yesterday and I looked today in the CakePHP's /tmp directory and there are a lot of files from yesterday. Thanks Oliver --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Routing - Many Slashes - One Parm
try $Route-connect('/thumb/:link', array('controller' = 'obrazki', 'action' = 'skaluj')); then in your skaluj action in your controller, take a look at debug($this-params); It should have the info you need and you should be able to do a join(), etc. On May 22, 9:26 am, ar2oor [EMAIL PROTECTED] wrote: i got: $Route-connect('/thumb/:link', array('controller' = 'obrazki', 'action' = 'skaluj'), array('link' = '(.)*')); www.asd.com/thumb/imgs/asd/dsa/dsa.jpg and i want to link=imgs/asd/dsa/dsa.jpg but i doesn't work :/ any ideas ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Html Helper link onclick option question
You have to turn off the escaping in the link functions, it auto escapes. Check out: http://www.donutczar.com/blog/?p=4 http://api.cakephp.org/1.2/class_html_helper.html On May 22, 4:56 am, jimbo [EMAIL PROTECTED] wrote: Hi, can anybody help me with this problem, I am creating a simple link in one of my views and I am having a problem giving an onClick option/ attribute for the link, as it seems cake is escaping/encoding the javascript function special characters like this: echo $html-link(foo, '#', array('onClick'=myObj.select(document.getElementById('. $element.')); return false;)); prints out something like: a href=# onClick=myObj.select(document.getElementById(#039;element0#039;)); return false;foo/a On the view, I have specified to use ISO-8859-1 encoding, is this the problem? meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1 / --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Saving NOW() in model
Most likely uses php's time (didn't check), but a good reason for this is to allow supporting of multiple databases (or even flat files) instead of db specific functions. On May 22, 10:25 am, Zifnab [EMAIL PROTECTED] wrote: Ok, well for consistency's sake, do you know if cakePHP's automatic filling of 'created', 'updated', and 'modified' fields uses PHP's time or MYSQL's time? Thanks for all the quick responses everyone :) On May 22, 7:11 am, djiize [EMAIL PROTECTED] wrote: yes you're right! I care about that because we have 1 MySQL central server and several servers that request it. And we have not always full control of theses servers (apps can be coded by others teams/companies). On 22 mai, 14:16, Joel Perras [EMAIL PROTECTED] wrote: It doesn't really matter whether or not you obtain the date from Apache/PHP or MySQL; as long as you are consistent. On May 22, 4:01 am, djiize [EMAIL PROTECTED] wrote: I use the same way as Stephen Because what if MySQL is hosted on another server than Apache/PHP ? You'll save Apache/PHP time which can be different of MySQL time (no the same meridian for instance). Of course, it's a very specific case. And my servers are time synchronised together, but some time differences appeared once or twice a year. On 22 mai, 07:47, Stephen Orr [EMAIL PROTECTED] wrote: I believe I used this method: 'last_login' = '!-NOW()' Which makes Cake stop trying to quote it. But I'm pretty sure the latest SVN revision recognises NOW() and doesn't quote it anyway. Maybe I'm confused. Steve On May 22, 2:12 am, Alex Ciobanu [EMAIL PROTECTED] wrote: Zifnab wrote: I'm trying to figure out how to implicitly make a mysql NOW() call when doing a model save...here's an example of the code: $aUserData = array( 'User' = array( 'id' = 4, 'last_login' = 'NOW()' ) ); $this-User-save( $aUserData, false, array( 'last_login' ) ); Naturally the save doesn't work, because NOW() saves as a string NOW() instead of as a mysql function NOW()How do I get it to save as a mysql function? $aUserData['User']['last_login'] = date(Y-m-d H:i:s); $this-User-save($aUserData); Not using NOW(), but does the trick. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Appending data in Session
to add onto b logics, you can use the id as the key in an associative array as the sessions use the period as it's delim: writing: $this-Session-write('product.'.$id, $name); reading $products = $this-Session-read('product); On May 22, 10:26 am, b logica [EMAIL PROTECTED] wrote: Additionally, if it were my app, I'd save the product name also so that a list for the current cart can be easily displayed at any time. So, instead of pushing an ID onto the array I'd first grab all of the products from session, add a new array with both ID name of latest product, then both save the products array back to the session as well as make it available to the view with set(). Just my $0.02 On Thu, May 22, 2008 at 6:46 AM, Amit Badkas [EMAIL PROTECTED] wrote: On Thu, May 22, 2008 at 3:16 PM, Reza Muhammad [EMAIL PROTECTED] wrote: Hello, I'm trying to save multiple data in a session (kind of like a shopping cart). The process is a user select an item using a checkbox, and then he/she submits the form. The function will write a session (called product_id). However, if I try to search for another item, and then I submit the form again, the session only holds the newest data. Can't I just do this with $this-Session-write('products', $this- data['Products']['id']); ? - You need to do session read and array merge for this, like $this-Session-write('products', am($this-Session-read('products'), array($this-data['Products']['id']))); Also check if products are in session before doing array merge, like if ($this-Session-check('products')) { $this-Session-write('products', am($this-Session-read('products'), array($this-data['Products']['id']))); } else { $this-Session-write('products', array($this-data['Products']['id'])); } -- Amit http://amitrb.wordpress.com/ http://coppermine-gallery.net/ http://cheesecake-photoblog.org/ http://www.sanisoft.com/blog/author/amitbadkas --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Appending data in Session
forgot, this also eliminates the need to check to see if it's there first. On May 22, 10:38 am, fr3nch13 [EMAIL PROTECTED] wrote: to add onto b logics, you can use the id as the key in an associative array as the sessions use the period as it's delim: writing: $this-Session-write('product.'.$id, $name); reading $products = $this-Session-read('product); On May 22, 10:26 am, b logica [EMAIL PROTECTED] wrote: Additionally, if it were my app, I'd save the product name also so that a list for the current cart can be easily displayed at any time. So, instead of pushing an ID onto the array I'd first grab all of the products from session, add a new array with both ID name of latest product, then both save the products array back to the session as well as make it available to the view with set(). Just my $0.02 On Thu, May 22, 2008 at 6:46 AM, Amit Badkas [EMAIL PROTECTED] wrote: On Thu, May 22, 2008 at 3:16 PM, Reza Muhammad [EMAIL PROTECTED] wrote: Hello, I'm trying to save multiple data in a session (kind of like a shopping cart). The process is a user select an item using a checkbox, and then he/she submits the form. The function will write a session (called product_id). However, if I try to search for another item, and then I submit the form again, the session only holds the newest data. Can't I just do this with $this-Session-write('products', $this- data['Products']['id']); ? - You need to do session read and array merge for this, like $this-Session-write('products', am($this-Session-read('products'), array($this-data['Products']['id']))); Also check if products are in session before doing array merge, like if ($this-Session-check('products')) { $this-Session-write('products', am($this-Session-read('products'), array($this-data['Products']['id']))); } else { $this-Session-write('products', array($this-data['Products']['id'])); } -- Amit http://amitrb.wordpress.com/ http://coppermine-gallery.net/ http://cheesecake-photoblog.org/ http://www.sanisoft.com/blog/author/amitbadkas --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Awesome Cake!
Shamelessly stolen from digg. http://digg.com/food_drink/Computer_Nerd_Birthday_Cake http://www.flickr.com/photos/chantastic/1590993819/sizes/l/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
PHP easter eggs/ undocumented feature.
hey cake guys, long time no talkie for me. there is an undocumented feature in php that exposes itself. i tested it on an install of cakephp and it showed itself. ** This is no direct effect from cakephp code, but of just php *** Though you guys might want to know about it. This doesn't have anything written on the page to seems like it would be a security issue unless some of the names change with different versions, then you may be able to determine the version of php. Add this to the end of your urls for cakephp or any php project for that matter: ?=PHPB8B5F2A0-3C92-11d3-A3A9-4C7B08C1 I shamelessly stole this from a digg comment. http://digg.com/software/The_101_Coolest_Easter_Eggs_Hidden_in_Your_Software_DVDs_an?t=1418#c1418 http://phpsec.org/projects/phpsecinfo/tests/expose_php.html http://php.net/manual/en/ini.core.php#ini.expose-php --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Paginate HABTM in the views question.
I looked over group, blogs, bakery, api, code, etc. and i can't seem to figure this one out. I'm paginating like suggested here: http://cakebaker.42dh.com/2007/10/17/pagination-of-data-from-a-habtm-relationship/ But where the article ends/is missing is what do you do in your view? Specifically, if you look below at the code from my view, I would assume that User.name would work, and it does as far as sorting by the correct field, but the direction is always asc, it never changes. I dont have enough records in my database yet to go over 1 page, so i don't know if this affects the page numbers as well. My views/users/category.ctp th?php echo $paginator-sort(__r('Name'), 'User.name');?/th __r() is a wrapper so i dont have to type 'true' Any help is appreciated. P.S. I assumed this based on the above article: My models/user.php class User extends AppModel { var $hasAndBelongsToMany = array('Category' = array('with' = 'CategoriesUser')); } My controllers/users_controller.php class UsersController extends AppController { // called via ajax from categories/view function category($category_id = null) { if ($category_id) { //$this-paginateHolder(); $users = $this-paginate('CategoriesUser', array('Category.id'=$category_id)); $this-set('users', $users); } $this-layout = 'ajax'; } } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Paginate HABTM in the views question.
seems like this isn't a new issue: https://trac.cakephp.org/ticket/1903 On Jan 19, 10:41 am, fr3nch13 [EMAIL PROTECTED] wrote: I looked over group, blogs, bakery, api, code, etc. and i can't seem to figure this one out. I'm paginating like suggested here:http://cakebaker.42dh.com/2007/10/17/pagination-of-data-from-a-habtm-... But where the article ends/is missing is what do you do in your view? Specifically, if you look below at the code from my view, I would assume that User.name would work, and it does as far as sorting by the correct field, but the direction is always asc, it never changes. I dont have enough records in my database yet to go over 1 page, so i don't know if this affects the page numbers as well. My views/users/category.ctp th?php echo $paginator-sort(__r('Name'), 'User.name');?/th __r() is a wrapper so i dont have to type 'true' Any help is appreciated. P.S. I assumed this based on the above article: My models/user.php class User extends AppModel { var $hasAndBelongsToMany = array('Category' = array('with' = 'CategoriesUser')); } My controllers/users_controller.php class UsersController extends AppController { // called via ajax from categories/view function category($category_id = null) { if ($category_id) { //$this-paginateHolder(); $users = $this-paginate('CategoriesUser', array('Category.id'=$category_id)); $this-set('users', $users); } $this-layout = 'ajax'; } } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: habtm or hasmany
you could do it both ways technically, but IMO i would go with the HABTM way and then create a model on the join table and use the 'with' option in HABTM associations. Example: class Group extends AppModel { var $hasAndBelongsToMany = array('User' = array('with' = 'GroupsUser')); } class GroupsUser extends AppModel { var $belongsTo = array( 'Group' = array('className' = 'Group', 'foreignKey' = 'group_id', 'conditions' = '', 'fields' = '', 'order' = '' ), 'User' = array('className' = 'User', 'foreignKey' = 'user_id', 'conditions' = '', 'fields' = '', 'order' = '' ) ); } On Jan 19, 3:34 pm, dan [EMAIL PROTECTED] wrote: I thought of a different way I could do ratings, I'm pretty new to CakePHP and I'm not sure if it would be better. I have users and games. I was going to have a ratings table, users hasmany ratings and games hasmany ratings. In the ratings table I would store what they rated the game. I want to be able to do things like users who liked this game also liked. I was reading about the new 1.2 habtm features and I thought of a different way. I could have a games_user table which would have a rating field. So the games_user table would have user_id, game_id, rating. Is one of the ways better than the other? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Paginate HABTM in the views question.
Ok, i found a solution to this and submitted a diff for it: https://trac.cakephp.org/ticket/1903#comment:10 This should allow proper pagination of a HABTM associated model on the main model's view .ctp file Let me know what you guys think. On Jan 19, 12:16 pm, fr3nch13 [EMAIL PROTECTED] wrote: seems like this isn't a new issue: https://trac.cakephp.org/ticket/1903 On Jan 19, 10:41 am, fr3nch13 [EMAIL PROTECTED] wrote: I looked over group, blogs, bakery, api, code, etc. and i can't seem to figure this one out. I'm paginating like suggested here:http://cakebaker.42dh.com/2007/10/17/pagination-of-data-from-a-habtm-... But where the article ends/is missing is what do you do in your view? Specifically, if you look below at the code from my view, I would assume that User.name would work, and it does as far as sorting by the correct field, but the direction is always asc, it never changes. I dont have enough records in my database yet to go over 1 page, so i don't know if this affects the page numbers as well. My views/users/category.ctp th?php echo $paginator-sort(__r('Name'), 'User.name');?/th __r() is a wrapper so i dont have to type 'true' Any help is appreciated. P.S. I assumed this based on the above article: My models/user.php class User extends AppModel { var $hasAndBelongsToMany = array('Category' = array('with' = 'CategoriesUser')); } My controllers/users_controller.php class UsersController extends AppController { // called via ajax from categories/view function category($category_id = null) { if ($category_id) { //$this-paginateHolder(); $users = $this-paginate('CategoriesUser', array('Category.id'=$category_id)); $this-set('users', $users); } $this-layout = 'ajax'; } } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Cakephp and MySQL's REGEXP option
off hand, does anyone here know if cakephp supports REGEXP inherently without having to explicitly call an sql string? http://dev.mysql.com/doc/refman/5.0/en/regexp.html --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Session lost using kcaptcha, after upgrading to new 1.2.0.6311
This is 99% a whitespace issue IME's. Hint: Find where kcaptcha is writing the image headers header(...) comment them out and try to look at the image... it should be all garbled. Take a look at the source. It the first character is a space, you know that's your problem. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How to run a background process in CakePhp
hint - search this group for 'cron jobs' On Oct 17, 1:58 pm, Felix Geisendörfer [EMAIL PROTECTED] wrote: You might want to check out this extension if you you need things like this: http://www.vl-srm.net/doc/ However, you find it easier to have a queue table that is processed by a cron executed script for your background processing needs. -- Felix -- My Blog:http://www.thinkingphp.org My Business:http://www.fg-webdesign.de Baz wrote: This isn't a very CakePHP question. It's straight PHP. The short answer is no. Anything you execute in PHP is going to be done in a blocking call. -- Baz L Web Development 2.0 http://WebDevelopment2.com/ On 10/17/07, *regent* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: I need to run a php script in the background. I have figured out I can run it like this: exec (/usr/bin/php yourscript.php /dev/null ); I have 2 questions concerning this: 1) Can I run a php script within the CakePhp framework? I've been able to run it outside the framework, I just put the script under webroot. But can i run it within the framework so I can take advantage of CakePhp's extra functionality? To be more clear, I want the script to reside in one of my views folders, so I can still take advantage of Cake's functions. 2) How do I pass arguments to the script? I need the exact syntax. I've searched google and could not find a clear example of how to do this. Thanks. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Rss time to Unix Time?
http://api.cakephp.org/1.2/class_rss_helper.html#29f174f1137ce44cc7328f199c2fa231 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: AJAX InPlaceEditor with collection?
maybe try this: ?php echo $ajax-editor('edit', '/cars/ajax_update/' . $car['Car'] ['id'], array('update' = 'edit', 'type' = 'synchronous', 'collection' = array('1'='Ferrari', '2'='Lamborghini'))); ? where you define the keys in your collection array. not tested but it may work for you. On Sep 19, 9:48 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi all, I'm using an AJAX in-place-editor inside my project; it's the standard one provided by Cake and Scriptacolous; I have a problem: I have to use a collection of elements inside a SelectBox. Here's the code: tddiv id=edit?php echo $car['Manufacturer']['name']?/div/ td ?php echo $ajax-editor('edit', '/cars/ajax_update/' . $car['Car'] ['id'], array('update' = 'edit', 'type' = 'synchronous', 'collection' = array('Ferrari', 'Lamborghini'))); ? Where I have the array('Ferrari','Lamborghini') I need to have the value associated with the ID, not only the value; I looked @ Scriptacolous Wiki and it says that the collection should be like this: [[1, Ferrari], [2, Lamborghini]] but how can I do this in Cake? Thanks! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Display data from two related tables on one page
http://manual.cakephp.org --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: 500 Errors
You may be running out of the allowed memory for your script. in your php.ini, look for the setting: memory_limit. by default it's set to 8M, try upping it to like 16M, or even 23M not sure if this is your issue, but worth looking at. On Sep 17, 9:45 am, jsgriffin [EMAIL PROTECTED] wrote: Hi I don't have any lines beginning with php in the .htaccess file I'm afraid :S On Sep 14, 6:19 pm, Thiago Paes [EMAIL PROTECTED] wrote: Try remove the lines beginning with php in the .htaccess file.. For me, works fine after this alteration on a shared webserver... On 9/14/07, jsgriffin [EMAIL PROTECTED] wrote: Hi I've got Cake running on a VD Server, with PHP5 running through suexec. It's running quite a large web app which collates and delivers content to users. The site works mostly fine, until we get to the more intensive parts, feed processors, layout processors etc, which is where the server starts to stall. It runs for a while, and then produces a 500 error, in the error_log we get Premature End Of Script Headers, and nothing in the suexec or PHP logs. We've been playing around with the php.ini and httpd.conf files trying to get this to work, but to no avail. Our hosts, too, have given up on this issue. Does anyone know of any Cake issues that could be causing this? Or indeed, does anyone have any suggestions for our server config? Thanks James Griffin -- Thiago Paes - WebDeveloper - Linux user: #224062 site:http://www.thiagopaes.com.br --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: mysql union equivalent?
You can use $this-Model-query(); However, it won't return any dependent models with it. http://manual.cakephp.org/chapter/models On Sep 13, 12:03 pm, Mike Green [EMAIL PROTECTED] wrote: Hi folks I want to query two tables at the same time, mysql lets me do this with: SELECT name,age FROM football UNION SELECT name,age FROM baseball which will produce something like this: nameage John20 Alex21 Robort 23 Reid16 Greek 19 ( shamelessly stolen fromhttp://www.plus2net.com/sql_tutorial/sql_union.php - linked to get a better idea of what im trying to achieve ) I have two tables, each identical schema, but with data from different places. I need to either create something that will override the default findall function, or do something clever with the paginator as the results *must* be shoved through the paginator. I'm not fussy about the overhead, if it takes 10 minutes to return the results, then thats fine. At the moment, I perform two queries, one on model1 and one on model2, and then join the results with some php array management, then shove that through my view, although obviously this doesnt make use of the great cake 1.2 paginator.. all and any ideas appreciated. Mike --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Admin Implementation.
A simple way to do this is to use the admin routing. so /admin/users/index would look like so: ? UsersController extents AppController { function checkAdmin() { admin checking goes here (or put this method in your app_controller.php for other controllers to use, or a component) } function admin_index() { $this-checkAdmin(); other stuff here } } ? This is how i do it in most of my apps for simple auth when acl seems like using a sledge hammer to put a pin in a wall French On Sep 13, 11:06 am, DGPhoebus [EMAIL PROTECTED] wrote: I have been messing around with CakePHP for a little bit of time and most things are making sense. I am having a hard time though trying to figure out how to implement an Administrative area of the site where site management takes place. In the past I have created an / admin folder and password protected it and then built a complete backend for my sites. Now it appears that I only have Admin Routing to get to Admin functions and it appears to me that most of the functions take place in the front end of the website by tagging a / admin/controller/action to the url. Am I wrong? Is there a way to separate the admin from the rest of the app? Do I have to implement ACL now to control actions? or can I still make a password protected directory? I love the CakePHP framework but I am stalling out on stuff like this and it is taking the rapid out of my rapid development :-) Someone please help! Thanks everyone. Daniel --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Can I access database or execute some sql inside views ?
If you have your models setup correctly: hasAndBelongsToMany if the user can be a part of many groups, or User belongsTo Group | Group hasMany User if they only belong to one. Then in the method your controller: class GroupsController extends AppController { function index() { $this-Group-recursive = 2; $this-set('groups', $this-Group-findAll()); // sets $groups for your view to access it hint: in your view, look at pr($groups); i'll bet you find your users } } in View: ?php foreach ($groups as $group): ? ?php echo $group['Group']['name']; //or whatever field instead of name ? ?php foreach ($group['User'] as $user): ? ?php echo $user['email']; //or whatever field instead of email ? ?php endforeach; ? ?php endforeach; ? This isn't tested but it should give you a point in the right direction On Aug 14, 8:49 am, Wimg [EMAIL PROTECTED] wrote: The problem is like this, i have a database as below: user_id , group_id 1 1 2 1 3 2 4 2 i wanna display users in the same group as a row in a table group1 group2 12 34 i was thinking that I get group_id first, then use group_ id to get users belong to the same group_id. but i donot know how to do this in controller . any ideas ? thx in front --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Discussion on cake-apps-sites-in-the-wild
Another Cake app. http://calculator.boxcart.com/ Calculates a quote for the Boxcart Company. Has an admin for the Client to modify every one of the options and their associations with each other to allow the calculator to evolve with the company. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Update multiple div on one ajax call
This should help you http://groups.google.com/group/cake-php/search?group=cake-phpq=multiple+div+ajax --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How to use a model in views?
search this group for 'requestAction' or use the ajax helper. On Apr 5, 6:37 am, JuniorCMS [EMAIL PROTECTED] wrote: Hi to all, i need to have a view that use a model or a controller method to load some data like news or other. I'm implementing a simple template system for my cake blog and my be one template want to load some data like news and other template want to load last read article What to do? Thanks! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Session variables in a model
Is there a way to access the session component in a model? I store a user's information in the session [$this-Session- read('User')] and when the user edit's their information, i want it to be able to update the session. I would do it in the controller, but there are 3 different ways to edit a user's information (long story.. had to be like this.) Because of this, i was trying to use the model's afterSave() method to update the session, but i am getting an error saying this-Session isn't available in the model. Anyone have any ideas on how to do this? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Ajax Sortable List Confusion
You have: ?php echo $ajax-sortable('questions', array('url' ='saveOrder')); ? Shouldn't the url be /controller/action? so like this: ?php echo $ajax-sortable('questions', array('url' ='/faq/ saveorder/')); ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Showcasing www.votigo.com
Yeah, awesome site and idea! I signed up. I made a suggestion to 'mike' about having rss feeds of your popular/ new/etc contests. I'm also interested in how you did the FLV video thing. I have a project coming up that may need this. Point us in the right direction would be great! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Admin Routing Techniques
Ir Even better just bake it... if you can't bake it then: (i haven't played with 1.2 yet, but unless it was drastically changed from 1.1.x, this is how you i do it:) change: turn on admin routing, then: http://www.domain.com/admin/controller/action class ControllerController extends AppController { function admin_index() { $this-set('controller',$this-Model-findAll()); } function admin_action() { $this-checkSession(); // a function in the AppController, app/ app_controller.php which checks the user is logged in and has permissions if(empty($this-data)) { } else { if($this-Model-save($this-data)) { $this-Session-setFlash('Model is saved'); $this-redirect('/admin/controller/index'); } } } } You shouldn't even have to call this-render() at all. Then you name your views: app/views/controller/admin_index.thtml app/views/controller/admin_action.thtml (replace thtml for ctp in 1.2) On Mar 25, 5:05 pm, Mariano Iglesias [EMAIL PROTECTED] wrote: Or even better, no parameter needed: function admin_add() { return $this-setAction('add'); } function add() { if (isset($this-params[CAKE_ADMIN])) { $this-render('admin_add'); } } -MI --- Remember, smart coders answer ten questions for every question they ask. So be smart, be cool, and share your knowledge. BAKE ON! blog:http://www.MarianoIglesias.com.ar -Mensaje original- De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre de Mariano Iglesias Enviado el: Domingo, 25 de Marzo de 2007 05:53 p.m. Para: cake-php@googlegroups.com Asunto: RE: Admin Routing Techniques No, setAction() will set the $controller-action to 'add' and therefore render() will render add.ctp But you can use a parameter: --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: View this page Cake Apps/Sites In The Wild
This is pretty cool! I tried to export one of the articles ad ms word 2007 xml and it gave me an error saying 'Cannot Open File' On Mar 21, 11:28 pm, bingo [EMAIL PROTECTED] wrote: Hi bakers, I wanted to let all bakers know about my new application. It is an online bibliography management toolkit, Memento, completely developed based on CakePHP and JQuery. After trying many different frameworks, I finally found CakePHP and I am happy that I took the decision of trying CakePHP. To see what wonders cakephp and jquery can do, please visitwww.geovista.psu.edu/memento. To try application use username/ password as demo/demo Click onhttp://groups.google.com/group/cake-php/web/cake-apps-sites-in-the-wild - or copy paste it into your browser's address bar if that doesn't work. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Problems with hasAndBelongsToMany
Im not sure if this thread is relevant anymore, but it may help: http://groups.google.com/group/cake-php/browse_thread/thread/b01e21968ce9a151/1af66e7bae2685df search the group for habtm On Mar 6, 3:49 am, superjean [EMAIL PROTECTED] wrote: Hello all, I have some problems with that kind of association in cakePHP. There are two models: Profile and Event. And the table which joins them together is `event_profiles` (event_id, profile_id, date). Date is necessary. It is simple to save event_id and profile_id using standard ways, but I experience difficulties saving `date` in the table. Did someone solve similar problems? Thank you. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Extending model
If your using 1.1.x you can use app_model.php like you would use app_controller.php. I'm sure this has been talked about on this group before. search for app_model --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: multi-page forms
not sure, but you could always invofe the $this- requestAction('othercontroller/othermethod/param1'); On Mar 2, 8:48 am, keymaster [EMAIL PROTECTED] wrote: Had another look at the form wizard. Studying the code in more detail helped me understand what can be abstracted out of routine multi-page forms processing. It was a good exercise. For those interested, looks like the cake wizard would save the following code every step of the way: 1. Navigation - your code doesn't have to check if the next or previous buttons were pressed, the wizard does this based on the name of the link (previous or next). - your code doesn't have to figure out which action to call, as that is configured up front in ways, when you init the wizard. - if you didn't have the wizard, each of your form actions would have to determine if the Next or Previous link was pressed, then redirect itself to the proper action. - Also, if you have multiple ways through your steps, the wizard handles those transparently to you, so you don't have to check at each step where to go next. For example, if the user is not registered, the wizard will know to first take him to the registration page, then to the login page to login, then back to the page which required login in the first place. (of course, in your validation routines you would have to change the way if you see the user is not logged in, I think). 2. Checking for the presence of data - - the wizard checks to see if there is form data submitted, and if not, calls the current action to redisplay the form with the error messages as appropriate. - if you didn't have the wizard, you would have to perform this check. Not much, but is one less thing to do. 3. Validation --- - the wizard calls the appropriate validation routines you supply each step of the way, and reinvokes the same action (which causes the associated view to be displayed) if there are errors. - if there are no errors, it invokes the action for the next step, according to the ways you defined at init time. - If you didn't have the wizard, you would have to call validate yourself (if you had multiple models involved, or custom validation). Again, not much, but something else your code doesn't have to do. 4. Accumulating and storing/ retrieving form data in Sessions - - after each step, the wizard takes care of storing and accumulating all the form field data in cake sessions, so you don't have to. - after reading and writing all the form variables to the session, the wizard updates everything into the regular cake format $this-data['model']['field'] style (even though it is managing it underneath in sessions) so you can process it like usual cake programming (ie. both Save validate will find the data). - by using sessions, it eliminates for you some of the data accumulation problems of BACK and FORWARD through the steps, and deals with the session variables transparently to you. Your code doesn't need to be concerned with sessions at all. - if you didn't have the wizard, you would have to manage the form data yourself in sessions, and update the $this-data['model'] ['field'] yourself from the sessions before saving. 5. Clearing the session data at the end - - after the last step, the wizard clears the session data. - if you didn't have the wizard, you would have to do this yourself. NOTE: all the above is only from reading the code. I have not played with it yet, so please take all the above with a grain of salt, and verify everything for yourself. Question - One of the things I was not sure about - perhaps someone can clarify - the way the wizard invokes your action is: $this-controller-$fct(); // $fct() is the name of your action Does this mean you must put all the actions for that multi-page form into a single controller? What do you do if it makes more sense to have different steps of the form processed by different controllers? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Troubles with routes
check to see if your mod_rewrite is working correctly On Mar 1, 2:39 pm, andy corpes [EMAIL PROTECTED] wrote: Hi Group, It seems that a recent installation of cake has broken some part of my configuration, I've gone through the original installation procedures, but cannot see where i have gone wrong. I now have a single entry in route.php as follows:- $Route-connect ('/tblallhosts/:action/*', array('controller'='TblAllhosts')); Now, this url works:- http://ac85489m/cake/index.php/TblAllhosts/ while this:-http://ac85489m/cake/TblAllhosts/ and this:-http://ac85489m/cake/TblAllhosts/ Do not. I'm sure i've missed something, somewhere, but can anyone give me some clues as to where to look? -- Andy --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: What editor do you use for CakePHP?
I use dreamweaver 8 with their site settings for editing, etc. I'm stuck on windows cuz i have to test in IE too. blah! BTW, great resource: http://tredosoft.com/Multiple_IE --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: What editor do you use for CakePHP?
With DW8 and using their sites, all you have to do is hit [control]+ [shift]+u and it will save and upload the file. On Feb 13, 10:56 am, joel [EMAIL PROTECTED] wrote: Just yesterday I learned that about DockSend with Transmit - awesome! And there's even a bundle command for it in TextMate. I reassigned the DockSend file command to Control + Shift + S in TextMate, and now I basically make an edit to a file and then save it and hit that key combo above and it automatically uploads it on the correct server and in the correct directory. This tip will save me lots of minutes switching back and forth between apps. Hope it helps! On Feb 12, 2:40 pm, tracyfloyd [EMAIL PROTECTED] wrote: +1 for TextMate and Transmit! Drag from the TextMate project right onto the Transmit icon in the dock with DockSend... simple and beautiful. On Feb 12, 10:11 am, nateklaiber [EMAIL PROTECTED] wrote: Textmate for the editor and Transmit for the FTP client (OS X). It's a great combination, and very flexible with code bundles. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: is there a function exist($var) somewhere that I didn't find?
yeah, isset(); if you wanna use your function in your post, you could rewite it like: function exist($var) { return isset($var); } which again would be the equivalent of just using isset() anyways On Feb 13, 10:42 am, DaddyCool78 [EMAIL PROTECTED] wrote: Hello to all the devs in here! I'm happy to have found this project, as it is really useful/impressive ^_^ I recently started creating/modifying apps and I was looking for a function that would look up for the existence of a x $variable . Exemple, there is frequently in Views something like : if ($error): .. problem is when the $error is not set (using AJAX form fill, etc.) . I was wondering if a function that I don't know the name yet would do something like this : function exist($var) { if (isset($var)) { return $var; }else{ return false; } } A simple way to check the existence of a variable and avoid the messages like 'xxx variable could not be found.' David --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: CakePHP CMS
the only one i know of is OceanCMS and it's still in alpha: http://cakeforge.org/projects/ocean-cms/ On Feb 13, 10:11 am, rhet [EMAIL PROTECTED] wrote: Does anyone know of any good CMS for cake? I would like the application to be a plugin. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---