Re: Some problem on the hasmany relationship

2011-04-28 Thread jackgoh
Hi Jeremy,

- There is a missing ' before category_id after
'associationForeignKey'
= sorry, my typo in this content only. sorry.

- Your conditions in the find-list look wrong; try 'conditions' =
array('stock_id' = $this-Stock-id)
= The results are the same. both ways are working, but your
suggestion way is better. ;)

- The convention is to name your joining table CategoryStock (the two
models are in alphabetical order). Although your arrangement ought to
work, I generally stay with conventions unless there is a compelling
reason not to.
= I changed it as what you suggested. (in Stock model  StockCategory
model)

- Do you have a model for StockCategory?
= Yes:
class CategoryStock extends AppModel
{
var $name = CategoryStocks;
 }

- What happens when you use find 'all' rather than 'list'?
= i got the correct array!!  But the result look like:
Array
(
[0] = Array
(
[CategoryStock] = Array
(
[stock_id] = 1
[business_category_id] = 4
)

)

[1] = Array
(
[CategoryStock] = Array
(
[stock_id] = 1
[business_category_id] = 7
)

)
[2] = Array
(
[CategoryStock] = Array
(
[stock_id] = 1
[business_category_id] = 14
)

)

)


- What happens when you die(debug($selectedRecord)) in your controller
before passing it to your view?
= same as above result.


Out of interest, what does the resulting SQL look like?
= (i simplified) :SELECT CategoryStock.* FROM `stock_CategoryStocks`
AS `CategoryStock` WHERE `stock_id` = 1 , effected rows is 3 , which
is always correct, when use the find('list'), the effected rows is
still 3, but debug($selectedRecord) show only 1 record in the array.
Weird.

Thanks.

Regards
Jack

On Apr 28, 12:03 pm, Jeremy Burns | Class Outfit
jeremybu...@classoutfit.com wrote:
 These might be typos but some of the code looks *slightly* odd.

 - There is a missing ' before category_id after 'associationForeignKey'
 - Your conditions in the find-list look wrong; try 'conditions' = 
 array('stock_id' = $this-Stock-id)
 - The convention is to name your joining table CategoryStock (the two models 
 are in alphabetical order). Although your arrangement ought to work, I 
 generally stay with conventions unless there is a compelling reason not to.
 - Do you have a model for StockCategory?
 - What happens when you use find 'all' rather than 'list'?
 - What happens when you die(debug($selectedRecord)) in your controller before 
 passing it to your view?

 Out of interest, what does the resulting SQL look like?

 Jeremy Burns
 Class Outfit

 jeremybu...@classoutfit.comhttp://www.classoutfit.com

 On 27 Apr 2011, at 22:51, jackgoh wrote:



  Hi cricket,

  The $this-Stock-id is set correctly. And the SQL is working
  perfectly, i can get the correct number of records (which 3 of them:
  4, 7, 14)

  On Apr 27, 1:53 am, cricket zijn.digi...@gmail.com wrote:
  Is $this-Stock-id set to something? What does the SQL look like? Set
  debug to 2 to see it.

  On Mon, Apr 25, 2011 at 1:25 PM, jackgoh kockh...@gmail.com wrote:
  Hi,

  I am facing some problem when deal with a realtionship tables, the
  record is not display :

  // in Stock model:
         var $hasAndBelongsToMany = array(
                 'Category' = array(
                         'className' = 'Category',
                         'joinTable' = 'category',
                         'foreignKey' = 'stock_id',
                         'associationForeignKey' = category_id',
                         'with' = 'StockCategory',
                 ),
         );

  // in Stock controller:
  $selectedRecord = $this-Stock-StockCategory-find('list',
  array( 'fields'=array('stock_id','category_id'),
  'conditions'=array('stock_id='.$this-Stock-id) ) );
  $this-set(compact('selectedRecord'));

  I try to copy the SQL by using debug() to phpmysql, and i get 3 lines
  of records. but when i try to PRINT_R the $selectedRecord, i can only
  get 1 record, example:

  Array
  (
     [1] = 4
  )

  Suppose the result have to be :

  Array
  (
     [1] = 4
     [1] = 7
     [1] = 14
  )

  Values : 4,7,14 are category_id, [1] is stock_id. There is a table
  call category to store all the category name.

  Please point out whats wrong to my code or logic??

  Thanks

  Best Regards.

  --
  Our newest site for the community: CakePHP Video 
  Tutorialshttp://tv.cakephp.org
  Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp 
  others with their CakePHP related questions.

  To unsubscribe from this group, send email to
  cake-php+unsubscr...@googlegroups.com For more options, visit this group 
  athttp://groups.google.com/group/cake-php-Hide quoted text -

  - Show quoted text -

  --
  Our newest site for the community: CakePHP Video 
  

Re: Some problem on the hasmany relationship

2011-04-28 Thread jackgoh
When i tried to debug($this-data['BusinessCategory']); in the Edit
View, i can get correct array which is 3 records in the array.



On Apr 28, 2:19 pm, jackgoh kockh...@gmail.com wrote:
 Hi Jeremy,

 - There is a missing ' before category_id after
 'associationForeignKey'
 = sorry, my typo in this content only. sorry.

 - Your conditions in the find-list look wrong; try 'conditions' =
 array('stock_id' = $this-Stock-id)
 = The results are the same. both ways are working, but your
 suggestion way is better. ;)

 - The convention is to name your joining table CategoryStock (the two
 models are in alphabetical order). Although your arrangement ought to
 work, I generally stay with conventions unless there is a compelling
 reason not to.
 = I changed it as what you suggested. (in Stock model  StockCategory
 model)

 - Do you have a model for StockCategory?
 = Yes:
 class CategoryStock extends AppModel
 {
         var $name = CategoryStocks;
  }

 - What happens when you use find 'all' rather than 'list'?
 = i got the correct array!!  But the result look like:
 Array
 (
     [0] = Array
         (
             [CategoryStock] = Array
                 (
                     [stock_id] = 1
                     [business_category_id] = 4
                 )

         )

     [1] = Array
         (
             [CategoryStock] = Array
                 (
                     [stock_id] = 1
                     [business_category_id] = 7
                 )

         )
     [2] = Array
         (
             [CategoryStock] = Array
                 (
                     [stock_id] = 1
                     [business_category_id] = 14
                 )

         )

 )

 - What happens when you die(debug($selectedRecord)) in your controller
 before passing it to your view?
 = same as above result.

 Out of interest, what does the resulting SQL look like?
 = (i simplified) :SELECT CategoryStock.* FROM `stock_CategoryStocks`
 AS `CategoryStock` WHERE `stock_id` = 1 , effected rows is 3 , which
 is always correct, when use the find('list'), the effected rows is
 still 3, but debug($selectedRecord) show only 1 record in the array.
 Weird.

 Thanks.

 Regards
 Jack

 On Apr 28, 12:03 pm, Jeremy Burns | Class Outfit



 jeremybu...@classoutfit.com wrote:
  These might be typos but some of the code looks *slightly* odd.

  - There is a missing ' before category_id after 'associationForeignKey'
  - Your conditions in the find-list look wrong; try 'conditions' = 
  array('stock_id' = $this-Stock-id)
  - The convention is to name your joining table CategoryStock (the two 
  models are in alphabetical order). Although your arrangement ought to work, 
  I generally stay with conventions unless there is a compelling reason not 
  to.
  - Do you have a model for StockCategory?
  - What happens when you use find 'all' rather than 'list'?
  - What happens when you die(debug($selectedRecord)) in your controller 
  before passing it to your view?

  Out of interest, what does the resulting SQL look like?

  Jeremy Burns
  Class Outfit

  jeremybu...@classoutfit.comhttp://www.classoutfit.com

  On 27 Apr 2011, at 22:51, jackgoh wrote:

   Hi cricket,

   The $this-Stock-id is set correctly. And the SQL is working
   perfectly, i can get the correct number of records (which 3 of them:
   4, 7, 14)

   On Apr 27, 1:53 am, cricket zijn.digi...@gmail.com wrote:
   Is $this-Stock-id set to something? What does the SQL look like? Set
   debug to 2 to see it.

   On Mon, Apr 25, 2011 at 1:25 PM, jackgoh kockh...@gmail.com wrote:
   Hi,

   I am facing some problem when deal with a realtionship tables, the
   record is not display :

   // in Stock model:
          var $hasAndBelongsToMany = array(
                  'Category' = array(
                          'className' = 'Category',
                          'joinTable' = 'category',
                          'foreignKey' = 'stock_id',
                          'associationForeignKey' = category_id',
                          'with' = 'StockCategory',
                  ),
          );

   // in Stock controller:
   $selectedRecord = $this-Stock-StockCategory-find('list',
   array( 'fields'=array('stock_id','category_id'),
   'conditions'=array('stock_id='.$this-Stock-id) ) );
   $this-set(compact('selectedRecord'));

   I try to copy the SQL by using debug() to phpmysql, and i get 3 lines
   of records. but when i try to PRINT_R the $selectedRecord, i can only
   get 1 record, example:

   Array
   (
      [1] = 4
   )

   Suppose the result have to be :

   Array
   (
      [1] = 4
      [1] = 7
      [1] = 14
   )

   Values : 4,7,14 are category_id, [1] is stock_id. There is a table
   call category to store all the category name.

   Please point out whats wrong to my code or logic??

   Thanks

   Best Regards.

   --
   Our newest site for the community: CakePHP Video 
   Tutorialshttp://tv.cakephp.org
   Check out the new CakePHP Questions 
   sitehttp://ask.cakephp.organdhelpothers 

Re: Some problem on the hasmany relationship

2011-04-28 Thread jackgoh
in the array, business_category_id is same as category_id in my
example, i just changed it. Sorry.


On Apr 28, 2:19 pm, jackgoh kockh...@gmail.com wrote:
 Hi Jeremy,

 - There is a missing ' before category_id after
 'associationForeignKey'
 = sorry, my typo in this content only. sorry.

 - Your conditions in the find-list look wrong; try 'conditions' =
 array('stock_id' = $this-Stock-id)
 = The results are the same. both ways are working, but your
 suggestion way is better. ;)

 - The convention is to name your joining table CategoryStock (the two
 models are in alphabetical order). Although your arrangement ought to
 work, I generally stay with conventions unless there is a compelling
 reason not to.
 = I changed it as what you suggested. (in Stock model  StockCategory
 model)

 - Do you have a model for StockCategory?
 = Yes:
 class CategoryStock extends AppModel
 {
         var $name = CategoryStocks;
  }

 - What happens when you use find 'all' rather than 'list'?
 = i got the correct array!!  But the result look like:
 Array
 (
     [0] = Array
         (
             [CategoryStock] = Array
                 (
                     [stock_id] = 1
                     [business_category_id] = 4
                 )

         )

     [1] = Array
         (
             [CategoryStock] = Array
                 (
                     [stock_id] = 1
                     [business_category_id] = 7
                 )

         )
     [2] = Array
         (
             [CategoryStock] = Array
                 (
                     [stock_id] = 1
                     [business_category_id] = 14
                 )

         )

 )

 - What happens when you die(debug($selectedRecord)) in your controller
 before passing it to your view?
 = same as above result.

 Out of interest, what does the resulting SQL look like?
 = (i simplified) :SELECT CategoryStock.* FROM `stock_CategoryStocks`
 AS `CategoryStock` WHERE `stock_id` = 1 , effected rows is 3 , which
 is always correct, when use the find('list'), the effected rows is
 still 3, but debug($selectedRecord) show only 1 record in the array.
 Weird.

 Thanks.

 Regards
 Jack

 On Apr 28, 12:03 pm, Jeremy Burns | Class Outfit



 jeremybu...@classoutfit.com wrote:
  These might be typos but some of the code looks *slightly* odd.

  - There is a missing ' before category_id after 'associationForeignKey'
  - Your conditions in the find-list look wrong; try 'conditions' = 
  array('stock_id' = $this-Stock-id)
  - The convention is to name your joining table CategoryStock (the two 
  models are in alphabetical order). Although your arrangement ought to work, 
  I generally stay with conventions unless there is a compelling reason not 
  to.
  - Do you have a model for StockCategory?
  - What happens when you use find 'all' rather than 'list'?
  - What happens when you die(debug($selectedRecord)) in your controller 
  before passing it to your view?

  Out of interest, what does the resulting SQL look like?

  Jeremy Burns
  Class Outfit

  jeremybu...@classoutfit.comhttp://www.classoutfit.com

  On 27 Apr 2011, at 22:51, jackgoh wrote:

   Hi cricket,

   The $this-Stock-id is set correctly. And the SQL is working
   perfectly, i can get the correct number of records (which 3 of them:
   4, 7, 14)

   On Apr 27, 1:53 am, cricket zijn.digi...@gmail.com wrote:
   Is $this-Stock-id set to something? What does the SQL look like? Set
   debug to 2 to see it.

   On Mon, Apr 25, 2011 at 1:25 PM, jackgoh kockh...@gmail.com wrote:
   Hi,

   I am facing some problem when deal with a realtionship tables, the
   record is not display :

   // in Stock model:
          var $hasAndBelongsToMany = array(
                  'Category' = array(
                          'className' = 'Category',
                          'joinTable' = 'category',
                          'foreignKey' = 'stock_id',
                          'associationForeignKey' = category_id',
                          'with' = 'StockCategory',
                  ),
          );

   // in Stock controller:
   $selectedRecord = $this-Stock-StockCategory-find('list',
   array( 'fields'=array('stock_id','category_id'),
   'conditions'=array('stock_id='.$this-Stock-id) ) );
   $this-set(compact('selectedRecord'));

   I try to copy the SQL by using debug() to phpmysql, and i get 3 lines
   of records. but when i try to PRINT_R the $selectedRecord, i can only
   get 1 record, example:

   Array
   (
      [1] = 4
   )

   Suppose the result have to be :

   Array
   (
      [1] = 4
      [1] = 7
      [1] = 14
   )

   Values : 4,7,14 are category_id, [1] is stock_id. There is a table
   call category to store all the category name.

   Please point out whats wrong to my code or logic??

   Thanks

   Best Regards.

   --
   Our newest site for the community: CakePHP Video 
   Tutorialshttp://tv.cakephp.org
   Check out the new CakePHP Questions 
   sitehttp://ask.cakephp.organdhelpothers with their CakePHP related 
   

Assemble IN clause for paginate

2011-04-28 Thread ZAky
1. I have a stored procedure that return an array of ids and can
return a comma delimited string of ids if its better
2. A have a paginator that return all the data from a table.
3. When the user perform a search I take the search parameters and
call the stored procedure.

Now I have an array or string that I want to use as a condition to the
paginator

$this-set('assets', $this-paginate(array('Asset.id IN' =
$searchTerm)));

Well its not working.

I tried to add '('.$searchTerm.')' with no success
And several more things

Thank you

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: $this-layout implementation in a controller

2011-04-28 Thread Salines
class MyController extends AppController {
function beforeFilter(){
  $this-layout = 'other';
}
}

OR

class MyController extends AppController {
function beforeRender(){
  $this-layout = 'other';
}
}

On 28 tra, 07:41, thom cyber.phanto...@gmail.com wrote:
 Hello,, I just wonder about how to make all function in a controller
 to 'use' $this-layout. Is it possible? Or It just can be done via
 adding the syntax into each function.

 Note : I have a controller that has a different layout from the others
 controllers.
 --
 Regards,,,
 mastantohttp://www.mastanto.comhttp://thom-sharing.blogspot.com

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Some problem on the hasmany relationship

2011-04-28 Thread Jeremy Burns | Class Outfit
What are the results of find list?

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 28 Apr 2011, at 07:19, jackgoh wrote:

 Hi Jeremy,
 
 - There is a missing ' before category_id after
 'associationForeignKey'
 = sorry, my typo in this content only. sorry.
 
 - Your conditions in the find-list look wrong; try 'conditions' =
 array('stock_id' = $this-Stock-id)
 = The results are the same. both ways are working, but your
 suggestion way is better. ;)
 
 - The convention is to name your joining table CategoryStock (the two
 models are in alphabetical order). Although your arrangement ought to
 work, I generally stay with conventions unless there is a compelling
 reason not to.
 = I changed it as what you suggested. (in Stock model  StockCategory
 model)
 
 - Do you have a model for StockCategory?
 = Yes:
 class CategoryStock extends AppModel
 {
   var $name = CategoryStocks;
 }
 
 - What happens when you use find 'all' rather than 'list'?
 = i got the correct array!!  But the result look like:
 Array
 (
[0] = Array
(
[CategoryStock] = Array
(
[stock_id] = 1
[business_category_id] = 4
)
 
)
 
[1] = Array
(
[CategoryStock] = Array
(
[stock_id] = 1
[business_category_id] = 7
)
 
)
[2] = Array
(
[CategoryStock] = Array
(
[stock_id] = 1
[business_category_id] = 14
)
 
)
 
 )
 
 
 - What happens when you die(debug($selectedRecord)) in your controller
 before passing it to your view?
 = same as above result.
 
 
 Out of interest, what does the resulting SQL look like?
 = (i simplified) :SELECT CategoryStock.* FROM `stock_CategoryStocks`
 AS `CategoryStock` WHERE `stock_id` = 1 , effected rows is 3 , which
 is always correct, when use the find('list'), the effected rows is
 still 3, but debug($selectedRecord) show only 1 record in the array.
 Weird.
 
 Thanks.
 
 Regards
 Jack
 
 On Apr 28, 12:03 pm, Jeremy Burns | Class Outfit
 jeremybu...@classoutfit.com wrote:
 These might be typos but some of the code looks *slightly* odd.
 
 - There is a missing ' before category_id after 'associationForeignKey'
 - Your conditions in the find-list look wrong; try 'conditions' = 
 array('stock_id' = $this-Stock-id)
 - The convention is to name your joining table CategoryStock (the two models 
 are in alphabetical order). Although your arrangement ought to work, I 
 generally stay with conventions unless there is a compelling reason not to.
 - Do you have a model for StockCategory?
 - What happens when you use find 'all' rather than 'list'?
 - What happens when you die(debug($selectedRecord)) in your controller 
 before passing it to your view?
 
 Out of interest, what does the resulting SQL look like?
 
 Jeremy Burns
 Class Outfit
 
 jeremybu...@classoutfit.comhttp://www.classoutfit.com
 
 On 27 Apr 2011, at 22:51, jackgoh wrote:
 
 
 
 Hi cricket,
 
 The $this-Stock-id is set correctly. And the SQL is working
 perfectly, i can get the correct number of records (which 3 of them:
 4, 7, 14)
 
 On Apr 27, 1:53 am, cricket zijn.digi...@gmail.com wrote:
 Is $this-Stock-id set to something? What does the SQL look like? Set
 debug to 2 to see it.
 
 On Mon, Apr 25, 2011 at 1:25 PM, jackgoh kockh...@gmail.com wrote:
 Hi,
 
 I am facing some problem when deal with a realtionship tables, the
 record is not display :
 
 // in Stock model:
var $hasAndBelongsToMany = array(
'Category' = array(
'className' = 'Category',
'joinTable' = 'category',
'foreignKey' = 'stock_id',
'associationForeignKey' = category_id',
'with' = 'StockCategory',
),
);
 
 // in Stock controller:
 $selectedRecord = $this-Stock-StockCategory-find('list',
 array( 'fields'=array('stock_id','category_id'),
 'conditions'=array('stock_id='.$this-Stock-id) ) );
 $this-set(compact('selectedRecord'));
 
 I try to copy the SQL by using debug() to phpmysql, and i get 3 lines
 of records. but when i try to PRINT_R the $selectedRecord, i can only
 get 1 record, example:
 
 Array
 (
[1] = 4
 )
 
 Suppose the result have to be :
 
 Array
 (
[1] = 4
[1] = 7
[1] = 14
 )
 
 Values : 4,7,14 are category_id, [1] is stock_id. There is a table
 call category to store all the category name.
 
 Please point out whats wrong to my code or logic??
 
 Thanks
 
 Best Regards.
 
 --
 Our newest site for the community: CakePHP Video 
 Tutorialshttp://tv.cakephp.org
 Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp 
 others with their CakePHP related questions.
 
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For 

Mysql 1064 error

2011-04-28 Thread blue_negative
Hi,

I am using Cake 1.3.8 and get a Mysql error code 1064. Following is
the details in debug mode
Query: check
Error: 1064: You have an error in your SQL syntax; check the manual
that corresponds to your MySQL server version for the right syntax to
use near '' at line 1

The associated mode has following relationships:
4 hasMany
1 belongsTo
1 HBTM

Its seems that the it is generating a sql query Check and hence it
is throwing the error. The interesting part is it does not generate
this check: query for my other mode.

Please let me know if I am doing something wrong. Let me know if any
additional information if required.

Regards
James

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Mysql 1064 error

2011-04-28 Thread blue_negative
Hi,

I am using Cake 1.3.8 and get a Mysql error code 1064. Following is
the details in debug mode
Query: check
Error: 1064: You have an error in your SQL syntax; check the manual
that corresponds to your MySQL server version for the right syntax to
use near '' at line 1

The associated mode has following relationships:
4 hasMany
1 belongsTo
1 HBTM

Its seems that the it is generating a sql query Check and hence it
is throwing the error. The interesting part is it does not generate
this check: query for my other mode.

Please let me know if I am doing something wrong. Let me know if any
additional information if required.

Regards
James

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Assemble IN clause for paginate

2011-04-28 Thread AD7six

On Apr 28, 8:29 am, ZAky procsh...@gmail.com wrote:
 1. I have a stored procedure that return an array of ids and can
 return a comma delimited string of ids if its better
 2. A have a paginator that return all the data from a table.
 3. When the user perform a search I take the search parameters and
 call the stored procedure.

 Now I have an array or string that I want to use as a condition to the
 paginator

 $this-set('assets', $this-paginate(array('Asset.id IN' =
 $searchTerm)));

'Asset.id' =


 Well its not working.

what query gets executed, what query are you wanting


 I tried to add '('.$searchTerm.')' with no success

what is that supposed to do (added it where?) what did it do.

 And several more things

I also sang the sacred chant, but no extra infromation or error
messages came forth.

AD

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: ajax is'n work correctly in chrome and ie

2011-04-28 Thread Jens Dittrich
Have you inspected you page in firefox with firebug extension and in
chrome with the developer tools? In case you run into a JavaScript
problem that one browser might tolerate and another might be strict on
the same matter, you will find hints in those tools.
Besides that, don't you think you should at least describe the nature
of your problem a bit further, than just saying works in A and does
not work in B? What exactly is working and what not?

On 28 Apr., 05:35, taq taqman...@gmail.com wrote:
 VIEW form
 div class=register 
 ?php

 // let the controller action decide weather to close the modalbox
 if (isset($closeModalbox)  $closeModalbox) echo div
 id='closeModalbox'/div;

 // output an ajax or a normal form
 if ($ajax-isAjax()) {
         // show ajax form
         echo $ajax-form('edit', 'post', array(
                 'model'    = 'User',
                 'url'      = array('controller' = 'Users', 'action' =
 'register'),
                 'update'   = 'MB_content',
                 'complete' = 'closeModalbox()'
         ));} else {

         // show default form
         echo $form-create( 'User');}

 ?
         fieldset
         ?php
                 echo $form-input('user_login', array( 'label' = 'User Name 
 :' ) );
                 echo $form-input('user_pass', array( 'label' =
 'Password :', 'type' = 'password') );
         ?
         /fieldset
 ?php echo $form-end('Submit');?
 /div

 please guide me to make code to complatible in firefox chrome and ie
 On Apr 28, 9:14 am, Krissy Masters naked.cake.ba...@gmail.com
 wrote:







  With all the details you provided it should be just such a simple fix.

  I also read palms and your future.

  -Original Message-
  From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf

  Of taq
  Sent: Wednesday, April 27, 2011 11:25 PM
  To: CakePHP
  Subject: ajax is'n work correctly in chrome and ie

  hi
  I create modalbox form it work corectly in firefox
  but work error on ie and chrome how to fix error
  thank you

  --
  Our newest site for the community: CakePHP Video 
  Tutorialshttp://tv.cakephp.org
  Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp
  others with their CakePHP related questions.

  To unsubscribe from this group, send email to
  cake-php+unsubscr...@googlegroups.com For more options, visit this group 
  athttp://groups.google.com/group/cake-php

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Assemble IN clause for paginate

2011-04-28 Thread euromark
your search term is an array of ids, right?
than its as easy as using

array('Asset.id' = $arrayOfIds)

because cake will automatically make an IN here


On 28 Apr., 09:25, AD7six andydawso...@gmail.com wrote:
 On Apr 28, 8:29 am, ZAky procsh...@gmail.com wrote:

  1. I have a stored procedure that return an array of ids and can
  return a comma delimited string of ids if its better
  2. A have a paginator that return all the data from a table.
  3. When the user perform a search I take the search parameters and
  call the stored procedure.

  Now I have an array or string that I want to use as a condition to the
  paginator

  $this-set('assets', $this-paginate(array('Asset.id IN' =
  $searchTerm)));

 'Asset.id' =



  Well its not working.

 what query gets executed, what query are you wanting



  I tried to add '('.$searchTerm.')' with no success

 what is that supposed to do (added it where?) what did it do.

  And several more things

 I also sang the sacred chant, but no extra infromation or error
 messages came forth.

 AD

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Validate from within a model

2011-04-28 Thread euromark
but thats awfully wrong and dangerous
your primary validation should be in php (in the model)
js validation is just a nice little addon

On 28 Apr., 04:15, cake-learner sh.koiz...@gmail.com wrote:
 I always do validation with Jquery plugins not with cakephp function
 since the form function is limited.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Html Link in the elements

2011-04-28 Thread Carachi
Hello,
I have this problem.
I want create a menu for my website, so I use an element that I set in
my layout.ctp so:

div class=menu?php echo $this-element('menu',array(),true);?/
div

I need use link for my menu but the helper doesn't work!
I try with :
$this-html-link(..) //but doesn't reconize $this because there
isn't an object
$html-link(..) // but is not set..

How can I use Html Helper?

Thank you
Bye

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Html Link in the elements

2011-04-28 Thread euromark
read the manuel for 1.3

$this-Html-link()

On 28 Apr., 11:40, Carachi carach...@gmail.com wrote:
 Hello,
 I have this problem.
 I want create a menu for my website, so I use an element that I set in
 my layout.ctp so:

 div class=menu?php echo $this-element('menu',array(),true);?/
 div

 I need use link for my menu but the helper doesn't work!
 I try with :
     $this-html-link(..) //but doesn't reconize $this because there
 isn't an object
     $html-link(..) // but is not set..

 How can I use Html Helper?

 Thank you
 Bye

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Validate from within a model

2011-04-28 Thread func0der
Okay.

I'm doing it like this.

I'm havin a new file uploaded.
The file data, like mime type, name etc. will be saved in the db under
the file id.
I'm using that id as a filename for the files in my filesystem.
So i need to first create a db record to use the id.

Afterwards i'm trying to save the file.
If for example the folder for the upload is not writable or i don't
have the permission or any other case i can't figure out now happens,
then i want to cancel the upload and delete the db record so i won't
have 2 or more of the same file in the database.

This user is getting an error message that something fails during the
file upload and also i want to let the users know what they are
supposed to do next.

This is my intention.

And i would never validate file uploads with javascripts because of 2
reasons:
First, i don't know how
Second, i know enough to know that this kind of validation wouldn't be
save enough ^^

Nothing against you, but js alone isn't the key.

On 27 Apr., 23:54, Miles J mileswjohn...@gmail.com wrote:
 You dont need to use validates(), just set an error manually.

 $this-invalidate('fields', 'Error message.');

 Also, your approach is still wrong IMO. You should be doing all error
 checking before any save functionality is triggered. In what scenario
 will the image NOT copy/transfer? I have yet to ever run into that
 problem.

 On Apr 27, 12:31 pm, func0der funco...@live.com wrote:

  okay...i think i got it.

  It is part of the MVC pattern, isn't it?

  The model is NOT connected to the view or the helpers. These two are
  getting their data or the invalid error messages by the controller.

  Am i right here?

  On 27 Apr., 21:00, func0der funco...@live.com wrote:

   I can re-save and delete, so why i shouldn't be able to revalidate?

   The error message is also in the validationErrors variable but while
   the output of the form there is no error message.
   But why?

   On 27 Apr., 20:38, Miles J mileswjohn...@gmail.com wrote:

You can't validates() something after the model save has already
happened. Use a behavior for validation or use my plugin.

   https://github.com/milesj/cake-uploader

And an example model on how to use it.

   https://github.com/milesj/cake-uploader/blob/master/tests/models/uplo...

On Apr 27, 11:18 am, func0der funco...@live.com wrote:

 Hey guys,

 i'm having a file upload here.
 I'm using afterSave to place the uploaded file in the filesystem.

         function afterSave($created){
                 //get the entry id
                 $this-data['DataFile']['id'] = $this-getInsertId();
                 if(!$this-saveDataFile($this-data)){
                         $this-delete($this-data['DataFile']['id']);
                         $this-data['DataFile']['data_file'] = 
 array();
                         $this-validates();
                 }
         }

 saveDataFile is a function which tries to places the uploaded file
 in the file system and returns false in case of copy fails.

 If the copy should fail i delete the record from the database and set
 the data_file index which normally cotains the uploaded file
 information to an empty array. This is because i want the validation
 to fail so the file upload field gets an error message while
 rendering.

 The problem now is that the upload form does NOT! contain the
 validation error message for that particular field.

 Do you know what i am doing wrong?

 Greetings
 func0der

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Calling an element based on row selection

2011-04-28 Thread heohni
Hi,

My idea is to have a list of database data listed in a table, one row
per member data details.
Each member has a link to open a popup (I am using a basic modal
jquery script). In this popup I would like to have a comment field to
add comments regarding the selected client.

I am not sure how to do that.
How can I call the popup with the comment field, which is outsourced
in a element, and parse the member id to it?

Guess I have a table like
...
tdmemberid 1/tdtdecho $this-Html-link(__('leave a comment',
true),?/td
/trtr
tdmemberid 2/tdtdecho $this-Html-link(__('leave a comment',
true),?/td
/trtr
tdmemberid 3/tdtdecho $this-Html-link(__('leave a comment',
true),?/td

My element looks like
div id=popup
?php echo $this-Ajax-Form('comment', 'post', array('url' =
array('action' = 'comment'))); ?
input type=hidden id=memberID value=
...
tdtextarea cols=10 rows=5 name=comment/textarea/td

?php echo $this-Ajax-Form-end(); ?
/div

Please give me a hand with this, I am sure it must be possible
somehow? Or?

Thanks!!

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Html Link in the elements

2011-04-28 Thread Carachi
Thank you euromark!

I read it but I didn't find anythig about it.
I try with $this-Html-link(...)

but give this error:
Fatal error: Using $this when not in object context in /home/gege/www/
app/views/elements/menu.ctp on line 101
I thing because I isn't in a Class...

Thank you



On 28 Apr, 11:47, euromark dereurom...@googlemail.com wrote:
 read the manuel for 1.3

 $this-Html-link()

 On 28 Apr., 11:40, Carachi carach...@gmail.com wrote:







  Hello,
  I have this problem.
  I want create a menu for my website, so I use an element that I set in
  my layout.ctp so:

  div class=menu?php echo $this-element('menu',array(),true);?/
  div

  I need use link for my menu but the helper doesn't work!
  I try with :
      $this-html-link(..) //but doesn't reconize $this because there
  isn't an object
      $html-link(..) // but is not set..

  How can I use Html Helper?

  Thank you
  Bye

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Some problem on the hasmany relationship

2011-04-28 Thread jackgoh
When use find('list',), it is:
Array
(
[1] = 4
)


But the result suppose is :


Array
(
[1] = 7
[1] = 14
[1] = 4
)

It is always get the last record.

Thanks

On Apr 28, 3:14 pm, Jeremy Burns | Class Outfit
jeremybu...@classoutfit.com wrote:
 What are the results of find list?

 Jeremy Burns
 Class Outfit

 jeremybu...@classoutfit.comhttp://www.classoutfit.com

 On 28 Apr 2011, at 07:19, jackgoh wrote:



  Hi Jeremy,

  - There is a missing ' before category_id after
  'associationForeignKey'
  = sorry, my typo in this content only. sorry.

  - Your conditions in the find-list look wrong; try 'conditions' =
  array('stock_id' = $this-Stock-id)
  = The results are the same. both ways are working, but your
  suggestion way is better. ;)

  - The convention is to name your joining table CategoryStock (the two
  models are in alphabetical order). Although your arrangement ought to
  work, I generally stay with conventions unless there is a compelling
  reason not to.
  = I changed it as what you suggested. (in Stock model  StockCategory
  model)

  - Do you have a model for StockCategory?
  = Yes:
  class CategoryStock extends AppModel
  {
     var $name = CategoryStocks;
  }

  - What happens when you use find 'all' rather than 'list'?
  = i got the correct array!!  But the result look like:
  Array
  (
     [0] = Array
         (
             [CategoryStock] = Array
                 (
                     [stock_id] = 1
                     [business_category_id] = 4
                 )

         )

     [1] = Array
         (
             [CategoryStock] = Array
                 (
                     [stock_id] = 1
                     [business_category_id] = 7
                 )

         )
     [2] = Array
         (
             [CategoryStock] = Array
                 (
                     [stock_id] = 1
                     [business_category_id] = 14
                 )

         )

  )

  - What happens when you die(debug($selectedRecord)) in your controller
  before passing it to your view?
  = same as above result.

  Out of interest, what does the resulting SQL look like?
  = (i simplified) :SELECT CategoryStock.* FROM `stock_CategoryStocks`
  AS `CategoryStock` WHERE `stock_id` = 1 , effected rows is 3 , which
  is always correct, when use the find('list'), the effected rows is
  still 3, but debug($selectedRecord) show only 1 record in the array.
  Weird.

  Thanks.

  Regards
  Jack

  On Apr 28, 12:03 pm, Jeremy Burns | Class Outfit
  jeremybu...@classoutfit.com wrote:
  These might be typos but some of the code looks *slightly* odd.

  - There is a missing ' before category_id after 'associationForeignKey'
  - Your conditions in the find-list look wrong; try 'conditions' = 
  array('stock_id' = $this-Stock-id)
  - The convention is to name your joining table CategoryStock (the two 
  models are in alphabetical order). Although your arrangement ought to 
  work, I generally stay with conventions unless there is a compelling 
  reason not to.
  - Do you have a model for StockCategory?
  - What happens when you use find 'all' rather than 'list'?
  - What happens when you die(debug($selectedRecord)) in your controller 
  before passing it to your view?

  Out of interest, what does the resulting SQL look like?

  Jeremy Burns
  Class Outfit

  jeremybu...@classoutfit.comhttp://www.classoutfit.com

  On 27 Apr 2011, at 22:51, jackgoh wrote:

  Hi cricket,

  The $this-Stock-id is set correctly. And the SQL is working
  perfectly, i can get the correct number of records (which 3 of them:
  4, 7, 14)

  On Apr 27, 1:53 am, cricket zijn.digi...@gmail.com wrote:
  Is $this-Stock-id set to something? What does the SQL look like? Set
  debug to 2 to see it.

  On Mon, Apr 25, 2011 at 1:25 PM, jackgoh kockh...@gmail.com wrote:
  Hi,

  I am facing some problem when deal with a realtionship tables, the
  record is not display :

  // in Stock model:
         var $hasAndBelongsToMany = array(
                 'Category' = array(
                         'className' = 'Category',
                         'joinTable' = 'category',
                         'foreignKey' = 'stock_id',
                         'associationForeignKey' = category_id',
                         'with' = 'StockCategory',
                 ),
         );

  // in Stock controller:
  $selectedRecord = $this-Stock-StockCategory-find('list',
  array( 'fields'=array('stock_id','category_id'),
  'conditions'=array('stock_id='.$this-Stock-id) ) );
  $this-set(compact('selectedRecord'));

  I try to copy the SQL by using debug() to phpmysql, and i get 3 lines
  of records. but when i try to PRINT_R the $selectedRecord, i can only
  get 1 record, example:

  Array
  (
     [1] = 4
  )

  Suppose the result have to be :

  Array
  (
     [1] = 4
     [1] = 7
     [1] = 14
  )

  Values : 4,7,14 are category_id, [1] is stock_id. There is a table
  call category to store all the category name.

  Please point out whats 

Re: Some problem on the hasmany relationship

2011-04-28 Thread Jeremy Burns | Class Outfit
That's probably because the first value is the array key and you can't have 
duplicate array keys (your desired result is impossible in PHP). Imagine it as 
a select list; each option would have the same value (1), which defeats the 
object. Cake is (in essence) simply doing a loop, adding each value it finds to 
the resulting array and that will always replace the last value found (it's 
always array key '1'); hence you end up with the 'last' record. Would it work 
for you to switch the columns around? That would give you the three values you 
need.

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 28 Apr 2011, at 11:13, jackgoh wrote:

 When use find('list',), it is:
 Array
 (
[1] = 4
 )
 
 
 But the result suppose is :
 
 
 Array
 (
[1] = 7
[1] = 14
[1] = 4
 )
 
 It is always get the last record.
 
 Thanks
 
 On Apr 28, 3:14 pm, Jeremy Burns | Class Outfit
 jeremybu...@classoutfit.com wrote:
 What are the results of find list?
 
 Jeremy Burns
 Class Outfit
 
 jeremybu...@classoutfit.comhttp://www.classoutfit.com
 
 On 28 Apr 2011, at 07:19, jackgoh wrote:
 
 
 
 Hi Jeremy,
 
 - There is a missing ' before category_id after
 'associationForeignKey'
 = sorry, my typo in this content only. sorry.
 
 - Your conditions in the find-list look wrong; try 'conditions' =
 array('stock_id' = $this-Stock-id)
 = The results are the same. both ways are working, but your
 suggestion way is better. ;)
 
 - The convention is to name your joining table CategoryStock (the two
 models are in alphabetical order). Although your arrangement ought to
 work, I generally stay with conventions unless there is a compelling
 reason not to.
 = I changed it as what you suggested. (in Stock model  StockCategory
 model)
 
 - Do you have a model for StockCategory?
 = Yes:
 class CategoryStock extends AppModel
 {
var $name = CategoryStocks;
 }
 
 - What happens when you use find 'all' rather than 'list'?
 = i got the correct array!!  But the result look like:
 Array
 (
[0] = Array
(
[CategoryStock] = Array
(
[stock_id] = 1
[business_category_id] = 4
)
 
)
 
[1] = Array
(
[CategoryStock] = Array
(
[stock_id] = 1
[business_category_id] = 7
)
 
)
[2] = Array
(
[CategoryStock] = Array
(
[stock_id] = 1
[business_category_id] = 14
)
 
)
 
 )
 
 - What happens when you die(debug($selectedRecord)) in your controller
 before passing it to your view?
 = same as above result.
 
 Out of interest, what does the resulting SQL look like?
 = (i simplified) :SELECT CategoryStock.* FROM `stock_CategoryStocks`
 AS `CategoryStock` WHERE `stock_id` = 1 , effected rows is 3 , which
 is always correct, when use the find('list'), the effected rows is
 still 3, but debug($selectedRecord) show only 1 record in the array.
 Weird.
 
 Thanks.
 
 Regards
 Jack
 
 On Apr 28, 12:03 pm, Jeremy Burns | Class Outfit
 jeremybu...@classoutfit.com wrote:
 These might be typos but some of the code looks *slightly* odd.
 
 - There is a missing ' before category_id after 'associationForeignKey'
 - Your conditions in the find-list look wrong; try 'conditions' = 
 array('stock_id' = $this-Stock-id)
 - The convention is to name your joining table CategoryStock (the two 
 models are in alphabetical order). Although your arrangement ought to 
 work, I generally stay with conventions unless there is a compelling 
 reason not to.
 - Do you have a model for StockCategory?
 - What happens when you use find 'all' rather than 'list'?
 - What happens when you die(debug($selectedRecord)) in your controller 
 before passing it to your view?
 
 Out of interest, what does the resulting SQL look like?
 
 Jeremy Burns
 Class Outfit
 
 jeremybu...@classoutfit.comhttp://www.classoutfit.com
 
 On 27 Apr 2011, at 22:51, jackgoh wrote:
 
 Hi cricket,
 
 The $this-Stock-id is set correctly. And the SQL is working
 perfectly, i can get the correct number of records (which 3 of them:
 4, 7, 14)
 
 On Apr 27, 1:53 am, cricket zijn.digi...@gmail.com wrote:
 Is $this-Stock-id set to something? What does the SQL look like? Set
 debug to 2 to see it.
 
 On Mon, Apr 25, 2011 at 1:25 PM, jackgoh kockh...@gmail.com wrote:
 Hi,
 
 I am facing some problem when deal with a realtionship tables, the
 record is not display :
 
 // in Stock model:
var $hasAndBelongsToMany = array(
'Category' = array(
'className' = 'Category',
'joinTable' = 'category',
'foreignKey' = 'stock_id',
'associationForeignKey' = category_id',
'with' = 'StockCategory',
),
);
 
 // in Stock controller:
 

Re: Some problem on the hasmany relationship

2011-04-28 Thread jackgoh
ahh.. okay, let me try then.

Thanks.


Regards

On Apr 28, 7:00 pm, Jeremy Burns | Class Outfit
jeremybu...@classoutfit.com wrote:
 That's probably because the first value is the array key and you can't have 
 duplicate array keys (your desired result is impossible in PHP). Imagine it 
 as a select list; each option would have the same value (1), which defeats 
 the object. Cake is (in essence) simply doing a loop, adding each value it 
 finds to the resulting array and that will always replace the last value 
 found (it's always array key '1'); hence you end up with the 'last' record. 
 Would it work for you to switch the columns around? That would give you the 
 three values you need.

 Jeremy Burns
 Class Outfit

 jeremybu...@classoutfit.comhttp://www.classoutfit.com

 On 28 Apr 2011, at 11:13, jackgoh wrote:



  When use find('list',), it is:
  Array
  (
     [1] = 4
  )

  But the result suppose is :

  Array
  (
     [1] = 7
     [1] = 14
     [1] = 4
  )

  It is always get the last record.

  Thanks

  On Apr 28, 3:14 pm, Jeremy Burns | Class Outfit
  jeremybu...@classoutfit.com wrote:
  What are the results of find list?

  Jeremy Burns
  Class Outfit

  jeremybu...@classoutfit.comhttp://www.classoutfit.com

  On 28 Apr 2011, at 07:19, jackgoh wrote:

  Hi Jeremy,

  - There is a missing ' before category_id after
  'associationForeignKey'
  = sorry, my typo in this content only. sorry.

  - Your conditions in the find-list look wrong; try 'conditions' =
  array('stock_id' = $this-Stock-id)
  = The results are the same. both ways are working, but your
  suggestion way is better. ;)

  - The convention is to name your joining table CategoryStock (the two
  models are in alphabetical order). Although your arrangement ought to
  work, I generally stay with conventions unless there is a compelling
  reason not to.
  = I changed it as what you suggested. (in Stock model  StockCategory
  model)

  - Do you have a model for StockCategory?
  = Yes:
  class CategoryStock extends AppModel
  {
     var $name = CategoryStocks;
  }

  - What happens when you use find 'all' rather than 'list'?
  = i got the correct array!!  But the result look like:
  Array
  (
     [0] = Array
         (
             [CategoryStock] = Array
                 (
                     [stock_id] = 1
                     [business_category_id] = 4
                 )

         )

     [1] = Array
         (
             [CategoryStock] = Array
                 (
                     [stock_id] = 1
                     [business_category_id] = 7
                 )

         )
     [2] = Array
         (
             [CategoryStock] = Array
                 (
                     [stock_id] = 1
                     [business_category_id] = 14
                 )

         )

  )

  - What happens when you die(debug($selectedRecord)) in your controller
  before passing it to your view?
  = same as above result.

  Out of interest, what does the resulting SQL look like?
  = (i simplified) :SELECT CategoryStock.* FROM `stock_CategoryStocks`
  AS `CategoryStock` WHERE `stock_id` = 1 , effected rows is 3 , which
  is always correct, when use the find('list'), the effected rows is
  still 3, but debug($selectedRecord) show only 1 record in the array.
  Weird.

  Thanks.

  Regards
  Jack

  On Apr 28, 12:03 pm, Jeremy Burns | Class Outfit
  jeremybu...@classoutfit.com wrote:
  These might be typos but some of the code looks *slightly* odd.

  - There is a missing ' before category_id after 'associationForeignKey'
  - Your conditions in the find-list look wrong; try 'conditions' = 
  array('stock_id' = $this-Stock-id)
  - The convention is to name your joining table CategoryStock (the two 
  models are in alphabetical order). Although your arrangement ought to 
  work, I generally stay with conventions unless there is a compelling 
  reason not to.
  - Do you have a model for StockCategory?
  - What happens when you use find 'all' rather than 'list'?
  - What happens when you die(debug($selectedRecord)) in your controller 
  before passing it to your view?

  Out of interest, what does the resulting SQL look like?

  Jeremy Burns
  Class Outfit

  jeremybu...@classoutfit.comhttp://www.classoutfit.com

  On 27 Apr 2011, at 22:51, jackgoh wrote:

  Hi cricket,

  The $this-Stock-id is set correctly. And the SQL is working
  perfectly, i can get the correct number of records (which 3 of them:
  4, 7, 14)

  On Apr 27, 1:53 am, cricket zijn.digi...@gmail.com wrote:
  Is $this-Stock-id set to something? What does the SQL look like? Set
  debug to 2 to see it.

  On Mon, Apr 25, 2011 at 1:25 PM, jackgoh kockh...@gmail.com wrote:
  Hi,

  I am facing some problem when deal with a realtionship tables, the
  record is not display :

  // in Stock model:
         var $hasAndBelongsToMany = array(
                 'Category' = array(
                         'className' = 'Category',
                         'joinTable' = 'category',
              

Re: David Persson - Media Plugin - Handing .docx and .xlsx uploads

2011-04-28 Thread designv...@gmail.com
As to be expected, work's like a charm!

Many thanks David for the fix and the plugin.

d//t

On Apr 27, 11:55 pm, David Persson nper...@gmx.de wrote:
 Hey,

 I think this commit will fix the issues with the mapping between MIME-type
 and 
 name.https://github.com/davidpersson/mm/commit/707ab2cd6b9452403cd56fd4aac...

 The fix has also been already propagated to the media plugin. In case it
 doesn't work for you please open an issue 
 here:https://github.com/davidpersson/media/issues
 or therehttps://github.com/davidpersson/mm/issues

 - David

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Problem with Variables in Elements

2011-04-28 Thread Santiago Basulto
Hello People,

i'm using CakePHP 1.3.5.

When i pass a variable to an element, as the book says
(http://book.cakephp.org/view/1081/Elements) i can't use it, i get
this error message: Notice (8): Undefined variable: variable
[APP/views/elements/header.ctp, line 2]

Here's my code:
In the layout:
?php echo $this-element('header',array('variable'='value')); ?
In the element (here's where te error arises):
?php debug($variable); ?Notice (8): Undefined variable:
variable [APP/views/elements/header.ctp, line 2]

What's going on? I've disabled all cache but still doesn't work.

-- 
Santiago Basulto.-

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


an appointment system...

2011-04-28 Thread Tan Cheng
Hi folks,

My boss ask me to create an appointment system, basically, I need a
calendar that I can add events, and maybe a message system.

I haven't found any good plug-in for this. So anybody has any related
experience doing this with php? Where should I start looking at?

Any input will be greatly appreciated!

Thank you!

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: an appointment system...

2011-04-28 Thread Tran Cao Thai
i used to play around with full calendar (a plugin of jquery) when doing my
bachelor. It is good, but we still had to configure a lot (3000 lines of
javascript). In my  opinion, building everything from scratch is a lot
better than trying to hack some complex systems. So if you still have time,
build your own

On Thu, Apr 28, 2011 at 11:04 PM, Tan Cheng davidtan...@gmail.com wrote:

 Hi folks,

 My boss ask me to create an appointment system, basically, I need a
 calendar that I can add events, and maybe a message system.

 I haven't found any good plug-in for this. So anybody has any related
 experience doing this with php? Where should I start looking at?

 Any input will be greatly appreciated!

 Thank you!

 --
 Our newest site for the community: CakePHP Video Tutorials
 http://tv.cakephp.org
 Check out the new CakePHP Questions site http://ask.cakephp.org and help
 others with their CakePHP related questions.


 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group
 at http://groups.google.com/group/cake-php


-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


I need an availability calendar...

2011-04-28 Thread netusco
Had anyone implemented any in their websites?

any suggestions?

I need some users to set up their availabilities, then other users can book 
them if they are free..

thanks!

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: do i need to create a controller for all pages in \views\pages\ folder

2011-04-28 Thread varai
Yes, I had already gone through the Blog tutorial. But that doesn't
have a static page (just to display info). What I'm trying to do is
similar to contents of about page.

I tried creating a missing_controller.ctp with no contents as below:
?php
class Missing_Controller extends AppController {
}
?
and i'm not getting any errors now.

thanks. :)

On Apr 27, 3:24 pm, Jeremy Burns | Class Outfit
jeremybu...@classoutfit.com wrote:
 You really need to read the guide...what are you are doing is not utilising 
 Cake at all. Follow the Blog tutorial:http://book.cakephp.org/view/1528/Blog

 Jeremy Burns
 Class Outfit

 jeremybu...@classoutfit.comhttp://www.classoutfit.com

 On 27 Apr 2011, at 08:21, varai wrote:



  Hi,

  Is it necessary to create a controller for each page in \views\pages\
  folder?

  I have this static page Preschool.html. And I'm getting the following
  error message:
  Missing Controller
  Error: Preschool.htmlController could not be found.

  Error: Create the class Preschool.htmlController below in file:
  merry_flowers\controllers\preschool.html_controller.php

  ?php
  class Preschool.htmlController extends AppController {

     var $name = 'Preschool.html';
  }
  ?
  Notice: If you want to customize this error message, create
  merry_flowers\views\errors\missing_controller.ctp

  Even after creating a controller with the above name and contents, i'm
  still getting the same Missing Controller message.

  As the notice says, if I create missing_controller.ctp, what should
  the contents be?

  Please help me. I'm cluelessI'm new to cakephp.

  thank you.

  --
  Our newest site for the community: CakePHP Video 
  Tutorialshttp://tv.cakephp.org
  Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help 
  others with their CakePHP related questions.

  To unsubscribe from this group, send email to
  cake-php+unsubscr...@googlegroups.com For more options, visit this group 
  athttp://groups.google.com/group/cake-php- Hide quoted text -

 - Show quoted text -

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: how to embed swf animation in home.ctp of my cakephp project

2011-04-28 Thread varai
Hi

Not working means no flash animation is displaying.

 Can you access main_ani.swf directly in your web browser?
Yes, I can.

 I haven't read that tutorial, but I just skimmed it, and it doesn't say to 
 call $this-renderSwf; it says to call $flash-renderSwf.
Yes, I had tried $flash-renderSwf earlier, But i got the following
error:
Notice (8): Undefined variable: flash [APP\views\pages\home.ctp, line
26]Code | Context/object--
?php
echo $flash-renderSwf('main_ani.swf',530,300,'content1');
$___viewFn  =   C:\wamp\www\merry_flowers\views\pages\home.ctp
$___dataForView =   array(
page = home,
subpage = null,
title_for_layout = Home
)
$loadHelpers=   true
$cached =   false
$form   =   FormHelper
FormHelper::$helpers = array
FormHelper::$fieldset = array
FormHelper::$__options = array
FormHelper::$fields = array
FormHelper::$requestType = NULL
FormHelper::$defaultModel = NULL
FormHelper::$_inputDefaults = array
FormHelper::$base = /merry_flowers
FormHelper::$webroot = /merry_flowers/
FormHelper::$theme = NULL
FormHelper::$here = /merry_flowers/
FormHelper::$params = array
FormHelper::$action = display
FormHelper::$plugin = NULL
FormHelper::$data = NULL
FormHelper::$namedArgs = NULL
FormHelper::$argSeparator = NULL
FormHelper::$validationErrors = NULL
FormHelper::$tags = array
FormHelper::$__tainted = NULL
FormHelper::$__cleaned = NULL
FormHelper::$Html = HtmlHelper object
$html   =   HtmlHelper
HtmlHelper::$tags = array
HtmlHelper::$_crumbs = array
HtmlHelper::$__includedScripts = array
HtmlHelper::$_scriptBlockOptions = array
HtmlHelper::$__docTypes = array
HtmlHelper::$helpers = NULL
HtmlHelper::$base = /merry_flowers
HtmlHelper::$webroot = /merry_flowers/
HtmlHelper::$theme = NULL
HtmlHelper::$here = /merry_flowers/
HtmlHelper::$params = array
HtmlHelper::$action = display
HtmlHelper::$plugin = NULL
HtmlHelper::$data = NULL
HtmlHelper::$namedArgs = NULL
HtmlHelper::$argSeparator = NULL
HtmlHelper::$validationErrors = NULL
HtmlHelper::$__tainted = NULL
HtmlHelper::$__cleaned = NULL
$session=   SessionHelper
SessionHelper::$helpers = array
SessionHelper::$__active = true
SessionHelper::$valid = false
SessionHelper::$error = false
SessionHelper::$_userAgent = af68519437971d9fba6217ccb9c690fc
SessionHelper::$path = /
SessionHelper::$lastError = NULL
SessionHelper::$security = medium
SessionHelper::$time = 1304005613
SessionHelper::$sessionTime = 1304017613
SessionHelper::$cookieLifeTime = false
SessionHelper::$watchKeys = array
SessionHelper::$id = NULL
SessionHelper::$host = NULL
SessionHelper::$timeout = NULL
SessionHelper::$base = /merry_flowers
SessionHelper::$webroot = /merry_flowers/
SessionHelper::$here = /merry_flowers/
SessionHelper::$params = array
SessionHelper::$action = display
SessionHelper::$data = NULL
SessionHelper::$theme = NULL
SessionHelper::$plugin = NULL
$page   =   home
$subpage=   null
$title_for_layout   =   Homeinclude - APP\views\pages\home.ctp, line 
26
View::_render() - CORE\cake\libs\view\view.php, line 731
View::render() - CORE\cake\libs\view\view.php, line 426
Controller::render() - CORE\cake\libs\controller\controller.php, line
909
PagesController::display() - APP\controllers\pages_controller.php,
line 82
Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 204
Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 171
[main] - APP\webroot\index.php, line 83
Fatal error: Call to a member function renderSwf() on a non-object in
C:\wamp\www\merry_flowers\views\pages\home.ctp on line 26

any help is appreciated! :)


On Apr 27, 8:19 pm, Ryan Schmidt google-2...@ryandesign.com wrote:
 On Apr 26, 2011, at 20:52,varaiwrote:

  Does anyone know on how to embed an swf file in myfolder/views/pages/
  home.ctp?

  I tried the following embed stmt and it is not working:
  div id=content1
  object classid=clsid:D27CDB6E-AE6D-11cf-96B8-44455354
  codebase=http://download.macromedia.com/pub/shockwave/cabs/flash/
  swflash.cab#version=7,0,19,0 width=550 height=300
  title=introductory animation
     param name=movie value=main_ani.swf /
     param name=quality value=high /
     embed src=main_ani.swf width=550 height=300 quality=high
  pluginspage=http://www.macromedia.com/go/getflashplayer;
  type=application/x-shockwave-flash/embed
  /object/div

 Define not working.

 Can you access main_ani.swf directly in your web browser?

  I also tried the following after reading
 http://bakery.cakephp.org/articles/alkemann/2008/11/25/flashhelper-a-...
  ?php echo $this-renderSwf('main_ani.swf',530,300,'content1'); ?

  and I'm getting the error below
  Fatal error: Call to undefined method View::renderSwf() in C:\wamp\www
  \merry_flowers\views\pages\home.ctp on line 25

  I couldn't find the renderSwf helper as stated in the link above in C:
  \wamp\www\cakephp\cake\libs\view\helpers

 I haven't read that tutorial, but I just skimmed it, and it doesn't say to 
 call $this-renderSwf; it says to call 

Re: do i need to create a controller for all pages in \views\pages\ folder

2011-04-28 Thread Jeremy Burns | Class Outfit
Really wrong. Please read the guide, even if the Blog tutorial isn't right for 
you. Start here: http://book.cakephp.org/view/958/The-Pages-Controller. What 
you are trying to do is one of the most basic things and you are way off line.

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 28 Apr 2011, at 16:42, varai wrote:

 Yes, I had already gone through the Blog tutorial. But that doesn't
 have a static page (just to display info). What I'm trying to do is
 similar to contents of about page.
 
 I tried creating a missing_controller.ctp with no contents as below:
 ?php
 class Missing_Controller extends AppController {
 }
 ?
 and i'm not getting any errors now.
 
 thanks. :)
 
 On Apr 27, 3:24 pm, Jeremy Burns | Class Outfit
 jeremybu...@classoutfit.com wrote:
 You really need to read the guide...what are you are doing is not utilising 
 Cake at all. Follow the Blog tutorial:http://book.cakephp.org/view/1528/Blog
 
 Jeremy Burns
 Class Outfit
 
 jeremybu...@classoutfit.comhttp://www.classoutfit.com
 
 On 27 Apr 2011, at 08:21, varai wrote:
 
 
 
 Hi,
 
 Is it necessary to create a controller for each page in \views\pages\
 folder?
 
 I have this static page Preschool.html. And I'm getting the following
 error message:
 Missing Controller
 Error: Preschool.htmlController could not be found.
 
 Error: Create the class Preschool.htmlController below in file:
 merry_flowers\controllers\preschool.html_controller.php
 
 ?php
 class Preschool.htmlController extends AppController {
 
var $name = 'Preschool.html';
 }
 ?
 Notice: If you want to customize this error message, create
 merry_flowers\views\errors\missing_controller.ctp
 
 Even after creating a controller with the above name and contents, i'm
 still getting the same Missing Controller message.
 
 As the notice says, if I create missing_controller.ctp, what should
 the contents be?
 
 Please help me. I'm cluelessI'm new to cakephp.
 
 thank you.
 
 --
 Our newest site for the community: CakePHP Video 
 Tutorialshttp://tv.cakephp.org
 Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help 
 others with their CakePHP related questions.
 
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group 
 athttp://groups.google.com/group/cake-php- Hide quoted text -
 
 - Show quoted text -
 
 -- 
 Our newest site for the community: CakePHP Video Tutorials 
 http://tv.cakephp.org 
 Check out the new CakePHP Questions site http://ask.cakephp.org and help 
 others with their CakePHP related questions.
 
 
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Some problem on the hasmany relationship

2011-04-28 Thread jackgoh
Hi Jeremy,
U r right!!! it works!!  THANKS!
the solution: find('list',
array( 'fields'=array('business_category_id',
'business_category_id'),);

But i m not able to save the record to this table, CategoryStock.
I did try save(), saveAll(), UpdateAll()...
if i split to : $this-Stock-CategotyStock-save($this-data), i will
get error message:

Undefined index: StockCategory. Why?

Thanks again.

Regards.

On Apr 28, 7:26 pm, jackgoh kockh...@gmail.com wrote:
 ahh.. okay, let me try then.

 Thanks.

 Regards

 On Apr 28, 7:00 pm, Jeremy Burns | Class Outfit



 jeremybu...@classoutfit.com wrote:
  That's probably because the first value is the array key and you can't have 
  duplicate array keys (your desired result is impossible in PHP). Imagine it 
  as a select list; each option would have the same value (1), which defeats 
  the object. Cake is (in essence) simply doing a loop, adding each value it 
  finds to the resulting array and that will always replace the last value 
  found (it's always array key '1'); hence you end up with the 'last' record. 
  Would it work for you to switch the columns around? That would give you the 
  three values you need.

  Jeremy Burns
  Class Outfit

  jeremybu...@classoutfit.comhttp://www.classoutfit.com

  On 28 Apr 2011, at 11:13,jackgohwrote:

   When use find('list',), it is:
   Array
   (
      [1] = 4
   )

   But the result suppose is :

   Array
   (
      [1] = 7
      [1] = 14
      [1] = 4
   )

   It is always get the last record.

   Thanks

   On Apr 28, 3:14 pm, Jeremy Burns | Class Outfit
   jeremybu...@classoutfit.com wrote:
   What are the results of find list?

   Jeremy Burns
   Class Outfit

   jeremybu...@classoutfit.comhttp://www.classoutfit.com

   On 28 Apr 2011, at 07:19,jackgohwrote:

   Hi Jeremy,

   - There is a missing ' before category_id after
   'associationForeignKey'
   = sorry, my typo in this content only. sorry.

   - Your conditions in the find-list look wrong; try 'conditions' =
   array('stock_id' = $this-Stock-id)
   = The results are the same. both ways are working, but your
   suggestion way is better. ;)

   - The convention is to name your joining table CategoryStock (the two
   models are in alphabetical order). Although your arrangement ought to
   work, I generally stay with conventions unless there is a compelling
   reason not to.
   = I changed it as what you suggested. (in Stock model  StockCategory
   model)

   - Do you have a model for StockCategory?
   = Yes:
   class CategoryStock extends AppModel
   {
      var $name = CategoryStocks;
   }

   - What happens when you use find 'all' rather than 'list'?
   = i got the correct array!!  But the result look like:
   Array
   (
      [0] = Array
          (
              [CategoryStock] = Array
                  (
                      [stock_id] = 1
                      [business_category_id] = 4
                  )

          )

      [1] = Array
          (
              [CategoryStock] = Array
                  (
                      [stock_id] = 1
                      [business_category_id] = 7
                  )

          )
      [2] = Array
          (
              [CategoryStock] = Array
                  (
                      [stock_id] = 1
                      [business_category_id] = 14
                  )

          )

   )

   - What happens when you die(debug($selectedRecord)) in your controller
   before passing it to your view?
   = same as above result.

   Out of interest, what does the resulting SQL look like?
   = (i simplified) :SELECT CategoryStock.* FROM `stock_CategoryStocks`
   AS `CategoryStock` WHERE `stock_id` = 1 , effected rows is 3 , which
   is always correct, when use the find('list'), the effected rows is
   still 3, but debug($selectedRecord) show only 1 record in the array.
   Weird.

   Thanks.

   Regards
   Jack

   On Apr 28, 12:03 pm, Jeremy Burns | Class Outfit
   jeremybu...@classoutfit.com wrote:
   These might be typos but some of the code looks *slightly* odd.

   - There is a missing ' before category_id after 'associationForeignKey'
   - Your conditions in the find-list look wrong; try 'conditions' = 
   array('stock_id' = $this-Stock-id)
   - The convention is to name your joining table CategoryStock (the two 
   models are in alphabetical order). Although your arrangement ought to 
   work, I generally stay with conventions unless there is a compelling 
   reason not to.
   - Do you have a model for StockCategory?
   - What happens when you use find 'all' rather than 'list'?
   - What happens when you die(debug($selectedRecord)) in your controller 
   before passing it to your view?

   Out of interest, what does the resulting SQL look like?

   Jeremy Burns
   Class Outfit

   jeremybu...@classoutfit.comhttp://www.classoutfit.com

   On 27 Apr 2011, at 22:51,jackgohwrote:

   Hi cricket,

   The $this-Stock-id is set correctly. And the SQL is working
   perfectly, i can get the correct number of 

Query with conditions in HABTM models

2011-04-28 Thread david hc
Hello,
I have a table posts related with table categories with de habtm table
posts_categories.

posts.id
categories.id
posts_categories.post_id
posts_categories.category_id

I'm trying to get all the records WITHOUT category (because I have
posts taken from RSS and not categorized yet).

My model Post has the habtm array, and it works fine (I get all the
posts with there categories when I find all).

My question is how could I get all the records in posts table that are
not included in related table. Any idea?

All my attempts (conditions, contain...) are wrong :(

Thank you very much!
David.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: an appointment system...

2011-04-28 Thread Miloš Vučinić
Why don't you just use google calendar or some other management
support software ? Comparing to what he has to pay you to do it, plus
the time you will not be working on something useful it pays off.

On Apr 28, 5:14 pm, Tran Cao Thai jasonvoorhees...@gmail.com wrote:
 i used to play around with full calendar (a plugin of jquery) when doing my
 bachelor. It is good, but we still had to configure a lot (3000 lines of
 javascript). In my  opinion, building everything from scratch is a lot
 better than trying to hack some complex systems. So if you still have time,
 build your own







 On Thu, Apr 28, 2011 at 11:04 PM, Tan Cheng davidtan...@gmail.com wrote:
  Hi folks,

  My boss ask me to create an appointment system, basically, I need a
  calendar that I can add events, and maybe a message system.

  I haven't found any good plug-in for this. So anybody has any related
  experience doing this with php? Where should I start looking at?

  Any input will be greatly appreciated!

  Thank you!

  --
  Our newest site for the community: CakePHP Video Tutorials
 http://tv.cakephp.org
  Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
  others with their CakePHP related questions.

  To unsubscribe from this group, send email to
  cake-php+unsubscr...@googlegroups.com For more options, visit this group
  athttp://groups.google.com/group/cake-php

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Cake 1.2 problem with XML files in plugin vendors folder

2011-04-28 Thread lsenft
I would like to load an XML file from a plugin vendors folder.  I get
the following error:

Error: myfile.xmlController could not be found.

Is there a way to serve xml files from a plugin's vendors folder?

Thank you,

Levi

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Security Blackholing actions I didn't specify

2011-04-28 Thread DragonFlyEye
Ok, in the app_controller, I've included my Security component and also 
added this little snippet of code for admin pages:
if(isset($this-params['admin'])) :
$this-Security-blackHoleCallback = 'forceSSL';
$this-Security-requireSecure();
endif;

That one's straight outta the book and as far as i can tell, working fine. I 
just add that here on the off chance I'm missing something.

In my carts controller (for shopping carts) I want to be able to secure 
the checkout action, only. Hence I've set up this beforeFilter:
function beforeFilter() {
parent::beforeFilter();
$this-Security-requireSecure('checkout');
$this-Security-blackHoleCallback = 'forceSSL';
}

The problem is that, when I do this, my add action (as in adding an item to 
the cart) is getting redirected per the forceSSL function (which also comes 
from the book, for reference).

More confusing, when I simply strip the bottom two lines of my beforeFilter 
away (thus, I presume, eliminating the effects of the Security component), I 
get a 404 error on the action.

Thanks for your time!

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Calling an element based on row selection

2011-04-28 Thread cricket
On Thu, Apr 28, 2011 at 6:06 AM, heohni
heidi.anselstet...@consultingteam.de wrote:
 Hi,

 My idea is to have a list of database data listed in a table, one row
 per member data details.
 Each member has a link to open a popup (I am using a basic modal
 jquery script). In this popup I would like to have a comment field to
 add comments regarding the selected client.

 I am not sure how to do that.
 How can I call the popup with the comment field, which is outsourced
 in a element, and parse the member id to it?

 Guess I have a table like
 ...
 tdmemberid 1/tdtdecho $this-Html-link(__('leave a comment',
 true),?/td
 /trtr
 tdmemberid 2/tdtdecho $this-Html-link(__('leave a comment',
 true),?/td
 /trtr
 tdmemberid 3/tdtdecho $this-Html-link(__('leave a comment',
 true),?/td

 My element looks like
 div id=popup
 ?php echo $this-Ajax-Form('comment', 'post', array('url' =
 array('action' = 'comment'))); ?
 input type=hidden id=memberID value=
 ...
 tdtextarea cols=10 rows=5 name=comment/textarea/td
 
 ?php echo $this-Ajax-Form-end(); ?
 /div


I think the best way to handle this is to pass the ID through the
click handler that opens the pop-up, as it's the routine that connects
a Member record row with the form.

BTW, I recommend you use buttons instead of links for this as they're
better suited to the job.
http://particletree.com/features/rediscovering-the-button-element/

Essentially, what you want to do is assign a unique id attribute to
some tag (or rel if it's the right type for that) in each row that's
based on the Member.id. This could be the tr, the td, the a, input, or
button. Because IDs can't begin with a number you'll need to supply
some prefix and then parse out the id.

button id=member_437.../button ...
button id=member_438.../button ...

JS:

var member_id = $(this).attr('id').replace(/member_/, '');

The above is for when the id has been given to the button or link
itself. If you apply it instead to the table row (perhaps you have
several buttons per row which handle various tasks) you'd do something
like:

var member_id = $(this).closest('tr').attr('id').replace(/member_/, '');

Once you have the id you can then apply it to the hidden form element.

$('#memberID', $('#popup')).val(member_id);

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: an appointment system...

2011-04-28 Thread Tan Cheng
Thank you. I will take a look into that, the full calendar looks
pretty good.

On Apr 28, 11:14 am, Tran Cao Thai jasonvoorhees...@gmail.com wrote:
 i used to play around with full calendar (a plugin of jquery) when doing my
 bachelor. It is good, but we still had to configure a lot (3000 lines of
 javascript). In my  opinion, building everything from scratch is a lot
 better than trying to hack some complex systems. So if you still have time,
 build your own



 On Thu, Apr 28, 2011 at 11:04 PM, Tan Cheng davidtan...@gmail.com wrote:
  Hi folks,

  My boss ask me to create an appointment system, basically, I need a
  calendar that I can add events, and maybe a message system.

  I haven't found any good plug-in for this. So anybody has any related
  experience doing this with php? Where should I start looking at?

  Any input will be greatly appreciated!

  Thank you!

  --
  Our newest site for the community: CakePHP Video Tutorials
 http://tv.cakephp.org
  Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
  others with their CakePHP related questions.

  To unsubscribe from this group, send email to
  cake-php+unsubscr...@googlegroups.com For more options, visit this group
  athttp://groups.google.com/group/cake-php- Hide quoted text -

 - Show quoted text -

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: an appointment system...

2011-04-28 Thread Tan Cheng
It's a good point, man. But we are trying to integrate this into
another web app we developed before and share the same users table.
Thanks for your input.

On Apr 28, 12:37 pm, Miloš Vučinić milosvuci...@gmail.com wrote:
 Why don't you just use google calendar or some other management
 support software ? Comparing to what he has to pay you to do it, plus
 the time you will not be working on something useful it pays off.

 On Apr 28, 5:14 pm, Tran Cao Thai jasonvoorhees...@gmail.com wrote:



  i used to play around with full calendar (a plugin of jquery) when doing my
  bachelor. It is good, but we still had to configure a lot (3000 lines of
  javascript). In my  opinion, building everything from scratch is a lot
  better than trying to hack some complex systems. So if you still have time,
  build your own

  On Thu, Apr 28, 2011 at 11:04 PM, Tan Cheng davidtan...@gmail.com wrote:
   Hi folks,

   My boss ask me to create an appointment system, basically, I need a
   calendar that I can add events, and maybe a message system.

   I haven't found any good plug-in for this. So anybody has any related
   experience doing this with php? Where should I start looking at?

   Any input will be greatly appreciated!

   Thank you!

   --
   Our newest site for the community: CakePHP Video Tutorials
  http://tv.cakephp.org
   Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp
   others with their CakePHP related questions.

   To unsubscribe from this group, send email to
   cake-php+unsubscr...@googlegroups.com For more options, visit this group
   athttp://groups.google.com/group/cake-php- Hide quoted text -

 - Show quoted text -

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Validate from within a model

2011-04-28 Thread Miles J
Why don't you just validate that the destination folder exists and is
writable?

On Apr 28, 2:57 am, func0der funco...@live.com wrote:
 Okay.

 I'm doing it like this.

 I'm havin a new file uploaded.
 The file data, like mime type, name etc. will be saved in the db under
 the file id.
 I'm using that id as a filename for the files in my filesystem.
 So i need to first create a db record to use the id.

 Afterwards i'm trying to save the file.
 If for example the folder for the upload is not writable or i don't
 have the permission or any other case i can't figure out now happens,
 then i want to cancel the upload and delete the db record so i won't
 have 2 or more of the same file in the database.

 This user is getting an error message that something fails during the
 file upload and also i want to let the users know what they are
 supposed to do next.

 This is my intention.

 And i would never validate file uploads with javascripts because of 2
 reasons:
 First, i don't know how
 Second, i know enough to know that this kind of validation wouldn't be
 save enough ^^

 Nothing against you, but js alone isn't the key.

 On 27 Apr., 23:54, Miles J mileswjohn...@gmail.com wrote:







  You dont need to use validates(), just set an error manually.

  $this-invalidate('fields', 'Error message.');

  Also, your approach is still wrong IMO. You should be doing all error
  checking before any save functionality is triggered. In what scenario
  will the image NOT copy/transfer? I have yet to ever run into that
  problem.

  On Apr 27, 12:31 pm, func0der funco...@live.com wrote:

   okay...i think i got it.

   It is part of the MVC pattern, isn't it?

   The model is NOT connected to the view or the helpers. These two are
   getting their data or the invalid error messages by the controller.

   Am i right here?

   On 27 Apr., 21:00, func0der funco...@live.com wrote:

I can re-save and delete, so why i shouldn't be able to revalidate?

The error message is also in the validationErrors variable but while
the output of the form there is no error message.
But why?

On 27 Apr., 20:38, Miles J mileswjohn...@gmail.com wrote:

 You can't validates() something after the model save has already
 happened. Use a behavior for validation or use my plugin.

https://github.com/milesj/cake-uploader

 And an example model on how to use it.

https://github.com/milesj/cake-uploader/blob/master/tests/models/uplo...

 On Apr 27, 11:18 am, func0der funco...@live.com wrote:

  Hey guys,

  i'm having a file upload here.
  I'm using afterSave to place the uploaded file in the filesystem.

          function afterSave($created){
                  //get the entry id
                  $this-data['DataFile']['id'] = 
  $this-getInsertId();
                  if(!$this-saveDataFile($this-data)){
                          
  $this-delete($this-data['DataFile']['id']);
                          $this-data['DataFile']['data_file'] = 
  array();
                          $this-validates();
                  }
          }

  saveDataFile is a function which tries to places the uploaded file
  in the file system and returns false in case of copy fails.

  If the copy should fail i delete the record from the database and 
  set
  the data_file index which normally cotains the uploaded file
  information to an empty array. This is because i want the validation
  to fail so the file upload field gets an error message while
  rendering.

  The problem now is that the upload form does NOT! contain the
  validation error message for that particular field.

  Do you know what i am doing wrong?

  Greetings
  func0der

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Validate from within a model

2011-04-28 Thread func0der
Can you explain that a bit more precise.

On Apr 28, 7:59 pm, Miles J mileswjohn...@gmail.com wrote:
 Why don't you just validate that the destination folder exists and is
 writable?

 On Apr 28, 2:57 am, func0der funco...@live.com wrote:







  Okay.

  I'm doing it like this.

  I'm havin a new file uploaded.
  The file data, like mime type, name etc. will be saved in the db under
  the file id.
  I'm using that id as a filename for the files in my filesystem.
  So i need to first create a db record to use the id.

  Afterwards i'm trying to save the file.
  If for example the folder for the upload is not writable or i don't
  have the permission or any other case i can't figure out now happens,
  then i want to cancel the upload and delete the db record so i won't
  have 2 or more of the same file in the database.

  This user is getting an error message that something fails during the
  file upload and also i want to let the users know what they are
  supposed to do next.

  This is my intention.

  And i would never validate file uploads with javascripts because of 2
  reasons:
  First, i don't know how
  Second, i know enough to know that this kind of validation wouldn't be
  save enough ^^

  Nothing against you, but js alone isn't the key.

  On 27 Apr., 23:54, Miles J mileswjohn...@gmail.com wrote:

   You dont need to use validates(), just set an error manually.

   $this-invalidate('fields', 'Error message.');

   Also, your approach is still wrong IMO. You should be doing all error
   checking before any save functionality is triggered. In what scenario
   will the image NOT copy/transfer? I have yet to ever run into that
   problem.

   On Apr 27, 12:31 pm, func0der funco...@live.com wrote:

okay...i think i got it.

It is part of the MVC pattern, isn't it?

The model is NOT connected to the view or the helpers. These two are
getting their data or the invalid error messages by the controller.

Am i right here?

On 27 Apr., 21:00, func0der funco...@live.com wrote:

 I can re-save and delete, so why i shouldn't be able to revalidate?

 The error message is also in the validationErrors variable but while
 the output of the form there is no error message.
 But why?

 On 27 Apr., 20:38, Miles J mileswjohn...@gmail.com wrote:

  You can't validates() something after the model save has already
  happened. Use a behavior for validation or use my plugin.

 https://github.com/milesj/cake-uploader

  And an example model on how to use it.

 https://github.com/milesj/cake-uploader/blob/master/tests/models/uplo...

  On Apr 27, 11:18 am, func0der funco...@live.com wrote:

   Hey guys,

   i'm having a file upload here.
   I'm using afterSave to place the uploaded file in the 
   filesystem.

           function afterSave($created){
                   //get the entry id
                   $this-data['DataFile']['id'] = 
   $this-getInsertId();
                   if(!$this-saveDataFile($this-data)){
                           
   $this-delete($this-data['DataFile']['id']);
                           $this-data['DataFile']['data_file'] = 
   array();
                           $this-validates();
                   }
           }

   saveDataFile is a function which tries to places the uploaded 
   file
   in the file system and returns false in case of copy fails.

   If the copy should fail i delete the record from the database and 
   set
   the data_file index which normally cotains the uploaded file
   information to an empty array. This is because i want the 
   validation
   to fail so the file upload field gets an error message while
   rendering.

   The problem now is that the upload form does NOT! contain the
   validation error message for that particular field.

   Do you know what i am doing wrong?

   Greetings
   func0der

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Mysql 1064 error

2011-04-28 Thread cricket
On Wed, Apr 27, 2011 at 3:28 PM, blue_negative james.dcu...@gmail.com wrote:
 Hi,

 I am using Cake 1.3.8 and get a Mysql error code 1064. Following is
 the details in debug mode
 Query: check
 Error: 1064: You have an error in your SQL syntax; check the manual
 that corresponds to your MySQL server version for the right syntax to
 use near '' at line 1

 The associated mode has following relationships:
 4 hasMany
 1 belongsTo
 1 HBTM

 Its seems that the it is generating a sql query Check and hence it
 is throwing the error. The interesting part is it does not generate
 this check: query for my other mode.

Can't say for sure as you haven't posted either the code or the SQL,
but this usually happens when you call a nonexistant method of the
model, eg.
$this-YourModel-check()

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


xml parser now what

2011-04-28 Thread Janu
Hi

I am getting different xmls and after parsing I want them to be pushed
to database. Is there an easy way to accomplish that. Is there a
database to xml mapping tool available for cakephp.
thanks

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Problem with Variables in Elements

2011-04-28 Thread cricket
On Thu, Apr 28, 2011 at 10:10 AM, Santiago Basulto
santiago.basu...@gmail.com wrote:
 Hello People,

 i'm using CakePHP 1.3.5.

 When i pass a variable to an element, as the book says
 (http://book.cakephp.org/view/1081/Elements) i can't use it, i get
 this error message: Notice (8): Undefined variable: variable
 [APP/views/elements/header.ctp, line 2]

 Here's my code:
    In the layout:
        ?php echo $this-element('header',array('variable'='value')); ?
    In the element (here's where te error arises):
        ?php debug($variable); ?Notice (8): Undefined variable:
 variable [APP/views/elements/header.ctp, line 2]

 What's going on? I've disabled all cache but still doesn't work.

Looks ok to me. Are you sure the spelling is good? Does the call to
this element occur in any other layouts? Maybe you're in a different
layout, which doesn't also have the variable assignment. Long shot, I
know.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Problem with Variables in Elements

2011-04-28 Thread cricket
On Thu, Apr 28, 2011 at 2:28 PM, cricket zijn.digi...@gmail.com wrote:

 Looks ok to me. Are you sure the spelling is good? Does the call to
 this element occur in any other layouts? Maybe you're in a different
 layout, which doesn't also have the variable assignment. Long shot, I
 know.


Also, try debug($this-viewVars);

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: how to embed swf animation in home.ctp of my cakephp project

2011-04-28 Thread cricket
On Thu, Apr 28, 2011 at 11:47 AM, varai vaanip...@gmail.com wrote:
 Hi

 Not working means no flash animation is displaying.

 Can you access main_ani.swf directly in your web browser?
 Yes, I can.

Using what path? Is the flash file sitting in app/webroot? Try:

/main_ani.swf

(note the slash)

Also, your markup gives the path for the embed tag but not the object.
You need to realise that embed and object are two different things.
Some browsers use one and some the other. The object tag requires
param tags inside it which have the same values as the attributes of
the embed tag. Notice that you  have not included the path to the
flash file for the object tag.

param name=src value=/main_ani.swf

 I haven't read that tutorial, but I just skimmed it, and it doesn't say to 
 call $this-renderSwf; it says to call $flash-renderSwf.
 Yes, I had tried $flash-renderSwf earlier, But i got the following
 error:
 Notice (8): Undefined variable: flash [APP\views\pages\home.ctp, line

That would suggest you haven't loaded the FlashHelper.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: do i need to create a controller for all pages in \views\pages\ folder

2011-04-28 Thread cricket
On Thu, Apr 28, 2011 at 11:49 AM, Jeremy Burns | Class Outfit
jeremybu...@classoutfit.com wrote:
 Really wrong. Please read the guide, even if the Blog tutorial isn't right
 for you. Start here: http://book.cakephp.org/view/958/The-Pages-Controller.
 What you are trying to do is one of the most basic things and you are way
 off line.

Although, granted, it's easy to see how it could be confusing.

varai, if you want to include static, full HTML pages put them under
app/webroot. You can even have a deep directory structure, eg

app/webroot/foo.bar.html

You would access this with:

http://www.domain.com/foo/bar.html

Take a close look at the rewrite rules in the .htaccess files. What
they do is check if the requested URL is for an existing file or
directory under app/webroot. If so, it serves that, other wise it
passes the request to index.php, which in turn passes it to
Dispatcher. It's the latter which is complaining that the request
doesn't make sense.

If you want your static pages to use an existing layout then you need
to change the static pages into templates. In that case, you'd use the
PagesController and put your various pages in the app/views/pages
directory.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: xml parser now what

2011-04-28 Thread cricket
On Thu, Apr 28, 2011 at 10:36 AM, Janu asimmee...@gmail.com wrote:
 Hi

 I am getting different xmls and after parsing I want them to be pushed
 to database. Is there an easy way to accomplish that. Is there a
 database to xml mapping tool available for cakephp.

You can turn the XML into an array but you'll need to do some work to
ensure the array structure matches your schema. See here:
http://blog.crazytje.be/xml-to-array-and-array-to-xml-in-cakephp/

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Query with conditions in HABTM models

2011-04-28 Thread cricket
On Thu, Apr 28, 2011 at 12:31 PM, david hc davi...@gmail.com wrote:
 Hello,
 I have a table posts related with table categories with de habtm table
 posts_categories.

 posts.id
 categories.id
 posts_categories.post_id
 posts_categories.category_id

 I'm trying to get all the records WITHOUT category (because I have
 posts taken from RSS and not categorized yet).

 My model Post has the habtm array, and it works fine (I get all the
 posts with there categories when I find all).

 My question is how could I get all the records in posts table that are
 not included in related table. Any idea?

Something like this should work.

public function uncategorized()
{
$this-set(
'data',
$this-Post-fetchOrphans()
);

$this-set(
'categories',
$this-Post-Category-find('list')
);
}

Post:
public function fetchOrphans()
{
$ids = Set::extract(
$this-PostCategory-find('all'),
'{n}.PostCategory.post_id'
);
return $this-find(
'all',
array(
'conditions' = array(
'NOT' = array(
'Post.id' = $ids
)
)
)
);
}

Not the most elegant code as it it relies on two queries
and--worse--uses IN, which isn't handled well by MySQL at least. But
it should do the job and, given the use case, it's not like this
method is going to be called constantly. I generally don't worry too
much about performance for these sorts of little-used admin functions
(within reason, of course).

Also, Cake's automagic joining puts the joined table names in
alphabetical order, so your table should be categories_posts and the
model CategoryPost. This isn't completely necessary if you've created
a model for the join but, in order to be sure you don't run into a
gotcha down the road, it may be worth following Cake's convention.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Cake 1.2 problem with XML files in plugin vendors folder

2011-04-28 Thread cricket
On Thu, Apr 28, 2011 at 12:30 PM, lsenft lse...@gmail.com wrote:
 I would like to load an XML file from a plugin vendors folder.  I get
 the following error:

 Error: myfile.xmlController could not be found.

 Is there a way to serve xml files from a plugin's vendors folder?

What's the code that leads to the error?

Some days, it's like every other person posting to this list assumes
everyone else can read minds.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Any way to pass multiple order string to Pagination

2011-04-28 Thread Mr.Jayesh
Hi Mates,

Am stuck at place where am not able to pass multiple order strings to
pagination. I am using pagination and have done this in my controller:

var $paginate = array(
'limit' = 15,
'order' = array(
'Model.field' = 'desc',
'Model.field' = 'desc')
);

But the results is just working the first string and ignoring the
second one.

Please, anyone guide me, I think have mistaken somewhere. Am unable to
get solution for this.

Regards.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Any way to pass multiple order string to Pagination

2011-04-28 Thread euromark
http://cakephp.lighthouseapp.com/projects/42648/tickets/325-adding-paginator-sort-to-order-by-two-fields
although it does not seem to be a duplicate of the other tickets - two
different things...

On 28 Apr., 21:45, Mr.Jayesh jayeshach...@gmail.com wrote:
 Hi Mates,

 Am stuck at place where am not able to pass multiple order strings to
 pagination. I am using pagination and have done this in my controller:

 var $paginate = array(
         'limit' = 15,
         'order' = array(
                         'Model.field' = 'desc',
                         'Model.field' = 'desc')
     );

 But the results is just working the first string and ignoring the
 second one.

 Please, anyone guide me, I think have mistaken somewhere. Am unable to
 get solution for this.

 Regards.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Any way to pass multiple order string to Pagination

2011-04-28 Thread euromark
'order' = array(
'Model.field' = 'desc',
'Model.field2' = 'desc')

should work, though


On 28 Apr., 21:47, euromark dereurom...@googlemail.com wrote:
 http://cakephp.lighthouseapp.com/projects/42648/tickets/325-adding-pa...
 although it does not seem to be a duplicate of the other tickets - two
 different things...

 On 28 Apr., 21:45, Mr.Jayesh jayeshach...@gmail.com wrote:







  Hi Mates,

  Am stuck at place where am not able to pass multiple order strings to
  pagination. I am using pagination and have done this in my controller:

  var $paginate = array(
          'limit' = 15,
          'order' = array(
                          'Model.field' = 'desc',
                          'Model.field' = 'desc')
      );

  But the results is just working the first string and ignoring the
  second one.

  Please, anyone guide me, I think have mistaken somewhere. Am unable to
  get solution for this.

  Regards.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Validate from within a model

2011-04-28 Thread cricket
On Thu, Apr 28, 2011 at 2:17 PM, func0der funco...@live.com wrote:
 Can you explain that a bit more precise.

http://php.net/manual/en/function.is-dir.php
http://www.php.net/manual/en/function.is-writable.php

I usually handle uploads on the controller/component side. Save your
model record, get the new ID, save the file, update the record. You
can leave out the initial save in some cases but you said that you're
using the id for the file name so you'd need 2 saves.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: an appointment system...

2011-04-28 Thread Chris
Well google does offer connectivity with it's data. You could do it
and still do what you want with the data.

On Apr 28, 2:01 pm, Tan Cheng davidtan...@gmail.com wrote:
 It's a good point, man. But we are trying to integrate this into
 another web app we developed before and share the same users table.
 Thanks for your input.

 On Apr 28, 12:37 pm, Miloš Vučinić milosvuci...@gmail.com wrote:







  Why don't you just use google calendar or some other management
  support software ? Comparing to what he has to pay you to do it, plus
  the time you will not be working on something useful it pays off.

  On Apr 28, 5:14 pm, Tran Cao Thai jasonvoorhees...@gmail.com wrote:

   i used to play around with full calendar (a plugin of jquery) when doing 
   my
   bachelor. It is good, but we still had to configure a lot (3000 lines of
   javascript). In my  opinion, building everything from scratch is a lot
   better than trying to hack some complex systems. So if you still have 
   time,
   build your own

   On Thu, Apr 28, 2011 at 11:04 PM, Tan Cheng davidtan...@gmail.com wrote:
Hi folks,

My boss ask me to create an appointment system, basically, I need a
calendar that I can add events, and maybe a message system.

I haven't found any good plug-in for this. So anybody has any related
experience doing this with php? Where should I start looking at?

Any input will be greatly appreciated!

Thank you!

--
Our newest site for the community: CakePHP Video Tutorials
   http://tv.cakephp.org
Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp
others with their CakePHP related questions.

To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group
athttp://groups.google.com/group/cake-php-Hide quoted text -

  - Show quoted text -

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: an appointment system...

2011-04-28 Thread Sergio
Tan,

Take a look at this note from  Derick Ng that may give a jumpstart to
your effort ;)

http://planetcakephp.org/aggregator/items/535-cakephp-calendar-helper

cheers,

Sergio

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: an appointment system...

2011-04-28 Thread Matt Murphy
I gotta agree.

On Thu, Apr 28, 2011 at 12:37 PM, Miloš Vučinić milosvuci...@gmail.comwrote:

 Why don't you just use google calendar or some other management
 support software ? Comparing to what he has to pay you to do it, plus
 the time you will not be working on something useful it pays off.

 On Apr 28, 5:14 pm, Tran Cao Thai jasonvoorhees...@gmail.com wrote:
  i used to play around with full calendar (a plugin of jquery) when doing
 my
  bachelor. It is good, but we still had to configure a lot (3000 lines of
  javascript). In my  opinion, building everything from scratch is a lot
  better than trying to hack some complex systems. So if you still have
 time,
  build your own
 
 
 
 
 
 
 
  On Thu, Apr 28, 2011 at 11:04 PM, Tan Cheng davidtan...@gmail.com
 wrote:
   Hi folks,
 
   My boss ask me to create an appointment system, basically, I need a
   calendar that I can add events, and maybe a message system.
 
   I haven't found any good plug-in for this. So anybody has any related
   experience doing this with php? Where should I start looking at?
 
   Any input will be greatly appreciated!
 
   Thank you!
 
   --
   Our newest site for the community: CakePHP Video Tutorials
  http://tv.cakephp.org
   Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
   others with their CakePHP related questions.
 
   To unsubscribe from this group, send email to
   cake-php+unsubscr...@googlegroups.com For more options, visit this
 group
   athttp://groups.google.com/group/cake-php

 --
 Our newest site for the community: CakePHP Video Tutorials
 http://tv.cakephp.org
 Check out the new CakePHP Questions site http://ask.cakephp.org and help
 others with their CakePHP related questions.


 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group
 at http://groups.google.com/group/cake-php


-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Custom Find sending back strange results

2011-04-28 Thread bradmaxs
All I want to do is have one find for my comments in each associated
model.  I would love to do this in the Comment model and only have to
do it once but that wasn't working out.

SHOW CONTROLLER

$this-paginate = array('comments', 'id' = $show['Show']['id'],
'model' = 'Show');
$comments = $this-paginate();
$this-set(compact('show', 'comments'));

SHOW MODEL

public $_findMethods = array('comments' = true);

public function _findComments($state, $query, $results=array()) {
if ($state == before) {
$query = $this-__getComments($query['id'], $query['model'],
$query);
return $query;
} else {
return $results;
}
}

private function __getComments($id, $model, $query) {
$query = ClassRegistry::init('Comment')-find('all', array(
'contain' = array(
'User'  = array(
'fields' = array('id', 'username', 
'slug'),
'Image'  = array(
'fields' = array('name')
)
)
),
'conditions' = array(
'Comment.typeID' = $id,
'Comment.model' = $model
),
'limit' = 5,
'order' =  array('Comment.created' = 'desc')
));
return $query;
}

RESULTS

This is the one I want:

SELECT `Comment`.`id`, `Comment`.`parent_id`, `Comment`.`user_id`,
`Comment`.`typeID`, `Comment`.`model`, `Comment`.`comment`,
`Comment`.`created`, `Comment`.`modified`, `User`.`id`,
`User`.`username`, `User`.`slug` FROM `comments` AS `Comment` LEFT
JOIN `users` AS `User` ON (`Comment`.`user_id` = `User`.`id`) WHERE
`Comment`.`typeID` = 2 AND `Comment`.`model` = 'Show' ORDER BY
`Comment`.`created` desc LIMIT 5

This is also on the sql log and it seems to be the one the view is
using:

SELECT `Comment`.`id`, `Comment`.`parent_id`, `Comment`.`user_id`,
`Comment`.`typeID`, `Comment`.`model`, `Comment`.`comment`,
`Comment`.`created`, `Comment`.`modified` FROM `comments` AS `Comment`
WHERE `Comment`.`typeID` IN (2, 3) ORDER BY `Comment`.`created` DESC

I don't even understand where it is coming from because I didn't
define it.

And I get these errors:

Notice (8): Undefined index: page [CORE/cake/libs/model/model.php,
line 2094]
Notice (8): Undefined index: order [CORE/cake/libs/model/model.php,
line 2100]
Notice (8): Undefined index: order [CORE/cake/libs/model/model.php,
line 2103]
Notice (8): Undefined index: callbacks [CORE/cake/libs/model/
model.php, line 2105]
Notice (8): Undefined index: callbacks [CORE/cake/libs/model/
model.php, line 2130]

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Validate from within a model

2011-04-28 Thread Miles J
You can also create the folders and make the writable before hand,
that way the file will always upload.

On Apr 28, 12:55 pm, cricket zijn.digi...@gmail.com wrote:
 On Thu, Apr 28, 2011 at 2:17 PM, func0der funco...@live.com wrote:
  Can you explain that a bit more precise.

 http://php.net/manual/en/function.is-dir.phphttp://www.php.net/manual/en/function.is-writable.php

 I usually handle uploads on the controller/component side. Save your
 model record, get the new ID, save the file, update the record. You
 can leave out the initial save in some cases but you said that you're
 using the id for the file name so you'd need 2 saves.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: an appointment system...

2011-04-28 Thread Ryan Snowden
I integrated a calendar plugin. Worked well. Had a few issues that still
exist but I'll post it up this weekend or later today.

On 29 April 2011 06:04, Matt Murphy mattyh...@gmail.com wrote:

 I gotta agree.


 On Thu, Apr 28, 2011 at 12:37 PM, Miloš Vučinić milosvuci...@gmail.comwrote:

 Why don't you just use google calendar or some other management
 support software ? Comparing to what he has to pay you to do it, plus
 the time you will not be working on something useful it pays off.

 On Apr 28, 5:14 pm, Tran Cao Thai jasonvoorhees...@gmail.com wrote:
  i used to play around with full calendar (a plugin of jquery) when doing
 my
  bachelor. It is good, but we still had to configure a lot (3000 lines of
  javascript). In my  opinion, building everything from scratch is a lot
  better than trying to hack some complex systems. So if you still have
 time,
  build your own
 
 
 
 
 
 
 
  On Thu, Apr 28, 2011 at 11:04 PM, Tan Cheng davidtan...@gmail.com
 wrote:
   Hi folks,
 
   My boss ask me to create an appointment system, basically, I need a
   calendar that I can add events, and maybe a message system.
 
   I haven't found any good plug-in for this. So anybody has any related
   experience doing this with php? Where should I start looking at?
 
   Any input will be greatly appreciated!
 
   Thank you!
 
   --
   Our newest site for the community: CakePHP Video Tutorials
  http://tv.cakephp.org
   Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
   others with their CakePHP related questions.
 
   To unsubscribe from this group, send email to
   cake-php+unsubscr...@googlegroups.com For more options, visit this
 group
   athttp://groups.google.com/group/cake-php

 --
 Our newest site for the community: CakePHP Video Tutorials
 http://tv.cakephp.org
 Check out the new CakePHP Questions site http://ask.cakephp.org and help
 others with their CakePHP related questions.


 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group
 at http://groups.google.com/group/cake-php


  --
 Our newest site for the community: CakePHP Video Tutorials
 http://tv.cakephp.org
 Check out the new CakePHP Questions site http://ask.cakephp.org and help
 others with their CakePHP related questions.


 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group
 at http://groups.google.com/group/cake-php


-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Form Validation

2011-04-28 Thread Sanfly
Hi

My cake version is 1.3.7

I'm just learning form validation and am having a few issues.

Firstly, the manual is crap in that it doesn't tell you how to
implement the validation in your model, and it doesn't tell you how to
show the validation error messages in your view.  Took a lot of
digging to find all that!

Anyway, on the the problem at hand.  I thought I had this working on
one field, went to implement for the rest of my fields and now it is
always validating the form even when I have deliberately used inputs
that should fail validation.  I have stripped it back down to one
field to try and get it working again

In my model: user.php

// VALIDATION
var $validate = array(
'first_name' = 'notEmpty'

);

In my controller:

function add(){

if($this-data){
if ($this-User-validates($this-data)) {
echo does validate;

}
else { //data doesn't validate
echo doesnt validatebr;
$this-Session-setFlash('Please correct errors 
below.brbr');
}

}
}

Can anyone see an obvious error that I have overlooked?

BTW, the 'does validate' and 'doesn't validate' are just in there for
me to see easily where my problems are occuring.  Obviously wouldnt be
there for production

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Form Validation

2011-04-28 Thread Tilen Majerle
Before you call $this-User-validates() you must the data to model...do
this
$this-User-set($this-data)

On Apr 29, 2011 4:31 AM, Sanfly san...@gmail.com wrote:

Hi

My cake version is 1.3.7

I'm just learning form validation and am having a few issues.

Firstly, the manual is crap in that it doesn't tell you how to
implement the validation in your model, and it doesn't tell you how to
show the validation error messages in your view.  Took a lot of
digging to find all that!

Anyway, on the the problem at hand.  I thought I had this working on
one field, went to implement for the rest of my fields and now it is
always validating the form even when I have deliberately used inputs
that should fail validation.  I have stripped it back down to one
field to try and get it working again

In my model: user.php

// VALIDATION
   var $validate = array(
   'first_name' = 'notEmpty'

   );

In my controller:

function add(){

   if($this-data){
   if ($this-User-validates($this-data)) {
   echo does validate;

   }
   else { //data doesn't validate
   echo doesnt validatebr;
   $this-Session-setFlash('Please correct
errors below.brbr');
   }

   }
   }

Can anyone see an obvious error that I have overlooked?

BTW, the 'does validate' and 'doesn't validate' are just in there for
me to see easily where my problems are occuring.  Obviously wouldnt be
there for production

--
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help
others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at
http://groups.google.com/group/cake-php

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php