Calling save attempts to insert instead of update
I have a problem with one specific controller trying to INSERT instead of UPDATE and I am getting duplicate entry errors. the "$this->data" variable contains the correct primary key of table I'm trying to update, but still tries to INSERT instead. Most notable text message is this in the debug dump: SELECT COUNT(*) AS `count` FROM `employees` AS `Employee` WHERE `Employee`.`id` IS NULL. Apparently its not getting the id at all? Code: functionedit( $id = null ) { pr( $id ); pr( $this->data ); $this->Employee->id = $id; if( !empty( $this->data ) ) { if( $this->Employee->save( $this->data ) ) { } } else { $this->data = $this->Employee->read( null, $id ); } } Both the pr functions display the correct data that suggests it should be doing an UPDATE instead of INSERT. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Will speed be affected?
Trying to have flexibility with having multiple Apps but having one Core App for common functions I wanted to use the bootstrap.php's $controllerPaths, $modelPaths and $viewPaths. I want to know if this will affect speed. In folder called 'core_app' I created a file called 'core_users_controller.php': class CoreUsersController extends AppController {} and 'users_controller.php': App::import('Controller', 'CoreUsers'); class UsersController extends CoreUsersController {} In another folder 'app_a' I use the bootstrap to load the controllers in 'core_app.' This will allow me to use the Users controller but if need be allow me to override the Users controller by creating a new 'users_controller.php' file in 'app_a.' The same would apply for the Models and Views. I don't know if this is the best way but any other suggestions would be greatly appreciated. --~--~-~--~~~---~--~~ 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: wrapper function not working!
Sure, sorry I should've posted earlier. \view\users\index.ctp =>http://www.warplayart.com/ bleed_till_death/delete_when_done/index.ctp \view\users\login.ctp =>http://www.warplayart.com/ bleed_till_death/delete_when_done/login.ctp \view\users\register.ctp =>http://www.warplayart.com/ bleed_till_death/delete_when_done/register.ctp \controllers\users_controller.php =>http://www.warplayart.com/ bleed_till_death/delete_when_done/users_controller.tphp -Cheers, Armen On Aug 11, 10:58 pm, John Andersen wrote: > Please show the code for the view in which you are creating the form > for the user to register him-/herself! > Enjoy, > John > > On Aug 12, 5:15 am, armen wrote: > > > It's not working really. I tried it again... > > if you click on the second link, where you register a username and > > password, then by clicking the submit button, you should be redirected > > to the index page without any problems since I'm creating a session > > and redirecting. > > $this->Session->write('User', $data); > > $this->redirect('index'); > > > Second the username and pass is not inserted in the database, so if > > you click on the first link to enter the username and password you > > just created, it won't let you login. > > > -Armen > > > On Aug 11, 12:43 am, anurag pal wrote: > > > > Hi, > > > > I have checked the code its working properly. > > > > Please cross check your method which checking for logged User. It > > > might be in beforeFilter because its asking for log-in. > > > > Regards, > > > Anurag Pal > > > > On Aug 11, 12:25 pm, armen wrote: > > > > > This is the link to the webpage that im working > > > > on...http://warplayart.com/bleed_till_death/UserLoging/users > > > > and this is the link that you register a > > > > user...http://warplayart.com/bleed_till_death/UserLoging/users/register > > > > > But the form on the register page, calles add in for it's action > > > > variable, even though im calling the register function from the url. > > > > So i ended up using a wrapper like this which doesn't work. > > > > > What am i doing wrong? > > > > > + when i was just using the add (http://warplayart.com/ > > > > bleed_till_death/UserLoging/users/add) and placed the code inside the > > > > add function it worked fine. > > > > > - > > > > function add() { > > > > $this->register($this->data); > > > > } > > > > > function register($data = null) { > > > > > if (!empty($data)) { > > > > > $data['User']['password'] = > > > > md5($data['User']['password']); > > > > $this->User->create(); > > > > > if ($this->User->save($data)) { > > > > $this->Session->setFlash(__('User > > > > successfully registered', > > > > true)); > > > > $this->Session->write('User', > > > > $data); > > > > $this->redirect('index'); > > > > exit(); > > > > } > > > > else { > > > > $this->Session->setFlash(__('The > > > > Post could not be saved. > > > > Please, try again.', true)); > > > > } > > > > } > > > > } > > > > > > > > > Thanks in advance. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: wrapper function not working!
Please show the code for the view in which you are creating the form for the user to register him-/herself! Enjoy, John On Aug 12, 5:15 am, armen wrote: > It's not working really. I tried it again... > if you click on the second link, where you register a username and > password, then by clicking the submit button, you should be redirected > to the index page without any problems since I'm creating a session > and redirecting. > $this->Session->write('User', $data); > $this->redirect('index'); > > Second the username and pass is not inserted in the database, so if > you click on the first link to enter the username and password you > just created, it won't let you login. > > -Armen > > On Aug 11, 12:43 am, anurag pal wrote: > > > Hi, > > > I have checked the code its working properly. > > > Please cross check your method which checking for logged User. It > > might be in beforeFilter because its asking for log-in. > > > Regards, > > Anurag Pal > > > On Aug 11, 12:25 pm, armen wrote: > > > > This is the link to the webpage that im working > > > on...http://warplayart.com/bleed_till_death/UserLoging/users > > > and this is the link that you register a > > > user...http://warplayart.com/bleed_till_death/UserLoging/users/register > > > > But the form on the register page, calles add in for it's action > > > variable, even though im calling the register function from the url. > > > So i ended up using a wrapper like this which doesn't work. > > > > What am i doing wrong? > > > > + when i was just using the add (http://warplayart.com/ > > > bleed_till_death/UserLoging/users/add) and placed the code inside the > > > add function it worked fine. > > > > - > > > function add() { > > > $this->register($this->data); > > > } > > > > function register($data = null) { > > > > if (!empty($data)) { > > > > $data['User']['password'] = > > > md5($data['User']['password']); > > > $this->User->create(); > > > > if ($this->User->save($data)) { > > > $this->Session->setFlash(__('User > > > successfully registered', > > > true)); > > > $this->Session->write('User', > > > $data); > > > $this->redirect('index'); > > > exit(); > > > } > > > else { > > > $this->Session->setFlash(__('The Post > > > could not be saved. > > > Please, try again.', true)); > > > } > > > } > > > } > > > > > > > Thanks in advance. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Currency precision
I'd like to take a number and display it as currency but with a defined precision - for example £100,000. I have tried the following: $number->currency($number->precision($property['Property']['price'], 0 ),'GBP') which nests the $number->precision function inside of the $number- >currency function, but the precision is being ignored. 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 cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Default values in select lists
This doesn't add a new value to the list, just selects one that's already there. I want the list to start of with a custom row that is not in the database (such as "Please select a value") that will be selected by default (unless there is already a selection) and the rest of the list is drawn from the table. On Aug 11, 9:21 am, arif hossen wrote: > You can use below code cakephp format. > > > echo $html->input('listname',array('options'=>$mylist,'Selected'=>'Please > select a value)); > > ?> > > On 8/11/09, jburns wrote: > > > > > How can I add a blank value (something like "Please select a value") > > to the top of a select list when using $this->Xxxx->Yyyy->find > > ('list'); instead of defaulting to the first value in the list? > > -- > > Regards, > Mohammad Arif Hossen > Web Developer > United Group International(UGIBD)www.ugibd.net > Mobile no: +88 01714355911 > Mobile no: +88 01922110308 --~--~-~--~~~---~--~~ 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: Want to add another application in cake
Yes you are right hols But the old site have more that 100 urls. So how can it do it by mod_rewrite? On Wed, Aug 12, 2009 at 3:02 AM, Hols Kay wrote: > > You can use use mod_rewrite to redirect all the old urls to their Cake > equivalents. > > http://www.yourhtmlsource.com/sitemanagement/urlrewriting.html > > On Aug 11, 7:43 pm, Vijay wrote: > > My old site is in simple php.We have developed a new version of that > > site using cakephp. > > Now we want to add the old site in the cakephp. > > > > But the google search gives the old site links.So i want to maintain > > the old site too along with new version which is in cakephp. > > > > Can anybody help me in this? > > > -- Thanks & Regards, Vijayk. Co-founder (www.weboniselab.com) "You Bring the Dreams, We'll Bring the Means" --~--~-~--~~~---~--~~ 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: HTML helper in function?
It works fine outside of the function. I've run into this before; helper functions not working within View functions. Are you sure you've had that work in the past? I think the issue is that you normally (in models, controllers, components...) need to reference the object where the function is located with $this-> in order to access functions accessible to the whole object. However, View files don't typically have their own classes and objects (excluding helpers) since most of the logic is handled elsewhere in the app. Therefore, you get either an unknown method error or non-object error. I think I will throw this all in an array -> menu helper with the Html helper. That way I'll be able to reference the object with the link() function. Thanks for your help. On Aug 11, 11:15 pm, JamesF wrote: > hmm im not sure if this will work but you could try in your element: > > App:import('Helper', Html'); > > $html = new html(); > > does html helper work in other parts of your element outside the > function? i usually have no problems at all using $html->link() within > an element function. > > On Aug 11, 10:47 pm, Josh wrote: > > > > > The helpers are set and work fine. However, $html->link() does not > > work when called within a function in the view. > > > As for where the logic is written: this is an element that appears in > > all admin tools throughout the site. requestAction() would allow me to > > put some of the logic in the controller, however since this is an > > array used only for constructing a menu, I don't really see any > > advantage to that. > > > On Aug 11, 7:15 pm, JamesF wrote: > > > > if your controller is set up with var $helpers = array('html') ; you > > > should be fine..that error is just telling you that cake can't find > > > HtmlHelper...is there a reason you are executing that logic in your > > > view and not the controller? > > > > On Aug 11, 7:02 pm, Josh wrote: > > > > > Hi, > > > > > I have the contents of a tree menu stored in a multi-dimensional > > > > array. The number of dimensions is not fixed, so to turn the array > > > > into a menu in the View file, I have set up a recurring function. This > > > > works fine except that I can't call the $html->link() from the > > > > function. > > > > > Fatal error: Call to a member function link() on a non-object in... > > > > > Any ideas? Is there a way to make the link() function global as you do > > > > a variable? There are some obvious work-arounds such as writing the > > > > anchor tag without the html helper, or turning the link array into a > > > > simpler two dimensional array where I can then iterate the link() > > > > function. However, I am wonder how I might specifically address the > > > > question of making the html->link() function available to a function > > > > within a view file. > > > > > I have a feeling this is either going to be a simple declaration or > > > > not worth the trouble. Thanks in advance. > > > > > Here is my code: > > > > > //array of links > > > > key: link title > > > > value: link location or sub-array > > > > $linkTree = array( > > > > 'User Management' => array( > > > > 'Permissions' => array( > > > > 'Set Permissions' => '/tools/setPermissions', > > > > 'Update ACOS' => '/tools/updateacl', > > > > 'View/Edit Groups' => '/admin/groups' > > > > ), > > > > 'User Settings' => '/tools/userSettings', > > > > 'Users' => array( > > > > 'List' => '/admin/users', > > > > 'Add User' => '/admin/users/add' > > > > ) > > > > ) > > > > ); > > > > > //output menu function > > > > function outputMenu ($array, $level) { > > > > global $levelMarker; > > > > > foreach ($array as $key => $value) { > > > > if (is_array($value)) { > > > > echo $level . $key; > > > > echo ''; > > > > outputMenu($value, $level . $levelMarker); > > > > } else { > > > > echo $html->link("$level$key", $value); > > > > echo ''; > > > > } > > > > } > > > > echo ""; > > > > } > > > > > //output menu settings > > > > $levelMarker = '-'; > > > > $level = ''; > > > > $linkTreeSimple = array(); > > > > > //output menu > > > > outputMenu($linkTree, $level); --~--~-~--~~~---~--~~ 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: HTML helper in function?
if you have time would you mind posting a test case or example code? i would love to see some more of the code in context just so I can improve my understanding of the issue. please let us know what works in the end for you it might help someone in the future On Aug 12, 1:09 am, Josh wrote: > It works fine outside of the function. I've run into this before; > helper functions not working within View functions. Are you sure > you've had that work in the past? > > I think the issue is that you normally (in models, controllers, > components...) need to reference the object where the function is > located with $this-> in order to access functions accessible to the > whole object. However, View files don't typically have their own > classes and objects (excluding helpers) since most of the logic is > handled elsewhere in the app. Therefore, you get either an unknown > method error or non-object error. > > I think I will throw this all in an array -> menu helper with the Html > helper. That way I'll be able to reference the object with the link() > function. > > Thanks for your help. > > On Aug 11, 11:15 pm, JamesF wrote: > > > hmm im not sure if this will work but you could try in your element: > > > App:import('Helper', Html'); > > > $html = new html(); > > > does html helper work in other parts of your element outside the > > function? i usually have no problems at all using $html->link() within > > an element function. > > > On Aug 11, 10:47 pm, Josh wrote: > > > > The helpers are set and work fine. However, $html->link() does not > > > work when called within a function in the view. > > > > As for where the logic is written: this is an element that appears in > > > all admin tools throughout the site. requestAction() would allow me to > > > put some of the logic in the controller, however since this is an > > > array used only for constructing a menu, I don't really see any > > > advantage to that. > > > > On Aug 11, 7:15 pm, JamesF wrote: > > > > > if your controller is set up with var $helpers = array('html') ; you > > > > should be fine..that error is just telling you that cake can't find > > > > HtmlHelper...is there a reason you are executing that logic in your > > > > view and not the controller? > > > > > On Aug 11, 7:02 pm, Josh wrote: > > > > > > Hi, > > > > > > I have the contents of a tree menu stored in a multi-dimensional > > > > > array. The number of dimensions is not fixed, so to turn the array > > > > > into a menu in the View file, I have set up a recurring function. This > > > > > works fine except that I can't call the $html->link() from the > > > > > function. > > > > > > Fatal error: Call to a member function link() on a non-object in... > > > > > > Any ideas? Is there a way to make the link() function global as you do > > > > > a variable? There are some obvious work-arounds such as writing the > > > > > anchor tag without the html helper, or turning the link array into a > > > > > simpler two dimensional array where I can then iterate the link() > > > > > function. However, I am wonder how I might specifically address the > > > > > question of making the html->link() function available to a function > > > > > within a view file. > > > > > > I have a feeling this is either going to be a simple declaration or > > > > > not worth the trouble. Thanks in advance. > > > > > > Here is my code: > > > > > > //array of links > > > > > key: link title > > > > > value: link location or sub-array > > > > > $linkTree = array( > > > > > 'User Management' => array( > > > > > 'Permissions' => array( > > > > > 'Set Permissions' => '/tools/setPermissions', > > > > > 'Update ACOS' => '/tools/updateacl', > > > > > 'View/Edit Groups' => '/admin/groups' > > > > > ), > > > > > 'User Settings' => '/tools/userSettings', > > > > > 'Users' => array( > > > > > 'List' => '/admin/users', > > > > > 'Add User' => '/admin/users/add' > > > > > ) > > > > > ) > > > > > ); > > > > > > //output menu function > > > > > function outputMenu ($array, $level) { > > > > > global $levelMarker; > > > > > > foreach ($array as $key => $value) { > > > > > if (is_array($value)) { > > > > > echo $level . $key; > > > > > echo ''; > > > > > outputMenu($value, $level . $levelMarker); > > > > > } else { > > > > > echo $html->link("$level$key", $value); > > > > > echo ''; > > > > > } > > > > > } > > > > > echo ""; > > > > > } > > > > > > //output menu settings > > > > > $levelMarker = '-'; > > > > > $level = ''; > > > > > $linkTreeSimple = array(); > > > > > > //output menu > > > > > outputMenu($linkTree, $level); --~--~-~--~~~---~--~~ Yo
Re: Uploading file issue - worning mkdir()
I'm trying to upload to /webroot/img/uploads/ both /img and /uploads directory has permission 777 and getting an error: Warning (2): mkdir() [function.mkdir]: Permission denied [CORE/cake/libs/folder.php, line 466] so I commented out line 466 ~ 476 in folder.php file: /* if (mkdir($pathname, $mode)) { umask($old); $this->__messages[] = sprintf(__('%s created', true), $pathname); return true; } else { umask($old); $this->__errors[] = sprintf(__('%s NOT created', true), $pathname); return false; } */ then everything working ok. I wander doing this causing any other issue? On Tue, Aug 11, 2009 at 10:54 AM, brian wrote: > > Don't set the permissions wide open for webroot dir! That's not a good > idea at all. > > What is the full path of the directory you want to upload to? > > I'm sorry, I'm not familiar with the plugin and don't understand your > other question about the data. > > On Tue, Aug 11, 2009 at 4:06 AM, leafchild > wrote: > > > > The uploaded img directory permission is set to 777 and just in case I > > even changed webroot permission to 777 > > but I'm still seeing same warning message. Where else I need to > > check? > > > > Also how can I stop update with entire file data to database? > > > > after trying to upload file debug show: > > == > > [id] =>1 > > [uploadfile] => Array > > ( > > [name] => IMG_0801.JPG > > [type] => image/jpeg > > [tmp_name] => /tmp/phpbo9DjW > > [error] => 0 > > [size] => 404887 > > ) > > [desc] => > > ... > > === > > > > uploadfile field needs only file name but looking at sql trying to > > update > > filed with file array information. > > > > > > > > > > > > > > On Aug 7, 6:24 pm, brian wrote: > >> Check the permissions for the directory. The webserver has to have > >> write access to the dir. > >> > >> > >> > >> On Fri, Aug 7, 2009 at 4:02 PM,leafchild > wrote: > >> > >> > I'm trying to make this plugin(http://www.milesj.me/resources/script/ > >> > uploader-plugin) works. > >> > >> > However, after I install I'm getting an error - Warning (2): mkdir() > >> > [function.mkdir]: Permission denied [CORE/cake/libs/folder.php, line > >> > 466] > >> > Actually I tried another behavior to upload file and got same error. > >> > Do I need to do some kind of server setting? I'm using MT(dv) > >> > >> > Also after submit to upload file I'm getting an SQL error because data > >> > need to be one but it try to update entire file data: > >> > >> > == > >> > [id] =>1 > >> > [uploadfile] => Array > >> > ( > >> > [name] => IMG_0801.JPG > >> > [type] => image/jpeg > >> > [tmp_name] => /tmp/phpbo9DjW > >> > [error] => 0 > >> > [size] => 404887 > >> > ) > >> > [desc] => > >> > ... > >> > === > >> > "uplodefile" 's data is not array just [NAME] of file. > >> > >> > How can I stop doing it? I can't use "$this->Landing->save($this- > >> >>data)" if I have file uploading? > > > > > > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Is there a way to select an action from a double-click?
It sounds like (no, no it doesn't - i'm just guessing) what you're after is some kind of inline editing jQuery plugin... something like http://www.appelsiini.net/projects/jeditable Or perhaps you mean something like a drop-down RED (http://paul-m- jones.com/?p=291) list for each row... On Aug 12, 7:47 am, FrederickD wrote: > Thank you for your on-going support! There are a lot of good answers > on this group. I've searched for this answer here and in "the book" > but cannot find it. > > What is the best way to have the user select an action (RUD; read, > update, delete) without a separate link at the end of the row, as in > the default behavior? > > Is there a way to describe a 'hot spot' for one or more attributes in > a list so that if there is a double-click an action can be executed? > > I'm wondering if this is the world of jQuery. I have not yet explored > that area yet. > > Thanks in advance for your help! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Search function
some fancy combos 'LIKE' and 'OR' in your find conditions array should get it done. The trick is formatting your array. http://book.cakephp.org/view/74/Complex-Find-Conditions On Aug 11, 8:55 pm, "Dave Maharaj :: WidePixels.com" wrote: > I am building a new search function for a input single field. > > I have the basic set up running but as I move forward I want the user to be > able to enter more than 1 word coma separated. > > How would I do this? > > spilt the $queryValues = $query split ',' > > So i now have an array of values that they entered but how do I then query > each of those values? > > Is there a better way to do this? > > thanks, > > Dave --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Custom library functions
@martin that's a great observation that i know will save me a few hours in the future. thanks for sharing On Aug 11, 11:13 am, Martin Westin wrote: > If you start adding more functions you may want to put them into a > separate file. > The top of my bootstrap.php looks like this: > > // This would mess things up royally--> App::import('Vendor', > 'basics'); > require_once(APP.'vendors'.DS.'basics.php'); > > I mention it mostly because you have to do a good old require unless > you want Cake's internals all confused. App::import() can't be used > because of Cake's bootstrapping order. Simply put bootstrap.php is > loaded before the "App" is ready to run. It took me a lot of time and > effort to track down that this was the cause for all sorts of > strangeness. > > /Martin > > On Aug 11, 4:54 pm, Robert P wrote: > > > The file /app/config/bootstrap.php is there for this exact reason. > > > On Aug 11, 8:56 pm, alaxos wrote: > > > > Hello, > > > > I have tried to figure out what would be the best way to add generic > > > functions to an app, in order to then be able to use them everywhere > > > in a Cake application. > > > > I wrote some time ago (nothing to do with cake) classes with methods > > > that I use to do different things. They are generic classes, that I > > > use for instance to manipulate strings, or whatever. > > > > I could off course copy/paste them in my components or helper that > > > need them, but I would prefer to have it written at only one place, > > > and be able to call it from everywhere. > > > > I could also for instance include the files I need somewhere in the > > > app (in 'app_controller.php' maybe). > > > > But I'd like to know what would be the best way to do it in order to > > > respect the Cake guidelines ? > > > > Thanks ! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Encoding pluses in URL - Is my patch OK?
well modifying the core in general is bad because it makes your app harder to debug and we can't really help you when you change the core . it's kind of like opening your ps2 and voiding the warranty, you might be able to install the mod chip, but it's no guarantee of future support. On Aug 11, 8:44 pm, BeanDog wrote: > Due to the way Apache's mod_rewrite mismanages query string encoding, > $_GET['url'] isn't what I'd hope it would be when there are pluses > encoded (%2B) in the URL. > > It looks like replacing line 614 of dispatcher.php with the following > works on my apache config: > > if(isset($_SERVER['REDIRECT_URL'])) > $url = $_SERVER['REDIRECT_URL']; //Will have correct special-char > encoding. > else > $url = $_GET['url']; > > Is there some reason I'm not aware of that I should _not_ do this? > > Ben Dilts --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Is there a way to select an action from a double-click?
really, really trying to understand what you are attempting here. On Aug 11, 7:47 pm, FrederickD wrote: > Thank you for your on-going support! There are a lot of good answers > on this group. I've searched for this answer here and in "the book" > but cannot find it. > > What is the best way to have the user select an action (RUD; read, > update, delete) without a separate link at the end of the row, as in > the default behavior? > > Is there a way to describe a 'hot spot' for one or more attributes in > a list so that if there is a double-click an action can be executed? > > I'm wondering if this is the world of jQuery. I have not yet explored > that area yet. > > Thanks in advance for your help! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Multidimensional array as named argument
i would just use implode on the array to set up my seperate arguments and turn it into a url string On Aug 11, 10:22 am, Tushar wrote: > Is it possible to pass an array through named arguments and have it > accessible via $this->passedArgs? > > How would you convert an array as such to a named argument > > Array > ( > [foo] => "foo1" > [bar] => Array > ( > [0] => "bar0" > [1] => "bar1" > ) > ) > > it becomes foo:foo1/bar:Array if passed to Router::url to generate the > url > > Is it not possible to have arrays in named arguments? Then how can we > handle multiple values generated by multiple selects or checkboxes? --~--~-~--~~~---~--~~ 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: HTML helper in function?
hmm im not sure if this will work but you could try in your element: App:import('Helper', Html'); $html = new html(); does html helper work in other parts of your element outside the function? i usually have no problems at all using $html->link() within an element function. On Aug 11, 10:47 pm, Josh wrote: > The helpers are set and work fine. However, $html->link() does not > work when called within a function in the view. > > As for where the logic is written: this is an element that appears in > all admin tools throughout the site. requestAction() would allow me to > put some of the logic in the controller, however since this is an > array used only for constructing a menu, I don't really see any > advantage to that. > > On Aug 11, 7:15 pm, JamesF wrote: > > > if your controller is set up with var $helpers = array('html') ; you > > should be fine..that error is just telling you that cake can't find > > HtmlHelper...is there a reason you are executing that logic in your > > view and not the controller? > > > On Aug 11, 7:02 pm, Josh wrote: > > > > Hi, > > > > I have the contents of a tree menu stored in a multi-dimensional > > > array. The number of dimensions is not fixed, so to turn the array > > > into a menu in the View file, I have set up a recurring function. This > > > works fine except that I can't call the $html->link() from the > > > function. > > > > Fatal error: Call to a member function link() on a non-object in... > > > > Any ideas? Is there a way to make the link() function global as you do > > > a variable? There are some obvious work-arounds such as writing the > > > anchor tag without the html helper, or turning the link array into a > > > simpler two dimensional array where I can then iterate the link() > > > function. However, I am wonder how I might specifically address the > > > question of making the html->link() function available to a function > > > within a view file. > > > > I have a feeling this is either going to be a simple declaration or > > > not worth the trouble. Thanks in advance. > > > > Here is my code: > > > > //array of links > > > key: link title > > > value: link location or sub-array > > > $linkTree = array( > > > 'User Management' => array( > > > 'Permissions' => array( > > > 'Set Permissions' => '/tools/setPermissions', > > > 'Update ACOS' => '/tools/updateacl', > > > 'View/Edit Groups' => '/admin/groups' > > > ), > > > 'User Settings' => '/tools/userSettings', > > > 'Users' => array( > > > 'List' => '/admin/users', > > > 'Add User' => '/admin/users/add' > > > ) > > > ) > > > ); > > > > //output menu function > > > function outputMenu ($array, $level) { > > > global $levelMarker; > > > > foreach ($array as $key => $value) { > > > if (is_array($value)) { > > > echo $level . $key; > > > echo ''; > > > outputMenu($value, $level . $levelMarker); > > > } else { > > > echo $html->link("$level$key", $value); > > > echo ''; > > > } > > > } > > > echo ""; > > > } > > > > //output menu settings > > > $levelMarker = '-'; > > > $level = ''; > > > $linkTreeSimple = array(); > > > > //output menu > > > outputMenu($linkTree, $level); --~--~-~--~~~---~--~~ 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: HTML helper in function?
hmm im not sure if this will work but you could try in your element: App:import('Helper', Html'); $html = new html(); On Aug 11, 10:47 pm, Josh wrote: > The helpers are set and work fine. However, $html->link() does not > work when called within a function in the view. > > As for where the logic is written: this is an element that appears in > all admin tools throughout the site. requestAction() would allow me to > put some of the logic in the controller, however since this is an > array used only for constructing a menu, I don't really see any > advantage to that. > > On Aug 11, 7:15 pm, JamesF wrote: > > > if your controller is set up with var $helpers = array('html') ; you > > should be fine..that error is just telling you that cake can't find > > HtmlHelper...is there a reason you are executing that logic in your > > view and not the controller? > > > On Aug 11, 7:02 pm, Josh wrote: > > > > Hi, > > > > I have the contents of a tree menu stored in a multi-dimensional > > > array. The number of dimensions is not fixed, so to turn the array > > > into a menu in the View file, I have set up a recurring function. This > > > works fine except that I can't call the $html->link() from the > > > function. > > > > Fatal error: Call to a member function link() on a non-object in... > > > > Any ideas? Is there a way to make the link() function global as you do > > > a variable? There are some obvious work-arounds such as writing the > > > anchor tag without the html helper, or turning the link array into a > > > simpler two dimensional array where I can then iterate the link() > > > function. However, I am wonder how I might specifically address the > > > question of making the html->link() function available to a function > > > within a view file. > > > > I have a feeling this is either going to be a simple declaration or > > > not worth the trouble. Thanks in advance. > > > > Here is my code: > > > > //array of links > > > key: link title > > > value: link location or sub-array > > > $linkTree = array( > > > 'User Management' => array( > > > 'Permissions' => array( > > > 'Set Permissions' => '/tools/setPermissions', > > > 'Update ACOS' => '/tools/updateacl', > > > 'View/Edit Groups' => '/admin/groups' > > > ), > > > 'User Settings' => '/tools/userSettings', > > > 'Users' => array( > > > 'List' => '/admin/users', > > > 'Add User' => '/admin/users/add' > > > ) > > > ) > > > ); > > > > //output menu function > > > function outputMenu ($array, $level) { > > > global $levelMarker; > > > > foreach ($array as $key => $value) { > > > if (is_array($value)) { > > > echo $level . $key; > > > echo ''; > > > outputMenu($value, $level . $levelMarker); > > > } else { > > > echo $html->link("$level$key", $value); > > > echo ''; > > > } > > > } > > > echo ""; > > > } > > > > //output menu settings > > > $levelMarker = '-'; > > > $level = ''; > > > $linkTreeSimple = array(); > > > > //output menu > > > outputMenu($linkTree, $level); --~--~-~--~~~---~--~~ 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: HTML helper in function?
The helpers are set and work fine. However, $html->link() does not work when called within a function in the view. As for where the logic is written: this is an element that appears in all admin tools throughout the site. requestAction() would allow me to put some of the logic in the controller, however since this is an array used only for constructing a menu, I don't really see any advantage to that. On Aug 11, 7:15 pm, JamesF wrote: > if your controller is set up with var $helpers = array('html') ; you > should be fine..that error is just telling you that cake can't find > HtmlHelper...is there a reason you are executing that logic in your > view and not the controller? > > On Aug 11, 7:02 pm, Josh wrote: > > > > > Hi, > > > I have the contents of a tree menu stored in a multi-dimensional > > array. The number of dimensions is not fixed, so to turn the array > > into a menu in the View file, I have set up a recurring function. This > > works fine except that I can't call the $html->link() from the > > function. > > > Fatal error: Call to a member function link() on a non-object in... > > > Any ideas? Is there a way to make the link() function global as you do > > a variable? There are some obvious work-arounds such as writing the > > anchor tag without the html helper, or turning the link array into a > > simpler two dimensional array where I can then iterate the link() > > function. However, I am wonder how I might specifically address the > > question of making the html->link() function available to a function > > within a view file. > > > I have a feeling this is either going to be a simple declaration or > > not worth the trouble. Thanks in advance. > > > Here is my code: > > > //array of links > > key: link title > > value: link location or sub-array > > $linkTree = array( > > 'User Management' => array( > > 'Permissions' => array( > > 'Set Permissions' => '/tools/setPermissions', > > 'Update ACOS' => '/tools/updateacl', > > 'View/Edit Groups' => '/admin/groups' > > ), > > 'User Settings' => '/tools/userSettings', > > 'Users' => array( > > 'List' => '/admin/users', > > 'Add User' => '/admin/users/add' > > ) > > ) > > ); > > > //output menu function > > function outputMenu ($array, $level) { > > global $levelMarker; > > > foreach ($array as $key => $value) { > > if (is_array($value)) { > > echo $level . $key; > > echo ''; > > outputMenu($value, $level . $levelMarker); > > } else { > > echo $html->link("$level$key", $value); > > echo ''; > > } > > } > > echo ""; > > } > > > //output menu settings > > $levelMarker = '-'; > > $level = ''; > > $linkTreeSimple = array(); > > > //output menu > > outputMenu($linkTree, $level); --~--~-~--~~~---~--~~ 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: wrapper function not working!
It's not working really. I tried it again... if you click on the second link, where you register a username and password, then by clicking the submit button, you should be redirected to the index page without any problems since I'm creating a session and redirecting. $this->Session->write('User', $data); $this->redirect('index'); Second the username and pass is not inserted in the database, so if you click on the first link to enter the username and password you just created, it won't let you login. -Armen On Aug 11, 12:43 am, anurag pal wrote: > Hi, > > I have checked the code its working properly. > > Please cross check your method which checking for logged User. It > might be in beforeFilter because its asking for log-in. > > Regards, > Anurag Pal > > On Aug 11, 12:25 pm, armen wrote: > > > This is the link to the webpage that im working > > on...http://warplayart.com/bleed_till_death/UserLoging/users > > and this is the link that you register a > > user...http://warplayart.com/bleed_till_death/UserLoging/users/register > > > But the form on the register page, calles add in for it's action > > variable, even though im calling the register function from the url. > > So i ended up using a wrapper like this which doesn't work. > > > What am i doing wrong? > > > + when i was just using the add (http://warplayart.com/ > > bleed_till_death/UserLoging/users/add) and placed the code inside the > > add function it worked fine. > > > - > > function add() { > > $this->register($this->data); > > } > > > function register($data = null) { > > > if (!empty($data)) { > > > $data['User']['password'] = > > md5($data['User']['password']); > > $this->User->create(); > > > if ($this->User->save($data)) { > > $this->Session->setFlash(__('User > > successfully registered', > > true)); > > $this->Session->write('User', > > $data); > > $this->redirect('index'); > > exit(); > > } > > else { > > $this->Session->setFlash(__('The Post > > could not be saved. > > Please, try again.', true)); > > } > > } > > } > > > > > Thanks in advance. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Search function
I am building a new search function for a input single field. I have the basic set up running but as I move forward I want the user to be able to enter more than 1 word coma separated. How would I do this? spilt the $queryValues = $query split ',' So i now have an array of values that they entered but how do I then query each of those values? Is there a better way to do this? thanks, Dave --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Encoding pluses in URL - Is my patch OK?
Due to the way Apache's mod_rewrite mismanages query string encoding, $_GET['url'] isn't what I'd hope it would be when there are pluses encoded (%2B) in the URL. It looks like replacing line 614 of dispatcher.php with the following works on my apache config: if(isset($_SERVER['REDIRECT_URL'])) $url = $_SERVER['REDIRECT_URL']; //Will have correct special-char encoding. else $url = $_GET['url']; Is there some reason I'm not aware of that I should _not_ do this? Ben Dilts --~--~-~--~~~---~--~~ 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: internationalization in model
On 8/11/2009 10:16 PM, tobi_one wrote: > Hi, > > for future reference, this is IMHO the most elegant solution for this > problem: > > http://cake.eizoku.com/blog/?p=30#comment-8 > > Cheers, > tobi_one > > On Jul 29, 4:07 am, "Dr. Loboto" wrote: > >> With Model::invalidate() method reload you do not have such problems >> at all. >> >> On Jul 29, 12:17 am,tobi_one wrote: >> >> >>> Hi, >>> >> >> >>> It works great, but there is one problem. I set the language of the >>> app in the beforefilter of the app_controller. Apparently the models >>> are loaded before this and so the models always return the default >>> language. >>> >> >>> Where do you guys set the language of the app? Especially if you are >>> using the __contruct method as mentioned in the post from above. >>> > Why not use 'error' in the input() option array? http://api.cakephp.org/class/form-helper#method-FormHelperinput I believe it was designed for this purpose. Perhaps a cake developer can confirm/infirm 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 -~--~~~~--~~--~--~---
Re: Fatal error: Class 'Dispatcher' not found - please help
We encountered this error on an CakePHP1.2 installation and found that it was related to the installed PHP version. It may be the same for you, PHP5.2 had a problem which was part of a debian install in our clients servers case. Hope that helps. http://wiltonsoftware.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Is there a way to select an action from a double-click?
Thank you for your on-going support! There are a lot of good answers on this group. I've searched for this answer here and in "the book" but cannot find it. What is the best way to have the user select an action (RUD; read, update, delete) without a separate link at the end of the row, as in the default behavior? Is there a way to describe a 'hot spot' for one or more attributes in a list so that if there is a double-click an action can be executed? I'm wondering if this is the world of jQuery. I have not yet explored that area yet. Thanks in advance for your help! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: server transfer problem
@brian would you mind pasting your index.php On Aug 11, 4:25 pm, brian wrote: > I'm having some trouble getting a site working on another server. The > people the client hired are using cPanel, PHP is installed as CGI, and > mod_rewrite is not available. Additionally, I have to access their > version of the site through an IP address plus a home subdirectory, > eg: > > http://xxx.xxx.xxx.xxx./~foo/ > > The directory structure: > > /home/foo/public_html/index.php > /home/foo/public_html/app/ > /home/foo/public_html/app/webroot/ > /home/foo/public_html/cake/ > > However, I'm just getting 404s (Apache's, not Cake's). Even a regular > file in public_html is not found. > > I had this working (almost) with the contents of webroot in > public_html and app & cake outside that. But I ran into trouble with > the lack of mod_rewrite and gave up on that. Now, I can't seem to get > anything to show up. Anyone have an idea? --~--~-~--~~~---~--~~ 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: HTML helper in function?
if your controller is set up with var $helpers = array('html') ; you should be fine..that error is just telling you that cake can't find HtmlHelper...is there a reason you are executing that logic in your view and not the controller? On Aug 11, 7:02 pm, Josh wrote: > Hi, > > I have the contents of a tree menu stored in a multi-dimensional > array. The number of dimensions is not fixed, so to turn the array > into a menu in the View file, I have set up a recurring function. This > works fine except that I can't call the $html->link() from the > function. > > Fatal error: Call to a member function link() on a non-object in... > > Any ideas? Is there a way to make the link() function global as you do > a variable? There are some obvious work-arounds such as writing the > anchor tag without the html helper, or turning the link array into a > simpler two dimensional array where I can then iterate the link() > function. However, I am wonder how I might specifically address the > question of making the html->link() function available to a function > within a view file. > > I have a feeling this is either going to be a simple declaration or > not worth the trouble. Thanks in advance. > > Here is my code: > > //array of links > key: link title > value: link location or sub-array > $linkTree = array( > 'User Management' => array( > 'Permissions' => array( > 'Set Permissions' => '/tools/setPermissions', > 'Update ACOS' => '/tools/updateacl', > 'View/Edit Groups' => '/admin/groups' > ), > 'User Settings' => '/tools/userSettings', > 'Users' => array( > 'List' => '/admin/users', > 'Add User' => '/admin/users/add' > ) > ) > ); > > //output menu function > function outputMenu ($array, $level) { > global $levelMarker; > > foreach ($array as $key => $value) { > if (is_array($value)) { > echo $level . $key; > echo ''; > outputMenu($value, $level . $levelMarker); > } else { > echo $html->link("$level$key", $value); > echo ''; > } > } > echo ""; > } > > //output menu settings > $levelMarker = '-'; > $level = ''; > $linkTreeSimple = array(); > > //output menu > outputMenu($linkTree, $level); --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
HTML helper in function?
Hi, I have the contents of a tree menu stored in a multi-dimensional array. The number of dimensions is not fixed, so to turn the array into a menu in the View file, I have set up a recurring function. This works fine except that I can't call the $html->link() from the function. Fatal error: Call to a member function link() on a non-object in... Any ideas? Is there a way to make the link() function global as you do a variable? There are some obvious work-arounds such as writing the anchor tag without the html helper, or turning the link array into a simpler two dimensional array where I can then iterate the link() function. However, I am wonder how I might specifically address the question of making the html->link() function available to a function within a view file. I have a feeling this is either going to be a simple declaration or not worth the trouble. Thanks in advance. Here is my code: //array of links key: link title value: link location or sub-array $linkTree = array( 'User Management' => array( 'Permissions' => array( 'Set Permissions' => '/tools/setPermissions', 'Update ACOS' => '/tools/updateacl', 'View/Edit Groups' => '/admin/groups' ), 'User Settings' => '/tools/userSettings', 'Users' => array( 'List' => '/admin/users', 'Add User' => '/admin/users/add' ) ) ); //output menu function function outputMenu ($array, $level) { global $levelMarker; foreach ($array as $key => $value) { if (is_array($value)) { echo $level . $key; echo ''; outputMenu($value, $level . $levelMarker); } else { echo $html->link("$level$key", $value); echo ''; } } echo ""; } //output menu settings $levelMarker = '-'; $level = ''; $linkTreeSimple = array(); //output menu outputMenu($linkTree, $level); --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
jquery / Ajax help
I have integrated jquery with my pagination but having trouble adding a history plugin . So if a user leaves the pagination page then clicks back in the browser it will load up where they left off. Has anyone added a feature like this to pagination and managed to get it working? Any help or name of the history plugin you used wuld be great. Thanks Dave --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: console cant connect to the database
hello, i got the same problem, and i am also using wamp as server, though i use sqlite for db it works perfectly fine from website (on handmade models) console was set like its shown in screencasts from cake bakery i would be thankfull if someone could solve our problem On 10 Sie, 09:43, ondrobaco wrote: > hello, im trying tobakean application. > the database is installed and the cakephp screen saying that the > application can connect to mysql. when i tried tobakethe models > using console, it says that it the database doesnt have a tables > (which it does) and comes up with this error message: > > What would you like toBake? (D/M/V/C/P/Q)> m > > ---BakeModel > Path: C:\wamp\www\textback\models\ > --- > > Warning: mysql_connect(): Can't connect to MySQL server on > '127.0.0.1' (10061) i > n C:\wamp\cake\cake\libs\model\datasources\dbo\dbo_mysql.php on line > 374 > > Warning: mysql_select_db(): supplied argument is not a valid MySQL- > Link resource > in C:\wamp\cake\cake\libs\model\datasources\dbo\dbo_mysql.php on line > 379 > > Warning: mysql_get_server_info(): supplied argument is not a valid > MySQL-Link re > source in C:\wamp\cake\cake\libs\model\datasources\dbo\dbo_mysql.php > on line 387 > > Warning: mysql_query(): supplied argument is not a valid MySQL-Link > resource in > C:\wamp\cake\cake\libs\model\datasources\dbo\dbo_mysql.php on line 411 > Error: Your database does not have any tables. > > any help is greatly appreciated. thank you --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Sessions and Redirect
Er... Sorry, you're right. My code example was wrong, but using Session->check ('key') ?> it also returns false. It creates two sessions (entries) in the database (cake_sessions). What i'm doing exactly: 1. User comes from an external site (eg. google.com) to an user- protected page (eg. mydomain.com/post/add) (user must login to access the page) 2. Cakephp stores the page the user wants to access in the session 3. User is redirected redirect('/users/login'); ?> 4. User authenticates and returns to Session->read ('referer'); ?> (note: if using referer() ?> in this case, it returns the original off-site address (google.com), not the first address the user tried to reach (mydomain.com/post/add)). Still need help. Please? Thanks! On Aug 11, 11:52 am, Robert P wrote: > In TwoController::bug() your call to SessionComponent seems > nonsensical. Looking at what you are trying to do it should either be > > $this->Session->check('key') which should return TRUE since you set > this value in OneController::start(), or > > ($this->Session->read('key') == 'info') which should also return TRUE > for the above reason > > On Aug 11, 10:06 pm, LS wrote: > > > Hello, everyone. > > > I'm into a dead end and I can't seem to get this session and redirect > > things right... > > > I've tested this using cakephp, php and database session methods. > > > I have two controllers and one action in each one, like this: > > > > > class OneController extends AppController { > > function start() { > > $this->Session->write('key', 'info'); > > $this->redirect('/two/bug'); > > // exit; // <<-- with or without this, I get the error. > > } > > (...) > > ?> > > > other file > > > > class TwoController extends AppController { > > function bug() { > > if ($this->Session->check('info')) { > > // This never happens! > > echo("working"); > > } > > } > > > } > > > ?> > > > When I check the database, I see two sessions, one with the info that > > was written on the controller "one", and another one almost empty > > (only timeout and other info). > > > I've even set the > false); ?> on the core.php file, but it still no good. > > > Can someone enlight me, please? > > Thanks! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: server transfer problem
Being a sys admin of a shared server a lot of cpanel servers do not server php on the. ~username. I would first check that On 8/11/09, Robert P wrote: > > According to the comments in /app/config/core.php: > 1. Delete ALL .htaccess files, and then > 2. Uncomment the line that sets App.baseUrl in /app/config/core.php > > But then again, the only times I played around with CakePHP without > mod_rewrite was pre-1.0 > > On Aug 12, 4:25 am, brian wrote: >> I'm having some trouble getting a site working on another server. The >> people the client hired are using cPanel, PHP is installed as CGI, and >> mod_rewrite is not available. Additionally, I have to access their >> version of the site through an IP address plus a home subdirectory, >> eg: >> >> http://xxx.xxx.xxx.xxx./~foo/ >> >> The directory structure: >> >> /home/foo/public_html/index.php >> /home/foo/public_html/app/ >> /home/foo/public_html/app/webroot/ >> /home/foo/public_html/cake/ >> >> However, I'm just getting 404s (Apache's, not Cake's). Even a regular >> file in public_html is not found. >> >> I had this working (almost) with the contents of webroot in >> public_html and app & cake outside that. But I ran into trouble with >> the lack of mod_rewrite and gave up on that. Now, I can't seem to get >> anything to show up. Anyone have an idea? > > > -- Sent from my mobile device --~--~-~--~~~---~--~~ 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: Want to add another application in cake
You can use use mod_rewrite to redirect all the old urls to their Cake equivalents. http://www.yourhtmlsource.com/sitemanagement/urlrewriting.html On Aug 11, 7:43 pm, Vijay wrote: > My old site is in simple php.We have developed a new version of that > site using cakephp. > Now we want to add the old site in the cakephp. > > But the google search gives the old site links.So i want to maintain > the old site too along with new version which is in cakephp. > > Can anybody help me in 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 -~--~~~~--~~--~--~---
Re: server transfer problem
According to the comments in /app/config/core.php: 1. Delete ALL .htaccess files, and then 2. Uncomment the line that sets App.baseUrl in /app/config/core.php But then again, the only times I played around with CakePHP without mod_rewrite was pre-1.0 On Aug 12, 4:25 am, brian wrote: > I'm having some trouble getting a site working on another server. The > people the client hired are using cPanel, PHP is installed as CGI, and > mod_rewrite is not available. Additionally, I have to access their > version of the site through an IP address plus a home subdirectory, > eg: > > http://xxx.xxx.xxx.xxx./~foo/ > > The directory structure: > > /home/foo/public_html/index.php > /home/foo/public_html/app/ > /home/foo/public_html/app/webroot/ > /home/foo/public_html/cake/ > > However, I'm just getting 404s (Apache's, not Cake's). Even a regular > file in public_html is not found. > > I had this working (almost) with the contents of webroot in > public_html and app & cake outside that. But I ran into trouble with > the lack of mod_rewrite and gave up on that. Now, I can't seem to get > anything to show up. Anyone have an idea? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
server transfer problem
I'm having some trouble getting a site working on another server. The people the client hired are using cPanel, PHP is installed as CGI, and mod_rewrite is not available. Additionally, I have to access their version of the site through an IP address plus a home subdirectory, eg: http://xxx.xxx.xxx.xxx./~foo/ The directory structure: /home/foo/public_html/index.php /home/foo/public_html/app/ /home/foo/public_html/app/webroot/ /home/foo/public_html/cake/ However, I'm just getting 404s (Apache's, not Cake's). Even a regular file in public_html is not found. I had this working (almost) with the contents of webroot in public_html and app & cake outside that. But I ran into trouble with the lack of mod_rewrite and gave up on that. Now, I can't seem to get anything to show up. Anyone have an idea? --~--~-~--~~~---~--~~ 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: internationalization in model
Hi, for future reference, this is IMHO the most elegant solution for this problem: http://cake.eizoku.com/blog/?p=30#comment-8 Cheers, tobi_one On Jul 29, 4:07 am, "Dr. Loboto" wrote: > With Model::invalidate() method reload you do not have such problems > at all. > > On Jul 29, 12:17 am,tobi_one wrote: > > > Hi, > > > I am using __() internationalization in my model as described here: > > >http://groups.google.com/group/cake-php/browse_thread/thread/fa32c81a... > > > It works great, but there is one problem. I set the language of the > > app in the beforefilter of the app_controller. Apparently the models > > are loaded before this and so the models always return the default > > language. > > > Where do you guys set the language of the app? Especially if you are > > using the __contruct method as mentioned in the post from above. > > > Thanks! > > > Cheers, > >tobi_one > > --~--~-~--~~~---~--~~ 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: clearCache() unexpected behavior
Think it only deletes files under tmp/cache/views --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
RE: Pagination Help
Perfect...the if ($this->RequestHandler->isAjax()) { $this->viewPath = 'elements/users'; $this->render('pagination'); } Did the trick. Thanks Dave -Original Message- From: brian [mailto:bally.z...@gmail.com] Sent: August-11-09 3:42 PM To: cake-php@googlegroups.com Subject: Re: Pagination Help If you place the markup that lists the posts in an element, you can specify to render just that, instead of the entire view, for AJAX requests. Here's an example that works for me. views/users/index.ctp: Member Directory element('users/pagination') ?> views/elements/users/pagination.ctp: sort('Name', 'User.last_name', array('title' => 'sort by last name')) ?> sort('Organization', 'User.organization', array('title' => 'sort by organization')) ?> sort('Country', 'User.country', array('title' => 'sort by country')) ?> element('paginator_links') ?> ... users_controller.php: public function index() { $this->set('users', $this->paginate('User')); /* render only the element for AJAX requests */ if ($this->RequestHandler->isAjax()) { $this->viewPath = 'elements/users'; $this->render('pagination'); } } users.js: $(function() { stripeRows('#user_list tbody'); initAsyncUserPagination(); }); /** * Initialise AJAX requests for the users table. * Both the pagination and sort links will be bound so that * requests are made asynchronously. */ function initAsyncUserPagination() { $('#user_list .PaginationLinks a, #user_list thead a').click(function() { $('#user_list').fadeTo('fast', 0.1); $('#content').loading(true); var href = $(this).attr('href'); /* fetch the form */ $.ajax({ url: href, cache: false, success: function(html) { $('#content').loading(false); /* replace the entire #user_list table */ $('#user_list').replaceWith(html).fadeTo('slow', 100); stripeRows('#user_list tbody'); /* call this function again to init new content */ initAsyncUserPagination(); } }); return false; }); } function stripeRows(selector) { $(selector + ' tr:nth-child(even)').addClass('Odd'); } On Tue, Aug 11, 2009 at 1:10 PM, Dave Maharaj :: WidePixels.com wrote: > I have the ajax jquery pagintiion set up no problem. > > I am using a default layout,single column for content. > > Now when i load the posts page (which has the pagination) the index > view is split into 2 columns, right side is menu, left side is the > paginator. But when i click next, the 2 column loads into the pagination div. > > I put just the pagination content into an element and load element > from the view, click next and it stll loads the full view. > > How can only load the pagination into a div. I know it has todo with > my index function because it loads the default template which then > pulls the index view which has the 2 cols...so when i load the ajax > pagination the index function is still pulling the full view. > > Dave > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Want to add another application in cake
My old site is in simple php.We have developed a new version of that site using cakephp. Now we want to add the old site in the cakephp. But the google search gives the old site links.So i want to maintain the old site too along with new version which is in cakephp. Can anybody help me in 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 -~--~~~~--~~--~--~---
Re: Using Javascript link
My original javascript code actually worked on a site (no setup with cakephp). The problem I'm having is linking everything together. I do appreciate the advice w/ the javascript though. :) --~--~-~--~~~---~--~~ 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: Ajax Errors
I actually ending up using this: http://deadlytechnology.com/scripts/javascript/ajax-failure-callback/ It sends a 403 server error back if the transaction doesn't validate which triggers my error message in the view. On Aug 11, 2:50 am, Saliem wrote: > I am not quite sure what you are missing but you might want to double > check a couple of things including: > > the name of your aliquot model file, > the validate variable in your aliquot model file and > try using the validationErrors method available for each of the models > created and returning any errors as json > > please see : > > http://book.cakephp.org/view/410/Validating-Data-from-the-Controller > > On Aug 10, 3:42 pm, Tony Thomas wrote: > > > This is something that's so simple, I'm embarrassed to ask. But after > > a few dozen Google searches, I'm going to swallow my pride and post my > > question here. > > > I have a simple ajax function in my controller and I want it to return > > an error is the request is not successful. For example: > > > function ajax_update_box($boxId, $aliquotIds){ > > if ($this->RequestHandler->isAjax()) { // if the request is AJAX > > if($aliquots = $this->Aliquot->validateMove($aliquotIds, > > $boxId)) > > { // make sure a slot is open in the box > > foreach($aliquots as $aliquot_id => $position ) { > > // validateMove > > returns an array > > if > > ($this->Aliquot->save($this->data['Aliquot'] =! true)) { > > Configure::write('debug', 0); > > $this->autoRender = false; > > exit('There was an error and some > > of the aliquots were not > > moved.'); > > } > > } > > > echo $this->unstored(); > > > } else { // this is where I want it to return an error. > > Configure::write('debug', 0); > > $this->autoRender = false; > > exit('The move did not work. Check to see if the > > box is full.'); > > > } > > Configure::write('debug', 0); > > $this->autoRender = false; > > exit(0); > > } > > > } > > > If the request doesn't pass validation in my model, I want to display > > an error message, but I can't seem to get that to work. Everything is > > treated as success. 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: Pagination Help
If you place the markup that lists the posts in an element, you can specify to render just that, instead of the entire view, for AJAX requests. Here's an example that works for me. views/users/index.ctp: Member Directory element('users/pagination') ?> views/elements/users/pagination.ctp: sort('Name', 'User.last_name', array('title' => 'sort by last name')) ?> sort('Organization', 'User.organization', array('title' => 'sort by organization')) ?> sort('Country', 'User.country', array('title' => 'sort by country')) ?> element('paginator_links') ?> ... users_controller.php: public function index() { $this->set('users', $this->paginate('User')); /* render only the element for AJAX requests */ if ($this->RequestHandler->isAjax()) { $this->viewPath = 'elements/users'; $this->render('pagination'); } } users.js: $(function() { stripeRows('#user_list tbody'); initAsyncUserPagination(); }); /** * Initialise AJAX requests for the users table. * Both the pagination and sort links will be bound so that * requests are made asynchronously. */ function initAsyncUserPagination() { $('#user_list .PaginationLinks a, #user_list thead a').click(function() { $('#user_list').fadeTo('fast', 0.1); $('#content').loading(true); var href = $(this).attr('href'); /* fetch the form */ $.ajax({ url: href, cache: false, success: function(html) { $('#content').loading(false); /* replace the entire #user_list table */ $('#user_list').replaceWith(html).fadeTo('slow', 100); stripeRows('#user_list tbody'); /* call this function again to init new content */ initAsyncUserPagination(); } }); return false; }); } function stripeRows(selector) { $(selector + ' tr:nth-child(even)').addClass('Odd'); } On Tue, Aug 11, 2009 at 1:10 PM, Dave Maharaj :: WidePixels.com wrote: > I have the ajax jquery pagintiion set up no problem. > > I am using a default layout,single column for content. > > Now when i load the posts page (which has the pagination) the index view is > split into 2 columns, right side is menu, left side is the paginator. But > when i click next, the 2 column loads into the pagination div. > > I put just the pagination content into an element and load element from the > view, click next and it stll loads the full view. > > How can only load the pagination into a div. I know it has todo with my > index function because it loads the default template which then pulls the > index view which has the 2 cols...so when i load the ajax pagination the > index function is still pulling the full view. > > Dave > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How can I leave entered value even there is an errro and couldn't complete
I don't even know if you *can* set recursive to 6. Use Containable and specify exactly which associations you want. On Tue, Aug 11, 2009 at 1:44 PM, leafchild book wrote: > Hi anurag, > You are saying I have to get POST data manually instead of using validation > ($this->Customer->validates())? > If I set id, then all the new information is replace back with old > information when coming back page with errors. > > Hi brian, > I didn't use Containable, only I do is when I get data I set recursive=6 so > I get all related information, > but this recursive stop working after coming back to page with errors. How > can I still make recursive active > so I don't get an "Undefined index" page. > > Thanks, > leafchild > > > On Tue, Aug 11, 2009 at 8:56 AM, brian wrote: >> >> I can't follow all of that but it seems like you'd be better off using >> Containable. >> >> On Tue, Aug 11, 2009 at 5:06 AM, leafchild >> wrote: >> > >> > Yes, I use $form->input() >> > >> > I found an issue because I was SQL again for the specific data before >> > going back to the page to show user an errors. >> > (I had an code like this that's why I couldn't keep the entered value >> > when there is an error. >> > === >> > function admin_edit(id = null){ >> > if (!empty($this->data)) { >> > ... >> > $this->data = $this->Customer->read(null, $id); >> > } >> > if (empty($this->data)) { >> > ... >> > $this->data = $this->Customer->read(null, $id); >> > } >> > >> > } >> > === >> > I took out the line "$this->data = $this->Customer->read(null, $id);" >> > in "if (!empty($this->data))" statement now I can keep the entered >> > value when there is an error. >> > However, now I have an other issue. >> > >> > In this admin/customers/edit page, I need to set "$this->Customer- >> >>recursive = 6;" to get all kind of information relates to Customer >> > from other table. >> > Either coming back with an error or success updating information(I >> > want to page to back to edit page not index page after "save"), >> > I get "Undefined index" error everywhere in this page because after >> > coming back to page, $this->data has only the information model show >> > relationship(I think,,, I have 4 "has one" relationship in this model >> > (Customer) and only those information is available from $this->data >> > after submit) >> > >> > How can I get "$this->data" has "recursive = 6" data to avoid getting >> > "undefined index" error? >> > >> > >> > thanks, >> > leafchild >> > >> > >> > >> > >> > >> > >> > On Aug 7, 6:22 pm, brian wrote: >> >> Are you using FormHelper to create your form elements? If you do, for >> >> example: >> >> >> >> echo $form->input('Post') >> >> >> >> ... the helper will add the value of the element based upon >> >> $this->data. >> >> >> >> If you are using the helper, maybe you should post your controller and >> >> view code. >> >> >> >> >> >> >> >> On Fri, Aug 7, 2009 at 6:56 PM,leafchild >> >> wrote: >> >> >> >> > I have a page with form. >> >> >> >> > If user entered name, address,,,and ,all kinds of information and >> >> > submit but there is mistakes such as not entered email >> >> > properly and came back to form page with error message. How can I >> >> > keep >> >> > the entered value user entered properly. >> >> >> >> > Currently in my form page, if user has an error, all the entered >> >> > value >> >> > are gone and user has to entered everything. >> > > >> > >> >> > > > > > --~--~-~--~~~---~--~~ 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: Uploading file issue - worning mkdir()
Don't set the permissions wide open for webroot dir! That's not a good idea at all. What is the full path of the directory you want to upload to? I'm sorry, I'm not familiar with the plugin and don't understand your other question about the data. On Tue, Aug 11, 2009 at 4:06 AM, leafchild wrote: > > The uploaded img directory permission is set to 777 and just in case I > even changed webroot permission to 777 > but I'm still seeing same warning message. Where else I need to > check? > > Also how can I stop update with entire file data to database? > > after trying to upload file debug show: > == > [id] =>1 > [uploadfile] => Array > ( > [name] => IMG_0801.JPG > [type] => image/jpeg > [tmp_name] => /tmp/phpbo9DjW > [error] => 0 > [size] => 404887 > ) > [desc] => > ... > === > > uploadfile field needs only file name but looking at sql trying to > update > filed with file array information. > > > > > > > On Aug 7, 6:24 pm, brian wrote: >> Check the permissions for the directory. The webserver has to have >> write access to the dir. >> >> >> >> On Fri, Aug 7, 2009 at 4:02 PM,leafchild wrote: >> >> > I'm trying to make this plugin(http://www.milesj.me/resources/script/ >> > uploader-plugin) works. >> >> > However, after I install I'm getting an error - Warning (2): mkdir() >> > [function.mkdir]: Permission denied [CORE/cake/libs/folder.php, line >> > 466] >> > Actually I tried another behavior to upload file and got same error. >> > Do I need to do some kind of server setting? I'm using MT(dv) >> >> > Also after submit to upload file I'm getting an SQL error because data >> > need to be one but it try to update entire file data: >> >> > == >> > [id] =>1 >> > [uploadfile] => Array >> > ( >> > [name] => IMG_0801.JPG >> > [type] => image/jpeg >> > [tmp_name] => /tmp/phpbo9DjW >> > [error] => 0 >> > [size] => 404887 >> > ) >> > [desc] => >> > ... >> > === >> > "uplodefile" 's data is not array just [NAME] of file. >> >> > How can I stop doing it? I can't use "$this->Landing->save($this- >> >>data)" if I have file uploading? > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How can I leave entered value even there is an errro and couldn't complete
Hi anurag, You are saying I have to get POST data manually instead of using validation ($this->Customer->validates())? If I set id, then all the new information is replace back with old information when coming back page with errors. Hi brian, I didn't use Containable, only I do is when I get data I set recursive=6 so I get all related information, but this recursive stop working after coming back to page with errors. How can I still make recursive active so I don't get an "Undefined index" page. Thanks, leafchild On Tue, Aug 11, 2009 at 8:56 AM, brian wrote: > > I can't follow all of that but it seems like you'd be better off using > Containable. > > On Tue, Aug 11, 2009 at 5:06 AM, leafchild > wrote: > > > > Yes, I use $form->input() > > > > I found an issue because I was SQL again for the specific data before > > going back to the page to show user an errors. > > (I had an code like this that's why I couldn't keep the entered value > > when there is an error. > > === > > function admin_edit(id = null){ > > if (!empty($this->data)) { > >... > > $this->data = $this->Customer->read(null, $id); > > } > > if (empty($this->data)) { > > ... > > $this->data = $this->Customer->read(null, $id); > > } > > > > } > > === > > I took out the line "$this->data = $this->Customer->read(null, $id);" > > in "if (!empty($this->data))" statement now I can keep the entered > > value when there is an error. > > However, now I have an other issue. > > > > In this admin/customers/edit page, I need to set "$this->Customer- > >>recursive = 6;" to get all kind of information relates to Customer > > from other table. > > Either coming back with an error or success updating information(I > > want to page to back to edit page not index page after "save"), > > I get "Undefined index" error everywhere in this page because after > > coming back to page, $this->data has only the information model show > > relationship(I think,,, I have 4 "has one" relationship in this model > > (Customer) and only those information is available from $this->data > > after submit) > > > > How can I get "$this->data" has "recursive = 6" data to avoid getting > > "undefined index" error? > > > > > > thanks, > > leafchild > > > > > > > > > > > > > > On Aug 7, 6:22 pm, brian wrote: > >> Are you using FormHelper to create your form elements? If you do, for > example: > >> > >> echo $form->input('Post') > >> > >> ... the helper will add the value of the element based upon $this->data. > >> > >> If you are using the helper, maybe you should post your controller and > >> view code. > >> > >> > >> > >> On Fri, Aug 7, 2009 at 6:56 PM,leafchild > wrote: > >> > >> > I have a page with form. > >> > >> > If user entered name, address,,,and ,all kinds of information and > >> > submit but there is mistakes such as not entered email > >> > properly and came back to form page with error message. How can I keep > >> > the entered value user entered properly. > >> > >> > Currently in my form page, if user has an error, all the entered value > >> > are gone and user has to entered everything. > > > > > > > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
cake media plugin imagemagick adapter
Hi! Im using the media plugin adapter: http://wiki.github.com/davidpersson/media/configuration By default this plugin is working with the GD adapter (we have both GD and ImageMagick). For us everything works fine, but some uploaded images display a warning: ... gd-jpeg, libjpeg: recoverable error: Corrupt JPEG data: 37... My questions is: How do i set imagemagick to be the default adapter? Thanks in advance. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: URL some page .../id disappeared ?
well, in most cases (and mine: 100%) you use so called "Affenformulare" (http://de.wikipedia.org/wiki/Affenformular) or "ape forms" which have either no adress value or the own one (and post to themselves again) this is the usual cake way anyway - process it in the corresponding controller method and decide what to do with it of course there are always exceptions :) but using the "ape" appraoch you could easily change the name or the method, the form would still work (but the links to it probably not anymore..) i once even baked the view code this way advantage: you can have "apply" instead of "add" and "consider" instead of "edit" and you dont have to change the view code at all On 11 Aug., 17:10, JamesF wrote: > i found that any time i didn't verbosely link i ended up having to > change all sorts of functions whenever my boss wanted a different url > > On Aug 11, 2:29 am, brian wrote: > > > @James > > > I thought at first that looked like a real pain but verbose array > > linking (finding, routing, containing, etc.) is definitely the way to > > go, I agree. It's often self-documenting, for one thing. And it goes > > to the heart of what Cake is, I think. Big kudos to the devs for > > pulling this together so coherently. > > > On Mon, Aug 10, 2009 at 9:53 PM, JamesF wrote: > > > > @euromark > > > > your code is certainly more to the point, but i can't break the habit > > > of verbosely linking all my actions. > > > > On Aug 8, 9:53 pm, "euromark (munich)" > > > wrote: > > >> as i said, i would go with JUST "url"=>"/".$this->params['url]['url'] > > >> in this case there is no need to use "action" or the manually built > > >> url like james suggested > > > >> be aware of the "/" in front of it though (otherwise the url is not > > >> built correctly) > > > >> On 9 Aug., 02:06, JamesF wrote: > > > >> > make sure you $form->create is submitting to the id as a parameter as > > >> > well > > > >> > echo $form->create('FormName', array('url'=>array > > >> > ('controller'=>'myController', 'action'=>'myAction', $id, > > >> > 'admin'=>true))); > > > >> > On Aug 7, 7:13 pm, leafchild wrote: > > > >> > > URL some page .../id disappeared ? > > > >> > > I have site there are different form pages to organize products. > > > >> > > Some form page such as admin_edit page - URL: ... > > >> > > admin/product/edit/ > > >> > > 1 > > >> > > After I submit URL still same either there is an error or not. > > > >> > > However, some form page lose id from URL after submit, > > >> > > and showing index error. > > > >> > > for example, URL: ...admin/category/customer/edit/1 -> ...admin/ > > >> > > category/customer/edit > > >> > > == > > >> > > if (!empty($this->data)) { > > >> > > // empty} > > > >> > > == > > >> > > I deleted all the code inside of if statement for taking care of > > >> > > submitting data. > > >> > > The one keep same URL doesn't show error but other does. > > > >> > > Not sure difference between these two has. > > >> > > I don't know why? Does anyone know what's the issue? --~--~-~--~~~---~--~~ 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: Validating a HABTM relationship
Found a solution: As far as I can tell, the validation methods expect the data all to be in (for example) $this->data['Question']['FunctionalArea']. (See line 2196 of model.php, where the only data considered for validation is in $this->data['Question'].) But the save method expects all the data to be in $this->data ['FunctionalArea']['FunctionalArea']. (See lines 1120-1125 of model.php, which considers everything in $this- >data, including HABTM relationships.) So I my View posts the data to $this->data['FunctionalArea'] ['FunctionalArea'], and in the Controller I copy it to $this->data ['Question']['FunctionalArea'], so that both validation and saving work. On Aug 10, 5:24 pm, mcrawford wrote: > Hmm, this is not quite right either. Now the associated models do not > save... > According tohttp://book.cakephp.org/view/85/Saving-Related-Model-Data-HABTM > I should be using > $form->input('FunctionalArea') > but that doesn't work with the validation. But it does work with the > save function. > > Dave, thanks, I did find that link when Googling for a solution. I was > hoping to avoid writing my own validation method since the multiple > one does exist, although it doesn't sound like people are having > success using it. > > On Aug 10, 11:49 am, mcrawford wrote: > > > Ah, I found it in the Form helper... > > > $form->input('Question.FunctionalArea') > > > I need to use the full dot-separated name of the field to get the form > > field to be what the validation is expecting. > > > On Aug 10, 11:32 am, mcrawford wrote: > > > > Hi, > > > > I have a model set up like this: > > > > class Question extends AppModel { > > > var $name = 'Question'; > > > var $hasAndBelongsToMany = array( > > > 'FunctionalArea' => array('joinTable' => > > > 'question_functions') > > > ); > > > var $validate = array( > > > 'title' => 'notEmpty', > > > 'content' => 'notEmpty', > > > 'FunctionalArea' => array( > > > 'rule' => array('multiple', array('min'=>1)), > > > 'required' => true > > > ) > > > ); > > > > } > > > > Then in my form I set up an input with FunctionalArea as the field > > > name, using Cake's form helper. This produces an input with name="data > > > [FunctionalArea][FunctionalArea][]". Now if I save the form with NO > > > validation, the vanilla $this->Question->save($this->data); works just > > > fine. The join table is all correct after saving. > > > > But when I put in that validation for FunctionalArea that I have in > > > the above code, the validation doesn't work correctly. The model's > > > invalidFields method does this: > > > if (isset($data[$this->alias])) { > > > $data = $data[$this->alias];} > > > > So that the data in data[FunctionalArea][FunctionalArea] never gets to > > > the validate method. So the validation always fails (because > > > FunctionalArea is required). > > > > My question is: what is the correct Cake way to do this? I'm trying to > > > use the automatic save feature, form fields, and the validation, but I > > > don't see how I can use them together, because the validation seems to > > > be ignoring the very place where the save needs the data. > > --~--~-~--~~~---~--~~ 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: Uploading file issue - worning mkdir()
Hi Anurag, Thank you for the comment. Where is your upload file directory? Is still in webroot? Thanks, leafchild On Tue, Aug 11, 2009 at 1:43 AM, anurag pal wrote: > Hi, > > I have the same issue. I found that its using different path for > uploading file. > > For stopping details to database just first upload the file and then > insert or update record in database. > > If you can provide the source code it would be better to diagnose the > problem. > > Regards, > Anurag Pal > > On Aug 11, 1:06 pm, leafchild wrote: > > The uploaded img directory permission is set to 777 and just in case I > > even changed webroot permission to 777 > > but I'm still seeing same warning message. Where else I need to > > check? > > > > Also how can I stop update with entire file data to database? > > > > after trying to upload file debug show: > > == > > [id] =>1 > > [uploadfile] => Array > >( > >[name] => IMG_0801.JPG > >[type] => image/jpeg > >[tmp_name] => /tmp/phpbo9DjW > >[error] => 0 > >[size] => 404887 > >) > > [desc] => > > ... > > === > > > > uploadfile field needs only file name but looking at sql trying to > > update > > filed with file array information. > > > > On Aug 7, 6:24 pm, brian wrote: > > > > > Check the permissions for the directory. The webserver has to have > > > write access to the dir. > > > > > On Fri, Aug 7, 2009 at 4:02 PM,leafchild > wrote: > > > > > > I'm trying to make this plugin( > http://www.milesj.me/resources/script/ > > > > uploader-plugin) works. > > > > > > However, after I install I'm getting an error - Warning (2): mkdir() > > > > [function.mkdir]: Permission denied [CORE/cake/libs/folder.php, line > > > > 466] > > > > Actually I tried another behavior to upload file and got same error. > > > > Do I need to do some kind of server setting? I'm using MT(dv) > > > > > > Also after submit to upload file I'm getting an SQL error because > data > > > > need to be one but it try to update entire file data: > > > > > > == > > > > [id] =>1 > > > > [uploadfile] => Array > > > > ( > > > > [name] => IMG_0801.JPG > > > > [type] => image/jpeg > > > > [tmp_name] => /tmp/phpbo9DjW > > > > [error] => 0 > > > > [size] => 404887 > > > > ) > > > > [desc] => > > > > ... > > > > === > > > > "uplodefile" 's data is not array just [NAME] of file. > > > > > > How can I stop doing it? I can't use "$this->Landing->save($this- > > > >>data)" if I have file uploading? > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Pagination Help
I have the ajax jquery pagintiion set up no problem. I am using a default layout,single column for content. Now when i load the posts page (which has the pagination) the index view is split into 2 columns, right side is menu, left side is the paginator. But when i click next, the 2 column loads into the pagination div. I put just the pagination content into an element and load element from the view, click next and it stll loads the full view. How can only load the pagination into a div. I know it has todo with my index function because it loads the default template which then pulls the index view which has the 2 cols...so when i load the ajax pagination the index function is still pulling the full view. Dave --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Hi i am newbie !
Don't use 1.1, I'd recommend using 1.2 blog tutorial http://book.cakephp.org/view/219/Blog On Aug 11, 9:26 am, pomares wrote: > This tutorial is a good way to start: > > http://book.cakephp.org/view/326/The-Cake-Blog-Tutorial > > On Aug 11, 9:43 am, sunny wrote: > > > Can any body tell me how build new project in cake php! --~--~-~--~~~---~--~~ 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: Hi i am newbie !
This tutorial is a good way to start: http://book.cakephp.org/view/326/The-Cake-Blog-Tutorial On Aug 11, 9:43 am, sunny wrote: > Can any body tell me how build new project in cake php! --~--~-~--~~~---~--~~ 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: PDF reader in view without new header
Thnx Martin, that solved the problem ;-) --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Hi i am newbie !
Can any body tell me how build new project in cake php! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How can I leave entered value even there is an errro and couldn't complete
I can't follow all of that but it seems like you'd be better off using Containable. On Tue, Aug 11, 2009 at 5:06 AM, leafchild wrote: > > Yes, I use $form->input() > > I found an issue because I was SQL again for the specific data before > going back to the page to show user an errors. > (I had an code like this that's why I couldn't keep the entered value > when there is an error. > === > function admin_edit(id = null){ > if (!empty($this->data)) { > ... > $this->data = $this->Customer->read(null, $id); > } > if (empty($this->data)) { > ... > $this->data = $this->Customer->read(null, $id); > } > > } > === > I took out the line "$this->data = $this->Customer->read(null, $id);" > in "if (!empty($this->data))" statement now I can keep the entered > value when there is an error. > However, now I have an other issue. > > In this admin/customers/edit page, I need to set "$this->Customer- >>recursive = 6;" to get all kind of information relates to Customer > from other table. > Either coming back with an error or success updating information(I > want to page to back to edit page not index page after "save"), > I get "Undefined index" error everywhere in this page because after > coming back to page, $this->data has only the information model show > relationship(I think,,, I have 4 "has one" relationship in this model > (Customer) and only those information is available from $this->data > after submit) > > How can I get "$this->data" has "recursive = 6" data to avoid getting > "undefined index" error? > > > thanks, > leafchild > > > > > > > On Aug 7, 6:22 pm, brian wrote: >> Are you using FormHelper to create your form elements? If you do, for >> example: >> >> echo $form->input('Post') >> >> ... the helper will add the value of the element based upon $this->data. >> >> If you are using the helper, maybe you should post your controller and >> view code. >> >> >> >> On Fri, Aug 7, 2009 at 6:56 PM,leafchild wrote: >> >> > I have a page with form. >> >> > If user entered name, address,,,and ,all kinds of information and >> > submit but there is mistakes such as not entered email >> > properly and came back to form page with error message. How can I keep >> > the entered value user entered properly. >> >> > Currently in my form page, if user has an error, all the entered value >> > are gone and user has to entered everything. > > > --~--~-~--~~~---~--~~ 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: expired cache files
Any insight everyone? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: how to match two form->select?
I couldn't run your example. There are many things missing, but you gave me a valuable tip and I learned how to do. Thanks. On 10 ago, 13:52, Marcelo Andrade wrote: > On Sun, Aug 9, 2009 at 5:09 PM, Persivo Cunha wrote: > > > Hi, I have two form->select and i want that after option of one be > > choice, values of other select change. > > > For example, > > > select 1: > > option: A > > option: B > > > if I choose option A, select 2 will show C and D > > if I choose option B, select 2 will show E and F > > > what should I do? > > Check the ajax helper observeField. > > An ilustrative non-tested example: > > [form view] > select('Model.select1', array('A', 'B')); ?> > > > > observeField('ModelSelect1', array( > 'update'=> 'select2' > , 'url'=> '/your/action' > )); ?> > > [your controller] > function action() { > if( !empty($this->data) ) { > if( $this->data['Model']['select1'] == 'A' ) > $options= array('C', 'D'); > elseif( $this->data['Model']['select1'] == 'B' ) > $options= array('E', 'F'); > } > $this->set(compact('options')); > > } > > [you action-view] > > > > > > > I hope it helps. > > Best regards. > > -- > MARCELO DE F. ANDRADE > Belem, PA, Amazonia, Brazil > Linux User #221105 > > http://mfandrade.wordpress.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: PDF reader in view without new header
Have you tried removing /app/webroot from the $html->url call? Not sure if that will fix all your issues but that is where I would start. On Aug 11, 7:54 am, RugerJ wrote: > How can you show a pdf file within a view without setting the header > to pdf. > > I tried to embed it like this: > > HEIGHT=450 WIDTH=555> Your browser does not support embedded > PDF files. > > But that doesn't work because of the routing >> says controller not > found. > Is there a way around? > > Thnx in advance --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: PDF reader in view without new header
Since you are pointing to a real file that exists and is readable (right?) your problem is probably not header. The url method is for controllers and actions. Try using the webroot method. You supply it with the path you want and it will add the base url for you. echo $html->webroot('css/screen.css') //--> /css/screen.css Under a normal production install that would simply be adding the initial /. /Martin On Aug 11, 4:54 pm, RugerJ wrote: > How can you show a pdf file within a view without setting the header > to pdf. > > I tried to embed it like this: > > HEIGHT=450 WIDTH=555> Your browser does not support embedded > PDF files. > > But that doesn't work because of the routing >> says controller not > found. > Is there a way around? > > Thnx in advance --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Access non CakePHP session from within CakePHP
The $_SESSION array should have what your looking for. On Aug 11, 12:15 am, Fabs wrote: > G'day all > > I'm integrating CakePHP into a legacy CMS. The CMS stores all of its > session data in the generic php session (it never calls session_name > ()). I need to retrieve this session data to prevent requiring users > to log in twice to use the old and the new functions. Is there a way > to do this? > > Thanks everyone. --~--~-~--~~~---~--~~ 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: Function Find - problem
It would be helpful if you posted the actual code of your find(), but it would appear that you are not forming your conditions array correctly. I haven't had any issues using LIKE, and maybe this link will help : http://book.cakephp.org/view/74/Complex-Find-Conditions ."Book.title LIKE" => "A%" should give you the results your looking for. On Aug 11, 5:40 am, boobalan wrote: > i found some difficulties using function find(), > / > SELECT `Book`.`isbn`, `Book`.`title`, `Book`.`author_name` FROM > `books` AS `Book` WHERE `Book`.`title` = 'LIKE 'A%' ORDER BY > `Book`.`title` ASC > // > In this query, i can't retrieve data because the conditions pasted in > this query is wrong > WHILE using LIKE in a query we can't use '=' symbol so suggest a > solution for this. > > Boobalan.M --~--~-~--~~~---~--~~ 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: Storing arrays in the database (one field many values)
Hi please disregard my last post. I found the answers at http://book.cakephp.org/view/78/Associations-Linking-Models-Together Thanks :) On Aug 11, 2:47 pm, Rawna wrote: > Do I need to set foreign keys (author_id, book_id) to the tables > (books, authors)? How do I make my views have multiple selection > fields and how do I store them (because they're in an array)? > > On Aug 7, 10:15 am, Robert P wrote: > > > Well, if Books can have more than one Author in your system then it's: > > Authors hasAndBelongsToMany Books > > Books hasAndBelongsToMany Authors > > > But if each book can only have one Author then it would be: > > Authors hasMany Books > > Book belongsTo Author > > > with the foreign keys set up as required. > > > Please read the Cookbook > > -http://book.cakephp.org/view/78/Associations-Linking-Models-Together > > > On Aug 7, 8:29 am,Rawna wrote: > > > > On Aug 7, 2:48 am, Vijay Kumbhar wrote: > > > > > Better way please create new table that will take the book_id & the > > > > auther_id so that you can associate the models. > > > > What Model relationship should I do to create that? Could you please > > > give an example? --~--~-~--~~~---~--~~ 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: Custom library functions
If you start adding more functions you may want to put them into a separate file. The top of my bootstrap.php looks like this: // This would mess things up royally--> App::import('Vendor', 'basics'); require_once(APP.'vendors'.DS.'basics.php'); I mention it mostly because you have to do a good old require unless you want Cake's internals all confused. App::import() can't be used because of Cake's bootstrapping order. Simply put bootstrap.php is loaded before the "App" is ready to run. It took me a lot of time and effort to track down that this was the cause for all sorts of strangeness. /Martin On Aug 11, 4:54 pm, Robert P wrote: > The file /app/config/bootstrap.php is there for this exact reason. > > On Aug 11, 8:56 pm, alaxos wrote: > > > > > Hello, > > > I have tried to figure out what would be the best way to add generic > > functions to an app, in order to then be able to use them everywhere > > in a Cake application. > > > I wrote some time ago (nothing to do with cake) classes with methods > > that I use to do different things. They are generic classes, that I > > use for instance to manipulate strings, or whatever. > > > I could off course copy/paste them in my components or helper that > > need them, but I would prefer to have it written at only one place, > > and be able to call it from everywhere. > > > I could also for instance include the files I need somewhere in the > > app (in 'app_controller.php' maybe). > > > But I'd like to know what would be the best way to do it in order to > > respect the Cake guidelines ? > > > Thanks ! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: URL some page .../id disappeared ?
i found that any time i didn't verbosely link i ended up having to change all sorts of functions whenever my boss wanted a different url On Aug 11, 2:29 am, brian wrote: > @James > > I thought at first that looked like a real pain but verbose array > linking (finding, routing, containing, etc.) is definitely the way to > go, I agree. It's often self-documenting, for one thing. And it goes > to the heart of what Cake is, I think. Big kudos to the devs for > pulling this together so coherently. > > On Mon, Aug 10, 2009 at 9:53 PM, JamesF wrote: > > > @euromark > > > your code is certainly more to the point, but i can't break the habit > > of verbosely linking all my actions. > > > On Aug 8, 9:53 pm, "euromark (munich)" > > wrote: > >> as i said, i would go with JUST "url"=>"/".$this->params['url]['url'] > >> in this case there is no need to use "action" or the manually built > >> url like james suggested > > >> be aware of the "/" in front of it though (otherwise the url is not > >> built correctly) > > >> On 9 Aug., 02:06, JamesF wrote: > > >> > make sure you $form->create is submitting to the id as a parameter as > >> > well > > >> > echo $form->create('FormName', array('url'=>array > >> > ('controller'=>'myController', 'action'=>'myAction', $id, > >> > 'admin'=>true))); > > >> > On Aug 7, 7:13 pm, leafchild wrote: > > >> > > URL some page .../id disappeared ? > > >> > > I have site there are different form pages to organize products. > > >> > > Some form page such as admin_edit page - URL: ... admin/product/edit/ > >> > > 1 > >> > > After I submit URL still same either there is an error or not. > > >> > > However, some form page lose id from URL after submit, > >> > > and showing index error. > > >> > > for example, URL: ...admin/category/customer/edit/1 -> ...admin/ > >> > > category/customer/edit > >> > > == > >> > > if (!empty($this->data)) { > >> > > // empty} > > >> > > == > >> > > I deleted all the code inside of if statement for taking care of > >> > > submitting data. > >> > > The one keep same URL doesn't show error but other does. > > >> > > Not sure difference between these two has. > >> > > I don't know why? Does anyone know what's the issue? --~--~-~--~~~---~--~~ 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: Log Errors when debug = 0?
libs/error.php doesn't deal with php errors. I was poking around there myself earlier. What I did find was: Cake sets up how much php should report on lines 293-312 of libs/ configure.php To setup your own error handler you can sneak a peek at lines 570 and 165-232 of libs/debugger.php. This is where Cake captures PHP errors and prints them with nice contexts and things. I imagine you can override these settings and display or log PHP errors as you wish even without modifying the Core. (all line numbers are for the current release version 1.2.4) /Martin On Aug 11, 3:44 pm, Rick wrote: > Look in the cake/libs/error.php class. You may be able to override > something there and make log output work. I don't know where in the > hierarchy of cake you would need to put the override to make it work. > Maybe some expert can contribute here. > > Rick > > On Aug 11, 3:31 am, bram wrote: > > > > > I do know it's possible to write all cake debugging and error info to > > the log file. But I don't know how to enable it without a small > > modification in the cake source code. I've asked a similar question a > > couple of days ago, but no replies > > >http://groups.google.com/group/cake-php/msg/05dfde6ad7ebfed2?hl=en > > > Bram > > > On Aug 10, 11:22 pm, David wrote: > > > > I would like to silently write errors to error.log when in production > > > mode. It would be useful to catch anything going wrong that I hadn't > > > previously noticed. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
PDF reader in view without new header
How can you show a pdf file within a view without setting the header to pdf. I tried to embed it like this: Your browser does not support embedded PDF files. But that doesn't work because of the routing >> says controller not found. Is there a way around? Thnx in advance --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Custom library functions
The file /app/config/bootstrap.php is there for this exact reason. On Aug 11, 8:56 pm, alaxos wrote: > Hello, > > I have tried to figure out what would be the best way to add generic > functions to an app, in order to then be able to use them everywhere > in a Cake application. > > I wrote some time ago (nothing to do with cake) classes with methods > that I use to do different things. They are generic classes, that I > use for instance to manipulate strings, or whatever. > > I could off course copy/paste them in my components or helper that > need them, but I would prefer to have it written at only one place, > and be able to call it from everywhere. > > I could also for instance include the files I need somewhere in the > app (in 'app_controller.php' maybe). > > But I'd like to know what would be the best way to do it in order to > respect the Cake guidelines ? > > Thanks ! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Sessions and Redirect
In TwoController::bug() your call to SessionComponent seems nonsensical. Looking at what you are trying to do it should either be $this->Session->check('key') which should return TRUE since you set this value in OneController::start(), or ($this->Session->read('key') == 'info') which should also return TRUE for the above reason On Aug 11, 10:06 pm, LS wrote: > Hello, everyone. > > I'm into a dead end and I can't seem to get this session and redirect > things right... > > I've tested this using cakephp, php and database session methods. > > I have two controllers and one action in each one, like this: > > > class OneController extends AppController { > function start() { > $this->Session->write('key', 'info'); > $this->redirect('/two/bug'); > // exit; // <<-- with or without this, I get the error. > } > (...) > ?> > > other file > > class TwoController extends AppController { > function bug() { > if ($this->Session->check('info')) { > // This never happens! > echo("working"); > } > } > > } > > ?> > > When I check the database, I see two sessions, one with the info that > was written on the controller "one", and another one almost empty > (only timeout and other info). > > I've even set the false); ?> on the core.php file, but it still no good. > > Can someone enlight me, please? > Thanks! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Multidimensional array as named argument
Is it possible to pass an array through named arguments and have it accessible via $this->passedArgs? How would you convert an array as such to a named argument Array ( [foo] => "foo1" [bar] => Array ( [0] => "bar0" [1] => "bar1" ) ) it becomes foo:foo1/bar:Array if passed to Router::url to generate the url Is it not possible to have arrays in named arguments? Then how can we handle multiple values generated by multiple selects or checkboxes? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Sessions and Redirect
Hello, everyone. I'm into a dead end and I can't seem to get this session and redirect things right... I've tested this using cakephp, php and database session methods. I have two controllers and one action in each one, like this: Session->write('key', 'info'); $this->redirect('/two/bug'); // exit; // <<-- with or without this, I get the error. } (...) ?> other file Session->check('info')) { // This never happens! echo("working"); } } } ?> When I check the database, I see two sessions, one with the info that was written on the controller "one", and another one almost empty (only timeout and other info). I've even set the on the core.php file, but it still no good. Can someone enlight me, please? Thanks! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Log Errors when debug = 0?
Look in the cake/libs/error.php class. You may be able to override something there and make log output work. I don't know where in the hierarchy of cake you would need to put the override to make it work. Maybe some expert can contribute here. Rick On Aug 11, 3:31 am, bram wrote: > I do know it's possible to write all cake debugging and error info to > the log file. But I don't know how to enable it without a small > modification in the cake source code. I've asked a similar question a > couple of days ago, but no replies > > http://groups.google.com/group/cake-php/msg/05dfde6ad7ebfed2?hl=en > > Bram > > On Aug 10, 11:22 pm, David wrote: > > > I would like to silently write errors to error.log when in production > > mode. It would be useful to catch anything going wrong that I hadn't > > previously noticed. > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Custom library functions
Hello, I have tried to figure out what would be the best way to add generic functions to an app, in order to then be able to use them everywhere in a Cake application. I wrote some time ago (nothing to do with cake) classes with methods that I use to do different things. They are generic classes, that I use for instance to manipulate strings, or whatever. I could off course copy/paste them in my components or helper that need them, but I would prefer to have it written at only one place, and be able to call it from everywhere. I could also for instance include the files I need somewhere in the app (in 'app_controller.php' maybe). But I'd like to know what would be the best way to do it in order to respect the Cake guidelines ? Thanks ! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Access Permissions
I have an Auth Acl setup working fine. I have scope-> Users.confirmed to verify they confirmed their email before they can login in...no problem. Now I have added User.status which is: default 0 = pending admin approval 1 = active 2= suspended Now I have 3 scenarios to allow access to the site (all based on User.confirmed = true) So if User.status = 0 they can only access their profile User.status = 1 they have full access to the site User.status = 2 they cant do anything What would be the best way set up these additional permission checks after the user has logged in? My ACL is restricting controllers/actions based on group_id. Dave --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Function Find - problem
i found some difficulties using function find(), / SELECT `Book`.`isbn`, `Book`.`title`, `Book`.`author_name` FROM `books` AS `Book` WHERE `Book`.`title` = 'LIKE 'A%' ORDER BY `Book`.`title` ASC // In this query, i can't retrieve data because the conditions pasted in this query is wrong WHILE using LIKE in a query we can't use '=' symbol so suggest a solution for this. Boobalan.M --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Using usort in Cake
Sorry for the mixed quotes. --~--~-~--~~~---~--~~ 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: lazy loading?
@demon that looks promising i'll check it out, thx On 11 Aug., 11:38, evilbloodydemon wrote: > take a look tohttp://github.com/mcurry/lazy_loader/tree/master > > On Aug 10, 8:13 pm, Martin Westin wrote: > > > Typical me. I never got to my real point. > > > I wanted to say that if you are having serious performance problems > > even while containing queries then that is a bit odd. What is the > > difference if you bench an action with the unneeded associations > > commented out completely (which should keep the models from loading at > > all)? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Using usort in Cake
For future refernce, you would use: usort($fruits, array(&$this, 'cmp")); --~--~-~--~~~---~--~~ 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: Array help
Thanks Joshua, That works just as needed. Dave _ From: joshua [mailto:josh...@gmail.com] Sent: August-11-09 1:14 AM To: cake-php@googlegroups.com Subject: Re: Array help I think you can define a model level filter, it will help you to solve this problem thoroughly. Just an idea of mine. Maybe you can put the filter engine in AppModel. [Client] > {Filter engine} > [Server] [Client] <--- {Filter engine} < [Server] For a temporary solution, I think the loop is enough: Assume the return result something like this: [0] => Array ( [Bookmark] => Array ( [id] => 38b7276f708 [user_id] => 4a5d569f-b9e8-416d-b34c-11cf4adcd75b [post_id] => 11e7ee [created] => 2009-08-09 21:59:01 ) [Post] => Array ( [title] => Test Title [rank] => 2 [created] => [description] => Test dscription [id] => 52louj ) ) [1] => Array ( [Bookmark] => Array ( [id] => 38b7276f708 [user_id] => 4a5d569f-b9e8-416d-b34c-11cf4adcd75b [post_id] => 11e7ee [created] => 2009-08-09 21:59:01 ) [Post] => Array ( [title] => [rank] => [created] => [description] => [id] => ) ) [CODE] foreach ($bookmarks as $key => $value) { if (empty($value['Post']['id'])) { unset($bookmarks[$key]['Post']); } } [/CODE] On Tue, Aug 11, 2009 at 11:19 AM, Dave Maharaj :: WidePixels.com wrote: The thing is the Post info is there in the database Scenario: The Post article has access level of 1 User that has an access level of 1 can see the Post and bookmark it. No problem Later the owner of the Post changes the access level to 3the user with level 1 access can no loger see that Post because his access level is too low, but his Bookmark for that Post still exists. But because the contain will pull all bookmarks that belongto the user andgetthe Posts where $access = 'Post.access' that info is no longer goingto get pulled, thats why it appears blank. So I need to completely remove that bookmark from the array. Trying something like: foreach ($bookmark as $key => $value) { if (empty($value)) { unset($q[$key]); but cant get it to work...still messing around with it _ From: joshua [mailto:josh...@gmail.com] Sent: August-11-09 12:41 AM To: cake-php@googlegroups.com Subject: Re: Array help 1. Use a callback function afterFind to loop the return array, remove the empty item. 2. How about give a condition when model->find. [CODE] 'conditions' => array(("not" => array ( "Post.id" => null )), //array of conditions [/CODE] On Tue, Aug 11, 2009 at 10:25 AM, Dave Maharaj :: WidePixels.com wrote: I have a contain query which produces these results. Basically the user bookmarked a page when they had access. The Owner of the post has changed the level of who can view the Post so in this case this user no longer can view the post hence the missing post data. It was not grabbed because the conditions of the Post did not match the users access level. But the bookmark still exists. Now in the query it pulls all bookmarks for the user and the post related to the bookmark. How can I remove [1] from the array all together or all from the array if [Post] has no data? I can not delete the bookmark when Posts change the access level because they may change it back to a lower setting and allow those who did have it bookmarked to once again have access. I just need to remove the array entry(s) where the Post array is empty. [0] => Array ( [Bookmark] => Array ( [id] => 38b7276f708 [user_id] => 4a5d569f-b9e8-416d-b34c-11cf4adcd75b [post_id] => 11e7ee [created] => 2009-08-09 21:59:01 ) [Post] => Array ( [title] => Test Title [rank] => 2 [created] => [description] => Test dscription [id] => 52louj ) ) [1] => Array ( [Bookmark] => Array ( [id] => 38b7276f708 [user_id] => 4a5d569f-b9e8-416d-b34c-11cf4adcd75b [post_id] => 11e7ee [created] => 2009-08-09 21:59:01 ) [Post] => Array ( [title] => [rank] => [created] => [description] => [id] => ) ) Thanks, Dave
Fatal error: Class 'Dispatcher' not found - please help
i have gotten this messege how can solve it ?? please help me... --~--~-~--~~~---~--~~ 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: wrapper function not working!
Hi, I have checked the code its working properly. Please cross check your method which checking for logged User. It might be in beforeFilter because its asking for log-in. Regards, Anurag Pal On Aug 11, 12:25 pm, armen wrote: > This is the link to the webpage that im working > on...http://warplayart.com/bleed_till_death/UserLoging/users > and this is the link that you register a > user...http://warplayart.com/bleed_till_death/UserLoging/users/register > > But the form on the register page, calles add in for it's action > variable, even though im calling the register function from the url. > So i ended up using a wrapper like this which doesn't work. > > What am i doing wrong? > > + when i was just using the add (http://warplayart.com/ > bleed_till_death/UserLoging/users/add) and placed the code inside the > add function it worked fine. > > - > function add() { > $this->register($this->data); > } > > function register($data = null) { > > if (!empty($data)) { > > $data['User']['password'] = > md5($data['User']['password']); > $this->User->create(); > > if ($this->User->save($data)) { > $this->Session->setFlash(__('User > successfully registered', > true)); > $this->Session->write('User', $data); > $this->redirect('index'); > exit(); > } > else { > $this->Session->setFlash(__('The Post > could not be saved. > Please, try again.', true)); > } > } > } > > > Thanks in advance. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Access non CakePHP session from within CakePHP
G'day all I'm integrating CakePHP into a legacy CMS. The CMS stores all of its session data in the generic php session (it never calls session_name ()). I need to retrieve this session data to prevent requiring users to log in twice to use the old and the new functions. Is there a way to do this? Thanks everyone. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Using the form helper to create elements failed in opera
Hi Guys, i' am using the form helper to create input fields, but they'll not displayed in opera. What could be the problem? A local instance of xampp is my webserver. cakephp 1.2.4.8284 stable http://img185.imageshack.us/img185/9628/20090811102017.png Thank you! Regards, Robert --~--~-~--~~~---~--~~ 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: Uploading file issue - worning mkdir()
Hi, I have the same issue. I found that its using different path for uploading file. For stopping details to database just first upload the file and then insert or update record in database. If you can provide the source code it would be better to diagnose the problem. Regards, Anurag Pal On Aug 11, 1:06 pm, leafchild wrote: > The uploaded img directory permission is set to 777 and just in case I > even changed webroot permission to 777 > but I'm still seeing same warning message. Where else I need to > check? > > Also how can I stop update with entire file data to database? > > after trying to upload file debug show: > == > [id] =>1 > [uploadfile] => Array > ( > [name] => IMG_0801.JPG > [type] => image/jpeg > [tmp_name] => /tmp/phpbo9DjW > [error] => 0 > [size] => 404887 > ) > [desc] => > ... > === > > uploadfile field needs only file name but looking at sql trying to > update > filed with file array information. > > On Aug 7, 6:24 pm, brian wrote: > > > Check the permissions for the directory. The webserver has to have > > write access to the dir. > > > On Fri, Aug 7, 2009 at 4:02 PM,leafchild wrote: > > > > I'm trying to make this plugin(http://www.milesj.me/resources/script/ > > > uploader-plugin) works. > > > > However, after I install I'm getting an error - Warning (2): mkdir() > > > [function.mkdir]: Permission denied [CORE/cake/libs/folder.php, line > > > 466] > > > Actually I tried another behavior to upload file and got same error. > > > Do I need to do some kind of server setting? I'm using MT(dv) > > > > Also after submit to upload file I'm getting an SQL error because data > > > need to be one but it try to update entire file data: > > > > == > > > [id] =>1 > > > [uploadfile] => Array > > > ( > > > [name] => IMG_0801.JPG > > > [type] => image/jpeg > > > [tmp_name] => /tmp/phpbo9DjW > > > [error] => 0 > > > [size] => 404887 > > > ) > > > [desc] => > > > ... > > > === > > > "uplodefile" 's data is not array just [NAME] of file. > > > > How can I stop doing it? I can't use "$this->Landing->save($this- > > >>data)" if I have file uploading? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How can I leave entered value even there is an errro and couldn't complete
Hi, Just set the Id so that it will get the reference on edit page. Regards, Anurag Pal On Tue, Aug 11, 2009 at 2:36 PM, leafchild wrote: > > Yes, I use $form->input() > > I found an issue because I was SQL again for the specific data before > going back to the page to show user an errors. > (I had an code like this that's why I couldn't keep the entered value > when there is an error. > === > function admin_edit(id = null){ > if (!empty($this->data)) { >... > $this->data = $this->Customer->read(null, $id); > } > if (empty($this->data)) { > ... > $this->data = $this->Customer->read(null, $id); > } > > } > === > I took out the line "$this->data = $this->Customer->read(null, $id);" > in "if (!empty($this->data))" statement now I can keep the entered > value when there is an error. > However, now I have an other issue. > > In this admin/customers/edit page, I need to set "$this->Customer- > >recursive = 6;" to get all kind of information relates to Customer > from other table. > Either coming back with an error or success updating information(I > want to page to back to edit page not index page after "save"), > I get "Undefined index" error everywhere in this page because after > coming back to page, $this->data has only the information model show > relationship(I think,,, I have 4 "has one" relationship in this model > (Customer) and only those information is available from $this->data > after submit) > > How can I get "$this->data" has "recursive = 6" data to avoid getting > "undefined index" error? > > > thanks, > leafchild > > > > > > > On Aug 7, 6:22 pm, brian wrote: > > Are you using FormHelper to create your form elements? If you do, for > example: > > > > echo $form->input('Post') > > > > ... the helper will add the value of the element based upon $this->data. > > > > If you are using the helper, maybe you should post your controller and > > view code. > > > > > > > > On Fri, Aug 7, 2009 at 6:56 PM,leafchild > wrote: > > > > > I have a page with form. > > > > > If user entered name, address,,,and ,all kinds of information and > > > submit but there is mistakes such as not entered email > > > properly and came back to form page with error message. How can I keep > > > the entered value user entered properly. > > > > > Currently in my form page, if user has an error, all the entered value > > > are gone and user has to entered everything. > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How can I leave entered value even there is an errro and couldn't complete
Hi, For that you have to pass values in input filed so that it will take it when it come back to page after getting validation errors. Regards, Anurag Pal On Aug 8, 3:56 am, leafchild wrote: > I have a page with form. > > If user entered name, address,,,and ,all kinds of information and > submit but there is mistakes such as not entered email > properly and came back to form page with error message. How can I keep > the entered value user entered properly. > > Currently in my form page, if user has an error, all the entered value > are gone and user has to entered everything. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Access non CakePHP session from within CakePHP?
G'day everyone I'm planning to integrate CakePHP with a legacy CRM site in use. My problem is with authentication. The legacy CRM stores session data just in $_SESSION (it doesn't call session_name()). Is there a straightforward way to access this data from within CakePHP, or should I somehow hack the CRM to insert data into CakePHP's session system? (I don't know how to do this) Any help will be appreciated. Thanks all. --~--~-~--~~~---~--~~ 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: I18n table How to use ?
Ok . . . I already have find the way to use it but . . . I have another one problem. How to translate my content ? ? ? in example : I set the $this->Post->locale = "gre" I save my data $this->Post->create(); $this->Post->save($this->data); Ok until now but If i like to translate this post now how can I do it ? ? ? Normaly I have to change the $this->Post->locale = "eng" and then ? ? ? how to continure ? ? ? --~--~-~--~~~---~--~~ 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: I18n table How to use ?
On Tue, Aug 11, 2009 at 6:23 AM, DatacenterHellas wrote: > > Hello all ! :) > > I'm creating an application and I like to make it multilanguage. > > The question is how ? ? ? > > I already have make the internationalization of the menus, I can > change languages to my interface but the question is how can I > translate my articles by using the I18n table ? ? ? Take a look at TranslateBehavior. If you have any difficulties, write us again. http://book.cakephp.org/view/92/Translate Best regards. -- MARCELO DE F. ANDRADE Belem, PA, Amazonia, Brazil Linux User #221105 http://mfandrade.wordpress.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: cPanel shared hosting
On 8/11/2009 9:23 AM, brian wrote: > That seems like a good method for this instance, where there isn't > (likely) to be a bunch of other Cake apps floating around. So, no need > to make the libs shareable. > FYI: For shared cake libs I use the setup described in the book. http://book.cakephp.org/view/35/Advanced-Installation Basically I just edit the |CAKE_CORE_INCLUDE_PATH. | --~--~-~--~~~---~--~~ 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: lazy loading?
take a look to http://github.com/mcurry/lazy_loader/tree/master On Aug 10, 8:13 pm, Martin Westin wrote: > Typical me. I never got to my real point. > > I wanted to say that if you are having serious performance problems > even while containing queries then that is a bit odd. What is the > difference if you bench an action with the unneeded associations > commented out completely (which should keep the models from loading at > all)? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
I18n table How to use ?
Hello all ! :) I'm creating an application and I like to make it multilanguage. The question is how ? ? ? I already have make the internationalization of the menus, I can change languages to my interface but the question is how can I translate my articles by using the I18n table ? ? ? Kind regards Merianos Nikso --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How can I leave entered value even there is an errro and couldn't complete
Yes, I use $form->input() I found an issue because I was SQL again for the specific data before going back to the page to show user an errors. (I had an code like this that's why I couldn't keep the entered value when there is an error. === function admin_edit(id = null){ if (!empty($this->data)) { ... $this->data = $this->Customer->read(null, $id); } if (empty($this->data)) { ... $this->data = $this->Customer->read(null, $id); } } === I took out the line "$this->data = $this->Customer->read(null, $id);" in "if (!empty($this->data))" statement now I can keep the entered value when there is an error. However, now I have an other issue. In this admin/customers/edit page, I need to set "$this->Customer- >recursive = 6;" to get all kind of information relates to Customer from other table. Either coming back with an error or success updating information(I want to page to back to edit page not index page after "save"), I get "Undefined index" error everywhere in this page because after coming back to page, $this->data has only the information model show relationship(I think,,, I have 4 "has one" relationship in this model (Customer) and only those information is available from $this->data after submit) How can I get "$this->data" has "recursive = 6" data to avoid getting "undefined index" error? thanks, leafchild On Aug 7, 6:22 pm, brian wrote: > Are you using FormHelper to create your form elements? If you do, for example: > > echo $form->input('Post') > > ... the helper will add the value of the element based upon $this->data. > > If you are using the helper, maybe you should post your controller and > view code. > > > > On Fri, Aug 7, 2009 at 6:56 PM,leafchild wrote: > > > I have a page with form. > > > If user entered name, address,,,and ,all kinds of information and > > submit but there is mistakes such as not entered email > > properly and came back to form page with error message. How can I keep > > the entered value user entered properly. > > > Currently in my form page, if user has an error, all the entered value > > are gone and user has to entered everything. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: MISSING TABLE
Firstly, the $name must be == to the name of the Model. $name is used to compatibility in php4 Secondly, The WorksCollections controller is looking for the WorksCollection model. Cakephp only singularises the last word in a multi word name. So you should rename your WorkCollection model to WorksCollection. Thirdly, your table name has the prefix cc_ so your are going to need to set that either in the database configuration (if shared by all your tables), or in the model (See api.cakephp.org) On Aug 9, 11:01 pm, JuanWalker wrote: > Hi Guys, I've this problem. I've a table called cc_works_collections > that I've created on mysql db. > > These are the controller and the model of this table (Using scaffold) > > class WorksCollectionsController extends AppController { > > var $name = 'WorksCollections'; > var $scaffold; > > } > > class WorkCollection extends AppModel{ > > var $name ="CcWorkCollection"; > var $belongsTo ="MdlAssignament"; > var $hasOne = "MdlAssignamentSubmission"; > > } > > When I try to test my scaffold it ask for works_collections table but > I've specified that my table has been named cc_works_collections as > you see on model source. > > This error is appearing : > > Missing Database Table > > Error: Database table works_collections for model WorksCollection was > not found. > > I've deleted cache from model and nothing changes, what's going on? > Please help me!! Many thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Default values in select lists
You can use below code cakephp format. input('listname',array('options'=>$mylist,'Selected'=>'Please select a value)); ?> On 8/11/09, jburns wrote: > > > How can I add a blank value (something like "Please select a value") > to the top of a select list when using $this->Xxxx->Yyyy->find > ('list'); instead of defaulting to the first value in the list? > > > -- Regards, Mohammad Arif Hossen Web Developer United Group International(UGIBD) www.ugibd.net Mobile no: +88 01714355911 Mobile no: +88 01922110308 --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Default values in select lists
How can I add a blank value (something like "Please select a value") to the top of a select list when using $this->Xxxx->Yyyy->find ('list'); instead of defaulting to the first value in the list? --~--~-~--~~~---~--~~ 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: Uploading file issue - worning mkdir()
The uploaded img directory permission is set to 777 and just in case I even changed webroot permission to 777 but I'm still seeing same warning message. Where else I need to check? Also how can I stop update with entire file data to database? after trying to upload file debug show: == [id] =>1 [uploadfile] => Array ( [name] => IMG_0801.JPG [type] => image/jpeg [tmp_name] => /tmp/phpbo9DjW [error] => 0 [size] => 404887 ) [desc] => ... === uploadfile field needs only file name but looking at sql trying to update filed with file array information. On Aug 7, 6:24 pm, brian wrote: > Check the permissions for the directory. The webserver has to have > write access to the dir. > > > > On Fri, Aug 7, 2009 at 4:02 PM,leafchild wrote: > > > I'm trying to make this plugin(http://www.milesj.me/resources/script/ > > uploader-plugin) works. > > > However, after I install I'm getting an error - Warning (2): mkdir() > > [function.mkdir]: Permission denied [CORE/cake/libs/folder.php, line > > 466] > > Actually I tried another behavior to upload file and got same error. > > Do I need to do some kind of server setting? I'm using MT(dv) > > > Also after submit to upload file I'm getting an SQL error because data > > need to be one but it try to update entire file data: > > > == > > [id] =>1 > > [uploadfile] => Array > > ( > > [name] => IMG_0801.JPG > > [type] => image/jpeg > > [tmp_name] => /tmp/phpbo9DjW > > [error] => 0 > > [size] => 404887 > > ) > > [desc] => > > ... > > === > > "uplodefile" 's data is not array just [NAME] of file. > > > How can I stop doing it? I can't use "$this->Landing->save($this- > >>data)" if I have file uploading? --~--~-~--~~~---~--~~ 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: Ajax Errors
I am not quite sure what you are missing but you might want to double check a couple of things including: the name of your aliquot model file, the validate variable in your aliquot model file and try using the validationErrors method available for each of the models created and returning any errors as json please see : http://book.cakephp.org/view/410/Validating-Data-from-the-Controller On Aug 10, 3:42 pm, Tony Thomas wrote: > This is something that's so simple, I'm embarrassed to ask. But after > a few dozen Google searches, I'm going to swallow my pride and post my > question here. > > I have a simple ajax function in my controller and I want it to return > an error is the request is not successful. For example: > > function ajax_update_box($boxId, $aliquotIds){ > if ($this->RequestHandler->isAjax()) { // if the request is AJAX > if($aliquots = $this->Aliquot->validateMove($aliquotIds, > $boxId)) > { // make sure a slot is open in the box > foreach($aliquots as $aliquot_id => $position ) { // > validateMove > returns an array > if > ($this->Aliquot->save($this->data['Aliquot'] =! true)) { > Configure::write('debug', 0); > $this->autoRender = false; > exit('There was an error and some of > the aliquots were not > moved.'); > } > } > > echo $this->unstored(); > > } else { // this is where I want it to return an error. > Configure::write('debug', 0); > $this->autoRender = false; > exit('The move did not work. Check to see if the box > is full.'); > > } > Configure::write('debug', 0); > $this->autoRender = false; > exit(0); > } > > } > > If the request doesn't pass validation in my model, I want to display > an error message, but I can't seem to get that to work. Everything is > treated as success. 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: Log Errors when debug = 0?
I do know it's possible to write all cake debugging and error info to the log file. But I don't know how to enable it without a small modification in the cake source code. I've asked a similar question a couple of days ago, but no replies http://groups.google.com/group/cake-php/msg/05dfde6ad7ebfed2?hl=en Bram On Aug 10, 11:22 pm, David wrote: > I would like to silently write errors to error.log when in production > mode. It would be useful to catch anything going wrong that I hadn't > previously noticed. --~--~-~--~~~---~--~~ 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: possible to do validation in not current model? where should I put validation??
Thanks brian, now I can put my validation code at model. On Aug 7, 6:26 pm, brian wrote: > I'm not sure that I understand your question. But you can call the > model's function directly from the controller. > > > > On Fri, Aug 7, 2009 at 4:42 PM,leafchild wrote: > > > Thanks, brian. but can I associate with my validation macadamized > > function? > > > so if set validation in Size model: > > > = > > ... > > 'size_name' => array( > > 'namechk'=>array( > > 'rule'=>array('namechk'), > > 'message'=> 'Please enter different name.' > > ) > > ... > > > ... > > function namechk($size_name){ > > /* want to check if size_name exist with same category_id > > here > > If there is same size_name but different category id > > then it's ok */ > > > } > > = > > > Thanks, > > leaf child > > > On Aug 4, 5:15 am, brian wrote: > >> Create some method in the Size model and pass the category_id to it: > > >> if ($this->Product->Size->yourMethod($category_id)) > > >> On Mon, Aug 3, 2009 at 3:45 PM,leafchild wrote: > > >> > thanks brian. > > >> > Is possible to pass specific value to validation at model("Size" model > >> > in this case) > > >> > I want to create custom validation but I need to pass value to do it. > >> > (in this case, "category_id") > > >> > thanks, > >> >leafchild > > >> > On Aug 2, 8:49 am, brian wrote: > >> >> Try this: > > >> >> $this->Product->Size->set($this->data); > > >> >> if ($this->Product->Size->validates()) > >> >> { > >> >> ... > > >> >> On Fri, Jul 31, 2009 at 3:12 PM,leafchild > >> >> wrote: > > >> >> > For example > > >> >> > There are 3 tables "categories", "products" and "sizes", and I'm > >> >> > working on product page (product.php, products_controller.php, > >> >> > product.ctp). > > >> >> > The database looks like this. > >> >> > sizes: > >> >> > --- > >> >> > | id | > >> >> > --- > >> >> > | category_id | > >> >> > | size_name | > >> >> > -- > > >> >> > products: > >> >> > --- > >> >> > | id | > >> >> > --- > >> >> > | sku | > >> >> > | category_id | > >> >> > | product_name | > >> >> > | size_id | > >> >> > > > >> >> > categories: > >> >> > --- > >> >> > | id | > >> >> > --- > >> >> > | category_name | > >> >> > --- > > >> >> > Product page can add/edit product: > >> >> > Before I save new product the page also can add new size. > > >> >> > I can verify a product data such as sku value from the model but I > >> >> > want to also make sure, > >> >> > user can add new size name if it's not exist in the system(not exist > >> >> > in size table). > > >> >> > I want to put validation code in model. > > >> >> > Should I put validation code in size.php or product.php > > >> >> > Also if I want validate this then I have to pass category also. > >> >> > (same size name can be exist if it has different category id) > >> >> > How can I pass specific value to model so I can set vilification in > >> >> > mode and not controller? > > >> >> > Or in this case I should just put code in controller? > > >> >> > thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
wrapper function not working!
This is the link to the webpage that im working on... http://warplayart.com/bleed_till_death/UserLoging/users and this is the link that you register a user... http://warplayart.com/bleed_till_death/UserLoging/users/register But the form on the register page, calles add in for it's action variable, even though im calling the register function from the url. So i ended up using a wrapper like this which doesn't work. What am i doing wrong? + when i was just using the add (http://warplayart.com/ bleed_till_death/UserLoging/users/add) and placed the code inside the add function it worked fine. - function add() { $this->register($this->data); } function register($data = null) { if (!empty($data)){ $data['User']['password'] = md5($data['User']['password']); $this->User->create(); if ($this->User->save($data)) { $this->Session->setFlash(__('User successfully registered', true)); $this->Session->write('User', $data); $this->redirect('index'); exit(); } else { $this->Session->setFlash(__('The Post could not be saved. Please, try again.', true)); } } } Thanks in advance. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---