Re: Getting js to work - prototype, jquery dont matter
Here is a more interesting potential solution: from my webhost: just not sure which .htaccess file to alter ... Do Rochen support both PHP4 and PHP5? Rochen is proud to be one of the very first hosting providers to offer dual PHP platform support meaning we support both PHP4 and PHP5 alongside each other on the same server. This is extremely useful because it means you can run a PHP4 script in one directory and a PHP5 script in another directory of the same account. You can select on the fly the PHP build you wish to use. There is no need to host sites on different servers etc. Some hosts have opted to make a full migration to PHP5 but in our opinion this is an irresponsible thing to do as it results in many popular scripts breaking that are not PHP5 compatible. We do however recognize the need for PHP5 support to allow clients to deploy the latest cutting edge applications in a production environment. Our dual PHP platform support system provides the best of both worlds. There are two very simple ways you can take advantage of PHP5 support under your account - * 1) Simply name the script you wish to execute using PHP5 .php5 instead of .php. That's all you need to do. * 2) Alternatively, if you would like scripts named .php to execute using PHP5 instead of PHP4 then simply drop the following contents into a .htaccess file within the directory containing the PHP5 script - Quote: AddHandler application/x-httpd-php5 .php By default all scripts named .php or .php4 will execute using PHP4 unless you are using the above .htaccess directive and scripts named .php5 will execute using PHP5. We will be keeping PHP4 as the default installation on all servers for the foreseeable future. As PHP5 develops over the next few years though, we may eventually change the configuration so that PHP5 is the default PHP installation. We have deployed the dual PHP support system on all shared (premium and non-premium) servers at no extra cost and it is available for immediate use. This has not been deployed on Managed Dedicated Servers as some clients are running very custom configurations, some are already running PHP5 and others simply don't need this type of support. If you would like dual PHP support though then please open a ticket and we will try and arrange this for you. On Jun 28, 12:50 am, Geoff Ford <[EMAIL PROTECTED]> wrote: > In your default.ctp do a debug on $this->helpers and/or > $this-.>viewVars > > It seems to me that the helpers aren't being passed through to the > view object. > > Html is the only helper by default (cake/libs/view/view.php line 115) > which is then supposed to be overwritten by the controllers helper > (line 289) which is inside a __construc() which I think is PHP5 only - > this is probably the cause of the issue on PHP4. > > Geoff > --http://lemoncake.wordpress.com > > On Jun 28, 4:33 pm, MercedesAMG <[EMAIL PROTECTED]> wrote: > > > localhost is php 5.2.1 > > trial site was using same php > > production site is using php 4.4.7 > > > the default.ctp is pretty generic from the cake install I removed > > anything possibly flaky and still get same error. > > thanks > > > On Jun 28, 12:04 am, Geoff Ford <[EMAIL PROTECTED]> wrote: > > > > Is there anything on the first 36 lines that may or may not cause an > > > issue or is it all html? > > > > I can't see why any of that would be causing issues...what version of > > > PHP is the local and remote hosts? > > > > --http://lemoncake.wordpress.com > > > > On Jun 28, 3:35 pm, MercedesAMG <[EMAIL PROTECTED]> wrote: > > > > > In the default.ctp i have the following: > > > > Line 37charset('UTF-8');?> > > > > 38link('prototype'); ?> > > > > 39link('jQuery'); ?> > > > > > I have in app/app_controller.php the following: > > > > > class AppController extends Controller { > > > > var $helpers = array('Html', 'Link', 'Form', 'Javascript', 'Ajax'); > > > > > } > > > > > and I have the same helpers line in every controller, just in case and > > > > in fact they were there before I made a new app_controller.php file. > > > > > I have debug on but the only line showing for an error is the line 38 > > > > error. ... > > > > but in the upper title of the page it says missing helper Class > > > > > so i checked that all out. > > > > > I was able to have the entire application work on localhost and on a > > > > test live site. This application is installed on a new production > > > > server. > > > > Thanks > > > > On Jun 27, 10:51 pm, Geoff Ford <[EMAIL PROTECTED]> wrote: > > > > > > Helpers used in the default.ctp need to be either included in every > > > > > controller or in the app_controller.php > > > > > > What is the function that it it can't find? i.e. what is on line 38? > > > > > > --http://lemoncake.wordpress.com > > > > > > On Jun 28, 2:15 pm, MercedesAMG <[EMAIL PROTECTED]> wrote: > > > > > > > here is the erro message I get > > > > > > > Fatal error: Call to a member function on a non-object in /home/ > > > > > >
multiple line file import problem.
I am attempting to import a file that has been uploaded to a imports folder in the correct location... I have had the import routine saving an entry, but when the next line is imported it does nto create a new record but updates the previous one. How can I do this... // open the file for reading if (! $fd = @fopen($csvFile, "r")) { die("Failed to open input file"); } // set header to true $header = true; // read the file using the automatic csv conversion routines while ($fields = fgetcsv($fd)) { // if it the header then skip the row if ($header) { /* skip CSV header row */ $header = false; continue; } else { // parse the imported data into the data array ready for saving $this->data = $this->__parse_csv_row($fields); // save the imported user data $this->User->save($this->data); } } Am I barking up the wrong tree on the way ->save works? Can I not get it to function this way? Thanks Ady --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: checkboxes 1.2
echo $form->checkbox('s_sexes[]',array('value'=>'Men')) . 'Men'; echo $form->checkbox('s_sexes[]',array('value'=>'Women')) . 'Women'; might work - you should then get the usual array structure in php $_POST['s_sexes'] => array('Men', 'Women') Geoff -- http://lemoncake.wordpress.com On Jun 28, 2:55 pm, Allen Romero <[EMAIL PROTECTED]> wrote: > radio buttons won't suffice here. > > Has anyone successfully used checkboxes in 1.2. Surely someone has > this working? > > Thx. > > Allen > > On Jun 24, 3:15 pm, trooney <[EMAIL PROTECTED]> wrote: > > > Try using radio inputs instead ofcheckboxes. > > > echo $html- > > > >radio('s_sexes',array('man'=>'Man','woman'=>'Woman','both'=>'Both'); > > > On Jun 24, 4:35 pm, Allen Romero <[EMAIL PROTECTED]> wrote: > > > > Does anyone know how to displaycheckboxesin1.2then retrieve their > > > values > > > > I tried something like > > > > echo $form->checkbox('s_sexes',array('value'=>'Men')) . 'Men'; > > > echo $form->checkbox('s_sexes',array('value'=>'Women')) . 'Women'; > > > > but whent he page is submitted, if both are checked, only the second > > > value is submitted to the page. > > > > Any examples appreciated. > > > > Thx. > > > > Allen --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Getting js to work - prototype, jquery dont matter
In your default.ctp do a debug on $this->helpers and/or $this-.>viewVars It seems to me that the helpers aren't being passed through to the view object. Html is the only helper by default (cake/libs/view/view.php line 115) which is then supposed to be overwritten by the controllers helper (line 289) which is inside a __construc() which I think is PHP5 only - this is probably the cause of the issue on PHP4. Geoff -- http://lemoncake.wordpress.com On Jun 28, 4:33 pm, MercedesAMG <[EMAIL PROTECTED]> wrote: > localhost is php 5.2.1 > trial site was using same php > production site is using php 4.4.7 > > the default.ctp is pretty generic from the cake install I removed > anything possibly flaky and still get same error. > thanks > > On Jun 28, 12:04 am, Geoff Ford <[EMAIL PROTECTED]> wrote: > > > Is there anything on the first 36 lines that may or may not cause an > > issue or is it all html? > > > I can't see why any of that would be causing issues...what version of > > PHP is the local and remote hosts? > > > --http://lemoncake.wordpress.com > > > On Jun 28, 3:35 pm, MercedesAMG <[EMAIL PROTECTED]> wrote: > > > > In the default.ctp i have the following: > > > Line 37charset('UTF-8');?> > > > 38link('prototype'); ?> > > > 39link('jQuery'); ?> > > > > I have in app/app_controller.php the following: > > > > class AppController extends Controller { > > > var $helpers = array('Html', 'Link', 'Form', 'Javascript', 'Ajax'); > > > > } > > > > and I have the same helpers line in every controller, just in case and > > > in fact they were there before I made a new app_controller.php file. > > > > I have debug on but the only line showing for an error is the line 38 > > > error. ... > > > but in the upper title of the page it says missing helper Class > > > > so i checked that all out. > > > > I was able to have the entire application work on localhost and on a > > > test live site. This application is installed on a new production > > > server. > > > Thanks > > > On Jun 27, 10:51 pm, Geoff Ford <[EMAIL PROTECTED]> wrote: > > > > > Helpers used in the default.ctp need to be either included in every > > > > controller or in the app_controller.php > > > > > What is the function that it it can't find? i.e. what is on line 38? > > > > > --http://lemoncake.wordpress.com > > > > > On Jun 28, 2:15 pm, MercedesAMG <[EMAIL PROTECTED]> wrote: > > > > > > here is the erro message I get > > > > > > Fatal error: Call to a member function on a non-object in /home/ > > > > > totalme/public_html/app/views/layouts/default.ctp on line 38 > > > > > > i have helper is controller and scripts are in app/webroot/js > > > > > > tried jquery and then back to prototype same error message > > > > > > I am missing ?- Hide quoted text - > > > > > - Show quoted text - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: validating password
If i use $this->invalidate("password", "Passwords do not match"); how do i associate that in my view.. Currently my view has input('password', array('error' => 'Password must be at least 4 characters.', 'type'=>'password', 'value' =>'')); ?> for the password.. If i do as you say, i still get the error about being at least 4 characters.. Personally i'd rather not even have the error messages in the view but in the models.. How do i set the error from invalidate to display in the views? On Jun 27, 4:27 pm, Grant Cox <[EMAIL PROTECTED]> wrote: > I would use $this->invalidate('password', "Passwords do not match") - > this way it is just the same as any other validation routine. You > also don't need to call beforeValidate() in your beforeSave, it is > done automatically by Cake when you save. > > Your beforeSave is still MD5-ing every password that gets put in > there. So, if you do: > > $existing_user = $this->User->read(null, $user_id); > $existing_user['User']['name'] = 'I am changing your name'; > $this->User->save( $existing_user ); > > then your password is now double MD5'd. What I was saying previously > is that the field submitted from the form that has the plain text > password should not be the actual password field used in your > database. So if you use "password" in the database to indicate a > hashed password, then on your form make the field "plain_password" or > "new_password" or something - this way in your beforeSave you know if > it needs to be MD5'd, otherwise don't change. The "plain_password" > should not be saved into the db at all. And you're right, the hashed > password field should not appear in a form either. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Getting js to work - prototype, jquery dont matter
When I remove the references to javascript (lines 38 and 39) the pages show up perfectly albiet in html format and no javascript rendering On Jun 28, 12:33 am, MercedesAMG <[EMAIL PROTECTED]> wrote: > localhost is php 5.2.1 > trial site was using same php > production site is using php 4.4.7 > > the default.ctp is pretty generic from the cake install I removed > anything possibly flaky and still get same error. > thanks > > On Jun 28, 12:04 am, Geoff Ford <[EMAIL PROTECTED]> wrote: > > > Is there anything on the first 36 lines that may or may not cause an > > issue or is it all html? > > > I can't see why any of that would be causing issues...what version of > > PHP is the local and remote hosts? > > > --http://lemoncake.wordpress.com > > > On Jun 28, 3:35 pm, MercedesAMG <[EMAIL PROTECTED]> wrote: > > > > In the default.ctp i have the following: > > > Line 37charset('UTF-8');?> > > > 38link('prototype'); ?> > > > 39link('jQuery'); ?> > > > > I have in app/app_controller.php the following: > > > > class AppController extends Controller { > > > var $helpers = array('Html', 'Link', 'Form', 'Javascript', 'Ajax'); > > > > } > > > > and I have the same helpers line in every controller, just in case and > > > in fact they were there before I made a new app_controller.php file. > > > > I have debug on but the only line showing for an error is the line 38 > > > error. ... > > > but in the upper title of the page it says missing helper Class > > > > so i checked that all out. > > > > I was able to have the entire application work on localhost and on a > > > test live site. This application is installed on a new production > > > server. > > > Thanks > > > On Jun 27, 10:51 pm, Geoff Ford <[EMAIL PROTECTED]> wrote: > > > > > Helpers used in the default.ctp need to be either included in every > > > > controller or in the app_controller.php > > > > > What is the function that it it can't find? i.e. what is on line 38? > > > > > --http://lemoncake.wordpress.com > > > > > On Jun 28, 2:15 pm, MercedesAMG <[EMAIL PROTECTED]> wrote: > > > > > > here is the erro message I get > > > > > > Fatal error: Call to a member function on a non-object in /home/ > > > > > totalme/public_html/app/views/layouts/default.ctp on line 38 > > > > > > i have helper is controller and scripts are in app/webroot/js > > > > > > tried jquery and then back to prototype same error message > > > > > > I am missing ?- Hide quoted text - > > > > > - Show quoted text - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Getting js to work - prototype, jquery dont matter
localhost is php 5.2.1 trial site was using same php production site is using php 4.4.7 the default.ctp is pretty generic from the cake install I removed anything possibly flaky and still get same error. thanks On Jun 28, 12:04 am, Geoff Ford <[EMAIL PROTECTED]> wrote: > Is there anything on the first 36 lines that may or may not cause an > issue or is it all html? > > I can't see why any of that would be causing issues...what version of > PHP is the local and remote hosts? > > --http://lemoncake.wordpress.com > > On Jun 28, 3:35 pm, MercedesAMG <[EMAIL PROTECTED]> wrote: > > > In the default.ctp i have the following: > > Line 37charset('UTF-8');?> > > 38link('prototype'); ?> > > 39link('jQuery'); ?> > > > I have in app/app_controller.php the following: > > > class AppController extends Controller { > > var $helpers = array('Html', 'Link', 'Form', 'Javascript', 'Ajax'); > > > } > > > and I have the same helpers line in every controller, just in case and > > in fact they were there before I made a new app_controller.php file. > > > I have debug on but the only line showing for an error is the line 38 > > error. ... > > but in the upper title of the page it says missing helper Class > > > so i checked that all out. > > > I was able to have the entire application work on localhost and on a > > test live site. This application is installed on a new production > > server. > > Thanks > > On Jun 27, 10:51 pm, Geoff Ford <[EMAIL PROTECTED]> wrote: > > > > Helpers used in the default.ctp need to be either included in every > > > controller or in the app_controller.php > > > > What is the function that it it can't find? i.e. what is on line 38? > > > > --http://lemoncake.wordpress.com > > > > On Jun 28, 2:15 pm, MercedesAMG <[EMAIL PROTECTED]> wrote: > > > > > here is the erro message I get > > > > > Fatal error: Call to a member function on a non-object in /home/ > > > > totalme/public_html/app/views/layouts/default.ctp on line 38 > > > > > i have helper is controller and scripts are in app/webroot/js > > > > > tried jquery and then back to prototype same error message > > > > > I am missing ?- Hide quoted text - > > > > - Show quoted text - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How can I get the execution time of PHP code and DB access?
Oh and to increse performace look into the caching settings in cake Cheers, Geoff -- http://lemoncake.wordpress.com On Jun 28, 4:21 pm, Geoff Ford <[EMAIL PROTECTED]> wrote: > For query times put DEBUG on level 2 in core.php A table will show at > the bottom of the page with all your sql queries including a "Took > (ms)" column. > For total page execution - on DEBUG level 2 there is a comment > rendered in the source with the execution time (right at the bottom) > > On Jun 28, 3:36 pm, hi and hello <[EMAIL PROTECTED]> wrote: > > > I am using cakephp to build a website and at last I found the > > performance is not very well. > > So I want to know if it exits a tool by which I can get the execution > > time of PHP code and DB access? > > Or how can I write the tool ? > >thanks very much!!! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How can I get the execution time of PHP code and DB access?
For query times put DEBUG on level 2 in core.php A table will show at the bottom of the page with all your sql queries including a "Took (ms)" column. For total page execution - on DEBUG level 2 there is a comment rendered in the source with the execution time (right at the bottom) On Jun 28, 3:36 pm, hi and hello <[EMAIL PROTECTED]> wrote: > I am using cakephp to build a website and at last I found the > performance is not very well. > So I want to know if it exits a tool by which I can get the execution > time of PHP code and DB access? > Or how can I write the tool ? >thanks very much!!! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Getting js to work - prototype, jquery dont matter
Is there anything on the first 36 lines that may or may not cause an issue or is it all html? I can't see why any of that would be causing issues...what version of PHP is the local and remote hosts? -- http://lemoncake.wordpress.com On Jun 28, 3:35 pm, MercedesAMG <[EMAIL PROTECTED]> wrote: > In the default.ctp i have the following: > Line 37charset('UTF-8');?> > 38link('prototype'); ?> > 39link('jQuery'); ?> > > I have in app/app_controller.php the following: > > class AppController extends Controller { > var $helpers = array('Html', 'Link', 'Form', 'Javascript', 'Ajax'); > > } > > and I have the same helpers line in every controller, just in case and > in fact they were there before I made a new app_controller.php file. > > I have debug on but the only line showing for an error is the line 38 > error. ... > but in the upper title of the page it says missing helper Class > > so i checked that all out. > > I was able to have the entire application work on localhost and on a > test live site. This application is installed on a new production > server. > Thanks > On Jun 27, 10:51 pm, Geoff Ford <[EMAIL PROTECTED]> wrote: > > > Helpers used in the default.ctp need to be either included in every > > controller or in the app_controller.php > > > What is the function that it it can't find? i.e. what is on line 38? > > > --http://lemoncake.wordpress.com > > > On Jun 28, 2:15 pm, MercedesAMG <[EMAIL PROTECTED]> wrote: > > > > here is the erro message I get > > > > Fatal error: Call to a member function on a non-object in /home/ > > > totalme/public_html/app/views/layouts/default.ctp on line 38 > > > > i have helper is controller and scripts are in app/webroot/js > > > > tried jquery and then back to prototype same error message > > > > I am missing ?- Hide quoted text - > > > - Show quoted text - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
How can I get the execution time of PHP code and DB access?
I am using cakephp to build a website and at last I found the performance is not very well. So I want to know if it exits a tool by which I can get the execution time of PHP code and DB access? Or how can I write the tool ? thanks very much!!! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Getting js to work - prototype, jquery dont matter
In the default.ctp i have the following: Line 37charset('UTF-8');?> 38link('prototype'); ?> 39link('jQuery'); ?> I have in app/app_controller.php the following: class AppController extends Controller { var $helpers = array('Html', 'Link', 'Form', 'Javascript', 'Ajax'); } and I have the same helpers line in every controller, just in case and in fact they were there before I made a new app_controller.php file. I have debug on but the only line showing for an error is the line 38 error. ... but in the upper title of the page it says missing helper Class so i checked that all out. I was able to have the entire application work on localhost and on a test live site. This application is installed on a new production server. Thanks On Jun 27, 10:51 pm, Geoff Ford <[EMAIL PROTECTED]> wrote: > Helpers used in the default.ctp need to be either included in every > controller or in the app_controller.php > > What is the function that it it can't find? i.e. what is on line 38? > > --http://lemoncake.wordpress.com > > On Jun 28, 2:15 pm, MercedesAMG <[EMAIL PROTECTED]> wrote: > > > > > here is the erro message I get > > > Fatal error: Call to a member function on a non-object in /home/ > > totalme/public_html/app/views/layouts/default.ctp on line 38 > > > i have helper is controller and scripts are in app/webroot/js > > > tried jquery and then back to prototype same error message > > > I am missing ?- Hide quoted text - > > - Show quoted text - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: cake1.2 model validation
works like a charm.. here's the final code: var $validate = array( 'directory' => array('rule' => 'ValidFunc') ); function ValidFunc($value) { $this->data['ModelName']['fieldname']='new' .$value; case 1: $this->invalidate('fieldname', 'message1'); return true; case 2: $this->invalidate('fieldname', 'message2'); return true; } now here's the magic trick, in order to make it visible in the form in the view i should..: $this->data = $this->ModelName->data; otherwise it doesn't get changed in the controller and then displayed in the view. is there a way to change it from the model itself? On Jun 28, 1:05 am, francky06l <[EMAIL PROTECTED]> wrote: > Yes, nice hack somehow :-) > Thanks Geoff > > On Jun 28, 12:56 am, Geoff Ford <[EMAIL PROTECTED]> wrote: > > > Just took at look at the code and your right franky, after you return > > false from your custom function invalidFields() then calls $this- > > > >invalidate() itself overwriting the message you just wrote. > > > However this is not the case if you return true. > > > This may be a bit "wrong" but you can get around this like so > > > function ValidFun($ruleParams){ > > $fieldName = array_keys($ruleParams); > > $fieldName = $fieldName[0]; > > if ($conditions){ > > // all validation passed > > } else { > >// validation failed > >$this->invalidate($fieldName, 'Your Error Message'); > > } > > > return true; > > > } > > > By always returning true invalidFields() will not set the error > > message itself, but the Model::validationErrors will still contain the > > invalid field with your error message and and so Model::validates() > > will return the correct value of false. > > > On Jun 28, 8:45 am, francky06l <[EMAIL PROTECTED]> wrote: > > > > I am not sure that will work (I might be wrong) but it seems to me > > > that the model->invalidate is called after your validFunc returning > > > false (this call will oerwrite your message). I haven't tested, > > > neither check the code deeply enough to know if the call to invalidate > > > (into the validateField method) checks for an existing messages prior > > > to call invalidate.. > > > > Let me know :-) > > > Thanks > > > > On Jun 28, 12:30 am, Geoff Ford <[EMAIL PROTECTED]> wrote: > > > > > Oops just reread the question. > > > > > To set the error message from within the ValidFunc you can use the > > > > Model::invalidate($field, $value = null); > > > > > On Jun 28, 8:26 am, Geoff Ford <[EMAIL PROTECTED]> wrote: > > > > > > if believe that you can change the error message with > > > > > var $validate = array( > > > > > 'directory' => array('error_mesasage' => > > > > > array(array('rule' => 'ValidFunc', 'message'=>'message')) > > > > > ); > > > > > > On Jun 28, 5:32 am, francky06l <[EMAIL PROTECTED]> wrote: > > > > > > > I guess you can't do this using the model validation, but if your > > > > > > validation function is in the current model, you could replace the > > > > > > value $this->data['Model']['field'] and return true (in this way, > > > > > > this > > > > > > will not be considered as an error). > > > > > > If your goal is to correct the value, show it with a message, the > > > > > > above is still valid (for the value) but I have no idea how to > > > > > > change > > > > > > the message. You can have a look to the bakery (multiple > > > > > > validation), > > > > > > Mariano has done work about validation messages into the view-side, > > > > > > maybe there you could interact with it. > > > > > > > On Jun 27, 9:11 pm, phpjoy <[EMAIL PROTECTED]> wrote: > > > > > > > > ahoy, > > > > > > > > i have the following validation in a model: > > > > > > > var $validate = array( > > > > > > > 'directory' => array('rule' => 'ValidFunc', > > > > > > > 'message'=>'message') > > > > > > > ); > > > > > > > > function ValidFunc($value) { > > > > > > > $newvalue = 'new' .$value; > > > > > > > $value = $newvalue; > > > > > > > case 1: /*message=1*/ return false; > > > > > > > case 2: /*message=2*/ return false; > > > > > > > } > > > > > > > > there are 2 things i'm struggling to do: > > > > > > > 1) change the validation message from the ValidFunc, > > > > > > > 2) change $value for the form to $newvalue. > > > > > > > > anyone knows how i can do that? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: checkboxes 1.2
radio buttons won't suffice here. Has anyone successfully used checkboxes in 1.2. Surely someone has this working? Thx. Allen On Jun 24, 3:15 pm, trooney <[EMAIL PROTECTED]> wrote: > Try using radio inputs instead ofcheckboxes. > > echo $html- > > >radio('s_sexes',array('man'=>'Man','woman'=>'Woman','both'=>'Both'); > > On Jun 24, 4:35 pm, Allen Romero <[EMAIL PROTECTED]> wrote: > > > Does anyone know how to displaycheckboxesin1.2then retrieve their > > values > > > I tried something like > > > echo $form->checkbox('s_sexes',array('value'=>'Men')) . 'Men'; > > echo $form->checkbox('s_sexes',array('value'=>'Women')) . 'Women'; > > > but whent he page is submitted, if both are checked, only the second > > value is submitted to the page. > > > Any examples appreciated. > > > Thx. > > > Allen --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Getting js to work - prototype, jquery dont matter
Helpers used in the default.ctp need to be either included in every controller or in the app_controller.php What is the function that it it can't find? i.e. what is on line 38? -- http://lemoncake.wordpress.com On Jun 28, 2:15 pm, MercedesAMG <[EMAIL PROTECTED]> wrote: > here is the erro message I get > > Fatal error: Call to a member function on a non-object in /home/ > totalme/public_html/app/views/layouts/default.ctp on line 38 > > i have helper is controller and scripts are in app/webroot/js > > tried jquery and then back to prototype same error message > > I am missing ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Getting js to work - prototype, jquery dont matter
here is the erro message I get Fatal error: Call to a member function on a non-object in /home/ totalme/public_html/app/views/layouts/default.ctp on line 38 i have helper is controller and scripts are in app/webroot/js tried jquery and then back to prototype same error message I am missing ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: validating password
it the lines function beforeSave() { if ($this->validates()) { that Grant was talking about; $this->validates(); is called automatically before it beforeSave() gets called so your call to $this->validates() is redundant. On Jun 28, 12:17 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > That is a good idea about using invalidate. I didnt know i could do it > that way. > And i'm not sure which code you are referring to, but the latest post > with code that i posted i did not call beforeValidate on my own.. > Maybe you read that part wrong.. Those were separate functions.. > Second of all, i'm not md5'ing anything more than once.. I'm sure of > that (i just tested to make sure). > > If you look closely at the code, in beforeValidate i check if the > password was left blank, and if it was i unset that variable from the > array altogether, because this means i don't want to change the > password. Turns out cakephp is fine with that, if a variable is not in > the $data array then it won't be changed when you do a save. So > basically its as if the password field wasn't even there if the user > didnt fill it in, which is exactly what i want.. > Then all i have to do is md5 if the field was not empty.. Thanks for > your help though, these little issues have been taking me a lot of > time to get figured out.. Hopefully the next app i build with cakephp > will be 10x faster (it should be) > > On Jun 27, 4:27 pm, Grant Cox <[EMAIL PROTECTED]> wrote: > > > I would use $this->invalidate('password', "Passwords do not match") - > > this way it is just the same as any other validation routine. You > > also don't need to call beforeValidate() in your beforeSave, it is > > done automatically by Cake when you save. > > > Your beforeSave is still MD5-ing every password that gets put in > > there. So, if you do: > > > $existing_user = $this->User->read(null, $user_id); > > $existing_user['User']['name'] = 'I am changing your name'; > > $this->User->save( $existing_user ); > > > then your password is now double MD5'd. What I was saying previously > > is that the field submitted from the form that has the plain text > > password should not be the actual password field used in your > > database. So if you use "password" in the database to indicate a > > hashed password, then on your form make the field "plain_password" or > > "new_password" or something - this way in your beforeSave you know if > > it needs to be MD5'd, otherwise don't change. The "plain_password" > > should not be saved into the db at all. And you're right, the hashed > > password field should not appear in a form either. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How can I have an action return the contents of a processed .thtml file
http://php.net/ob_start http://php.net/ob_get_contents $layout = $this->layout; ob_start(); $this->layout = null; $this->render('view'); $html = ob_get_contents(); ob_end_clean(); $this->layout = $layout; On Jun 28, 12:14 pm, codecowboy <[EMAIL PROTECTED]> wrote: > Hi All, > > I have been wondering it is possible to have a function like render > return as a string the html that is produced by a view after cake has > processed it into html. > > For instance. Lets say that I am using a datagrid to return search > results. I use a callback function to modify the content of certain > cells. I want that callback function to use a .thtml to stylize the > content of the cell. Basically, I am trying to follow MVC design > pretty strictly. I do not want to create html in the call back > function itself. > > Perhaps something like this is what I am looking for > > function printLink(...){ > . > . > . > > //set some vars for some_view.thtml > . > . > . > > // Process the view and retrieve the html that resulted > $strHtml = $this->render(some_view.thtml); > > return $strHtml; > > } > > I want the html that is returned by printLink(...) to be displayed in > the datagrid cell. So my question is "Is there anything like that > $this->render(some_view.thtml) that I can call in Cake?". > > Let me know if my question is unclear. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Instructions for Upgrading to 1.2
To find out, then, I'd recommend using WinMerge (search for it, it's free), you can do a directory comparison, and drill down to a file compare :-) On 6/27/07, Sonic Baker <[EMAIL PROTECTED]> wrote: > > Hi Jonathan, > > IIRC there are also some files and directories (such as the 'locale' > directory) in the 1.2 app directory which aren't included in the 1.1version. > And from what I remember, there are some files in the > 1.1 branch which aren't in the 1.2. It could be that my app dir is from an > old checkout though. > > Cheers, > > Sonic > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Instructions for Upgrading to 1.2
Hi Jonathan, IIRC there are also some files and directories (such as the 'locale' directory) in the 1.2 app directory which aren't included in the 1.1version. And from what I remember, there are some files in the 1.1 branch which aren't in the 1.2. It could be that my app dir is from an old checkout though. Cheers, Sonic --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: validating password
That is a good idea about using invalidate. I didnt know i could do it that way. And i'm not sure which code you are referring to, but the latest post with code that i posted i did not call beforeValidate on my own.. Maybe you read that part wrong.. Those were separate functions.. Second of all, i'm not md5'ing anything more than once.. I'm sure of that (i just tested to make sure). If you look closely at the code, in beforeValidate i check if the password was left blank, and if it was i unset that variable from the array altogether, because this means i don't want to change the password. Turns out cakephp is fine with that, if a variable is not in the $data array then it won't be changed when you do a save. So basically its as if the password field wasn't even there if the user didnt fill it in, which is exactly what i want.. Then all i have to do is md5 if the field was not empty.. Thanks for your help though, these little issues have been taking me a lot of time to get figured out.. Hopefully the next app i build with cakephp will be 10x faster (it should be) On Jun 27, 4:27 pm, Grant Cox <[EMAIL PROTECTED]> wrote: > I would use $this->invalidate('password', "Passwords do not match") - > this way it is just the same as any other validation routine. You > also don't need to call beforeValidate() in your beforeSave, it is > done automatically by Cake when you save. > > Your beforeSave is still MD5-ing every password that gets put in > there. So, if you do: > > $existing_user = $this->User->read(null, $user_id); > $existing_user['User']['name'] = 'I am changing your name'; > $this->User->save( $existing_user ); > > then your password is now double MD5'd. What I was saying previously > is that the field submitted from the form that has the plain text > password should not be the actual password field used in your > database. So if you use "password" in the database to indicate a > hashed password, then on your form make the field "plain_password" or > "new_password" or something - this way in your beforeSave you know if > it needs to be MD5'd, otherwise don't change. The "plain_password" > should not be saved into the db at all. And you're right, the hashed > password field should not appear in a form either. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
How can I have an action return the contents of a processed .thtml file
Hi All, I have been wondering it is possible to have a function like render return as a string the html that is produced by a view after cake has processed it into html. For instance. Lets say that I am using a datagrid to return search results. I use a callback function to modify the content of certain cells. I want that callback function to use a .thtml to stylize the content of the cell. Basically, I am trying to follow MVC design pretty strictly. I do not want to create html in the call back function itself. Perhaps something like this is what I am looking for function printLink(...){ . . . //set some vars for some_view.thtml . . . // Process the view and retrieve the html that resulted $strHtml = $this->render(some_view.thtml); return $strHtml; } I want the html that is returned by printLink(...) to be displayed in the datagrid cell. So my question is "Is there anything like that $this->render(some_view.thtml) that I can call in Cake?". Let me know if my question is unclear. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Instructions for Upgrading to 1.2
in the app folder, i believe the only real change there is swapping thtml for ctp (not required), and removing extraneous addons that are 1.1 only (assuming their functionality is unneeded for 1.2) my main change was with the template files (change to ctp), $form helper use, and validation On 6/27/07, Sonic Baker <[EMAIL PROTECTED]> wrote: > > > > On 6/27/07, Chris Hartjes <[EMAIL PROTECTED]> wrote: > > > > Once you fix things you can do a diff > > on the two directories (old version and 1.2 version) to get an idea on > > what has changed. > > > I tried doing this directly on the 'app' directories of the two branches > in the CakePHP repository itself. Unfortunately it gave me a huge output > detailing the differences on each line of code in each file. I couldn't > figure out how to only get a difference in the directory file listings. > > I don't believe there are any "this is how to migrate to Cake 1.2" > > instructions out there. > > > Looks like another item to add to my TODO list of bakery articles. "Oh, if > I had a minute to myself" :-( > > Hope that helps, and I appologize that the technique is more > > brute-force than anything. > > > That's ok dude. Thanks for the sugggestion anyway. I'm just one of these > people who won't feel right unless I know I have all the correct files in > the correct places. > I wonder if it'd be possible to write a script to do all the replacing > etc? > > Cheers, > > Sonic > > > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Incorrectly Nested Arrays
Yes, it is supposed to be like this. When you do a findAll on SolutionProcess, you are going to get an array of SolutionProcess results. If SolutionProcess is associated with any models (and your recursive causes them to be found), then they will appear as siblings to SolutionProcess, so: $results = array( array( SolutionProcess, SolutionCategory ), array( SolutionProcess, SolutionCategory ) ) When your recursive goes beyond 1 though, the new associations cannot be at the same level. What about when these further joins are associated to the same table - whose data appears as a sibling? So all second and third level associations are as children, rather than siblings. What can also be confusing is where the model name keys are used for belongsTo vs hasMany. belongsTo will give you $results = array( 0 => array( 'MainModel' => array(...data...), 'MainModelBelongsTo' => array(...data...) ) ) whereas hasMany would give $results = array( 0 => array( 'MainModel' => array(...data...), 'MainModelHasMany' => array( 0 => array(...data...), 1 => array(...data...) ) ) ) such that the associated model name key ("MainModelBelongsTo" or "MainModelHasMany") is still at the sibling level, but with hasMany the children found do not have this model key, even if they themselves have associations. Anyway, it is probably best that you play around with a number of associations to get the hang of it. But what you are seeing is the expected behaviour. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: db association question
Item model: var $hasMany = array( 'SourceSwap' => array( 'className' => 'SwapItem', 'foreignKey' => 'org_id', ), 'DestSwap' => array( 'className' => 'SwapItem', 'foreignKey' => 'swap_id', ), ); SwapItem model: var $belongsTo = array( 'SourceItem' => array( 'className' => 'Item', 'foreignKey' => 'org_id', ), 'DestItem' => array( 'className' => 'Item', 'foreignKey' => 'swap_id', ), ); --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: validating password
I would use $this->invalidate('password', "Passwords do not match") - this way it is just the same as any other validation routine. You also don't need to call beforeValidate() in your beforeSave, it is done automatically by Cake when you save. Your beforeSave is still MD5-ing every password that gets put in there. So, if you do: $existing_user = $this->User->read(null, $user_id); $existing_user['User']['name'] = 'I am changing your name'; $this->User->save( $existing_user ); then your password is now double MD5'd. What I was saying previously is that the field submitted from the form that has the plain text password should not be the actual password field used in your database. So if you use "password" in the database to indicate a hashed password, then on your form make the field "plain_password" or "new_password" or something - this way in your beforeSave you know if it needs to be MD5'd, otherwise don't change. The "plain_password" should not be saved into the db at all. And you're right, the hashed password field should not appear in a form either. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: cake1.2 model validation
Yes, nice hack somehow :-) Thanks Geoff On Jun 28, 12:56 am, Geoff Ford <[EMAIL PROTECTED]> wrote: > Just took at look at the code and your right franky, after you return > false from your custom function invalidFields() then calls $this- > > >invalidate() itself overwriting the message you just wrote. > > However this is not the case if you return true. > > This may be a bit "wrong" but you can get around this like so > > function ValidFun($ruleParams){ > $fieldName = array_keys($ruleParams); > $fieldName = $fieldName[0]; > if ($conditions){ > // all validation passed > } else { >// validation failed >$this->invalidate($fieldName, 'Your Error Message'); > } > > return true; > > } > > By always returning true invalidFields() will not set the error > message itself, but the Model::validationErrors will still contain the > invalid field with your error message and and so Model::validates() > will return the correct value of false. > > On Jun 28, 8:45 am, francky06l <[EMAIL PROTECTED]> wrote: > > > I am not sure that will work (I might be wrong) but it seems to me > > that the model->invalidate is called after your validFunc returning > > false (this call will oerwrite your message). I haven't tested, > > neither check the code deeply enough to know if the call to invalidate > > (into the validateField method) checks for an existing messages prior > > to call invalidate.. > > > Let me know :-) > > Thanks > > > On Jun 28, 12:30 am, Geoff Ford <[EMAIL PROTECTED]> wrote: > > > > Oops just reread the question. > > > > To set the error message from within the ValidFunc you can use the > > > Model::invalidate($field, $value = null); > > > > On Jun 28, 8:26 am, Geoff Ford <[EMAIL PROTECTED]> wrote: > > > > > if believe that you can change the error message with > > > > var $validate = array( > > > > 'directory' => array('error_mesasage' => > > > > array(array('rule' => 'ValidFunc', 'message'=>'message')) > > > > ); > > > > > On Jun 28, 5:32 am, francky06l <[EMAIL PROTECTED]> wrote: > > > > > > I guess you can't do this using the model validation, but if your > > > > > validation function is in the current model, you could replace the > > > > > value $this->data['Model']['field'] and return true (in this way, this > > > > > will not be considered as an error). > > > > > If your goal is to correct the value, show it with a message, the > > > > > above is still valid (for the value) but I have no idea how to change > > > > > the message. You can have a look to the bakery (multiple validation), > > > > > Mariano has done work about validation messages into the view-side, > > > > > maybe there you could interact with it. > > > > > > On Jun 27, 9:11 pm, phpjoy <[EMAIL PROTECTED]> wrote: > > > > > > > ahoy, > > > > > > > i have the following validation in a model: > > > > > > var $validate = array( > > > > > > 'directory' => array('rule' => 'ValidFunc', > > > > > > 'message'=>'message') > > > > > > ); > > > > > > > function ValidFunc($value) { > > > > > > $newvalue = 'new' .$value; > > > > > > $value = $newvalue; > > > > > > case 1: /*message=1*/ return false; > > > > > > case 2: /*message=2*/ return false; > > > > > > } > > > > > > > there are 2 things i'm struggling to do: > > > > > > 1) change the validation message from the ValidFunc, > > > > > > 2) change $value for the form to $newvalue. > > > > > > > anyone knows how i can do that? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: cake1.2 model validation
Just took at look at the code and your right franky, after you return false from your custom function invalidFields() then calls $this- >invalidate() itself overwriting the message you just wrote. However this is not the case if you return true. This may be a bit "wrong" but you can get around this like so function ValidFun($ruleParams){ $fieldName = array_keys($ruleParams); $fieldName = $fieldName[0]; if ($conditions){ // all validation passed } else { // validation failed $this->invalidate($fieldName, 'Your Error Message'); } return true; } By always returning true invalidFields() will not set the error message itself, but the Model::validationErrors will still contain the invalid field with your error message and and so Model::validates() will return the correct value of false. On Jun 28, 8:45 am, francky06l <[EMAIL PROTECTED]> wrote: > I am not sure that will work (I might be wrong) but it seems to me > that the model->invalidate is called after your validFunc returning > false (this call will oerwrite your message). I haven't tested, > neither check the code deeply enough to know if the call to invalidate > (into the validateField method) checks for an existing messages prior > to call invalidate.. > > Let me know :-) > Thanks > > On Jun 28, 12:30 am, Geoff Ford <[EMAIL PROTECTED]> wrote: > > > Oops just reread the question. > > > To set the error message from within the ValidFunc you can use the > > Model::invalidate($field, $value = null); > > > On Jun 28, 8:26 am, Geoff Ford <[EMAIL PROTECTED]> wrote: > > > > if believe that you can change the error message with > > > var $validate = array( > > > 'directory' => array('error_mesasage' => > > > array(array('rule' => 'ValidFunc', 'message'=>'message')) > > > ); > > > > On Jun 28, 5:32 am, francky06l <[EMAIL PROTECTED]> wrote: > > > > > I guess you can't do this using the model validation, but if your > > > > validation function is in the current model, you could replace the > > > > value $this->data['Model']['field'] and return true (in this way, this > > > > will not be considered as an error). > > > > If your goal is to correct the value, show it with a message, the > > > > above is still valid (for the value) but I have no idea how to change > > > > the message. You can have a look to the bakery (multiple validation), > > > > Mariano has done work about validation messages into the view-side, > > > > maybe there you could interact with it. > > > > > On Jun 27, 9:11 pm, phpjoy <[EMAIL PROTECTED]> wrote: > > > > > > ahoy, > > > > > > i have the following validation in a model: > > > > > var $validate = array( > > > > > 'directory' => array('rule' => 'ValidFunc', > > > > > 'message'=>'message') > > > > > ); > > > > > > function ValidFunc($value) { > > > > > $newvalue = 'new' .$value; > > > > > $value = $newvalue; > > > > > case 1: /*message=1*/ return false; > > > > > case 2: /*message=2*/ return false; > > > > > } > > > > > > there are 2 things i'm struggling to do: > > > > > 1) change the validation message from the ValidFunc, > > > > > 2) change $value for the form to $newvalue. > > > > > > anyone knows how i can do that? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Bad choice of Variable Name "$db"
since both cake and phpbb are essentially php apps that include the world Now something is inversed here ... Maybe that's the key to your scoping issue. Seems like the only strategy is to search and replace all code around $db ... ; ). -- Felix -- My latest blog posts: My Business: http://www.fg-webdesign.de MikeK wrote: Thanks for the positive advice. Of course register globals is off. The problem is both $db are in the same scope since both cake and phpbb are essentially php apps that include the world. Looks like the mass find/replace is truly the only option. Thanks again! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: cake1.2 model validation
I am not sure that will work (I might be wrong) but it seems to me that the model->invalidate is called after your validFunc returning false (this call will oerwrite your message). I haven't tested, neither check the code deeply enough to know if the call to invalidate (into the validateField method) checks for an existing messages prior to call invalidate.. Let me know :-) Thanks On Jun 28, 12:30 am, Geoff Ford <[EMAIL PROTECTED]> wrote: > Oops just reread the question. > > To set the error message from within the ValidFunc you can use the > Model::invalidate($field, $value = null); > > On Jun 28, 8:26 am, Geoff Ford <[EMAIL PROTECTED]> wrote: > > > if believe that you can change the error message with > > var $validate = array( > > 'directory' => array('error_mesasage' => > > array(array('rule' => 'ValidFunc', 'message'=>'message')) > > ); > > > On Jun 28, 5:32 am, francky06l <[EMAIL PROTECTED]> wrote: > > > > I guess you can't do this using the model validation, but if your > > > validation function is in the current model, you could replace the > > > value $this->data['Model']['field'] and return true (in this way, this > > > will not be considered as an error). > > > If your goal is to correct the value, show it with a message, the > > > above is still valid (for the value) but I have no idea how to change > > > the message. You can have a look to the bakery (multiple validation), > > > Mariano has done work about validation messages into the view-side, > > > maybe there you could interact with it. > > > > On Jun 27, 9:11 pm, phpjoy <[EMAIL PROTECTED]> wrote: > > > > > ahoy, > > > > > i have the following validation in a model: > > > > var $validate = array( > > > > 'directory' => array('rule' => 'ValidFunc', > > > > 'message'=>'message') > > > > ); > > > > > function ValidFunc($value) { > > > > $newvalue = 'new' .$value; > > > > $value = $newvalue; > > > > case 1: /*message=1*/ return false; > > > > case 2: /*message=2*/ return false; > > > > } > > > > > there are 2 things i'm struggling to do: > > > > 1) change the validation message from the ValidFunc, > > > > 2) change $value for the form to $newvalue. > > > > > anyone knows how i can do that? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Foreign Key in table referecing itself?
Use parent_id as the relationship field name and then look into Model::findAllThreaded() On Jun 28, 7:00 am, "Jon Bennett" <[EMAIL PROTECTED]> wrote: > > Question about a model. I'm creating a table like below where > > category_id is a foreign key to the categories table (basically the > > parent id because I'm building a tree in the database in one table). > > I was wondering A) is this a good approach for building categories > > that can be applied to multiple sets of content and B) what would the > > model code look like (i.e. would I use $hasMany > > $hasManyAndBelongsToMany)? > > check > outhttp://bakery.cakephp.org/articles/view/coding-a-self-join-in-a-cake-... > > jb > > -- > > jon bennett > t: +44 (0) 1225 341 039 w:http://www.jben.net/ > iChat (AIM): jbendotnet Skype: jon-bennett --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: db association question
This does not look like a typical association, I don't think this kind of relationship can be managed with a simple association. I think you will need to use an appropriate function within the Item Model with the business logic that manages the swap. On Jun 28, 5:35 am, Alteczen <[EMAIL PROTECTED]> wrote: > I have a table in my db called items and another called swapitems. > The swapitems tells me what items can be "swapped" for another item > and if there is a fee for the swap (one item is worth more than the > other). For example: > > items: > pk|name > 1|cat > 2|dog > 3|horse > > swapitems: > pk|org_id|swap_id|upcharge > 1|1|2|5 - you can swap a cat for a dog if you give the cat plus $5 > 2|1|3|20 - you can swap a cat for a horse if you give the cat plus > $20 > > What association would I use when "baking" my models for the sideswap > model? Or should I set this up some other way? > > Thanks for the help !!! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: cake1.2 model validation
Oops just reread the question. To set the error message from within the ValidFunc you can use the Model::invalidate($field, $value = null); On Jun 28, 8:26 am, Geoff Ford <[EMAIL PROTECTED]> wrote: > if believe that you can change the error message with > var $validate = array( > 'directory' => array('error_mesasage' => > array(array('rule' => 'ValidFunc', 'message'=>'message')) > ); > > On Jun 28, 5:32 am, francky06l <[EMAIL PROTECTED]> wrote: > > > I guess you can't do this using the model validation, but if your > > validation function is in the current model, you could replace the > > value $this->data['Model']['field'] and return true (in this way, this > > will not be considered as an error). > > If your goal is to correct the value, show it with a message, the > > above is still valid (for the value) but I have no idea how to change > > the message. You can have a look to the bakery (multiple validation), > > Mariano has done work about validation messages into the view-side, > > maybe there you could interact with it. > > > On Jun 27, 9:11 pm, phpjoy <[EMAIL PROTECTED]> wrote: > > > > ahoy, > > > > i have the following validation in a model: > > > var $validate = array( > > > 'directory' => array('rule' => 'ValidFunc', > > > 'message'=>'message') > > > ); > > > > function ValidFunc($value) { > > > $newvalue = 'new' .$value; > > > $value = $newvalue; > > > case 1: /*message=1*/ return false; > > > case 2: /*message=2*/ return false; > > > } > > > > there are 2 things i'm struggling to do: > > > 1) change the validation message from the ValidFunc, > > > 2) change $value for the form to $newvalue. > > > > anyone knows how i can do that? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: cake1.2 model validation
if believe that you can change the error message with var $validate = array( 'directory' => array('error_mesasage' => array(array('rule' => 'ValidFunc', 'message'=>'message')) ); On Jun 28, 5:32 am, francky06l <[EMAIL PROTECTED]> wrote: > I guess you can't do this using the model validation, but if your > validation function is in the current model, you could replace the > value $this->data['Model']['field'] and return true (in this way, this > will not be considered as an error). > If your goal is to correct the value, show it with a message, the > above is still valid (for the value) but I have no idea how to change > the message. You can have a look to the bakery (multiple validation), > Mariano has done work about validation messages into the view-side, > maybe there you could interact with it. > > On Jun 27, 9:11 pm, phpjoy <[EMAIL PROTECTED]> wrote: > > > ahoy, > > > i have the following validation in a model: > > var $validate = array( > > 'directory' => array('rule' => 'ValidFunc', > > 'message'=>'message') > > ); > > > function ValidFunc($value) { > > $newvalue = 'new' .$value; > > $value = $newvalue; > > case 1: /*message=1*/ return false; > > case 2: /*message=2*/ return false; > > } > > > there are 2 things i'm struggling to do: > > 1) change the validation message from the ValidFunc, > > 2) change $value for the form to $newvalue. > > > anyone knows how i can do that? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Bad choice of Variable Name "$db"
Okay, I'm sorry, I still don't see how that's possible. Show me where in Cake a variable called $db is used in the global scope. On Jun 27, 6:07 pm, MikeK <[EMAIL PROTECTED]> wrote: > Thanks for the positive advice. Of course register globals is off. The > problem is both $db are in the same scope since both cake and phpbb > are essentially php apps that include the world. Looks like the mass > find/replace is truly the only option. > Thanks again! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Decode GWT post into $_POST
No. http://us.php.net/json_decode On Jun 27, 2:54 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > > Data is escaped properly when it is inserted into the db which > > prevents sql injection. You then escape output so to remove unexpected/ > > malicious output. > > Is there any chance of malicious PHP code inserted as input that would > get executed during the massaging of data to get it into $this->data > array? > > > 1. function beforeFilter() { > > 2. if(isset($this->params['form']['json'])) { > > 3. $this->data = json_decode($this->params['form'] > > ['json']); > > 4. } > > 5. } > > > Ok turns out to be five lines. $this->params['form']['json'] > > represents the packaged posted json data from GWT. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Bad choice of Variable Name "$db"
Thanks for the positive advice. Of course register globals is off. The problem is both $db are in the same scope since both cake and phpbb are essentially php apps that include the world. Looks like the mass find/replace is truly the only option. Thanks again! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Instructions for Upgrading to 1.2
Hi Jonathan, First of all I appreciate your response so thanks. Unfortunately though, I was talking about the files in the 'app' directory only. This is because I don't version the cake core, (only my individual 'app's) so I'm really looking for the files I should add/remove from my 1.1 app in order to bring it up to date with the files expected from a 1.2 app. Did you happen to get a list of these files? How did you use SVN to generate a list of different files without the changes in the lines of code? Cheers, Sonic --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Paginate define columns to use (1.2)
Is it not possible to ignore the other fields like tags when i don't need them? http://api.cakephp.org/1.2/class_controller.html#6f79c1eed018894aede112c294087345 The scope seems to only add parameters to where, what whitelists does i don't really understand. But is it not possible to define fields as with findAll for example? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Instructions for Upgrading to 1.2
Since you have SVN, I would just replace your 1.1 files with the 1.2 files. As for files to remove, here's my list (I started with 1.1, upgraded to 1.2a week later, but forgot to clean out old files, just did this 2 days ago after viewing differences between a base 1.2 vs my working 1.2) btw, the /trunk/base/ folder is the folder i store the cake install in, fyi, so ignore that Revision: 143 Author: intel352 Date: 4:16:53 PM, Tuesday, June 26, 2007 Message: Removing outdated files Deleted : /trunk/base/cake/libs/controller/components/acl_base.php Deleted : /trunk/base/cake/libs/controller/components/dbacl Deleted : /trunk/base/cake/libs/controller/components/iniacl Deleted : /trunk/base/cake/libs/legacy.php Deleted : /trunk/base/cake/libs/model/dbo Deleted : /trunk/base/cake/libs/model/model_php4.php Deleted : /trunk/base/cake/libs/model/model_php5.php Deleted : /trunk/base/cake/libs/neat_array.php Deleted : /trunk/base/cake/libs/validators.php Deleted : /trunk/base/cake/libs/view/templates/elements/dump.thtml Deleted : /trunk/base/cake/libs/view/templates/errors/error404.thtml Deleted : /trunk/base/cake/libs/view/templates/errors/missing_action.thtml Deleted : /trunk/base/cake/libs/view/templates/errors/missing_component_class.thtml Deleted : /trunk/base/cake/libs/view/templates/errors/missing_component_file.thtml Deleted : /trunk/base/cake/libs/view/templates/errors/missing_connection.thtml Deleted : /trunk/base/cake/libs/view/templates/errors/missing_controller.thtml Deleted : /trunk/base/cake/libs/view/templates/errors/missing_helper_class.thtml Deleted : /trunk/base/cake/libs/view/templates/errors/missing_helper_file.thtml Deleted : /trunk/base/cake/libs/view/templates/errors/missing_layout.thtml Deleted : /trunk/base/cake/libs/view/templates/errors/missing_model.thtml Deleted : /trunk/base/cake/libs/view/templates/errors/missing_scaffolddb.thtml Deleted : /trunk/base/cake/libs/view/templates/errors/missing_table.thtml Deleted : /trunk/base/cake/libs/view/templates/errors/missing_view.thtml Deleted : /trunk/base/cake/libs/view/templates/errors/private_action.thtml Deleted : /trunk/base/cake/libs/view/templates/errors/scaffold_error.thtml Deleted : /trunk/base/cake/libs/view/templates/layouts/ajax.thtml Deleted : /trunk/base/cake/libs/view/templates/layouts/default.thtml Deleted : /trunk/base/cake/libs/view/templates/layouts/flash.thtml Deleted : /trunk/base/cake/libs/view/templates/pages/home.thtml Deleted : /trunk/base/cake/libs/view/templates/scaffolds/add.thtml Deleted : /trunk/base/cake/libs/view/templates/scaffolds/edit.thtml Deleted : /trunk/base/cake/libs/view/templates/scaffolds/index.thtml Deleted : /trunk/base/cake/libs/view/templates/scaffolds/view.thtml Deleted : /trunk/base/cake/scripts On 6/27/07, Sonic Baker <[EMAIL PROTECTED]> wrote: > > Hey there Chris! > > On 6/27/07, Chris Hartjes <[EMAIL PROTECTED]> wrote: > > > > > > Create a branch of your code at the point you want to start updating > > to CakePHP 1.2.x. Very simple. > > > Can you elaborate on how this will tell me which files to remove and which > to add in order to bring the 'app' to the same structure as the default > 1.2 app please? > > Cheers, > > Sonic > > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Instructions for Upgrading to 1.2
Hey Francky! Thanks for your response. On 6/27/07, francky06l <[EMAIL PROTECTED]> wrote: > > There are 2 approaches I guess : >- use cake 1.2 and run it, correct until all "errors" are cleared >- use 1.2 and make the best of it in an existing application (needs > quite an effort for re-write) > > I have chosen another : > > - wait to upgrade to 1.2 untill I have to integrate a lot of > functionalities, almost as re-writing a new app. I've tried the above two approached but the uneasy feeling lead me back to option 3 as in your case. However, I keep coming back to try again every Month or so. The reasons are mainly to making use of the better Testing suites available for 1.2 I'll battle on I guess. Cheers, Sonic --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Instructions for Upgrading to 1.2
On 6/27/07, Chris Hartjes <[EMAIL PROTECTED]> wrote: > > Once you fix things you can do a diff > on the two directories (old version and 1.2 version) to get an idea on > what has changed. I tried doing this directly on the 'app' directories of the two branches in the CakePHP repository itself. Unfortunately it gave me a huge output detailing the differences on each line of code in each file. I couldn't figure out how to only get a difference in the directory file listings. I don't believe there are any "this is how to migrate to Cake 1.2" > instructions out there. Looks like another item to add to my TODO list of bakery articles. "Oh, if I had a minute to myself" :-( Hope that helps, and I appologize that the technique is more > brute-force than anything. That's ok dude. Thanks for the sugggestion anyway. I'm just one of these people who won't feel right unless I know I have all the correct files in the correct places. I wonder if it'd be possible to write a script to do all the replacing etc? Cheers, Sonic --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Session mysteriously being dropped
I am using cake version: 1.1.10.3825, php version: 5.1.6 Here are my core settings: define('CAKE_SESSION_SAVE', 'php'); define('CAKE_SESSION_STRING', 'DYhG93b0qyJfIxfs2guVoUubWwvniR2G0FgaC9mi'); When I refresh the page the session is being reset by cake: $this->Session->read('Config.rand'); My code workes for another domain, any ideas as to what could be happening? Thanks so much, have spent way too long debugging this! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Using more than one Submit button
Apologies Grant, I've just read another post you replied to "Multiple Action in View with Checkbox on Grid" which has solved my problem. Thanks On Jun 27, 2:52 pm, mussond <[EMAIL PROTECTED]> wrote: > Thanks for the quick reply, I've been away from this project. > > I'm still stuck, I'm guessing I've got a syntax error somewhere, I'm > not sure if I should put $this->params['form']['button_name' in my > index.thtml or my controller. > Either way when I do I get an error message saying: > Notice: Undefined index: Run Single user Report in /Library/WebServer/ > Documents/cake/app/controllers/data_points_controller.php on line 15 > or > Notice: Undefined index: a in /Library/WebServer/Documents/cake/app/ > views/data_points/index.thtml on line 16 > > Heres my index.thtml code: > > Number of Sounds > > Select a Report Type and its options . . . > > > echo $html->selectTag('ComUser/id', $comUser, $html->tagValue('ComUser/ > id'), array(), array(), false); > echo $html->submit('Run Single user Report'); > echo $html->submit('Run Boulder users Report'); > echo $html->submit('Run ALL users Report')?> > > if ($this->params['form']['Run Single user Report']) >{ > echo "Hi"; > } > ?> > > Heres what I have if I put if statement in the controller: > > class DataPointsController extends AppController > { > var $name = 'DataPoints'; > var $uses = array('DataPoint','DesWalk','ComProject','ComUser'); > var $helpers = array('Html', 'Form'); > > function index() > { > $this->DataPoint->recursive = 0; > $this->set('datapoints', $this->DataPoint->findAll()); >$comUser = $this->ComUser->generateList('id'); > $this->set('comUser', $comUser); > if ($this->params['form']['Run Single user Report']) > { > echo "Hi"; > } > } > ?> > > On Jun 21, 6:51 pm, Grant Cox <[EMAIL PROTECTED]> wrote: > > > I take it you would normally look at $_POST['button_name'] to see if > > it was submitted, if so it was the one that was clicked. You can do a > > similar thing in Cake, just make sure the button has a unique name > > when you add it, and look in $this->params['form']['button_name']. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Foreign Key in table referecing itself?
> Question about a model. I'm creating a table like below where > category_id is a foreign key to the categories table (basically the > parent id because I'm building a tree in the database in one table). > I was wondering A) is this a good approach for building categories > that can be applied to multiple sets of content and B) what would the > model code look like (i.e. would I use $hasMany > $hasManyAndBelongsToMany)? check out http://bakery.cakephp.org/articles/view/coding-a-self-join-in-a-cake-application jb -- jon bennett t: +44 (0) 1225 341 039 w: http://www.jben.net/ iChat (AIM): jbendotnet Skype: jon-bennett --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Instructions for Upgrading to 1.2
On 6/27/07, Sonic Baker <[EMAIL PROTECTED]> wrote: > > Can you elaborate on how this will tell me which files to remove and which > to add in order to bring the 'app' to the same structure as the default 1.2 > app please? > Well, I couldn't tell you that as I don't keep that type of info in my head. :) Here's what I would do: 1) create my branch 2) update my cake directory to 1.2.x 3) try running my app and fix what breaks. I know that's not much of an answer, but that's the only approach I can think of that will work properly. Cake is very good at spitting out warnings about deprecated functions os you should be able to figure it out reasonably well. Once you fix things you can do a diff on the two directories (old version and 1.2 version) to get an idea on what has changed. I don't believe there are any "this is how to migrate to Cake 1.2" instructions out there. Hope that helps, and I appologize that the technique is more brute-force than anything. -- Chris Hartjes Senior Developer Cake Development Corporation My motto for 2007: "Just build it, damnit!" @TheBallpark - http://www.littlehart.net/attheballpark @TheKeyboard - http://www.littlehart.net/atthekeyboard --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Using more than one Submit button
Thanks for the quick reply, I've been away from this project. I'm still stuck, I'm guessing I've got a syntax error somewhere, I'm not sure if I should put $this->params['form']['button_name' in my index.thtml or my controller. Either way when I do I get an error message saying: Notice: Undefined index: Run Single user Report in /Library/WebServer/ Documents/cake/app/controllers/data_points_controller.php on line 15 or Notice: Undefined index: a in /Library/WebServer/Documents/cake/app/ views/data_points/index.thtml on line 16 Heres my index.thtml code: Number of Sounds Select a Report Type and its options . . . selectTag('ComUser/id', $comUser, $html->tagValue('ComUser/ id'), array(), array(), false); echo $html->submit('Run Single user Report'); echo $html->submit('Run Boulder users Report'); echo $html->submit('Run ALL users Report')?> params['form']['Run Single user Report']) { echo "Hi"; } ?> Heres what I have if I put if statement in the controller: DataPoint->recursive = 0; $this->set('datapoints', $this->DataPoint->findAll()); $comUser = $this->ComUser->generateList('id'); $this->set('comUser', $comUser); if ($this->params['form']['Run Single user Report']) { echo "Hi"; } } ?> On Jun 21, 6:51 pm, Grant Cox <[EMAIL PROTECTED]> wrote: > I take it you would normally look at $_POST['button_name'] to see if > it was submitted, if so it was the one that was clicked. You can do a > similar thing in Cake, just make sure the button has a unique name > when you add it, and look in $this->params['form']['button_name']. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Instructions for Upgrading to 1.2
Hey there Chris! On 6/27/07, Chris Hartjes <[EMAIL PROTECTED]> wrote: > > > Create a branch of your code at the point you want to start updating > to CakePHP 1.2.x. Very simple. Can you elaborate on how this will tell me which files to remove and which to add in order to bring the 'app' to the same structure as the default 1.2app please? Cheers, Sonic --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Instructions for Upgrading to 1.2
Upgrading is not only a story of having the new frame-work... I started to upgrade but I wanted to take advantage of 1.2 (also learning it) .. Changes in views, the model is much more better and you want to take advantage of it .. I also added in cake 1.1 the CJS package, caching..etc ...I had also made a lot of "home made" validations that are now handled in cake 1.2 ... Well all this discouraged me after a while and now I build new application based on cake 1.2. This requires a lot of digging in source code, lot's of test etc ... What I can say is cake 1.2 is great, really ..after trying you can't come back to 1.1. However, it's very hard (depends of time), also not such motivating to re-write something already done in 1.1 There are 2 approaches I guess : - use cake 1.2 and run it, correct until all "errors" are cleared - use 1.2 and make the best of it in an existing application (needs quite an effort for re-write) I have chosen another : - wait to upgrade to 1.2 untill I have to integrate a lot of functionalities, almost as re-writing a new app. On Jun 27, 10:22 pm, "Chris Hartjes" <[EMAIL PROTECTED]> wrote: > On 6/27/07, Sonic Baker <[EMAIL PROTECTED]> wrote: > > > I was thinking that perhaps someone knew of some sort of SVN trickery which > > could be used to give an indication of the exact changes required. > > Create a branch of your code at the point you want to start updating > to CakePHP 1.2.x. Very simple. > > -- > Chris Hartjes > Senior Developer > Cake Development Corporation > > My motto for 2007: "Just build it, damnit!" > > @TheBallpark -http://www.littlehart.net/attheballpark > @TheKeyboard -http://www.littlehart.net/atthekeyboard --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Instructions for Upgrading to 1.2
On 6/27/07, Sonic Baker <[EMAIL PROTECTED]> wrote: > I was thinking that perhaps someone knew of some sort of SVN trickery which > could be used to give an indication of the exact changes required. Create a branch of your code at the point you want to start updating to CakePHP 1.2.x. Very simple. -- Chris Hartjes Senior Developer Cake Development Corporation My motto for 2007: "Just build it, damnit!" @TheBallpark - http://www.littlehart.net/attheballpark @TheKeyboard - http://www.littlehart.net/atthekeyboard --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Instructions for Upgrading to 1.2
Hi All, I've been asking around on the IRC from time to time about how exactly to upgrade an app from the 1.1.x.x framework to the 1.2.x.x version. I 've tried a few time but felt uneasy about a couple of things and haven't been able to get any definite answers which could fully ease the feelings. The problem is that, on inspection of the default 'app' directory in the 1.2branch it can be seen that there are files and directories there which aren't present in the 1.1 branch. This doesn't pose huge difficulty alone, but there are also some files in the 1.1 branch (app directory) which are NOT present in the 1.2 version. Attempts at manually adding and deleting the relevant files can get a little bit confusing at times and so after checking and double checking you can end up in a bit of a confusing mess. Although the application may seem to work and pass all the relevant unit tests, there can still be the annoying feeling in your mind that you may have done something wrong. Currently I only have my 'app' directory under version control so I wanted to try to preserve the file histories during the upgrade. Therefore I haven't committed any of my upgrade attempts to SVN as of yet for fear of something going wrong somewhere down the line when I've forgotten what I've moved where. I was thinking that perhaps someone knew of some sort of SVN trickery which could be used to give an indication of the exact changes required. Something like running 'svn ls' on the 1.1 app directory, doing the same on the 1.2version and piping the results into a 'diff' to give the layout changes. Can any of you SVN wizards out there think of a way to do such a thing? If not, has anyone documented the correct upgrade path? If no to both of these I am happy to document my next attempt myself and post it here. I was just wondering if anyone in the same boat already had a readily available answer. Cheers to all, Sonic --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Bad choice of Variable Name "$db"
This is probably the second most ridiculous complaint I have yet seen. Ever heard of local scope? Seriously, do you have any idea what you're doing? On Jun 27, 1:50 pm, MikeK <[EMAIL PROTECTED]> wrote: > I am working on a CMS that also uses phpBB. I punted on Rails after > their awful deployment issues and inability to get along with other > apps without rearchitecting them. I was happy with CakePHP until I > wrote the piece to integrate phpBB's session code with my pages. Turns > out both phpBB and CakePHP have a global var named $db. So collision > city and major breakage. > > No way am I going to go and change the name of such a key var > throughout phpBB -- it is used less in CakePHP but I am not tempted to > change it there either. I'd love to be able to get updates without > having to run a script to rename a high use global like $db. I have a > kludgy workaround for the moment but couldn't someone pick some decent > var names and anticipate that their code might be integrated into > something down the road? Geesh -- how about $cake_db? > > Flame OFF --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Foreign Key in table referecing itself?
Which version of cake are you using ? On Jun 27, 7:06 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Question about a model. I'm creating a table like below where > category_id is a foreign key to the categories table (basically the > parent id because I'm building a tree in the database in one table). > I was wondering A) is this a good approach for building categories > that can be applied to multiple sets of content and B) what would the > model code look like (i.e. would I use $hasMany > $hasManyAndBelongsToMany)? > > Thanks for any help! > > CREATE TABLE `categories` ( > `id` bigint(20) NOT NULL auto_increment, > `name` varchar(255) NOT NULL, > `description` text, > `link` varchar(255) default NULL, > `level` int(11) default NULL, > `order` int(11) NOT NULL, > `category_id` bigint(20) NOT NULL default '0', > PRIMARY KEY (`id`) > ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=11 ; --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
db association question
I have a table in my db called items and another called swapitems. The swapitems tells me what items can be "swapped" for another item and if there is a fee for the swap (one item is worth more than the other). For example: items: pk|name 1|cat 2|dog 3|horse swapitems: pk|org_id|swap_id|upcharge 1|1|2|5 - you can swap a cat for a dog if you give the cat plus $5 2|1|3|20 - you can swap a cat for a horse if you give the cat plus $20 What association would I use when "baking" my models for the sideswap model? Or should I set this up some other way? Thanks for the help !!! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: cake1.2 model validation
I guess you can't do this using the model validation, but if your validation function is in the current model, you could replace the value $this->data['Model']['field'] and return true (in this way, this will not be considered as an error). If your goal is to correct the value, show it with a message, the above is still valid (for the value) but I have no idea how to change the message. You can have a look to the bakery (multiple validation), Mariano has done work about validation messages into the view-side, maybe there you could interact with it. On Jun 27, 9:11 pm, phpjoy <[EMAIL PROTECTED]> wrote: > ahoy, > > i have the following validation in a model: > var $validate = array( > 'directory' => array('rule' => 'ValidFunc', > 'message'=>'message') > ); > > function ValidFunc($value) { > $newvalue = 'new' .$value; > $value = $newvalue; > case 1: /*message=1*/ return false; > case 2: /*message=2*/ return false; > } > > there are 2 things i'm struggling to do: > 1) change the validation message from the ValidFunc, > 2) change $value for the form to $newvalue. > > anyone knows how i can do that? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
cake1.2 model validation
ahoy, i have the following validation in a model: var $validate = array( 'directory' => array('rule' => 'ValidFunc', 'message'=>'message') ); function ValidFunc($value) { $newvalue = 'new' .$value; $value = $newvalue; case 1: /*message=1*/ return false; case 2: /*message=2*/ return false; } there are 2 things i'm struggling to do: 1) change the validation message from the ValidFunc, 2) change $value for the form to $newvalue. anyone knows how i can do that? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: One cake application, multiple sites
sorry, not load-balancing specifically, but the act of using usdbconfig On 6/27/07, francky06l <[EMAIL PROTECTED]> wrote: > > > Load balancing has not much to do with your original problem I guess > > On Jun 27, 7:13 pm, "Jonathan Langevin" <[EMAIL PROTECTED]> wrote: > > ah, cool feature that I was unaware of :-) > > > > here's an article that references it: > http://bakery.cakephp.org/articles/view/load-balancing-and-mysql-mast... > > > > On 6/27/07, rtconner <[EMAIL PROTECTED]> wrote: > > > > > > > > > Or you can use the useDBConfig variable in your app_model file to > > > override the db config for all models. > > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: PHP functions file_exists, is_executable and shell_exec fails in CakePHP
you would usually do this using the vendors directory. On Jun 27, 6:27 pm, jamietssg <[EMAIL PROTECTED]> wrote: > Thanks for the reply. > > My mistake. > > I was including a php file at the top of the controller class. This > included file had a class and a global variable outside the class. It > worked when I used a normal class variable instead of a global > variable. > > The included class could not see the global variable. > > This may be a stupid question but how do you normally include extra > PHP classes or PHP files in CakePHP. > > Thanks for the help. > > On Jun 27, 3:59 pm, gwoo <[EMAIL PROTECTED]> wrote: > > > Nothing Cake does would affect the file system access. The mostly > > likely cause of the error is permissions. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: One cake application, multiple sites
Load balancing has not much to do with your original problem I guess On Jun 27, 7:13 pm, "Jonathan Langevin" <[EMAIL PROTECTED]> wrote: > ah, cool feature that I was unaware of :-) > > here's an article that references > it:http://bakery.cakephp.org/articles/view/load-balancing-and-mysql-mast... > > On 6/27/07, rtconner <[EMAIL PROTECTED]> wrote: > > > > > Or you can use the useDBConfig variable in your app_model file to > > override the db config for all models. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Decode GWT post into $_POST
> Data is escaped properly when it is inserted into the db which > prevents sql injection. You then escape output so to remove unexpected/ > malicious output. Is there any chance of malicious PHP code inserted as input that would get executed during the massaging of data to get it into $this->data array? > 1. function beforeFilter() { > 2. if(isset($this->params['form']['json'])) { > 3. $this->data = json_decode($this->params['form'] > ['json']); > 4. } > 5. } > > Ok turns out to be five lines. $this->params['form']['json'] > represents the packaged posted json data from GWT. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: horizontal form fields with css
ah, shame to hear I was wrong, happy to hear you found the correct usage :-) thanks for posting back with the correct syntax On 6/27/07, Siegfried Hirsch <[EMAIL PROTECTED]> wrote: > > Hello Jonathan, > > thanks for the suggestion, but it is wrong. > > with class you can only specify the class of the itself. But with > the > formhelper, there is always a surrounding the and the > . > > But there is a solution: > > you can specify the class of the surrounding div in this way by using > div instead > of class, as in your sample. > > $form->input('fieldname',array('div'=>'floatleft') ); > > With this it is possible to have different css classes for the > different input elements > of a form. > > Siegfried > > 2007/6/26, Jonathan Langevin <[EMAIL PROTECTED]>: > > What you would do, is when you call (Cake 1.2 style) the input method, > > specify the class to be used > > $form->input('fieldname',array('class'=>'floatleft') ); > > > > I believe floatleft would be appended to the class 'input' (resulting in > > 'input floatleft'), but you should test it > > > > > > On 6/26/07, Siegfried Hirsch <[EMAIL PROTECTED]> wrote: > > > > > > I have the same problem here. > > > > > > I want some input fields in horizontal position and some as usual > > > with the label above the input field. > > > Is there a way to specify a second class for the surrounding > class="input"> > > > so that I am able the change the css behavior of different input > fields. > > > > > > I know I could do this by hand, but that is not very cake like I guess > and > > > I really want to use the formhelper, whereever possible. > > > > > > Thanks > > > Siegfried > > > > > > 2007/6/25, trooney <[EMAIL PROTECTED]>: > > > > > > > > You can chain together multiple classes on a single element, eg > > > class="input floatleft">. But your question is more related to > > > > stylesheets, rather than CakePHP. You should consult the Google > oracle > > > > for more information on CSS. > > > > > > > > On Jun 24, 3:24 pm, Amy1234 <[EMAIL PROTECTED] > wrote: > > > > > can I overide the in my css class to how I > want > > > > > all my forms to be? > > > > > > > > > > On Jun 24, 2:27 pm, trooney < [EMAIL PROTECTED]> wrote: > > > > > > > > > > > Google CSS & Floats to find articles on how to dynamically > position > > > > > > elements on a page. > > > > > > > > > > > If you've baked your views with 1.2, your form elements are > wrapped > > in > > > > > > tag. A quick and dirty method would be > applying > > > > > > the style attribute directly to the divs wrapping the title and > > author > > > > > > elements, then clearing the next div element after these two. > > > > > > > > > > > On Jun 24, 1:26 pm, Amy1234 <[EMAIL PROTECTED]> wrote: > > > > > > > > > > > > Hello, > > > > > > > > > > > > I have googled this but is unable to find out how to do this. > On > > my > > > > > > > forms instead of vertically listed fields such as:Title: > __ > > > > > > > Author: ___ > > > > > > > > > > > > I would like it to be: Title: Author: > > > > > > > > > > > > how would I do that. > > > > > > > > > > > > Thanks for your help > > > > > > > Amy > > > > > > > > > > > > "" would be the input box. > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > Siegfried Hirsch > > > hhS - Welserstr. 1 - 81373 M�nchen - (089) 5484 3564 - skype:shirsch > > > http://gadgetgui.de / http://www.rss-blogger.de > > > http://www.newsbee.de NewsBee 2 - customized RSS solutions > > > > > > > > > > > > > > > > -- > Siegfried Hirsch > hhS - Welserstr. 1 - 81373 München - (089) 5484 3564 - skype:shirsch > http://gadgetgui.de / http://www.rss-blogger.de > http://www.newsbee.de NewsBee 2 - customized RSS solutions > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Bad choice of Variable Name "$db"
how about just get Editplus 2 and do a mass find/replace on the cake files and stop whining. as you said yourself, it's less used in cake, plus cake has fewer releases (unlike phpbb2, which has to have a release every other day due to security flaws) On 6/27/07, MikeK <[EMAIL PROTECTED]> wrote: > > > I am working on a CMS that also uses phpBB. I punted on Rails after > their awful deployment issues and inability to get along with other > apps without rearchitecting them. I was happy with CakePHP until I > wrote the piece to integrate phpBB's session code with my pages. Turns > out both phpBB and CakePHP have a global var named $db. So collision > city and major breakage. > > No way am I going to go and change the name of such a key var > throughout phpBB -- it is used less in CakePHP but I am not tempted to > change it there either. I'd love to be able to get updates without > having to run a script to rename a high use global like $db. I have a > kludgy workaround for the moment but couldn't someone pick some decent > var names and anticipate that their code might be integrated into > something down the road? Geesh -- how about $cake_db? > > Flame OFF > > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Decode GWT post into $_POST
Data is escaped properly when it is inserted into the db which prevents sql injection. You then escape output so to remove unexpected/ malicious output. 1. function beforeFilter() { 2. if(isset($this->params['form']['json'])) { 3. $this->data = json_decode($this->params['form'] ['json']); 4. } 5. } Ok turns out to be five lines. $this->params['form']['json'] represents the packaged posted json data from GWT. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Decode GWT post into $_POST
> you dont need to sanitize. I can see the beforeFilter being about 4 > lines of code max. Seems pretty painless to me 1) Why don't I need to sanitize. I don't trust this data as it is coming from a form. 2) Would you mind posting these "4 lines of code" or pseudo code? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Decode GWT post into $_POST
you dont need to sanitize. I can see the beforeFilter being about 4 lines of code max. Seems pretty painless to me --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Bad choice of Variable Name "$db"
On 6/27/07, MikeK <[EMAIL PROTECTED]> wrote: > > I am working on a CMS that also uses phpBB. I punted on Rails after > their awful deployment issues and inability to get along with other > apps without rearchitecting them. I was happy with CakePHP until I > wrote the piece to integrate phpBB's session code with my pages. Turns > out both phpBB and CakePHP have a global var named $db. So collision > city and major breakage. > > No way am I going to go and change the name of such a key var > throughout phpBB -- it is used less in CakePHP but I am not tempted to > change it there either. I'd love to be able to get updates without > having to run a script to rename a high use global like $db. I have a > kludgy workaround for the moment but couldn't someone pick some decent > var names and anticipate that their code might be integrated into > something down the road? Geesh -- how about $cake_db? > > Flame OFF > Rght. CakePHP should've known that people would integrate their project with others. Why didn't phpBB call it $phpbb_db instead of $db? Edge case, move on. -- Chris Hartjes Senior Developer Cake Development Corporation My motto for 2007: "Just build it, damnit!" @TheBallpark - http://www.littlehart.net/attheballpark @TheKeyboard - http://www.littlehart.net/atthekeyboard --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: horizontal form fields with css
Hello Jonathan, thanks for the suggestion, but it is wrong. with class you can only specify the class of the itself. But with the formhelper, there is always a surrounding the and the . But there is a solution: you can specify the class of the surrounding div in this way by using div instead of class, as in your sample. $form->input('fieldname',array('div'=>'floatleft') ); With this it is possible to have different css classes for the different input elements of a form. Siegfried 2007/6/26, Jonathan Langevin <[EMAIL PROTECTED]>: > What you would do, is when you call (Cake 1.2 style) the input method, > specify the class to be used > $form->input('fieldname',array('class'=>'floatleft') ); > > I believe floatleft would be appended to the class 'input' (resulting in > 'input floatleft'), but you should test it > > > On 6/26/07, Siegfried Hirsch <[EMAIL PROTECTED]> wrote: > > > > I have the same problem here. > > > > I want some input fields in horizontal position and some as usual > > with the label above the input field. > > Is there a way to specify a second class for the surrounding class="input"> > > so that I am able the change the css behavior of different input fields. > > > > I know I could do this by hand, but that is not very cake like I guess and > > I really want to use the formhelper, whereever possible. > > > > Thanks > > Siegfried > > > > 2007/6/25, trooney <[EMAIL PROTECTED]>: > > > > > > You can chain together multiple classes on a single element, eg > > class="input floatleft">. But your question is more related to > > > stylesheets, rather than CakePHP. You should consult the Google oracle > > > for more information on CSS. > > > > > > On Jun 24, 3:24 pm, Amy1234 <[EMAIL PROTECTED] > wrote: > > > > can I overide the in my css class to how I want > > > > all my forms to be? > > > > > > > > On Jun 24, 2:27 pm, trooney < [EMAIL PROTECTED]> wrote: > > > > > > > > > Google CSS & Floats to find articles on how to dynamically position > > > > > elements on a page. > > > > > > > > > If you've baked your views with 1.2, your form elements are wrapped > in > > > > > tag. A quick and dirty method would be applying > > > > > the style attribute directly to the divs wrapping the title and > author > > > > > elements, then clearing the next div element after these two. > > > > > > > > > On Jun 24, 1:26 pm, Amy1234 <[EMAIL PROTECTED]> wrote: > > > > > > > > > > Hello, > > > > > > > > > > I have googled this but is unable to find out how to do this. On > my > > > > > > forms instead of vertically listed fields such as:Title: __ > > > > > > Author: ___ > > > > > > > > > > I would like it to be: Title: Author: > > > > > > > > > > how would I do that. > > > > > > > > > > Thanks for your help > > > > > > Amy > > > > > > > > > > "" would be the input box. > > > > > > > > > > > > > > > > > > > -- > > Siegfried Hirsch > > hhS - Welserstr. 1 - 81373 M�nchen - (089) 5484 3564 - skype:shirsch > > http://gadgetgui.de / http://www.rss-blogger.de > > http://www.newsbee.de NewsBee 2 - customized RSS solutions > > > > > > > > > -- Siegfried Hirsch hhS - Welserstr. 1 - 81373 München - (089) 5484 3564 - skype:shirsch http://gadgetgui.de / http://www.rss-blogger.de http://www.newsbee.de NewsBee 2 - customized RSS solutions --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Bad choice of Variable Name "$db"
FLAME ON um how about "register_globals off" do you know how php works? $db is a temp variable in the model and various other classes. It is not a global var. Geesh, how about you sit back for a second and think about your problem before getting all up in a huff about it. FLAME OFF --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: ACL trouble: Listing AROs that have a 'read' access to an ACO
In Cake 1.2.0. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Bad choice of Variable Name "$db"
I am working on a CMS that also uses phpBB. I punted on Rails after their awful deployment issues and inability to get along with other apps without rearchitecting them. I was happy with CakePHP until I wrote the piece to integrate phpBB's session code with my pages. Turns out both phpBB and CakePHP have a global var named $db. So collision city and major breakage. No way am I going to go and change the name of such a key var throughout phpBB -- it is used less in CakePHP but I am not tempted to change it there either. I'd love to be able to get updates without having to run a script to rename a high use global like $db. I have a kludgy workaround for the moment but couldn't someone pick some decent var names and anticipate that their code might be integrated into something down the road? Geesh -- how about $cake_db? Flame OFF --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Ver esta página: "Cake Apps/Sites In The Wild"
Nuevo sitio Haz clic en http://groups.google.es/group/cake-php/web/cake-apps-sites-in-the-wild. Si haciendo clic no se activa, copia el vínculo y pégalo en la barra de direcciones de tu navegador. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Nested sortables / drag and drop?
there's no tools built on the tree helper that i've seen, it essentially handles all parent/child/sibling relationships within a table, to make things transparent for you. you'll have to call the Tree methods to pull children items, but that's simple. then you could just pass the results into your View, and run a loop to create the visible structure On 6/27/07, Mech7 <[EMAIL PROTECTED]> wrote: > > > Thanks for the info.. i just have another question, will the new tree > helper fill in the left / right collumns automagically? Or will i need > to do my own calculations? > > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: validating password
Ok i got it all working now, unsetting the field did work here is what i did in my model: function beforeValidate() { $u = &$this->data['User']; $p1 = &$u['password']; $p2 = &$u['password1']; if ($p1 != $p2) { $this->set('error', 'Passwords do not match'); return false; } if (empty($p1)) { unset($this->data['User']['password']); } return true; } function beforeSave() { if ($this->validates()) { if (isset($this->data['User']['password'])) { $this->data['User']['password'] = md5($this->data['User'] ['password']); } return true; } return false; } controller: function edit_profile() { $this->User->id = $this->Session->read('User.id'); if (empty($this->data)) { $this->data = $this->User->read(); } else { if ($this->User->save($this->data)) { $this->flash("Your profile has been saved.", '/users/profile'); } } } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Nested sortables / drag and drop?
Thanks for the info.. i just have another question, will the new tree helper fill in the left / right collumns automagically? Or will i need to do my own calculations? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Graham Bird's AJAX tutorial in 1.2.x.x
Thanks for pointing me in the right direction, Garrett. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: validating password
Ok this is what i've added and its not working. beforeSave never gets called.. I tested by putting a die statement at the top. Users controller: function edit_profile() { $this->User->id = $this->Session->read('User.id'); if (empty($this->data)) { $this->data = $this->User->read(); } else { if ($this->User->save($this->data)) { $this->flash("Your profile has been saved.", '/users/profile'); } } } Model: function beforeValidate() { $u = &$this->data['User']; $p1 = &$u['password']; $p2 = &$u['password1']; if ($p1 != $p2) { $this->set('error', 'Passwords do not match'); return false; } return true; } function beforeSave() { die("WTF"); $pempty = empty($this->data['User']['password']); if ($pempty) { $this->data['User']['password'] = $this->User->password; } if ($this->User->validates()) { if (!$pempty) { $this->data['User']['password'] = md5($this->data['User'] ['password']); } return true; } its never getting to beforeSave but it did get through beforeValidate, i checked on that as well.. And beforeValidate passes as true.. Do i need to call something else before actually calilng save in the controller for it to call beforeSave?? It seems like that should be automatic. I"m going to have to bust out the source i guess. On Jun 27, 10:01 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Good idea grant.. I was wondering how to figure that out.. I'm a bit > unsure what you mean though about having a hashed_password field? > I don't want to put the hashed password into a hidden input in the > form (md5 is known for dictionary attacks, and although this site i'm > sure would never have that happen, i still wouldnt want to use such a > practice) > are you talking about adding that field in at the controller or > something.. And what is the order of execution.. does it go controller > to beforeValidate to beforeSave? I'm thinking i could just add in a > field into the $data array that i can use elsewhere, perhaps thats > what you meant. > Also, this is a profile form where they can edit anything.. I want it > so that if they leave password and password1 fields blank, that they > won't get changed. I was thinking that if they are empty, i can just > unset the password index and then it should validate, correct? I'm not > sure the details on the cake implementation but i was hoping you could > update a row without giving all the values, and unsetting the index > seems like it should work. > Thanks for the help, i'll see if this works. > Matt > > On Jun 27, 6:36 am, Grant Cox <[EMAIL PROTECTED]> wrote: > > > Its $this->User->validates( $this->data ) , not validate. Cake has > > a habit of executing any unknown function you call on a model as SQL. > > > You can still do it all in the model, just use the beforeValidate to > > validate the password submitted is ok (number of chars, matches > > confirm password etc) and then use beforeSave to MD5 the password. As > > you don't want to double MD5 a password it is probably best to have > > separate fields, ie submit the form as "plain_password", and MD5 into > > "hashed_password" (with the database only having a "hashed_password" > > field). --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Foreign Key in table referecing itself?
Question about a model. I'm creating a table like below where category_id is a foreign key to the categories table (basically the parent id because I'm building a tree in the database in one table). I was wondering A) is this a good approach for building categories that can be applied to multiple sets of content and B) what would the model code look like (i.e. would I use $hasMany $hasManyAndBelongsToMany)? Thanks for any help! CREATE TABLE `categories` ( `id` bigint(20) NOT NULL auto_increment, `name` varchar(255) NOT NULL, `description` text, `link` varchar(255) default NULL, `level` int(11) default NULL, `order` int(11) NOT NULL, `category_id` bigint(20) NOT NULL default '0', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=11 ; --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: One cake application, multiple sites
ah, cool feature that I was unaware of :-) here's an article that references it: http://bakery.cakephp.org/articles/view/load-balancing-and-mysql-master-and-slaves-2 On 6/27/07, rtconner <[EMAIL PROTECTED]> wrote: > > > Or you can use the useDBConfig variable in your app_model file to > override the db config for all models. > > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Cake 12, validation message and L10N
Thanks Mariano, I have seen this article and actually I found the above solution quite nice and very small :-) Anyway, I will try to implement in your recommended way. Thanks On Jun 27, 6:55 pm, "Mariano Iglesias" <[EMAIL PROTECTED]> wrote: > This is why I always recommend to do view-side validation messages. > > Check the article in the bakery: > > http://bakery.cakephp.org/articles/view/multiple-rules-of-validation-... > ld-in-cakephp-1-2 > > -MI > > --- > > Remember, smart coders answer ten questions for every question they ask. > So be smart, be cool, and share your knowledge. > > BAKE ON! > > blog:http://www.MarianoIglesias.com.ar > > -Mensaje original- > De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre > de francky06l > Enviado el: Miércoles, 27 de Junio de 2007 01:47 p.m. > Para: Cake PHP > Asunto: Cake 12, validation message and L10N > > I am working on the validation in cake12, powerfull ! > I am using the l10n for multi language, and I set some custom message > into the $validate : > > array('rule' => , > 'message' => 'erroruser'); > > Actually I can't use the __('erroruser') in the model definition for > var $validate (unless I missed something somewhere), bug going deeper > I found out that modifying the line (in model.php, method invalidate, > lime 1739 of SVN branch) as follow : --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: validating password
Good idea grant.. I was wondering how to figure that out.. I'm a bit unsure what you mean though about having a hashed_password field? I don't want to put the hashed password into a hidden input in the form (md5 is known for dictionary attacks, and although this site i'm sure would never have that happen, i still wouldnt want to use such a practice) are you talking about adding that field in at the controller or something.. And what is the order of execution.. does it go controller to beforeValidate to beforeSave? I'm thinking i could just add in a field into the $data array that i can use elsewhere, perhaps thats what you meant. Also, this is a profile form where they can edit anything.. I want it so that if they leave password and password1 fields blank, that they won't get changed. I was thinking that if they are empty, i can just unset the password index and then it should validate, correct? I'm not sure the details on the cake implementation but i was hoping you could update a row without giving all the values, and unsetting the index seems like it should work. Thanks for the help, i'll see if this works. Matt On Jun 27, 6:36 am, Grant Cox <[EMAIL PROTECTED]> wrote: > Its $this->User->validates( $this->data ) , not validate. Cake has > a habit of executing any unknown function you call on a model as SQL. > > You can still do it all in the model, just use the beforeValidate to > validate the password submitted is ok (number of chars, matches > confirm password etc) and then use beforeSave to MD5 the password. As > you don't want to double MD5 a password it is probably best to have > separate fields, ie submit the form as "plain_password", and MD5 into > "hashed_password" (with the database only having a "hashed_password" > field). --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: One cake application, multiple sites
Or you can use the useDBConfig variable in your app_model file to override the db config for all models. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: One cake application, multiple sites
Not much choice of having a separate webroot per config. You do not need a switch if in your index.php you define a value such as define('DBCONFIG', 'config1'), etc .. Then in your databse.php you can have multiple dbconfig having the name of the define. In app_model you can set $var $dbConfig = DBCONFIG. Of course you would have to update your css in each webroot (also img etc ..) On Jun 27, 4:50 pm, "Jonathan Langevin" <[EMAIL PROTECTED]> wrote: > btw, each webroot's index.php would need to be configured to know the cake > core and app install locations > > On 6/27/07, Jonathan Langevin <[EMAIL PROTECTED]> wrote: > > > > > if i were you, i'd check into the possibility of upgrading > > > in the meantime, cake core already has the ability to be located > > elsewhere, as does the app folder, so your only true issue is using a > > different db config per site > > > what I would do, is put your entire cms in a central accessible location, > > then copy your app/webroot into each website folder. modify the webroot's > > index.php to hold a $site_id value, assign a value in each site's > > index.php > > > then in the database conf file, setup a switch based on the $site_id > > > if you need more help, lemme know > > > On 6/27/07, quincy < [EMAIL PROTECTED]> wrote: > > > > I apologise in advance becasue I know this has come up many times > > > already, but I cannot seem to find the information I'm after. I want > > > to be able to have a single installation of my cake app (a CMS) on a > > > server, and run several sites from the same installation by simply > > > using a different database config file on each one. The only other > > > thing that might change would be CSS files so that each client can > > > have a customized colours or logos etc, but the point is that I want a > > > single point of upgrade for the CMS so that when we reach a new > > > version it can propogate across every site that uses it. > > > > To put it another way, one set of models, views and controllers, and > > > many sites running off this one application by simple specifying the > > > relevant DB config file and maybe stylesheets. Thats it. > > > > Any help greatly appreciated. I am using quite an old version of cake > > > as upgrades have not been possible during the development of our CMS > > > (long story), the version according to the config is 1.1.14.4797 > > > > Cheers --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Decode GWT post into $_POST
Hi, I'm considering using GWT for my UI with my existing cakephp backend. To communicate with the server I encode all my post variables into one JSON variable and perform an asynchronous post. I would then like cakephp to decode the JSON and assign it to $_POST before it does anything else. This way as far as cakephp is concerned the $_POST data came from a form submitted in a typical fashion. Do I have to do this manually? ie: 1) In beforefilter read that one post variable, decoded the JSON. 2) sanitize the new variables one by one. 3) assign them to the $data variable. Anyone have any other ideas to make this as painless as possible? -Raf --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
RE: Cake 12, validation message and L10N
This is why I always recommend to do view-side validation messages. Check the article in the bakery: http://bakery.cakephp.org/articles/view/multiple-rules-of-validation-per-fie ld-in-cakephp-1-2 -MI --- Remember, smart coders answer ten questions for every question they ask. So be smart, be cool, and share your knowledge. BAKE ON! blog: http://www.MarianoIglesias.com.ar -Mensaje original- De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre de francky06l Enviado el: Miércoles, 27 de Junio de 2007 01:47 p.m. Para: Cake PHP Asunto: Cake 12, validation message and L10N I am working on the validation in cake12, powerfull ! I am using the l10n for multi language, and I set some custom message into the $validate : array('rule' => , 'message' => 'erroruser'); Actually I can't use the __('erroruser') in the model definition for var $validate (unless I missed something somewhere), bug going deeper I found out that modifying the line (in model.php, method invalidate, lime 1739 of SVN branch) as follow : --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Cake 12, validation message and L10N
Hi All I am working on the validation in cake12, powerfull ! I am using the l10n for multi language, and I set some custom message into the $validate : array('rule' => , 'message' => 'erroruser'); Actually I can't use the __('erroruser') in the model definition for var $validate (unless I missed something somewhere), bug going deeper I found out that modifying the line (in model.php, method invalidate, lime 1739 of SVN branch) as follow : <<< $this->validationErrors[$field] = $value; >>>$this->validationErrors[$field] = __($value, true); This make my message appearing according to the desired language (or the initial message if not defined in default.po) Is there a built-in way to do this, such as a parameter I forgot somewhere ? Would be convenient to have an "afterValidate" method to override, I could "translate" my messages there. Thanks Franck --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: PHP functions file_exists, is_executable and shell_exec fails in CakePHP
Thanks for the reply. My mistake. I was including a php file at the top of the controller class. This included file had a class and a global variable outside the class. It worked when I used a normal class variable instead of a global variable. The included class could not see the global variable. This may be a stupid question but how do you normally include extra PHP classes or PHP files in CakePHP. Thanks for the help. On Jun 27, 3:59 pm, gwoo <[EMAIL PROTECTED]> wrote: > Nothing Cake does would affect the file system access. The mostly > likely cause of the error is permissions. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Extending / Decorating models and views
Apologies if my post is appearing 3 times - something is going a bit strange and I don't know what it is. I tried deleting the duplicates, but they reappeared... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Ajax and redirection with a flash message
For flash message.. check out the setFlash() method along with this code in your view.. check('Message.flash')) $session->flash(); ?> For the second one.. dont you just want.. /pages/sessionexpiry as your URL? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: PHP functions file_exists, is_executable and shell_exec fails in CakePHP
Nothing Cake does would affect the file system access. The mostly likely cause of the error is permissions. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
PHP functions file_exists, is_executable and shell_exec fails in CakePHP
Hello I wonder if someone could help me. I am new to CakePHP and really like it. I have a problem when I need to call a command line unix program from with CakePHPfor generating samba passwords. I first try the PHP function file_exists( /usr/local/bin/mkntpwd ) CakePHP cannot locate the file by this path though I know it's in the correct location. PHP scripts using file_exists( etc ) outside CakePHP framework can call this program but scripts inside the phpcake framework cannot. I think it's due to CakePHP altering the paths in some way. Any advice appreciated! Thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: bootstrap.php woes
if you moved /cake anywhere other than where it was in the downloaded package you need to change the CAKE_CORE_INCLUDE_PATH in the /app/ webroot/index.php --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Graham Bird's AJAX tutorial in 1.2.x.x
The TohDoh done by Crazylegs is really well done. I would not waste my time on a two year old tutorial that was not that well written to begin with. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: One cake application, multiple sites
btw, each webroot's index.php would need to be configured to know the cake core and app install locations On 6/27/07, Jonathan Langevin <[EMAIL PROTECTED]> wrote: > > if i were you, i'd check into the possibility of upgrading > > in the meantime, cake core already has the ability to be located > elsewhere, as does the app folder, so your only true issue is using a > different db config per site > > what I would do, is put your entire cms in a central accessible location, > then copy your app/webroot into each website folder. modify the webroot's > index.php to hold a $site_id value, assign a value in each site's > index.php > > then in the database conf file, setup a switch based on the $site_id > > if you need more help, lemme know > > On 6/27/07, quincy < [EMAIL PROTECTED]> wrote: > > > > > > I apologise in advance becasue I know this has come up many times > > already, but I cannot seem to find the information I'm after. I want > > to be able to have a single installation of my cake app (a CMS) on a > > server, and run several sites from the same installation by simply > > using a different database config file on each one. The only other > > thing that might change would be CSS files so that each client can > > have a customized colours or logos etc, but the point is that I want a > > single point of upgrade for the CMS so that when we reach a new > > version it can propogate across every site that uses it. > > > > To put it another way, one set of models, views and controllers, and > > many sites running off this one application by simple specifying the > > relevant DB config file and maybe stylesheets. Thats it. > > > > Any help greatly appreciated. I am using quite an old version of cake > > as upgrades have not been possible during the development of our CMS > > (long story), the version according to the config is 1.1.14.4797 > > > > Cheers > > > > > > > > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: One cake application, multiple sites
if i were you, i'd check into the possibility of upgrading in the meantime, cake core already has the ability to be located elsewhere, as does the app folder, so your only true issue is using a different db config per site what I would do, is put your entire cms in a central accessible location, then copy your app/webroot into each website folder. modify the webroot's index.php to hold a $site_id value, assign a value in each site's index.php then in the database conf file, setup a switch based on the $site_id if you need more help, lemme know On 6/27/07, quincy <[EMAIL PROTECTED]> wrote: > > > I apologise in advance becasue I know this has come up many times > already, but I cannot seem to find the information I'm after. I want > to be able to have a single installation of my cake app (a CMS) on a > server, and run several sites from the same installation by simply > using a different database config file on each one. The only other > thing that might change would be CSS files so that each client can > have a customized colours or logos etc, but the point is that I want a > single point of upgrade for the CMS so that when we reach a new > version it can propogate across every site that uses it. > > To put it another way, one set of models, views and controllers, and > many sites running off this one application by simple specifying the > relevant DB config file and maybe stylesheets. Thats it. > > Any help greatly appreciated. I am using quite an old version of cake > as upgrades have not been possible during the development of our CMS > (long story), the version according to the config is 1.1.14.4797 > > Cheers > > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
One cake application, multiple sites
I apologise in advance becasue I know this has come up many times already, but I cannot seem to find the information I'm after. I want to be able to have a single installation of my cake app (a CMS) on a server, and run several sites from the same installation by simply using a different database config file on each one. The only other thing that might change would be CSS files so that each client can have a customized colours or logos etc, but the point is that I want a single point of upgrade for the CMS so that when we reach a new version it can propogate across every site that uses it. To put it another way, one set of models, views and controllers, and many sites running off this one application by simple specifying the relevant DB config file and maybe stylesheets. Thats it. Any help greatly appreciated. I am using quite an old version of cake as upgrades have not been possible during the development of our CMS (long story), the version according to the config is 1.1.14.4797 Cheers --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Ajax and redirection with a flash message
I've checked on this forum, but could not find an answer, so hopefully someone has an idea. While inside an ajax action, say the code detects some invalid condition. This can happen for various reasons (eg. session expiry). So, the code needs to redirect the user to the home page, with a flash message describing the problem. Since we are inside AJAX, we need to include this javascript in the view sent to the browser: (1) echo $javascript->codeBlock("window.location.href = ".$html- >url('/')); However, that only solves half the problem, ie. the redirection. How can you then display the flash to the user. The flash will not stick after the redirect. I thought of having the js above redirect to an action which invokes $this->session->setflash() and then renders the home page. The javascript code I am using is: (2) echo $javascript->codeBlock("window.location.href = ".$html->url('/ pages/display/sessionexpiry')); For some reason though, while code (1) above redirects correctly, code (2) does not even do a redirect at all. I don't know enough javascript to understand why. (testing on FF) Does anyone have any ideas? Thanks. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: validating password
Its $this->User->validates( $this->data ) , not validate. Cake has a habit of executing any unknown function you call on a model as SQL. You can still do it all in the model, just use the beforeValidate to validate the password submitted is ok (number of chars, matches confirm password etc) and then use beforeSave to MD5 the password. As you don't want to double MD5 a password it is probably best to have separate fields, ie submit the form as "plain_password", and MD5 into "hashed_password" (with the database only having a "hashed_password" field). --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
bootstrap.php woes
I've installed Apache 2.059 and PHP 5.2.3 on my local machine to give Cake a try for (re)developing web applications at my job. I figure that a framework (especially one in the vein of Cake/Rails) will vastly improve the integrity of my code and make it a much simpler matter to update when the time comes. Anyway, Apache and PHP are running spectacularly, so I dump the cake folder into Apache's htdocs folder and navigate to it. Here is the message I get: Warning: require(cake\bootstrap.php) [function.require]: failed to open stream: No such file or directory in C:\webserver\Apache2\htdocs \cake\app\webroot\index.php on line 78 Fatal error: require() [function.require]: Failed opening required 'cake\bootstrap.php' (include_path='C:\webserver\Apache2\htdocs\cake;C: \webserver\Apache2\htdocs\cake\app\;.;C:\php5\pear') in C:\webserver \Apache2\htdocs\cake\app\webroot\index.php on line 78 A few notes: I moved all files and folders originally outside of the cake folder into the cake folder - .htaccess, etc. Also, I purposefully left index.php recognition off in my httpd.conf file to make sure mod_rewrite was turned on. It was, and http://localhost/cake/ redirects properly to http://localhost/cake/app/webroot. Also, bootstrap.php exists in the 'cake' folder as it should, and I haven't modified it at all. If anyone has had any similar experiences, I would greatly appreciate some insight. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Graham Bird's AJAX tutorial in 1.2.x.x
No, thats not the problem, cause .thtml and .ctp are still working in 1.2. But it is recommended to use .ctp, as I understood. Maybe it is a good idea to have a look at tohtoh from crazylegs. 2007/6/27, abba bryant <[EMAIL PROTECTED]>: > > > Also, since I noticed you said you were using 1.2 and then mentioned > default.thtml.. I believe the new 1.2 branches use default.ctp ( note the > extension ). It could be that your thtml files are parsing as plain text? -- Siegfried Hirsch hhS - Welserstr. 1 - 81373 München - (089) 5484 3564 - skype:shirsch http://gadgetgui.de / http://www.rss-blogger.de http://www.newsbee.de NewsBee 2 - customized RSS solutions --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Probably a ridiculously easy-to-solve problem with 1.2's paginate
thx for those links On 6/27/07, dardosordi <[EMAIL PROTECTED]> wrote: > > > > http://bakery.cakephp.org/articles/view/basic-pagination-overview-3 > > http://cake.insertdesignhere.com/posts/view/16 > > > On Jun 25, 8:22 pm, "Jonathan Langevin" <[EMAIL PROTECTED]> wrote: > > nice find, how'd you come across that? > > > > On 6/25/07, kionae <[EMAIL PROTECTED]> wrote: > > > > > > > > > Seems there's yet another way to do it (would have been nice if I'd > > > found it about 6 hours ago, but meh... what can ya do? XD ), if you > > > fancy setting the default sort order for the entire controller rather > > > than doing each function on its own. > > > > > You can set: > > > > > var $paginate = array('order'=>array('field_name' => 'desc')); > > > > > at the beginning of your controller, and get the same effect. > > > > > On Jun 25, 4:54 pm, "Jonathan Langevin" <[EMAIL PROTECTED]> wrote: > > > > BTW, as I mentioned, you can pass the parameters via url as well > (i've > > > been > > > > playing with it now, hehe) > > > > > > i.e. - > > > > > > /cake/app/content/contentList/?limit=5&page=4&sort=parent_id&direction=desc > > > > > > etc > > > > > > i believe limit can also be replaced by "show" > > > > > > On 6/25/07, kionae <[EMAIL PROTECTED]> wrote: > > > > > > > I knew it had to be something ridiculously easy. :) Both ways > seem > > > > > to work. Thanks! > > > > > > > On Jun 25, 2:36 pm, "Jonathan Langevin" <[EMAIL PROTECTED]> > wrote: > > > > > > Apparently another way is to do: > > > > > > $this->params['order'] = array(); > > > > > > $this->params['order']['id'] = 'desc'; > > > > > > > > On 6/25/07, Jonathan Langevin <[EMAIL PROTECTED]> wrote: > > > > > > > > > Where are you calling paginate from? in your controller? > > > > > > > if so, just try > > > > > > > $this->params['sort'] = 'id'; > > > > > > > $this->params['direction'] = 'desc'; > > > > > > > > > before you call $this->paginate(); > > > > > > > > > On 6/25/07, kionae <[EMAIL PROTECTED]> wrote: > > > > > > > > > > The problem with that is that I can't figure out how/where > to > > > set > > > > > > > > them. They don't seem to come from the parameters passed > > > through > > > > > the > > > > > > > > paginate function in the controller, but rather from the > > > $options > > > > > > > > array and I don't know how to set things in the $options > array. > > > > > > > > > > On Jun 25, 1:56 pm, "Jonathan Langevin" <[EMAIL PROTECTED]> > > > wrote: > > > > > > > > > According to cake/libs/controller/controller.php (function > > > > > paginate), > > > > > > > > it > > > > > > > > > appears you need to set "sort" and "direction": > > > > > > > > > sort => true > > > > > > > > > direction => 'asc'|'desc' > > > > > > > > > > > it will check $this->params, $this->params['url'], and > > > > > > > > $this->passedArgs, so > > > > > > > > > try it in your url, might be the easiest test for now > > > > > > > > > > > On 6/25/07, kionae <[EMAIL PROTECTED]> wrote: > > > > > > > > > > > > The problem is not getting paginate in 1.2 to work, but > > > rather > > > > > > > > > > changing the default sort order. Everything is sorted > in > > > > > ascending > > > > > > > > > > order on the ID field when the page initially loads, but > I > > > need > > > > > it > > > > > > > > in > > > > > > > > > > descending order on the date field... and for the life > of > > > me, I > > > > > > > > can't > > > > > > > > > > find any way to specify this when calling > $this->paginate() > > > in > > > > > the > > > > > > > > > > controller. The API has been less than helpful, as all > it > > > has > > > > > to > > > > > > > > say > > > > > > > > > > about paginate is: > > > > > > > > > > > > Controller::paginate( $object = null, > > > > > > > > > > $scope = array(), > > > > > > > > > > $whitelist = array() ) > > > > > > > > > > > > Handles automatic pagination of model records > > > > > > > > > > Parameters: > > > > > > > > > > mixed $object > > > > > > > > > > mixed $scope > > > > > > > > > > array $whitelist > > > > > > > > > > > > There has to be some way to tell it to spit things out > in > > > > > descending > > > > > > > > > > order on whichever field I specify, instead of the > default > > > > > ascending > > > > > > > > > > > > order on the ID field... I know I'm probably missing > > > something > > > > > > > > > > stupidly easy, but I can't figure it out. Help? > > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---