Ideas about models and associations
Hi! I'm working on a new project and right now I'm struggling a bit to put the requirements together in a proper cake-like way. I use Auth/ACL which is set up and works fine. The users who can log-in belong to three different groups. These groups are defined by a field "role_id" in the user table. Now I want to add profiles for the users. The problem is that each group has a different type of profile with different fields in it so I defined three models for the profiles. My first idea was to do something like this in my user model: var $hasOne = array( 'AdminProfile' => array( 'className' => 'AdminProfile', 'conditions' => 'User.role_id = 1' ), 'EditorProfile' => array( 'className' => 'EditorProfile', 'conditions' => 'User.role_id = 2' ), 'ReviewerProfile' => array( 'className' => 'ReviewerProfile', 'conditions' => 'User.role_id = 3' ) ); Which seems to work to a degree but is a bit of a hassle when it comes to editing the profiles and validating the form data. How would you solve this? Regards Guenther --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
problem in cakephp style
hi 1) i have installed AppServ 2.5.10: Apache 2.2.8 PHP 5.2.6 MySQL 5.0.51b phpMyAdmin-2.10.3 2) under httpd.conf file i enabled (LoadModule:rewrite_module libexec/mod_rewrite.so) 3) i checked .htaccess override it's ok: Options Indexes MultiViews AllowOverride All Order allow,deny Allow from all 4) i couldn't see AddModule list (AddModule mod_rewrite.c.) so the style for index page is still not configure ,please do you have 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: kiosk using cakePhp framework
On Tue, Sep 16, 2008 at 6:26 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > hi > I am software developer, I want to build a online shopping system for > a kiosk enviornment .So,changes of any configaration is needed?please > advise me. If the kiosk is configured properly then all the touch screen interaction is directly taken to be as equivalent mouse actions. You application will run in the browser (presumably full screen) - so I don't think you need anything special to get going. Cheers Tarique -- = Cheesecake-Photoblog: http://cheesecake-photoblog.org PHP for E-Biz: http://sanisoft.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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Retrieve data with child in index page
I'm using cake1.2 rc2. I have a table called A and A has one or many children in table B or C. So B and C both have foreign key, A_id. And A only has children in either B or C (can't have in both). I want to create an index page that show A has children in B and an index page that show A has children in C but i don't know how. SQL will be like: SELECT A.* FROM A, B WHERE A.id=B.A_id AND COUNT(B.id) > 0 to show A has children in B. I set this condition, COUNT(B.id) > 0 in $this->paginate() but however I set the relation in models or change recursive, child tables doesn't seem to be read in paginate(). Related children seem to retrieve later using WHERE IN (). Is there any way to do 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Remove password hashing in AuthComponent
Mark, The AuthComponent has an authenticate member. If you set this member to an object with a hashPasswords method, it will be used instead of the default behavior of the AuthComponent. One thing that a.php.programmer left off is to set this member in your app_controller. Here is an example in the beforeFilter. app_controller.php Auth->authenticate = $this->User; // the rest of your beforeFilter } } Next, add the hashPassword described by a.php.programmer to your user model. models/user.php http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Remove password hashing in AuthComponent
cake have a hook method: hashPasswords name]['password'])) { $data[$this->name]['password'] = md5($data[$this->name] ['password']); } return $data; } } ?> On Sep 17, 6:43 am, mark <[EMAIL PROTECTED]> wrote: > I looked around for a solution to removing password hashing in > AuthComponent, and the closest thing I found was to overwrite the > password method. It explained it in the section of the manual where it > talks about changing the hashing type. > > http://manual.cakephp.org/view/566/Changing-Encryption-Type > > I wasn't sure though how to actually go about doing this. Auth is > setup in my AppController like so: > class AppController extends Controller { > var $name = 'App'; > var $components = array('Acl', 'Auth'); > var $publicControllers = array('pages', 'archives', 'mail'); > > function beforeFilter() { > if (isset($this->Auth)) { > $this->Auth->loginAction = '/admin/users/login'; > $this->Auth->loginRedirect = '/admin/issues'; > $this->Auth->authorize = 'actions'; > > // turn off password hashing > > if (in_array(low($this->params['controller']), > $this->publicControllers)) { > $this->Auth->allow(); > } > } > } > > } > > What exactly would I do? > > Thank you guys so much > > -Mark --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
localization
Hi ; I am reading the localization article in the cakePHP . And in that article it says that I have to include the uses('L10n'); in the controllers I want to use . But I want to change the validation errors in the models and some messages in the views what should I do ? The second question about that is it is using the ISO639-2 character encoding . What should I put in the doctype of my default.ctp ? Can anyone give me an example of Doctypes in Cakephp ? For various Languages please ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Unsigned Integers??
On Sep 13, 11:47 pm, Brenton B <[EMAIL PROTECTED]> wrote: > > I'll chalk this up to storage-type dependency ... (ex: MySQL can do > unsigned ints, but others can't) ... Yeah, that. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Got Error when try the tutorial of "The CakePHP Blog Tutorial with SMARTY"
Hi, I just got an error when try the tutorial of "The CakePHP Blog Tutorial with SMARTY". Tutorial link: http://bakery.cakephp.org/articles/view/the-cakephp-blog-tutorial-with-smarty I think I have followed the instructions exactly as what the tutorial said, but still comes up with the following error message "Fatal error: Class 'SmartyView' not found in C:\Site\phpCake\cake\libs \controller\controller.php on line 709". I have tried to do research to resolve this but not succeed. If anyone have similiar experience, could you help me out? Regards --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Unsigned Integers??
Hi, I think only the dev team can explain exactly why Cake is the way it is. However, I thought that you'd probably answered your own question :-) Many of us do not use MySql and we are delighted that so much effort is being made to develop Cake in a DB-agnostic way. The idea is that Cake developers can change the DB back-end just by changing a config file. It is a wonderful concept and we wouldn't want to spoil it by introducing unsigned integer field-types if that reduces the portability of our code without any good reason. On Sep 16, 10:59 pm, Brenton B <[EMAIL PROTECTED]> wrote: > Really, no one knows? For serious? > > On Sep 13, 9:47 pm, Brenton B <[EMAIL PROTECTED]> wrote: > > > So, in MySQL I can create a table with a field that has type integer > > with unsigned integer, which as we all know will define the length to > > 10 and doubles the maximum possible value. > > So why doesn't the `schema` console function take this into account? > > For my specs, the chances of having more than 2,147,483,647 records is > > pretty negligible, but still ... > > > I'll chalk this up to storage-type dependency ... (ex: MySQL can do > > unsigned ints, but others can't) ... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Remove password hashing in AuthComponent
I looked around for a solution to removing password hashing in AuthComponent, and the closest thing I found was to overwrite the password method. It explained it in the section of the manual where it talks about changing the hashing type. http://manual.cakephp.org/view/566/Changing-Encryption-Type I wasn't sure though how to actually go about doing this. Auth is setup in my AppController like so: Auth)) { $this->Auth->loginAction = '/admin/users/login'; $this->Auth->loginRedirect = '/admin/issues'; $this->Auth->authorize = 'actions'; // turn off password hashing if (in_array(low($this->params['controller']), $this->publicControllers)) { $this->Auth->allow(); } } } } What exactly would I do? Thank you guys so much -Mark --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
soap with attachment which datatype to use?
how would i do soap attachments? Would I use type binary => xsd:base64binary for an attachment? thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Unsigned Integers??
Really, no one knows? For serious? On Sep 13, 9:47 pm, Brenton B <[EMAIL PROTECTED]> wrote: > So, in MySQL I can create a table with a field that has type integer > with unsigned integer, which as we all know will define the length to > 10 and doubles the maximum possible value. > So why doesn't the `schema` console function take this into account? > For my specs, the chances of having more than 2,147,483,647 records is > pretty negligible, but still ... > > I'll chalk this up to storage-type dependency ... (ex: MySQL can do > unsigned ints, but others can't) ... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Accessing MySQL default values
Is it possible to get and set default values for MySQL columns in CakePHP? I am wondering if it would be a good idea to use MySQL default values to set the default configurations for table data. For example, I have column quota in table users. Instead of storing the default quota limit in a separate table, it would be easier to set the default value of the column. Currently I haven't seen any in-built way to access the default value in CakePHP. Moreover, I haven't seen this done in just PHP either, I did do a quick Google. Is this a good idea? Is this something everyone has been doing already for years and I've only just thought of? Also will this solution work with other databases? Your thoughts are 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: how to unit test a shell script
Jeurgen, Testing shell classes is a bit tricky right now App::import() currently does not let you target shells so you have to include them regular php style. We are working on ways of improving this though, as testing shells is a big pain right now. -Mark On Sep 16, 9:45 am, JuergenRiemer <[EMAIL PROTECTED]> wrote: > Hi, > > I do the following to unit test a shell script > [ learn.test.php ] put in a folder "tests/cases/shells" (that I > created) > App::import( 'Shell', 'Learn' ); > > class LearnShellTest extends CakeTestCase { > > function setUp(){ > $this->LearnShell = new LearnShell(); > } > > function testOne(){ > > $this->LearnShell->testFunc(); > }} > > ?> > > how ever it does not find the Class LearnShell. > Now before I get deeper into it... can anyone point me to the proper > solution? > thx > Jeurgen --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Unexpected behavior during unit testing.
While writing some unit tests for my app I noticed some behavior that has me a little confused in regards to the setUp and tearDown functions. When doing unit testing with just SimpleTest, the setUp and tearDown functions are the first and last methods to run when a test method is executed. This is not the case in the CakeTestCase class. The setUp function executes before every test method in the test case along with the start, end, startCase and endCase methods, while the tearDown function executes after every test method along with the start, end, startCase and endCase methods. To me this seems like a bug since the SimpleTest behavior is to run setUp before each test method and tearDown after. Can anyone shed any light on 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Find using dates producing incorrect query
try $date,'DATE(Post.date) <'=>$end_date))); On Sep 16, 7:22 pm, Benster <[EMAIL PROTECTED]> wrote: > Hi All, > > Newb question... > > Im having problems with a "find" command which searches all records > whose date fields match the range between $date and $end_date as > follows: > > return $this->find('all',array('conditions'=>array('DATE(Post.date)'=>'>'. > > $date,'DATE(Post.date)'=>'<'.$end_date))); > > The strange thing is that the query produced uses a where clause that > is incorrect - using an = and placing the less than into the date > string: > > SELECT `Post`.`id`, `Post`.`name`, `Post`.`date`, `Post`.`content`, > `Post`.`user_id`, `User`.`id`, `User`.`name`, `User`.`email`, > `User`.`firstname`, `User`.`lastname` FROM `posts` AS `Post` LEFT JOIN > `users` AS `User` ON (`Post`.`user_id` = `User`.`id`) WHERE > DATE(`Post`.`date`) = '<2008-12-31 23:59:59' > > Any idea where my error is? > > Best regards, Ben. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Find using dates producing incorrect query
try $date,'DATE(Post.date) <'=>$end_date))); On Sep 16, 7:22 pm, Benster <[EMAIL PROTECTED]> wrote: > Hi All, > > Newb question... > > Im having problems with a "find" command which searches all records > whose date fields match the range between $date and $end_date as > follows: > > return $this->find('all',array('conditions'=>array('DATE(Post.date)'=>'>'. > > $date,'DATE(Post.date)'=>'<'.$end_date))); > > The strange thing is that the query produced uses a where clause that > is incorrect - using an = and placing the less than into the date > string: > > SELECT `Post`.`id`, `Post`.`name`, `Post`.`date`, `Post`.`content`, > `Post`.`user_id`, `User`.`id`, `User`.`name`, `User`.`email`, > `User`.`firstname`, `User`.`lastname` FROM `posts` AS `Post` LEFT JOIN > `users` AS `User` ON (`Post`.`user_id` = `User`.`id`) WHERE > DATE(`Post`.`date`) = '<2008-12-31 23:59:59' > > Any idea where my error is? > > Best regards, Ben. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Missing Database Table
Hi! This seems to be an ACL table. I think there was a call like "cake acl something" to generate that tables. HTH Bernhard 2008/9/16 [EMAIL PROTECTED] <[EMAIL PROTECTED]> > > Whenever I am oh so sure I have everything setup but I still get > strange errors like this it is always one thing... cache. > Empty out all the caches and refresh. Hopefully your table will be > available again. > > > > On Sep 16, 8:35 am, simpleman996633 <[EMAIL PROTECTED]> > wrote: > > Hi all, > > > > After running my Cake application locally i tried to upload it to my > > remote server, configured everything properly, checked all the tables, > > database access. But i couldn't solve the following error. I can't > > find enough resources too . Plz somebody help > > > > Missing Database Table > > Error: Database table acos for model Aco was not found. > > > > Notice: If you want to customize this error message, create app/views/ > > errors/missing_table.ctp > > > > I used the ACL component. > > > > Plz 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
mssql problem
I'm also having this problem, did you figure it out? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Find using dates producing incorrect query
Hi All, Newb question... Im having problems with a "find" command which searches all records whose date fields match the range between $date and $end_date as follows: return $this- >find('all',array('conditions'=>array('DATE(Post.date)'=>'>'. $date,'DATE(Post.date)'=>'<'.$end_date))); The strange thing is that the query produced uses a where clause that is incorrect - using an = and placing the less than into the date string: SELECT `Post`.`id`, `Post`.`name`, `Post`.`date`, `Post`.`content`, `Post`.`user_id`, `User`.`id`, `User`.`name`, `User`.`email`, `User`.`firstname`, `User`.`lastname` FROM `posts` AS `Post` LEFT JOIN `users` AS `User` ON (`Post`.`user_id` = `User`.`id`) WHERE DATE(`Post`.`date`) = '<2008-12-31 23:59:59' Any idea where my error is? Best regards, Ben. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Form data from a view element
I created the form using the line: $form->create('Comment', array('action' => 'add')); Doesn't this specify that it should use the controller associated with the "Comment" model, i.e. the Comments controller? This is how I've done it with all of my other forms... And yes, I realize the table based layout is terrible, I'm just mocking things at the moment and didn't want to write a stylesheet to position things yet. Thanks! - Dan On Sep 16, 11:23 am, mark_story <[EMAIL PROTECTED]> wrote: > On Sep 16, 9:11 am, Daniel <[EMAIL PROTECTED]> wrote: > > > > > Hello, > > > I currently have a "comment box" view element that I plan to > > embed in various places in my CakePHP application to allow users to > > leave comments on various aspects of the site. > > > I'm using the form helper inside of the element to generate the > > form to be used to submit the data, however when I submit the data I > > receive only a blank screen that says "0 query took ms". I've even > > added debugging echoes to the controller to print the data array and > > I'm still just receiving a blank page with "0 query took ms". > > > Attached below is the comment "add" method and the respective > > element code. > > > Any help anyone can provide would be greatly appreciated, I seem > > to be pretty stuck! > > > Controller code: > > > function add() > > { > > echo ""; > > $mrClean = new Sanitize(); > > > echo "Data ". $this->data; > > > if(!empty($this->data)) > > { > > $mrClean->clean($this->data); > > > $currUser = $this->get_current_user(); > > $this->data['Comment']['user_id'] = $currUser['id']; > > $this->data['Comment']['isDeleted'] = 0; > > > $targetEvent = $this->Event->find("first", > > array('conditions' => array('Event.id' => > > $this->data['Comment'] > > ['event_id']), > > 'recursive' => 1)); > > > print_r($targetEvent); > > > if(empty($targetEvent) || is_null($targetEvent)) > > { > > $this->Comment->invalidate('event_id', 'You have selected > > an > > invalid event.'); > > return; > > } > > > if($this->Comment->save($this->data)) > > { > > $this->flash('Your comment has been added', > > '/events/view/'. > > $this->data['Comment']['event_id']); > > } else { > > $this->flash('An error has occured adding your > > comment.', '/ > > events'); > > } > > } > > > } > > > Element code: > > > create('Comment', array('action' => 'add')); ?> > > > > > > > > Subject: input('subject', > > array( 'label' => > > false )); ?> > > > > > > > > > > > > textarea('body', > > array( 'label' => false, > > 'rows' => 7, > > 'cols' => 80 )); ?> > > > > > > > > > > submit('Post Comment'); ?> > > > > > > > > hidden('event_id', array('value' => $event_id)); ?> > > end(); ?> > > Your form doesn't have a controller? how will it know what controller > it is supposed to submit to. I would double check that you are being > sent to the right URL when submitting the form. Also tables for > layout make babies cry :) > > -Mark --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
ajax not working when debug=0
I have an app that works fine with debug=2, but I get 404 errors when i set debug=0 The message I get is "the requested location /urls/getTemplateData/2 does not exist on this server" On the server side I have the following code in url_templates_controller: function getTemplateData($id) { $template = $this->UrlTemplate->find('where URLTemplateId=' . $id); $result = 'disaster' . ' -- ' . sizeof($template) . ' -- ' . $id; if( sizeof($template) != 0) { $result = 'excellente' . ' -- ' . sizeof($template) . ' -- ' . $id . ' --- '; } header("Content-type:application/xml"); echo '' . $template['UrlTemplate'] ['URLTemplateId'] . ''; echo '' . $template['UrlTemplate'] ['URLTemplateDesc'] . ''; echo '' . $result . ''; On the client side I call that as follows: function getUrlTemplateData(templateId,urlName,urlType) { var template = document.getElementById(templateId); var urlName = document.getElementById(urlName); var value = template.value; var url = '/url_templates/getTemplateData/' + value; var pars = 'value=' + value; var result = false; var myAjax = new Ajax.Request( url, { method: 'get', parameters: pars, evalScripts: true, onSuccess: function(transport) { if (transport.responseText.match(/excellente/)) { urlName.setValue(getXmlValue(transport.responseText, 'URLTemplateDesc')); result = true; } else { urlName.setValue({ background: 'pink' }); result = false; } } }); return result; } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: ajax editor
SOLVED! it turns out that you can not have any spaces in the code if you want it to choose a input type=text instead of a textarea. So if your code looks like this Titile txt here you will get a text area if it is this Titile txt here you should get a input type=text area instead. On Sep 15, 10:20 pm, sfmerv <[EMAIL PROTECTED]> wrote: > I have a small problem with the ajax editor. Everything works fine in > terms of updating and returning the proper value. > > Here is the problem. I want the editor to load a input text field > instead of a textarea when the user clicks on the the text they want > to edit. Is there a way to set it? Also I want to edit the look of the > form, is it best to do that in css? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Websites Using CakePHP
Excellent! Thank you very much, John! Regards, Mike > http://book.cakephp.org/view/510/Sites-in-the-wild > > -- John --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Best way to validate dates to prevent future dating
Here is a sample that I use, Its not exactly what your looking for, but a little tweaking will get you where you need to be: var $validate = array( 'expires' => array('rule'=>array('date','mdy'),'rule'=>array('validateFutureDate'),'on'=>'create') ); function validateFutureDate($value) { $valid = false; $timestamp = strtotime(str_replace('-','/', $value['expires'])); $t = time()+(86400*34); if($timestamp >= $t) $valid = true; return $valid; } On Sep 16, 3:08 am, RichardAtHome <[EMAIL PROTECTED]> wrote: > > I was afraid that might be the case > > It's really not difficult :-) > > And its a very powerful solution once you understand how it works. > > On Sep 16, 1:46 am, Tony Thomas <[EMAIL PROTECTED]> wrote: > > > Thanks. I was afraid that might be the case. > > > On Sep 15, 7:42 pm, "Dardo Sordi Bogado" <[EMAIL PROTECTED]> wrote: > > > > You can't use functions i.e date() at class definitions, create a > > > custom method in the model and use that as a validation rule. > > > > On Mon, Sep 15, 2008 at 9:34 PM, Tony Thomas <[EMAIL PROTECTED]> wrote: > > > > > According to the documentation that's the proper way to define the > > > > array. > > > > >http://book.cakephp.org/view/139/comparison > > > > > It just amounts to defining an array without defining the keys if I'm > > > > not mistaken. I'll take a closer look at the syntax in the morning > > > > when my mind is a little fresher. I'll post something here if > > > > something jumps out at me. > > > > > On Sep 15, 4:20 pm, 703designs <[EMAIL PROTECTED]> wrote: > > > >> I noticed that the way you coded your array would definitely throw a > > > >> syntax error. > > > > >> How about > > > >> 'rule' => array( > > > >> 'comparison' => date() > > > >> ), > > > > >> I'll try this on my Cake installation later to check, as I haven't > > > >> used the 'comparison' validator. I just know that your array looks > > > >> botched. > > > > >> On Sep 15, 5:14 pm, 703designs <[EMAIL PROTECTED]> wrote: > > > > >> > date() should just return the formatted date string. What sort of > > > >> > errors are you seeing? > > > > >> > On Sep 15, 3:51 pm, Tony Thomas <[EMAIL PROTECTED]> wrote: > > > > >> > > Anyone have a proven method for validating submitted dates to make > > > >> > > sure they're not in the future? > > > > >> > > The closest I can get is: > > > > >> > > 'date_field' => array('rule' => array('comparison', > > > >> > > '>=', > > > >> > > date()), > > > >> > > 'message' > > > >> > > => 'Dates cannot be in the future.') > > > > >> > > But date() is throwing a syntax error. > > > > >> > > None of the core time testing helpers do this. > > > > >> > > I should note that in the controller, before save, the date string > > > >> > > is > > > >> > > converted into a Unix timestamp. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: changing data in the hasAndBelongsToMany tables
Just solved it: $this->Match->save( Array( "Match" => Array( "id" => $match_id ), "Person" => Array( "Person" => Array( Array( "person_id" => $main_referee_id, "role" => 'main_referee' ) ) ) ) ); On Sep 16, 12:57 pm, Dérico Filho <[EMAIL PROTECTED]> wrote: > Hi, > > I have two tables: > > matches > people > > linked together by: > > matches_people > > Well, on the matches_people table there are other fields but match_id > and person_id, for instance: role, a enum type field. > > The question is how do I save data into matches_people in way I can > also update the role field? > > I've tried: > $this->Match->save( > Array( > "Match" => Array( "id" => $match_id > ), > "Person" => Array( "id" => > $main_referee_id ), > "MatchPerson" => Array( "role" => > "main_referee" ) > ) > ); > > But it did not work out, how do I do it? > > Thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Websites Using CakePHP
On Sep 16, 2008, at 10:41 AM, taokodr wrote: > > Hi Gang! > > Out of curiosity, whatever happened to the area that had the large > list of sites using CakePHP? I keep finding references to this link > (http://groups.google.com/group/cake-php/web/cakephp-in-the-wild? > hl=en), but it goes to a site that says "You have to be a manager of > this group to view this page". > > Is there a publicly viewable version floating around somewhere else > and I just can't find it? http://book.cakephp.org/view/510/Sites-in-the-wild -- John --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Websites Using CakePHP
Hi Gang! Out of curiosity, whatever happened to the area that had the large list of sites using CakePHP? I keep finding references to this link (http://groups.google.com/group/cake-php/web/cakephp-in-the-wild? hl=en), but it goes to a site that says "You have to be a manager of this group to view this page". Is there a publicly viewable version floating around somewhere else and I just can't find it? Thanks, and sorry if I'm rehashing old thread material! Regards, Mike --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
changing data in the hasAndBelongsToMany tables
Hi, I have two tables: matches people linked together by: matches_people Well, on the matches_people table there are other fields but match_id and person_id, for instance: role, a enum type field. The question is how do I save data into matches_people in way I can also update the role field? I've tried: $this->Match->save( Array( "Match" => Array( "id" => $match_id ), "Person" => Array( "id" => $main_referee_id ), "MatchPerson" => Array( "role" => "main_referee" ) ) ); But it did not work out, how do I do it? Thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: MAMP installation
Having just done this in the past 72 hours I can give one bit of advice. use 'port' => '/var/mysql/mysql.sock', in your db config, where the path points to the mysql socket you wish to use. I pointed it at the default mysql install instead of the MAMP one for example. ( Which I had to symlink myself due to Leapord path issues with the MYSQL package. jsnewbie wrote: > > > Searched around and found many variations on this exact thread but > none have moved me forward at all. So I'm appealing for help as a last > gasp - hope the reiteration isn't too annoying. > Trying to install cakephp on MAMP. MAMP works. osx 10.5.4 > > var $default = array( > 'driver' => 'mysql', > 'persistent' => false, > 'host' => ':/Applications/MAMP/tmp/mysql/mysql.sock', > 'login' => 'root', > 'password' => 'root', > 'database' => 'cake', > 'prefix' => '', > ); > > gives 3 errors the first > > Warning (2): mysql_connect() [function.mysql-connect]: Can't connect > to local MySQL server through socket '/Applications/MAMP/tmp/mysql/ > mysql.sock:3306' (2) [CORE/cake/libs/model/datasources/dbo/ > dbo_mysql.php, line 117] > > adding > 'port' => '8889', > > changes the sock: to 8889 in the error. > > switching to > 'host' => '127.0.0.1', > 'port' => '8889', > > gives > > Warning (2): mysql_connect() [function.mysql-connect]: Lost connection > to MySQL server at 'reading initial communication packet', system > error: 61 [CORE/cake/libs/model/datasources/dbo/dbo_mysql.php, line > 117] > > tried > > sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock /var/mysql/ > mysql.sock > > ln: /var/mysql/mysql.sock: File exists > > > > > -- View this message in context: http://www.nabble.com/MAMP-installation-tp19455600p19514231.html Sent from the CakePHP mailing list archive at Nabble.com. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Form data from a view element
On Sep 16, 9:11 am, Daniel <[EMAIL PROTECTED]> wrote: > Hello, > > I currently have a "comment box" view element that I plan to > embed in various places in my CakePHP application to allow users to > leave comments on various aspects of the site. > > I'm using the form helper inside of the element to generate the > form to be used to submit the data, however when I submit the data I > receive only a blank screen that says "0 query took ms". I've even > added debugging echoes to the controller to print the data array and > I'm still just receiving a blank page with "0 query took ms". > > Attached below is the comment "add" method and the respective > element code. > > Any help anyone can provide would be greatly appreciated, I seem > to be pretty stuck! > > Controller code: > > function add() > { > echo ""; > $mrClean = new Sanitize(); > > echo "Data ". $this->data; > > if(!empty($this->data)) > { > $mrClean->clean($this->data); > > $currUser = $this->get_current_user(); > $this->data['Comment']['user_id'] = $currUser['id']; > $this->data['Comment']['isDeleted'] = 0; > > $targetEvent = $this->Event->find("first", > array('conditions' => array('Event.id' => > $this->data['Comment'] > ['event_id']), > 'recursive' => 1)); > > print_r($targetEvent); > > if(empty($targetEvent) || is_null($targetEvent)) > { > $this->Comment->invalidate('event_id', 'You have selected an > invalid event.'); > return; > } > > if($this->Comment->save($this->data)) > { > $this->flash('Your comment has been added', > '/events/view/'. > $this->data['Comment']['event_id']); > } else { > $this->flash('An error has occured adding your > comment.', '/ > events'); > } > } > > } > > Element code: > > create('Comment', array('action' => 'add')); ?> > > > > Subject: input('subject', > array( 'label' => > false )); ?> > > > > > > textarea('body', > array( 'label' => false, >'rows' => 7, >'cols' => 80 )); ?> > > > > > submit('Post Comment'); ?> > > > > hidden('event_id', array('value' => $event_id)); ?> > end(); ?> Your form doesn't have a controller? how will it know what controller it is supposed to submit to. I would double check that you are being sent to the right URL when submitting the form. Also tables for layout make babies cry :) -Mark --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Some Data Not Saving
On Mon, Sep 15, 2008 at 5:49 PM, thatsgreat2345 <[EMAIL PROTECTED]> wrote: > > Well here is my problem , I am creating a simple sign up, haven't > added any validation yet but the sign up doesn't seem to want to work. > I set $this->data['User']['confirm_code'] as well as the level of the > user. But neither the password, confirm_code , or level get saved. I > was told that input named password is already hashed so I had to > create hash the second password. > > As well when the data is submitted, the page isn't rendered , it is > just blank. The email gets sent and all. It seems as if the > beforeFilter isn't working. Any help would be appreciated. You might try setting the debug level to greater then 0 in the app/config/core.php file and see if php and or cake is spitting any errors. Then if those are dealt with then remove your validation rules and add them back one by one and see if you can isolate an error there. The key is to make it simple and then build the apps complexity Sam D --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Problem with hasAndBelongsToMany association
I've found the gap! I added in the contact model var $displayField = 'surname'; Thx On 16 Set, 16:26, salgua1977 <[EMAIL PROTECTED]> wrote: > Hi, > > I have an association "hasAndBelongsToMany" between 2 models. It > works, but when I add a related field in a form (example: I have a > form to add nations, there is an association between nation and > contact model, and I want in the nation model a list field to select > contacts), this field works, but it show me only the contact.title > field. I think that there is a way to specify wich field it has to > show (maybe in the model...), but I cannot find them. > > Any idea? > > Thx and bye, > Salvatore --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Problem with hasAndBelongsToMany association
Hi, I have an association "hasAndBelongsToMany" between 2 models. It works, but when I add a related field in a form (example: I have a form to add nations, there is an association between nation and contact model, and I want in the nation model a list field to select contacts), this field works, but it show me only the contact.title field. I think that there is a way to specify wich field it has to show (maybe in the model...), but I cannot find them. Any idea? Thx and bye, Salvatore --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Handling your own model associations
On Sep 16, 12:31 am, DanielMedia <[EMAIL PROTECTED]> wrote: > Hey all, > > I'm wondering if anyone out there has chosen to bypass Cake's > associations and use a more traditional approach. For example, if I > want to get all the comments in an article, I could write my own > method and call $this->Article->get_comments(). Seems like an easier > approach than having to worry about binding/unbinding. I guess what > I'm really asking here is, what is the downside (if any) of bypass > Cake's "auto-magic" features like associations. For example, if I want > fine-grained control over caching of comments via memcache, am I > losing something by bypassing Cake's conventions? The only thing I can > think of is that I would have to use custom query pagination. Any > other thoughts? Well bypassing it all seems like a heck of a lot of work. Using containable seems like a much better solution to me. Associations are there to save you time, going around and fighting them will cost you time. I think starting off with the full associations and pruning back with containable is the best solution. -Mark --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Why is the Validation Filters Array Processed Backwards and Returns Conservatively?
So then, is there no way to have all errors be returned to the controller for displaying in the view? I've still yet to discover a way. On Sep 16, 6:32 am, grigri <[EMAIL PROTECTED]> wrote: > Interestingly, there's only one test case in the core that deals with > validation order, and it seems incorrect (or at least misleading). > > This is the code: > > $TestModel->validate = array( > 'title' => array( > 'tooShort' => array('rule' => > array('minLength', 50)), > 'onlyLetters' => array('rule' => '/[a-z]+/i') > ), > ); > $data = array('TestValidate' => array( > 'title' => 'I am a short string' > )); > $TestModel->create($data); > $result = $TestModel->validates(); > $this->assertFalse($result); > $result = $TestModel->validationErrors; > $expected = array( > 'title' => 'tooShort' > ); > $this->assertEqual($result, $expected); > > Based on this test, it looks like it's assumed that both rules would > fail, but that validation would stop on the 1st rule. But it doesn't, > because although the second rule is called "only letters" the regexp "/ > [a-z]+/i" doesn't mean "only letters" it means "must contain at least > one sequence of at least one letter" (rather pointless - anything that > would match/fail this would also match/fail "/[a-z]/i"). "only > letters" would be "/^[a-z]+$/i" > > I think I'll create a trac ticket about this; it certainly needs some > clarification. > > On Sep 16, 10:50 am, "O.J. Tibi" <[EMAIL PROTECTED]> wrote: > > > > > Thanks for the help guys, I'll make a few test cases on this behavior > > later and see if it's as how grigri described. > > > On Sep 16, 4:51 pm, RichardAtHome <[EMAIL PROTECTED]> wrote: > > > > Ah, cool - thanks for clearing that up :) > > > > On Sep 16, 8:18 am, grigri <[EMAIL PROTECTED]> wrote: > > > > > > If that's true, how do you explain the behaviour I mentioned above? > > > > > (unique message doesn't display, required message does)? > > > > > Because in your example, the validation rule is not handled in the > > > > normal manner. Checking if a field is empty or not is not handled by > > > > the 'allowEmpty' key, and works differently to the normal validation > > > > flow (yeah, it's weird). > > > > > For example, with these rules: > > > > > var $validate = array( > > > > "name"=>array( > > > > "required"=>array( > > > > "rule"=>array("minLength, 1), > > > > "message"=>"is required", > > > > "required"=>true > > > > ), > > > > "need-a"=>array( > > > > "rule"=>"/a/", > > > > "message"=>"must contain an a" > > > > ), > > > > "need-b"=>array( > > > > "rule"=>"/b/", > > > > "message"=>"must contain a b" > > > > ) > > > > ) > > > > ); > > > > > If you give it "xyz", both the 'need-a' and 'need-b' rules will fail, > > > > and the error message will first be set to "must contain an a" then > > > > overwritten with "must contain a b". If, in the "need-a" rule you add > > > > "last" => true, then the validation for that field will stop after > > > > 'need-a' fails and the error message will remain "must contain an a". > > > > > hope this makes sense > > > > grigri- Hide quoted text - > > - Show quoted text - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Missing Database Table
Whenever I am oh so sure I have everything setup but I still get strange errors like this it is always one thing... cache. Empty out all the caches and refresh. Hopefully your table will be available again. On Sep 16, 8:35 am, simpleman996633 <[EMAIL PROTECTED]> wrote: > Hi all, > > After running my Cake application locally i tried to upload it to my > remote server, configured everything properly, checked all the tables, > database access. But i couldn't solve the following error. I can't > find enough resources too . Plz somebody help > > Missing Database Table > Error: Database table acos for model Aco was not found. > > Notice: If you want to customize this error message, create app/views/ > errors/missing_table.ctp > > I used the ACL component. > > Plz 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
how to unit test a shell script
Hi, I do the following to unit test a shell script [ learn.test.php ] put in a folder "tests/cases/shells" (that I created) LearnShell = new LearnShell(); } function testOne(){ $this->LearnShell->testFunc(); } } ?> how ever it does not find the Class LearnShell. Now before I get deeper into it... can anyone point me to the proper solution? thx Jeurgen --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Form data from a view element
It doesn't matter whether your form comes from an element or a view file, it's generating the same HTML in the end, so check that first. If the form/controller doesn't work it's not a problem of the element. I'd guess that one of your problems is that you want to redirect as the final action of processing the data, but you're already echoing a lot of stuff before, so the redirect will fail. As a side note, you don't need to instantiate Sanitize, you can call it statically like Sanitize::clean($data); On 16 Sep 2008, at 22:11, Daniel wrote: > > Hello, > > I currently have a "comment box" view element that I plan to > embed in various places in my CakePHP application to allow users to > leave comments on various aspects of the site. > > I'm using the form helper inside of the element to generate the > form to be used to submit the data, however when I submit the data I > receive only a blank screen that says "0 query took ms". I've even > added debugging echoes to the controller to print the data array and > I'm still just receiving a blank page with "0 query took ms". > > Attached below is the comment "add" method and the respective > element code. > > Any help anyone can provide would be greatly appreciated, I seem > to be pretty stuck! > > > Controller code: > > function add() > { >echo ""; >$mrClean = new Sanitize(); > >echo "Data ". $this->data; > >if(!empty($this->data)) > { > $mrClean->clean($this->data); > > $currUser = $this->get_current_user(); > $this->data['Comment']['user_id'] = $currUser['id']; > $this->data['Comment']['isDeleted'] = 0; > > $targetEvent = $this->Event->find("first", > array('conditions' => array('Event.id' => > $this->data['Comment'] > ['event_id']), > 'recursive' => 1)); > > print_r($targetEvent); > > if(empty($targetEvent) || is_null($targetEvent)) > { > $this->Comment->invalidate('event_id', 'You have selected an > invalid event.'); > return; > } > > if($this->Comment->save($this->data)) > { > $this->flash('Your comment has been added', > '/events/view/'. > $this->data['Comment']['event_id']); > } else { > $this->flash('An error has occured adding your > comment.', '/ > events'); > } > } > } > > > Element code: > > create('Comment', array('action' => 'add')); ?> > > > > Subject: input('subject', > array( 'label' => > false )); ?> > > > > > > textarea('body', > array( 'label' => false, > 'rows' => 7, > 'cols' => 80 )); ?> > > > > > submit('Post Comment'); ?> > > > > hidden('event_id', array('value' => $event_id)); ?> > end(); ?> > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Auction software
It is not part of any api. It is an "automatic" behaviour. It is on line 317 http://api.cakephp.org/time_8php-source.html#l00317 If the date/time you provide is "greater than" the current time it is a future date and treated as such. But the name of the method does not really reflect this flexibility. :) On Sep 16, 12:04 pm, cem <[EMAIL PROTECTED]> wrote: > I think creating a new helper from the time helper would be easier > right ? > Maybe in next versions they will add time calculations too :) > And I couldn't find the $backwards in the api of time helper . Where > is that ? > > On 16 Eylül, 12:33, "[EMAIL PROTECTED]" > > <[EMAIL PROTECTED]> wrote: > > It does take future dates as far I understand the source... there is a > > $backwards variable that detects if you are dealing with the future. > > > On Sep 16, 11:10 am, RichardAtHome <[EMAIL PROTECTED]> wrote: > > > > I *think* cem needs a function that works like timeAgoInWords, but for > > > dates in the future. > > > > Take a look in the TimeHelper source at the timeAgoInWords function, > > > that should give you a good starting place. > > > > On Sep 15, 7:42 pm, "[EMAIL PROTECTED]" > > > > <[EMAIL PROTECTED]> wrote: > > > > TimeHelper is used to help format times and dates. I am not sure that > > > > was what you were looking for? > > > > TimeHelper::timeAgoInWords() - can take future dates and times and > > > > will in those cases return the relative time without the "ago" in the > > > > end. > > > > > There is no (and no need for) class designed to help you "set" > > > > remaining time on your model data. > > > > When I have needed relative times stored I have turned to strtotime(). > > > > If I want an auction to expire "in 2 weeks" I would just store > > > > strtotime('+ 2 weeks') in my database (or a datetime formatted string > > > > of that timestamp is more likely). > > > > > Like I said I was not sure what you were asking. > > > > > On Sep 15, 7:36 pm, cem <[EMAIL PROTECTED]> wrote: > > > > > > Hi I am trying to build an auction software with cakePHP . My problem > > > > > is : > > > > > > As you know i have to set the time remaining for all the auctions . > > > > > Does cake provide any ready made class for that ? > > > > > > I take a look at the time helper but could not find anything > > > > > useful . > > > > > Any ideas ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Auth Redirect Problems
yeah Tony I am seeming to get this too :/ someone on IRC said to check that things like favicons are correctly being pointed at and so on. can anyone post a sample of some redirect Auth code? Luke On Sep 15, 5:21 pm, Tony Thomas <[EMAIL PROTECTED]> wrote: > I did that. Same problem. > > To explain further, if I'm logging in for the first time on a given > day, theredirectworks fine. It's only if I log out or my session > expires and I log back in that the problem occurs. > > On Sep 9, 12:55 pm, "Yodi Aditya" <[EMAIL PROTECTED]> wrote: > > > Try using : > > $this->Auth->loginRedirect = array('controller'=>'users', > > 'action'=>'profile'); > > on beforeFilter() > > > then > > > function login() { > > $this->redirect($this->Auth->redirect()); > > > } > > > Yodiaditya -http://re.web.id > > > On 9/9/08, Tony Thomas <[EMAIL PROTECTED]> wrote: > > > > If someone is familiar with a post to this group or blog entry that > > > addresses this issue, please let me know. I've spent the morning > > > scouring both with no satisfactory results. > > > > I have a cakePHP app on a shared server. In local testing, everything > > > worked fine. But mod_rewrite did not function properly on the shared > > > server, so I'm using CakePHP pretty URLS instead. Also caching (at > > > least temporarily) is off. I've uncommented the pertinent lines of > > > code in core.php and I've dutifully deleted the .htaccess files. > > > > The problem I have is that after logging in, theredirectis > > > inconsistent. About 2/3 of the time I get redirected to > > >https://[base_url]/https:/[domain]. I just can't seem to find away > > > around this problem. > > > > My login function looks like this: > > > > function login() { > > > $this->Auth->loginRedirect = array('controller' => > > > 'controller_name', 'action' => 'index'); > > > } > > > > I still get inconsistent results with theredirectgoing to a URL like > > > the former example the majority of the time. Any insight, links, etc. > > > would be 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Form data from a view element
Hello, I currently have a "comment box" view element that I plan to embed in various places in my CakePHP application to allow users to leave comments on various aspects of the site. I'm using the form helper inside of the element to generate the form to be used to submit the data, however when I submit the data I receive only a blank screen that says "0 query took ms". I've even added debugging echoes to the controller to print the data array and I'm still just receiving a blank page with "0 query took ms". Attached below is the comment "add" method and the respective element code. Any help anyone can provide would be greatly appreciated, I seem to be pretty stuck! Controller code: function add() { echo ""; $mrClean = new Sanitize(); echo "Data ". $this->data; if(!empty($this->data)) { $mrClean->clean($this->data); $currUser = $this->get_current_user(); $this->data['Comment']['user_id'] = $currUser['id']; $this->data['Comment']['isDeleted'] = 0; $targetEvent = $this->Event->find("first", array('conditions' => array('Event.id' => $this->data['Comment'] ['event_id']), 'recursive' => 1)); print_r($targetEvent); if(empty($targetEvent) || is_null($targetEvent)) { $this->Comment->invalidate('event_id', 'You have selected an invalid event.'); return; } if($this->Comment->save($this->data)) { $this->flash('Your comment has been added', '/events/view/'. $this->data['Comment']['event_id']); } else { $this->flash('An error has occured adding your comment.', '/ events'); } } } Element code: create('Comment', array('action' => 'add')); ?> Subject: input('subject', array( 'label' => false )); ?> textarea('body', array( 'label' => false, 'rows' => 7, 'cols' => 80 )); ?> submit('Post Comment'); ?> hidden('event_id', array('value' => $event_id)); ?> end(); ?> --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
kiosk using cakePhp framework
hi I am software developer, I want to build a online shopping system for a kiosk enviornment .So,changes of any configaration is needed?please advise me. Apurba --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---