I'm creating CakePOWER.org: a plugin enhancement extension for CakePHP, i need your help!

2010-10-06 Thread MPeg
Hi, i'm Marco Pegoraro, an italian CakePHP lover and developer.

I use CakePHP to build a lot of sites and in the last three years i
built a CMS named juniorcms.com (not documented, not distributed yet).

It is built upon CakePHP 1.1 and i wrote some classes to allow plugins
coworking and extending other plugins.
My intention was to be able to wrap news functionality to a news
plugin and then, when my client ask me to add a custom field or
function, to write a my-client-news who contain only rules to
describe how to extend news plugin without fork it or have to modify
his source code.

Now i starting develope CakePOWER.org based upon CakePHP 1.3. This
project will do the same things but now i'm trying to distribute it
and document it in a wiki.

I need you to proceed with this project, document it and distribute
it.

Please visit cakepower.org and mail me at i...@cakepower.org!

Thanks,
Marco.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Testing file uploads using SimpleTest web tests?

2010-10-06 Thread psybear83
Hi everybody

After suffering hours of debugging the problem that my upload form
worked great when used in Firefox and not working (being blackholed)
using SimpleTest web tests, I finally found the problem: SimpleTest
doesn't seem to recognize the file upload field, and so the
SecurityComponent::_validatePost() fails because when displaying the
form there is one more field than after submit, where the file field
is missing in the $data array.

I did some searching and found that SimpleTest should be able to
simulate file uploads:

File upload testing - Can simulate the input type file tag on
http://www.simpletest.org/api/SimpleTest/tutorial_SimpleTest.pkg.html

And here I found some API-information:
http://simpletest.org/api_1.0.1/SimpleTest/WebTester/SimpleUploadTag.html

But I didn't find any information on how to use this in practice.

So for now I deactivated validatePost for the action using

$this-Security-validatePost = false;

in the UsersController. But it would be great if anybody could help me
getting this to work using SimpleTest.

Thanks a lot
Josh

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


some helper problem

2010-10-06 Thread hoss7
i have this:
class SubcatHelper extends Helper {



function find($id){

$subcat = $this-Subcat-Cat-find('all',array('conditions' =
array('Subcat.status' = 1,'Subcat.id'=2)));

return $subcat;

}


}

in SubcatsController this code

$usercats = $this-Subcat-Cat-find('all',array(
'conditions' = array(
'Cat.status' = 1
)));

work but in subcathelper i have this error

Notice (8): Undefined property: SubcatHelper::$Subcat [APP\views
\helpers\subcat.php, line 8]
Code | Context

function find($id){



$subcat = $this-Subcat-Cat-find('all',array('conditions' =
array('Cat.status' = 1)));

$id =   2

SubcatHelper::find() - APP\views\helpers\subcat.php, line 8
include - APP\plugins\spark_plug\views\users\index.ctp, line 29
View::_render() - CORE\cake\libs\view\view.php, line 723
View::render() - CORE\cake\libs\view\view.php, line 419
Controller::render() - CORE\cake\libs\controller\controller.php, line
913
Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 207
Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 171
[main] - APP\webroot\index.php, line 83

Notice (8): Trying to get property of non-object [APP\views\helpers
\subcat.php, line 8]
Code | Context

function find($id){



$subcat = $this-Subcat-Cat-find('all',array('conditions' =
array('Cat.status' = 1)));

$id =   2

SubcatHelper::find() - APP\views\helpers\subcat.php, line 8
include - APP\plugins\spark_plug\views\users\index.ctp, line 29
View::_render() - CORE\cake\libs\view\view.php, line 723
View::render() - CORE\cake\libs\view\view.php, line 419
Controller::render() - CORE\cake\libs\controller\controller.php, line
913
Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 207
Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 171
[main] - APP\webroot\index.php, line 83


Fatal error: Call to a member function find() on a non-object in D:
\xampp\htdocs\ird\www\app\views\helpers\subcat.php on line 8


how can i use some function in helper like function in Controller?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: some helper problem

2010-10-06 Thread Mike Karthauser
hi hoss

helpers are for manipulating views and shouldn't/ can't be used to load
data from models.

perhaps you are better suited with a component?

mikek


On Wed, October 6, 2010 1:09 pm, hoss7 wrote:
 i have this:
 class SubcatHelper extends Helper {



   function find($id){

   $subcat = $this-Subcat-Cat-find('all',array('conditions' =
 array('Subcat.status' = 1,'Subcat.id'=2)));

   return $subcat;

   }


 }

 in SubcatsController this code

 $usercats = $this-Subcat-Cat-find('all',array(
   'conditions' = array(
   'Cat.status' = 1
   )));

 work but in subcathelper i have this error

 Notice (8): Undefined property: SubcatHelper::$Subcat [APP\views
 \helpers\subcat.php, line 8]
 Code | Context

 function find($id){



 $subcat = $this-Subcat-Cat-find('all',array('conditions' =
 array('Cat.status' = 1)));

 $id   =   2

 SubcatHelper::find() - APP\views\helpers\subcat.php, line 8
 include - APP\plugins\spark_plug\views\users\index.ctp, line 29
 View::_render() - CORE\cake\libs\view\view.php, line 723
 View::render() - CORE\cake\libs\view\view.php, line 419
 Controller::render() - CORE\cake\libs\controller\controller.php, line
 913
 Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 207
 Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 171
 [main] - APP\webroot\index.php, line 83

 Notice (8): Trying to get property of non-object [APP\views\helpers
 \subcat.php, line 8]
 Code | Context

 function find($id){



 $subcat = $this-Subcat-Cat-find('all',array('conditions' =
 array('Cat.status' = 1)));

 $id   =   2

 SubcatHelper::find() - APP\views\helpers\subcat.php, line 8
 include - APP\plugins\spark_plug\views\users\index.ctp, line 29
 View::_render() - CORE\cake\libs\view\view.php, line 723
 View::render() - CORE\cake\libs\view\view.php, line 419
 Controller::render() - CORE\cake\libs\controller\controller.php, line
 913
 Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 207
 Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 171
 [main] - APP\webroot\index.php, line 83


 Fatal error: Call to a member function find() on a non-object in D:
 \xampp\htdocs\ird\www\app\views\helpers\subcat.php on line 8


 how can i use some function in helper like function in Controller?

 Check out the new CakePHP Questions site http://cakeqs.org and help others
 with their CakePHP related questions.

 You received this message because you are subscribed to the Google Groups
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group
 at http://groups.google.com/group/cake-php?hl=en




-- 
Mike Karthauser
Managing Director - Brightstorm Ltd

Email: mi...@brightstorm.co.uk
Web: http://www.brightstorm.co.uk
Tel:  07939 252144 (mobile)
Fax: 0870 1320560

Address: 1 Brewery Court, North Street, Bristol, BS3 1JS

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: some helper problem

2010-10-06 Thread Tilen Majerle
u can load data from models with helpers

use ClassRegistry::init(ModelName, Model); or App::import();

read cakephp manual about this...

--
Tilen Majerle
http://majerle.eu



2010/10/6 Mike Karthauser mi...@brightstorm.co.uk

 hi hoss

 helpers are for manipulating views and shouldn't/ can't be used to load
 data from models.

 perhaps you are better suited with a component?

 mikek


 On Wed, October 6, 2010 1:09 pm, hoss7 wrote:
  i have this:
  class SubcatHelper extends Helper {
 
 
 
function find($id){
 
$subcat = $this-Subcat-Cat-find('all',array('conditions'
 =
  array('Subcat.status' = 1,'Subcat.id'=2)));
 
return $subcat;
 
}
 
 
  }
 
  in SubcatsController this code
 
  $usercats = $this-Subcat-Cat-find('all',array(
'conditions' = array(
'Cat.status' = 1
)));
 
  work but in subcathelper i have this error
 
  Notice (8): Undefined property: SubcatHelper::$Subcat [APP\views
  \helpers\subcat.php, line 8]
  Code | Context
 
  function find($id){
 
 
 
  $subcat = $this-Subcat-Cat-find('all',array('conditions' =
  array('Cat.status' = 1)));
 
  $id   =   2
 
  SubcatHelper::find() - APP\views\helpers\subcat.php, line 8
  include - APP\plugins\spark_plug\views\users\index.ctp, line 29
  View::_render() - CORE\cake\libs\view\view.php, line 723
  View::render() - CORE\cake\libs\view\view.php, line 419
  Controller::render() - CORE\cake\libs\controller\controller.php, line
  913
  Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 207
  Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 171
  [main] - APP\webroot\index.php, line 83
 
  Notice (8): Trying to get property of non-object [APP\views\helpers
  \subcat.php, line 8]
  Code | Context
 
  function find($id){
 
 
 
  $subcat = $this-Subcat-Cat-find('all',array('conditions' =
  array('Cat.status' = 1)));
 
  $id   =   2
 
  SubcatHelper::find() - APP\views\helpers\subcat.php, line 8
  include - APP\plugins\spark_plug\views\users\index.ctp, line 29
  View::_render() - CORE\cake\libs\view\view.php, line 723
  View::render() - CORE\cake\libs\view\view.php, line 419
  Controller::render() - CORE\cake\libs\controller\controller.php, line
  913
  Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 207
  Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 171
  [main] - APP\webroot\index.php, line 83
 
 
  Fatal error: Call to a member function find() on a non-object in D:
  \xampp\htdocs\ird\www\app\views\helpers\subcat.php on line 8
 
 
  how can i use some function in helper like function in Controller?
 
  Check out the new CakePHP Questions site http://cakeqs.org and help
 others
  with their CakePHP related questions.
 
  You received this message because you are subscribed to the Google Groups
  CakePHP group.
  To post to this group, send email to cake-php@googlegroups.com
  To unsubscribe from this group, send email to
  cake-php+unsubscr...@googlegroups.comcake-php%2bunsubscr...@googlegroups.comFor
   more options, visit this group
  at http://groups.google.com/group/cake-php?hl=en
 
 


 --
 Mike Karthauser
 Managing Director - Brightstorm Ltd

 Email: mi...@brightstorm.co.uk
 Web: http://www.brightstorm.co.uk
 Tel:  07939 252144 (mobile)
 Fax: 0870 1320560

 Address: 1 Brewery Court, North Street, Bristol, BS3 1JS

 Check out the new CakePHP Questions site http://cakeqs.org and help others
 with their CakePHP related questions.

 You received this message because you are subscribed to the Google Groups
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.comcake-php%2bunsubscr...@googlegroups.comFor
  more options, visit this group at
 http://groups.google.com/group/cake-php?hl=en


Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Best way to handle sub-tabs

2010-10-06 Thread Joey Mukherjee
Maybe I'm missing something really fundamental...

What is the best way to have a menu of side tabs for a given index
view?  Right now, I have this:

 $options = array ('update' = '#main_content');
 $options ['escape'] = false;
 $options ['before'] = ;
 foreach ($side_buttons as $side_button) {
 $options ['before'] .= document.getElementById
('mission_side_menu_.
 $side_button ['name'].
 
').className='side_menu_button';;
 }
 foreach ($side_buttons as $side_button) {
 $options ['complete'] = document.getElementById
('mission_side_menu_.
  $side_button ['name'].
 
').className='side_menu_button_sel';;
 echo $this-Html-div (side_menu_button,
$this-Js-link ($this-Html-tag
('span', $side_button ['title']),
 array ('action'=
'display/'.$side_button ['name']),
 $options),
array ('id'='mission_side_menu_'.
$side_button ['name']));
 }

You can see my action is display/ button name.

In my controller, display just does $this-render ($subtab).  This
unfortunately keeps http://system/mission/subtab from working though.

Thanks for your help!  I know I am close to understanding, just need a
little bit more...

Joey

On Oct 4, 8:48 pm, Dr. Loboto drlob...@gmail.com wrote:
 Just check AJAX in view as $this-params['isAjax'] and output full
 view or only subtab element, that's all the difference. Same you can
 check in controller.

 On 5 ÏËÔ, 01:48, Joey Mukherjee joe...@gmail.com wrote:



  It is different since the subtab is updated by Ajax. šAt least that's
  what I think.

  When I go directly tohttp://system/tabname/subtab, I get a message
  saying (for instance)  Error: šThe action spacecraft is not defined
  in controller MissionsController š In this case spacecraft is my
  subtab and Mission is my main tab. šThis makes sense in that I don't
  have that routine defined. šHowever, I am at a loss for what to put in
  that routine. šMy attempt at it would be:

  š š function spacecraft ()
  š š {
  š š š š $this-render ('/elements/missions/spacecraft');
  š š }

  which displays my text, but not the rest of the tabs (i.e. the stuff I
  have on the index.ctp view). šWhat I'd like is:

  $this-render ('index');
  $this-render ('/elements/missions/spacecraft'); // this will just
  manually switch tabs for the user.

  Hope this makes sense!

  Thanks!
  Joey

  On Oct 4, 12:15špm, Miles J mileswjohn...@gmail.com wrote:

   And again, what your saying is exactly what a controller and action is
   for. How is that different than your setup?

   On Oct 4, 7:30šam, Joey Mukherjee joe...@gmail.com wrote:

In retrospect, I guess I didn't explain as well as I should have.

I have each subtab as an element now and every subtab is rendered via
ajax (i.e. š$js-link ($html-tag ('span', $side_button
['title']),
array ('action'= 'display/'.$side_button ['name']), $options). šThe
controller action display just has a $this-render (/elements/
$tabname/$whatToDisplay);

So, when the user goes tohttp://system/tabname, the initial view sets
up the element specific to that tab that views/layouts/default.ctp did
not setup. šEach subtab element just has stuff specific to that subtab
(in my case, mainly just text).

However, I'd like people to go tohttp://system/tabname/subtaband
directly render the specific text to that subtab. šThat's what I can't
figure out??

Anyway, does this sound right to everyone? šI feel like I am the only
one having this problem on something which seems pretty common (tabs/
   subtabs). šIs there ša better way of doing the above? šI'd welcome all
ideas!

Thanks for the response!
Joey

On Oct 1, 1:49špm, Miles J mileswjohn...@gmail.com wrote:

 Just use the default MVC architecture?

 tabname = controller
 subtab = action

 On Sep 30, 12:05špm, Joey Mukherjee joe...@gmail.com wrote:

  I have some tabs along the top of my CakePHP site and some sub-tabs
  along the left side of my page. šWhen I switch tabs, it goes to a 
  URL
  such ashttp://system/tabname. šWhen I go to a sub-tab, I use 
  $this-render to update the content of the view to what the user 
  clicked

  on. šHowever, I'd like a URL such ashttp://system/tabname/subtabto
  go directly to the subtab.

  How might I accomplish this? šBasically, I want to redirect to 
  tabname/
  index and then render the subtab.

  My tabname index view sets up the side menu. šThe subtab just 
  modifies
  the inner content. šThe views/layouts/default.ctp has the top tabs
  defined in them. šObviously, the side tabs change from tab to tab.

  Hope that makes sense!

  Thanks,
  

Re: some helper problem

2010-10-06 Thread hoss7
thanks tilen

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: some helper problem

2010-10-06 Thread Tilen Majerle
hehe no problem :D
--
Tilen Majerle
http://majerle.eu



2010/10/6 hoss7 hoss...@gmail.com

 thanks tilen

 Check out the new CakePHP Questions site http://cakeqs.org and help others
 with their CakePHP related questions.

 You received this message because you are subscribed to the Google Groups
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.comcake-php%2bunsubscr...@googlegroups.comFor
  more options, visit this group at
 http://groups.google.com/group/cake-php?hl=en


Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: some helper problem

2010-10-06 Thread Mike Karthauser

On Wed, October 6, 2010 2:20 pm, Tilen Majerle wrote:
 u can load data from models with helpers

 use ClassRegistry::init(ModelName, Model); or App::import();

 read cakephp manual about this...

Although you *can* do this, its breaking cake MVC conventions.

Really you should be loading data from model into controller and then
passing into the view for the helper to process.


 --
 Tilen Majerle
 http://majerle.eu



 2010/10/6 Mike Karthauser mi...@brightstorm.co.uk

 hi hoss

 helpers are for manipulating views and shouldn't/ can't be used to load
 data from models.

 perhaps you are better suited with a component?

 mikek


 On Wed, October 6, 2010 1:09 pm, hoss7 wrote:
  i have this:
  class SubcatHelper extends Helper {
 
 
 
function find($id){
 
$subcat =
 $this-Subcat-Cat-find('all',array('conditions'
 =
  array('Subcat.status' = 1,'Subcat.id'=2)));
 
return $subcat;
 
}
 
 
  }
 
  in SubcatsController this code
 
  $usercats = $this-Subcat-Cat-find('all',array(
'conditions' = array(
'Cat.status' = 1
)));
 
  work but in subcathelper i have this error
 
  Notice (8): Undefined property: SubcatHelper::$Subcat [APP\views
  \helpers\subcat.php, line 8]
  Code | Context
 
  function find($id){
 
 
 
  $subcat = $this-Subcat-Cat-find('all',array('conditions' =
  array('Cat.status' = 1)));
 
  $id   =   2
 
  SubcatHelper::find() - APP\views\helpers\subcat.php, line 8
  include - APP\plugins\spark_plug\views\users\index.ctp, line 29
  View::_render() - CORE\cake\libs\view\view.php, line 723
  View::render() - CORE\cake\libs\view\view.php, line 419
  Controller::render() - CORE\cake\libs\controller\controller.php, line
  913
  Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 207
  Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 171
  [main] - APP\webroot\index.php, line 83
 
  Notice (8): Trying to get property of non-object [APP\views\helpers
  \subcat.php, line 8]
  Code | Context
 
  function find($id){
 
 
 
  $subcat = $this-Subcat-Cat-find('all',array('conditions' =
  array('Cat.status' = 1)));
 
  $id   =   2
 
  SubcatHelper::find() - APP\views\helpers\subcat.php, line 8
  include - APP\plugins\spark_plug\views\users\index.ctp, line 29
  View::_render() - CORE\cake\libs\view\view.php, line 723
  View::render() - CORE\cake\libs\view\view.php, line 419
  Controller::render() - CORE\cake\libs\controller\controller.php, line
  913
  Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 207
  Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 171
  [main] - APP\webroot\index.php, line 83
 
 
  Fatal error: Call to a member function find() on a non-object in D:
  \xampp\htdocs\ird\www\app\views\helpers\subcat.php on line 8
 
 
  how can i use some function in helper like function in Controller?
 
  Check out the new CakePHP Questions site http://cakeqs.org and help
 others
  with their CakePHP related questions.
 
  You received this message because you are subscribed to the Google
 Groups
  CakePHP group.
  To post to this group, send email to cake-php@googlegroups.com
  To unsubscribe from this group, send email to
  cake-php+unsubscr...@googlegroups.comcake-php%2bunsubscr...@googlegroups.comFor
 more options, visit this group
  at http://groups.google.com/group/cake-php?hl=en
 
 


 --
 Mike Karthauser
 Managing Director - Brightstorm Ltd

 Email: mi...@brightstorm.co.uk
 Web: http://www.brightstorm.co.uk
 Tel:  07939 252144 (mobile)
 Fax: 0870 1320560

 Address: 1 Brewery Court, North Street, Bristol, BS3 1JS

 Check out the new CakePHP Questions site http://cakeqs.org and help
 others
 with their CakePHP related questions.

 You received this message because you are subscribed to the Google
 Groups
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.comcake-php%2bunsubscr...@googlegroups.comFor
 more options, visit this group at
 http://groups.google.com/group/cake-php?hl=en


 Check out the new CakePHP Questions site http://cakeqs.org and help others
 with their CakePHP related questions.

 You received this message because you are subscribed to the Google Groups
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group
 at http://groups.google.com/group/cake-php?hl=en



-- 
Mike Karthauser
Managing Director - Brightstorm Ltd

Email: mi...@brightstorm.co.uk
Web: http://www.brightstorm.co.uk
Tel:  07939 252144 (mobile)
Fax: 0870 1320560

Address: 1 Brewery Court, North Street, Bristol, BS3 1JS

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP 

Re: Getting numeric array keys from query... need model names.

2010-10-06 Thread Dr. Loboto
We had same problem on find queries with MySQL 5.0 and model for view
based on UNION query. For a while we lived with check for key, then
upgraded MySQL to 5.1 and problem gone.

On Oct 5, 9:28 pm, foldiman vi...@vinceallen.com wrote:
 I'm currently deploying a CakePHP site that works fine in one
 environment (staging), but then encounters errors in another (live).
 The error... my result array keys in staging reflect the joined tables
 while my array keys in live are numeric. This means, on live, when I
 state $my_var = $results['MyModel']['myData'], 'MyModel' is not a
 valid index. However, $results[0]['myData'] is valid bc the key has
 been converted to a numeric index.

 Any ideas on what would cause this? If so, I could hunt down the
 difference between the environments.

 Thanks!

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Bake templates

2010-10-06 Thread Jeremy Burns
I am creating my own templates for baking views (I spend the time
getting that right then bake all my views - it's quicker than changing
the results of hundreds of views after baking or creating my own).

I'm changing the following file:
/app/vendors/shells/templates/mytemplatename/views/index.ctp

This has an array called $fields, which is just an array of the name
of each field to be written out in the view. I'd like to handle some
fields differently if they are datetime fields. Does anyone know where
I can get that information from whilst parsing index.ctp?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Bake templates

2010-10-06 Thread Jeremy Burns | Class Outfit
Got it:

if ($schema[$field]['type'] == 'datetime'):

Jeremy Burns
Class Outfit

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

On 6 Oct 2010, at 16:51, Jeremy Burns wrote:

 I am creating my own templates for baking views (I spend the time
 getting that right then bake all my views - it's quicker than changing
 the results of hundreds of views after baking or creating my own).
 
 I'm changing the following file:
 /app/vendors/shells/templates/mytemplatename/views/index.ctp
 
 This has an array called $fields, which is just an array of the name
 of each field to be written out in the view. I'd like to handle some
 fields differently if they are datetime fields. Does anyone know where
 I can get that information from whilst parsing index.ctp?
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: save not working

2010-10-06 Thread huoxito
try this to see if its a valitation problem:

if ( $this-Host-save($this-data)  ){
 // it saved
}else{
echo $errors = $this-ModelName-invalidFields();
}

or maybe some wrong field name you got in your array



On 5 out, 10:15, james jamesliv...@googlemail.com wrote:
 I'm trying to run a save on certain fields from my model and for some
 reason it isnt working -

 similarly to an edit im calling

 $this-Host-save($this-data)

 and the array in $this-data looks like

 Array
 (
     [Host] = Array
         (
             [web] = 25
             [prev_cost_of_sale] =
             [extras] =
             [price_A4s] =
             [previous_price_A4s] =
             [previous_adverts] =
             [previous_appts] =
         )

 )

 can anyone see what im doing wrong?

 thanks

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: HTML Purifier or Sanitize core library

2010-10-06 Thread mark_story
HTML purifier is miles better than the Sanitize.  I would recommend
escaping and using a text processor like markdown or textile.
However, if you need to accept html from the unwashed masses, use
HTMLPurifier.

-Mark

On Oct 4, 1:02 pm, Loic Duros loic.du...@gmail.com wrote:
 Hello,

 I'm currently building a blog with CakePHP, and I would like to
 sanitize/filter my posts before they are displayed on screen to prevent
 cross-site scripting. However, I would still like to allow for a great deal
 of HTML markup and attributes in the HTML. I have tried using the Sanitize
 Core Library but, as far as I know, it doesn't allow for filtering some tags
 while keeping others. As a result, I'm looking into HTML Purifier 
 (http://htmlpurifier.org/) to do the job in my controller and/or view
 template files. I found the following Brita Component in the 
 Bakery:http://bakery.cakephp.org/articles/view/brita-component-with-html-pur...

 I wonder however if anyone has implemented such a filtering/sanitizing
 solution for their site and if I'm missing something obvious I should be
 using to secure my site on that end.

 Thank you,

 Loic

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Possible bug in HtmlHelper ?

2010-10-06 Thread mark_story
Don't use the Html-tag method to make inputs.  It won't do it
correctly, as it wasn't intended for this.  Use the FormHelper, its
much better at building input tags.

-Mark

On Oct 4, 6:20 am, Adael adae...@gmail.com wrote:
 Hi all, in HtmlHelper::tag() (line 728) we found this code:

 if ($text === null) {
         $tag = 'tagstart';

 } else {
         $tag = 'tag';
 }

 So, if you do the call

     echo $html-tag('input', 'name', 'value');

 It's output: input class='value'name/input
 I except: input type='text' name='name' value='value'/

 Other way:

     echo $html-tag('input', 'name', array('value' = 'thevalue',
 class='miclass'));

 output: input value='thevalue' class='miclass'name/input
 excepted: input type='text' name='name' value='thevalue'
 class='miclass'/

 In documentation, you can find that HtmlHelper-tags has an array with
 preformatted tags (wich uses sprintf). That functionality doesn't
 works.

 i have no time to explain, but i think that addition can fix the
 problem:

 if ($text === null) {
         $tag = 'tagstart';

 }elseif( array_key_exists($name, $this-tags) ){
         $tag = $name;
 } else {
         $tag = 'tag';
 }

 Thans to all, and excuse my bad english, i'm spanish.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: HTML Purifier or Sanitize core library

2010-10-06 Thread Loic Duros
Thanks for all the answers --

Mark, do you use Markdown or textile at mark-story.com to write blog posts?
Just curious since it seems you have lots of HTML in there.

Thanks again,

Loic

On Wed, Oct 6, 2010 at 1:16 PM, mark_story mark.st...@gmail.com wrote:

 HTML purifier is miles better than the Sanitize.  I would recommend
 escaping and using a text processor like markdown or textile.
 However, if you need to accept html from the unwashed masses, use
 HTMLPurifier.

 -Mark

 On Oct 4, 1:02 pm, Loic Duros loic.du...@gmail.com wrote:
  Hello,
 
  I'm currently building a blog with CakePHP, and I would like to
  sanitize/filter my posts before they are displayed on screen to prevent
  cross-site scripting. However, I would still like to allow for a great
 deal
  of HTML markup and attributes in the HTML. I have tried using the
 Sanitize
  Core Library but, as far as I know, it doesn't allow for filtering some
 tags
  while keeping others. As a result, I'm looking into HTML Purifier (
 http://htmlpurifier.org/) to do the job in my controller and/or view
  template files. I found the following Brita Component in the Bakery:
 http://bakery.cakephp.org/articles/view/brita-component-with-html-pur...
 
  I wonder however if anyone has implemented such a filtering/sanitizing
  solution for their site and if I'm missing something obvious I should be
  using to secure my site on that end.
 
  Thank you,
 
  Loic

 Check out the new CakePHP Questions site http://cakeqs.org and help others
 with their CakePHP related questions.

 You received this message because you are subscribed to the Google Groups
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.comcake-php%2bunsubscr...@googlegroups.comFor
  more options, visit this group at
 http://groups.google.com/group/cake-php?hl=en




-- 
Loic J. Duros - www.lduros.net

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Help for simple behavior

2010-10-06 Thread senser
Hello,

I'm trying to create a simple behavior for data mapping - I have an
array with structure different than this in my model. Just an example:

$input=array('some_key'=array('id'=2,
'data'='some_data'),
 'some_key2'=array('data2'='some_data2'),
 'data3'='some_data3')

but my model and respectively database table needs the data in format
like this:

$data=array('id'=2,
  'data'='some_data',
  'data2'='some_data2',
 'data3' ='some_data3')

So, I wrote a simple behavior that can do this job in beforeValidate
callback - I pass the mapping relation between $input and $data in
behavior parameters, and remap it. Everything seemed to work fine, but
today I've sticked a weird problem: if the field ID (this it the
primary key for the model) is in nested array and is not present at
first level in $input, Cake tries to insert new record rather then
editing the existing one. This happens because in save method of
model, data is setted before callbacks execution, so when Cake sets
the model data it assumes that this is new record because ID is
missing (ID is set later in beforeValidate callback of my behavior).

I wonder what is the best way to solve this problem - I can create new
behavior method saveConverted() and to call it rather than $model-
save, or may be just to do remapping in the behavior, return the
resulted data and to save it with $model-save().

Regards,
Nikolay

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Problem with saveAll or wrong way?

2010-10-06 Thread DerBjörn
Hi,

i habe a model 'player' and a model 'skill_pool': Player hasOne
SkillPool.

Now i want to randomize the player data and his skills and save
everything at once, but it doesn't work this way:

$this-Player-randomize();
$this-Player-SkillPool-randomize();
$this-Player-saveAll();

The player gets saved correctly. His skillpool not. Looks different
when i use following:

$this-Player-randomize();
$this-Player-SkillPool-randomize();
$this-Player-save(); // or saveAll - doesn't matter
$this-Player-SkillPool-set('player_id', $this-Player-id);
$this-Player-SkillPool-save();

QUESTION: Why i didn't get to save the SkillPool in the first example.
How i have to manage a saving both at the same time without this
workaround of example two?

Thanks :)

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Strange behavior own comparing validat...@model

2010-10-06 Thread leafchild
I have Auth system, and In my user model, I have a validation
soemething like this:

==
var $validate = array(
...
'password' = array(
'sameCheck' = array(
'rule' = array('sameCheck', 
'password_confirm'),
'message' = 'Passwords do not match.'
)
 ),
'password_confirm' = array(
'no_empty'=array(
'rule'='notEmpty',
'message'='Please enter a password'
)
),
..
}
function sameCheck($data, $target) {
return strcmp(array_shift($data), AuthComponent::password($this-
data[$this-name][$target])) == 0;
}

==

users_controller.php : $this-data has only User.id and User.name but
still password/password_confirm field cakephp error is preventing
saving new data.
==
...
$this-Member-set($this-data);
if(($this-Member-validates())){
...
==

When creating new user everything working fine but when editing user
information without password.
I get cakephp error Undefined index: password_confirm

I only let user edit one filed (ex. user name) but password_confirm
error showing.
There is no password/password_confirm field but how come this part of
validation
keep showing?


anyone any idea?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Chef Cookbook for CakePHP

2010-10-06 Thread ardell
I just posted a Chef Cookbook for CakePHP at 
http://github.com/ardell/cakephp-cookbook

Chef allows you to easily provision cloud instances (e.g. Amazon EC2,
Rackspace, etc) and Chef Cookbooks allow you to configure applications
on a cloud server in a repeatable way.  Using Chef and this cookbook,
I can now boot up a cloud server with CakePHP running (and auto-
configuring db connections, etc) in less than 2 minutes.

I'd love any feedback, would love it if folks forked the project on
Github.

-Jason

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


How can i access home page without login?

2010-10-06 Thread redleon
I'm using Auth Component. Guest visitor can access register, login,
remember_password etc. but can not access home page of the site.

I tried everythink i know.

For Auth-Allow () methot, i gave '/', 'home', 'display' parameters.
But it has not worked.

I would like to give permission for guests to access home page of my
site.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Cascading Models in hasone

2010-10-06 Thread Rob
Hello Everyone,

I'm a new user of CakePHP, and have a project where we need to reflect
a 3-step hierarchy of inheritance in our database in a model.

We have people, adults, and users.  All users are adults, and people,
and all adults are people.


Ideally our Adults model hasone person, and our Users model hasone
adult (which would have one person).


In my tests, however, we have found that when we instantiate a user,
it only has an adult associated with it, and not a person.

When we instantiate an adult, it does however have a person beneath
it.

So in summary, I would like to know if there is a way to instantiate
users, and have the user's adult and person properties come with it.

Thanks!
Rob B.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


SELECT ... FOR UPDATE

2010-10-06 Thread andres amaya diaz
Hi, hope you can help me with a SELECT .. FOR UPDATE problem.

I have a web app that can be accessed by many users at the same time.
I have a table with a field wich has a counter on the next invoice
number. Lets call if invoicenumbers (this field cant be
auto_increment)
And then i have another table where i need to store the invoices data
Lets call it invoices

So lets see:
A user enters Save Invoice, i need to do a SELECT or FIND to the
invoicenumbers to get the next invoice number and then an UPDATE to
invoicenumbers to set the field counter = counter+1.
But maybe between the select and the update another user Saves another
Invoice wich will do the same (SELECT and the UPDATE) and that is a
remote posibility that they both get the same Invoice Number and then
both UPDATE the table increasing the counter by 2.

I hope i made myself clear.

Thanks in advance ... aad

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Beginners question about adjusting views

2010-10-06 Thread AvE
Hi all,

I'm kind of new to CakePHP and currently learning the system. So far
I've been able to find answers to my questions via internet and in
this group, but this time I have a problem where I can't find the
answer to, also because it's a bit hard to describe.

I'm building an application to store information about companies. Each
company can have several share capitals and each share capital belongs
to a class of shares (ie: ordinary, preferent, etc).

For this I made some tables:

The table 'contacts', which has a field capital_id to link it to the
table capitals
The table 'capitals', which has a field capitalclass_id to link to the
table capitalclasses
The table 'capitalclasses', which just has two fields 'id' and 'name'.

A contact (company) can have several capitals. Each capital only
belongs to one capitalclass.

The relationship between tables in the code works very well, I used
cake bake to make the controller and views. When I view a contact all
data is displayed well.

Also on the bottom the 'baked' code will display the capital details,
now it's being displayed as:

Capitalclass_id - Amount - Value
1 - 100 - 1

Of course I don't want the capitalclass_id to be displayed, I want the
name of the capitalclass to be displayed (in this case 'ordinary' for
ordinary shares).

As this is the view of a contact and contact has no direct link with
capitalclass, but only via capital, how can I accomplish this?

The code of contacts/view.ctp to display the capital data:

?php if (!empty($contact['Contact']['companyname']) 
  $contact['Status']['status'] == 'ACTIVE'):?
div class=related
h3?php __('Capital');?/h3
?php if (!empty($contact['Capital'])):?
table cellpadding = 0 cellspacing = 0
   tr
th?php __('Capitalclass Id'); ?/th
th?php __('Currency Id'); ?/th
th?php __('Amount'); ?/th
th?php __('Value'); ?/th
th class=actions?php __('Actions');?/th
/tr
?php
$i = 0;
foreach ($contact['Capital'] as $capital):
$class = null;
if ($i++ % 2 == 0) {
$class = ' class=altrow';
}
?
tr?php echo $class;?
td?php echo $capital['capitalclass_id'];?/td 
// Here
should capitalclass.name be displayed instead.
td?php echo $capital['currency_id'];?/td
td?php echo $capital['amount'];?/td
td?php echo $capital['value'];?/td
td class=actions
?php echo $html-link(__('View', true), 
array('controller' =
'capitals', 'action' = 'view', $capital['id'])); ?
?php echo $html-link(__('Edit', true), 
array('controller' =
'capitals', 'action' = 'edit', $capital['id'])); ?
?php echo $html-link(__('Delete', true), 
array('controller'
= 'capitals', 'action' = 'delete', $capital['id']), null,
sprintf(__('Are you sure you want to delete # %s?', true),
$capital['id'])); ?
/td
/tr
?php endforeach; ?
/table
?php endif; ?

div class=actions
ul
li?php echo $html-link(__('New Capital', true),
array('controller' = 'capitals', 'action' = 'add'));? /li
/ul
/div
/div

I hope it's clear what I mean as it's a bit hard for me to describe
the problem.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Changing the language of CakePHP

2010-10-06 Thread me3911
Hallo!

How can I change the language of the users module and my CakePHP
installation?

Is there a german translation that can be downloaded anywhere?

Thanks

Regards

me3911

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Fatal error: Out of memory - Even when there is no memory limit

2010-10-06 Thread Fuitad
Hello,

I'm in charge of transferring a live CakePHP application from one
server to another. I'm trying to get the new site to work but I'm
hitting a weird error and I just can't figure it out.

When I try to load the main page, I get this:

Fatal error: Out of memory (allocated 13631488) (tried to allocate
8192 bytes) in /home/haakqsm/public_html/app/views/nodes/display.ctp
on line 1

The problem is, this error happens no matter what memory_limit is. For
example, it's set to -1 right now.

php -i | grep memory
trtd class=ememory_limit/tdtd class=v-1/tdtd
class=v-1/td/tr


Does anybody have any clue what could be the issue here? Both servers
(the live one and the new one) have the same php modules installed and
the same php.ini.



Server Info:

CentOS release 5.5 (Final)
Kernel Information:  Linux 2.6.18-194.11.4.el5xen x86_64
GNU bash, version 3.2.25(1)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2005 Free Software Foundation, Inc.

# php -v
PHP 5.2.14 (cgi) (built: Sep 30 2010 11:08:48)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies
with the ionCube PHP Loader v3.3.20, Copyright (c) 2002-2010, by
ionCube Ltd.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Strange issue using mysqlnd and the character encoding

2010-10-06 Thread 5942marine
Okay, let me give you a little background on the issue. Up until know,
I've been using Cakephp 1.3.3 with PHP 5.3.2. Now, my site has two
parts, a front end for users and my crawlers, which I run at home,
again, using Cakephp 1.3.0

My crawlers basically hit RSS feeds for twiter and google blog search.
Now, ever since I decided to use my Mac Pro at home for the crawlers,
instead of Ubutnu, I've ran into a issue. Basically, when I'm using
Snow Leopard at home and the daemon is running, it seems to not encode
some of my datarows that are inserted into the db. The only difference
between my setups that I can tell, is that Ubuntu is still using the
mysql api driver and Snow Leopard, is using the mysqlnd.

On my dev site, I've been doing some debugging and found that my
articles that have the issues, don't have a proper character encoding,
thus is why i'm seeing some strange characters in the title, etc.

Now, when I'm running Ubuntu at home for my crawlers, and it's
updating my site, I never have any of these issues. Again, they're
both running the same version of PHP and the only difference that I
can tell when executing a phpinfo(); is the Driver that mysql is
using.

I've been working on this for the past week. I know it's an encoding
issue, where the following characters seem to render incorrectly, such
as - or |

Anyways, just curious if anyone else has ran into some issues using
the mysqlnd. I'm not even 100% that's the culprit, but from all my
research, that's what I'm focusing on right now.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Google Checkout

2010-10-06 Thread Daniel Mulé
Hi guys!

Anyone know of a plugin to integrate Google Checkout in CakePhp? I need to
do a subscription!

Thanks,
Daniel.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


How to keep Cake from trying to save certain form inputs ?

2010-10-06 Thread EJ
Folks,

I have a newbie question:

I have a form that has certain inputs that just need to be ignored.
For example a User may be associated (e.g. via HABTM) with a
particular City
The City may be associated with a State but I don't need an
association between State and User.

When I show the registration form, I want to use AJAX to show you a
list of states and once you select a state show you the list of cities
to avoid an overly-long list of cities. But when the form is submitted
I don't want Cake to try to save the state since there's no direct
association between user and state.

Is there a magic setting in the form input to keep it from being set?
Or do I have to handle it and null it out in the controller?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Cakephp using flaot on part part of a website and removing it on another

2010-10-06 Thread ninja
Hi I am still a bit new to phpcake so i already have a page that has
two floats left and right but now i want to remove the float on
certain pages of the website eg(About page) which needs the entire
horizontal spacing of the page.please help

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


How to use ORDER BY within Containable Behavior

2010-10-06 Thread Paul Bricks
I would like to have a sorted-array (order by) to print out in my Post-
View.
The Problem is, that the order-by-attribute (Category.name) lies
deeper
than attributes (Post.id, Tag.id, ...), which have to be ordered.

Here is my example:

Relations:
Post -- hasMany -- Tag -- belongsTo -- Category


PostsController:
...
$posts = $this-Post-find('all', array (
'contain' = array (
'Tag' = array (
'Category' = array (
'fields' = array (
'id',
'name'
)
)
)
)
));
$this-set('posts', $posts);
...


Now i would like to to print out the posts-aray in my Post-View
to get this ordered table (order-by Category.name ASC):

Post.id Tag.id  Category.name
-
1   3   Basketball
1   2   Football
2   4   Hockey
4   1   Tennis


And my Question is:
Where do i have to put the order-clause to get this array, shown
above.
And if this will not work like this way, how will it work otherwise?

PS:
This is the pr($posts); which i want to have:


Array
(
[0] = Array
(
[Post] = Array
(
[id] = 1
)
[Tag] = Array
(
[0] = Array
(
[id] = 3
[Category] = Array
(
[id] = 1
[name] = Basketball
)
)
[1] = Array
(
[id] = 2
[Category] = Array
(
[id] = 5
[name] = Football
)
)
)
)
[1] = Array
(
[Post] = Array
(
[id] = 2
)
[Tag] = Array
(
[0] = Array
(
[id] = 4
[Category] = Array
(
[id] = 1
[name] = Hockey
)
)
)
)
[2] = Array
(
[Post] = Array
(
[id] = 4
)
[Tag] = Array
(
[0] = Array
(
[id] = 1
[Category] = Array
(
[id] = 1
[name] = Tennis
)
)
)
)
)

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Using Form type of GET makes input elements have blank name attributes?

2010-10-06 Thread Michael T
Hello,

I have a form in a view which is created using the FormHelper in the
following way:

echo $this-Form-create(False, array('action' = 'something', 'type'
= 'get'));

I then have an input for the form defined in the following way:

echo $this-Form-input('department', array('id' = 'department',
'options' = $departments, 'empty' = '(select)'));

When the form type is set to Get in this way, the HTML rendered for
the form input does not contain a name attribute (the name attribute
is empty):

select name= id=department ... /select

But when I change the form type to Post like this:

echo $this-Form-create(False, array('action' = 'something', 'type'
= 'post'));

and render the same input, the resulting HTML is:

select id=department name=data[department] ... /select

Why does the name disappear for Get type forms? I noticed that this
hidden input is not rendered with Get, but it is with Post:

div style=display: none;input type=hidden value=POST
name=_method/div

This is causing problems when I try to serialize the form data for an
ajax request using the JsHelper - even though the ajax request uses
the POST method, the form data is incomplete because it does not have
any names.

Thanks in advance for your help!
Michael

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Paypal integration

2010-10-06 Thread Warrior
Hi Guys!

I am integrating my site with paypal, as per requirement I am not
suppose to use the api credentials for integrating paypal with
website.
is there any way to integrate paypal directly without api integration?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


help to slove this

2010-10-06 Thread Adnan
why this msg is sowing
Notice (1024): Please change the value of 'Security.salt' in app/
config/core.php to a salt value specific to your application [CORE\cake
\libs\debugger.php, line 548]

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


redirect not working

2010-10-06 Thread a17s
Hello, got a problem with using cakephp redirect. Get an error saying
header already been set. Please how can I redirect to another action
after processing a post. My error keeps pointing to the cake/
basic.php, and the controller/controller.php

See error and code below:

Error

Congratulations, your new account has been successfully created

Warning (2): Cannot modify header information - headers already sent
by (output started at /home/asco3112/public_html/projects/library/cake/
basics.php:655) [CORE/cake/libs/controller/controller.php, line 746]
Code | Context

$status =   Location: http://a17s.com/projects/library/users;

header - [internal], line ??
Controller::header() - CORE/cake/libs/controller/controller.php, line
746
Controller::redirect() - CORE/cake/libs/controller/controller.php,
line 725
UsersController::register() - APP/controllers/users_controller.php,
line 97
Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 204
Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 171
[main] - APP/webroot/index.php, line 83

Code

function register(){
if(!empty($this-data)){
$this-User-create($this-data);
if($this-User-save($this-data)){
$this-Session-setFlash(__('Congratulations, 
your new account has
been successfully created'));
unset($this-data);
$this-redirect(array('controller'='users',
'action'='index'));
}
else{
//unable to save data
$this-Session-setFlash(__('Unable to register 
user, please try
again'));

}
}
}

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


blog tutorial Html-link problem

2010-10-06 Thread J. Argyl Plath
Hello. I am following along on the blog tutorial and I can't get my
first view to work.

I set up the database just fine and created my model and controller. I
copy/pasted in the view code but I get this error:

Notice (8): Undefined property: View::$Html
Fatal error: Call to a member function link() on a non-object

I tried dumping out $this and saw that in fact there is no Html
property.

Suggestions?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: blog tutorial Html-link problem

2010-10-06 Thread Jeremy Burns | Class Outfit
Are you using version 1.3? If so, replace all instances of $Html to 
$this-Html. You'll also need to do the same with $Form (to $this-Form) and 
$Session/$session (to $this-Session). You'll also need to include the Session 
helper and component in your app_controller:

var $components = array(...'Session'...);
var $helpers = array(...'Session'...);

(the dots indicate that you might have other components/helpers in your array 
already).

For more details, check here: 
http://book.cakephp.org/view/1561/Migrating-from-CakePHP-1-2-to-1-3

The examples were written for earlier versions and need to be updated - perhaps 
I'll take that on when a get a bit of time.

Jeremy Burns
Class Outfit

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

On 4 Oct 2010, at 20:45, J. Argyl Plath wrote:

 Hello. I am following along on the blog tutorial and I can't get my
 first view to work.
 
 I set up the database just fine and created my model and controller. I
 copy/pasted in the view code but I get this error:
 
 Notice (8): Undefined property: View::$Html
 Fatal error: Call to a member function link() on a non-object
 
 I tried dumping out $this and saw that in fact there is no Html
 property.
 
 Suggestions?
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: How can i access home page without login?

2010-10-06 Thread Jeremy Burns | Class Outfit
Do you have a pages controller? If so, adding:

parent::beforeFilter();
$this-Auth-allow('display');

..in your beforeFilter() ought to work.

Jeremy Burns
Class Outfit

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

On 4 Oct 2010, at 21:31, redleon wrote:

 I'm using Auth Component. Guest visitor can access register, login,
 remember_password etc. but can not access home page of the site.
 
 I tried everythink i know.
 
 For Auth-Allow () methot, i gave '/', 'home', 'display' parameters.
 But it has not worked.
 
 I would like to give permission for guests to access home page of my
 site.
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Cascading Models in hasone

2010-10-06 Thread Jeremy Burns | Class Outfit
The default behaviour is called 'recursion', where the find will look for 
models directly related to the model you are doing the find on. This is usually 
one level, but by setting var $recursive = n; you'll go to n levels instead. So 
in theory setting var $recursive = 2; will solve your issue, but it can return 
a lot more data than you need as it will bring back all models n steps away, 
not just the ones you really want.

You should use the Containable behaviour 
(http://book.cakephp.org/view/1323/Containable). This allows you very closely 
define which data you want returned. Create a file in /app called app_model.php:

class AppModel extends Model {
var $actsAs = array('Containable');
var $recursive = -1;
}

This makes every model use the Containable behaviour and effectively turns off 
recursion. Then your find would be:
$people = $this-Person-find(
'all',
array(
'contain' = array(
'Adult' = array(
'User'
)
)
)
);

You'll see that it mirrors your three step hierarchy (Person-Adult-User).

Jeremy Burns
Class Outfit

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

On 4 Oct 2010, at 22:20, Rob wrote:

 Hello Everyone,
 
 I'm a new user of CakePHP, and have a project where we need to reflect
 a 3-step hierarchy of inheritance in our database in a model.
 
 We have people, adults, and users.  All users are adults, and people,
 and all adults are people.
 
 
 Ideally our Adults model hasone person, and our Users model hasone
 adult (which would have one person).
 
 
 In my tests, however, we have found that when we instantiate a user,
 it only has an adult associated with it, and not a person.
 
 When we instantiate an adult, it does however have a person beneath
 it.
 
 So in summary, I would like to know if there is a way to instantiate
 users, and have the user's adult and person properties come with it.
 
 Thanks!
 Rob B.
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Beginners question about adjusting views

2010-10-06 Thread Jeremy Burns | Class Outfit
The secret is getting the data right in the controller before you pass it down 
to the view. I'd recommend the Containable behaviour (see this post I just 
replied to) and then do this in your controller function:

$contact = $this-Contact-find(
'first',
array(
'conditions' = array(
'Contact.id' = $id,
),
'contain' = array(
'Capital' = array(
'Capitalclass'
)
)
)
);

$this-set('contact', $contact);

Then in your view you can do:

td?php echo $contact['Capital']['Capitalclass']['name'];?/td

To see what the full array looks like, do this in your view:
die(debug($contact));

Jeremy Burns
Class Outfit

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

On 5 Oct 2010, at 09:39, AvE wrote:

 Hi all,
 
 I'm kind of new to CakePHP and currently learning the system. So far
 I've been able to find answers to my questions via internet and in
 this group, but this time I have a problem where I can't find the
 answer to, also because it's a bit hard to describe.
 
 I'm building an application to store information about companies. Each
 company can have several share capitals and each share capital belongs
 to a class of shares (ie: ordinary, preferent, etc).
 
 For this I made some tables:
 
 The table 'contacts', which has a field capital_id to link it to the
 table capitals
 The table 'capitals', which has a field capitalclass_id to link to the
 table capitalclasses
 The table 'capitalclasses', which just has two fields 'id' and 'name'.
 
 A contact (company) can have several capitals. Each capital only
 belongs to one capitalclass.
 
 The relationship between tables in the code works very well, I used
 cake bake to make the controller and views. When I view a contact all
 data is displayed well.
 
 Also on the bottom the 'baked' code will display the capital details,
 now it's being displayed as:
 
 Capitalclass_id - Amount - Value
 1 - 100 - 1
 
 Of course I don't want the capitalclass_id to be displayed, I want the
 name of the capitalclass to be displayed (in this case 'ordinary' for
 ordinary shares).
 
 As this is the view of a contact and contact has no direct link with
 capitalclass, but only via capital, how can I accomplish this?
 
 The code of contacts/view.ctp to display the capital data:
 
 ?php if (!empty($contact['Contact']['companyname']) 
 $contact['Status']['status'] == 'ACTIVE'):?
   div class=related
   h3?php __('Capital');?/h3
   ?php if (!empty($contact['Capital'])):?
   table cellpadding = 0 cellspacing = 0
  tr
   th?php __('Capitalclass Id'); ?/th
   th?php __('Currency Id'); ?/th
   th?php __('Amount'); ?/th
   th?php __('Value'); ?/th
   th class=actions?php __('Actions');?/th
   /tr
   ?php
   $i = 0;
   foreach ($contact['Capital'] as $capital):
   $class = null;
   if ($i++ % 2 == 0) {
   $class = ' class=altrow';
   }
   ?
   tr?php echo $class;?
   td?php echo $capital['capitalclass_id'];?/td 
 // Here
 should capitalclass.name be displayed instead.
   td?php echo $capital['currency_id'];?/td
   td?php echo $capital['amount'];?/td
   td?php echo $capital['value'];?/td
   td class=actions
   ?php echo $html-link(__('View', true), 
 array('controller' =
 'capitals', 'action' = 'view', $capital['id'])); ?
   ?php echo $html-link(__('Edit', true), 
 array('controller' =
 'capitals', 'action' = 'edit', $capital['id'])); ?
   ?php echo $html-link(__('Delete', true), 
 array('controller'
 = 'capitals', 'action' = 'delete', $capital['id']), null,
 sprintf(__('Are you sure you want to delete # %s?', true),
 $capital['id'])); ?
   /td
   /tr
   ?php endforeach; ?
   /table
?php endif; ?
 
   div class=actions
   ul
   li?php echo $html-link(__('New Capital', true),
 array('controller' = 'capitals', 'action' = 'add'));? /li
   /ul
   /div
/div
 
 I hope it's clear what I mean as it's a bit hard for me to describe
 the problem.
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email 

Re: Fatal error: Out of memory - Even when there is no memory limit

2010-10-06 Thread Jeremy Burns | Class Outfit
It looks like you have some sort of loop in your code, or your query is 
returning far too much data. Try putting some debug statements into the display 
action of your nodes_controller before rendering the view to see what's 
happening. Maybe there are some code and/or database differences between the 
servers.

Jeremy Burns
Class Outfit

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

On 5 Oct 2010, at 16:28, Fuitad wrote:

 Hello,
 
 I'm in charge of transferring a live CakePHP application from one
 server to another. I'm trying to get the new site to work but I'm
 hitting a weird error and I just can't figure it out.
 
 When I try to load the main page, I get this:
 
 Fatal error: Out of memory (allocated 13631488) (tried to allocate
 8192 bytes) in /home/haakqsm/public_html/app/views/nodes/display.ctp
 on line 1
 
 The problem is, this error happens no matter what memory_limit is. For
 example, it's set to -1 right now.
 
 php -i | grep memory
 trtd class=ememory_limit/tdtd class=v-1/tdtd
 class=v-1/td/tr
 
 
 Does anybody have any clue what could be the issue here? Both servers
 (the live one and the new one) have the same php modules installed and
 the same php.ini.
 
 
 
 Server Info:
 
 CentOS release 5.5 (Final)
 Kernel Information:  Linux 2.6.18-194.11.4.el5xen x86_64
 GNU bash, version 3.2.25(1)-release (x86_64-redhat-linux-gnu)
 Copyright (C) 2005 Free Software Foundation, Inc.
 
 # php -v
 PHP 5.2.14 (cgi) (built: Sep 30 2010 11:08:48)
 Copyright (c) 1997-2010 The PHP Group
 Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies
with the ionCube PHP Loader v3.3.20, Copyright (c) 2002-2010, by
 ionCube Ltd.
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: redirect not working

2010-10-06 Thread Akeda Bagus
On Thu, Oct 7, 2010 at 4:17 AM, a17s godlyfr...@googlemail.com wrote:
 Hello, got a problem with using cakephp redirect. Get an error saying
 header already been set. Please how can I redirect to another action
 after processing a post. My error keeps pointing to the cake/
 basic.php, and the controller/controller.php

 See error and code below:

 Error
 
 Congratulations, your new account has been successfully created

 Warning (2): Cannot modify header information - headers already sent
 by (output started at /home/asco3112/public_html/projects/library/cake/
 basics.php:655) [CORE/cake/libs/controller/controller.php, line 746]
 Code | Context

 $status =       Location: http://a17s.com/projects/library/users;

 header - [internal], line ??
 Controller::header() - CORE/cake/libs/controller/controller.php, line
 746
 Controller::redirect() - CORE/cake/libs/controller/controller.php,
 line 725
 UsersController::register() - APP/controllers/users_controller.php,
 line 97
 Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 204
 Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 171
 [main] - APP/webroot/index.php, line 83

 Code
 
 function register(){
                if(!empty($this-data)){
                        $this-User-create($this-data);
                        if($this-User-save($this-data)){
                                $this-Session-setFlash(__('Congratulations, 
 your new account has
 been successfully created'));
                                unset($this-data);
                                $this-redirect(array('controller'='users',
 'action'='index'));
                        }
                                else{
                                //unable to save data
                                $this-Session-setFlash(__('Unable to 
 register user, please try
 again'));

                        }
                }
        }


What's in index action? Make sure there's no echo, pr, etc on model
and controller (check your callbacks). Just look for any statement
that outputs something before the redirect.

-- 
regards,
gedex

blog: http://gedex.web.id

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Cakephp using flaot on part part of a website and removing it on another

2010-10-06 Thread Jeremy Burns | Class Outfit
Sounds like you need to set up a different layout file that has different div 
ids/classes, and then apply css appropriately. 
http://book.cakephp.org/view/1080/Layouts

Jeremy Burns
Class Outfit

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

On 5 Oct 2010, at 20:27, ninja wrote:

 Hi I am still a bit new to phpcake so i already have a page that has
 two floats left and right but now i want to remove the float on
 certain pages of the website eg(About page) which needs the entire
 horizontal spacing of the page.please help
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: help to slove this

2010-10-06 Thread Jeremy Burns | Class Outfit
Cake ships with a default salt value. The salt value is used for encrypting 
passwords and the like. You are supposed to change it to something unique to 
your site. Change it in /app/config/core.php

Jeremy Burns
Class Outfit

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

On 6 Oct 2010, at 13:58, Adnan wrote:

 why this msg is sowing
 Notice (1024): Please change the value of 'Security.salt' in app/
 config/core.php to a salt value specific to your application [CORE\cake
 \libs\debugger.php, line 548]
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: redirect not working

2010-10-06 Thread Jeremy Burns | Class Outfit
You are outputting text to the screen before you do the redirect, so it won't 
work. Rather than doing (and I am guessing what you are doing here) this:

echo Congratulations, your new account has been successfully created;
$this-redirect...etc

...place the text into the session flash:
$this-Session-setFlash('Congratulations, your new account has been 
successfully created');

...and then echo it out in the view you are sending them to:
echo $this-Session-flash();

Jeremy Burns
Class Outfit

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

On 6 Oct 2010, at 22:17, a17s wrote:

 Hello, got a problem with using cakephp redirect. Get an error saying
 header already been set. Please how can I redirect to another action
 after processing a post. My error keeps pointing to the cake/
 basic.php, and the controller/controller.php
 
 See error and code below:
 
 Error
 
 Congratulations, your new account has been successfully created
 
 Warning (2): Cannot modify header information - headers already sent
 by (output started at /home/asco3112/public_html/projects/library/cake/
 basics.php:655) [CORE/cake/libs/controller/controller.php, line 746]
 Code | Context
 
 $status   =   Location: http://a17s.com/projects/library/users;
 
 header - [internal], line ??
 Controller::header() - CORE/cake/libs/controller/controller.php, line
 746
 Controller::redirect() - CORE/cake/libs/controller/controller.php,
 line 725
 UsersController::register() - APP/controllers/users_controller.php,
 line 97
 Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 204
 Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 171
 [main] - APP/webroot/index.php, line 83
 
 Code
 
 function register(){
   if(!empty($this-data)){
   $this-User-create($this-data);
   if($this-User-save($this-data)){
   $this-Session-setFlash(__('Congratulations, 
 your new account has
 been successfully created'));
   unset($this-data);
   $this-redirect(array('controller'='users',
 'action'='index'));
   }
   else{
   //unable to save data
   $this-Session-setFlash(__('Unable to register 
 user, please try
 again'));
 
   }
   }
   }
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


plugin messing with existing routes

2010-10-06 Thread cricket
I'm writing a Poll plugin and have configured the following routes:

Router::connect(
'/polls/vote',
array(
'plugin' = 'poll',
'controller' = 'polls',
'action' ='vote'
)
);
Router::connect(
'/admin/polls',
array(
'plugin' = 'poll',
'admin' = 1,
'controller' = 'polls',
'action' = 'index'
)
);

The first works just fine. However, when trying the 2nd while not yet
logged in, I found myself being redirected to /poll/users/login,
which failed, of course. I thought it was just an Auth thing, so I
created a beforeFilter() in PollAppController, where I re-declared
$loginAction, $loginRedirect, etc. but with 'plugin' = null in each
route array. That fixed the problem with login redirection but I've
since noticed that ALL of my routes have '/poll' prepended when a view
from my plugin is displayed. I mean, all links for the rest of the
site. Everything.

So, do I have to add 'plugin' = null to every route and every
$this-Html-link() call? Please tell me no and that it'll all be
ok.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: How to keep Cake from trying to save certain form inputs ?

2010-10-06 Thread cricket
On Tue, Oct 5, 2010 at 3:25 PM, EJ funkybl...@hotmail.com wrote:
 Folks,

 I have a newbie question:

 I have a form that has certain inputs that just need to be ignored.
 For example a User may be associated (e.g. via HABTM) with a
 particular City
 The City may be associated with a State but I don't need an
 association between State and User.

 When I show the registration form, I want to use AJAX to show you a
 list of states and once you select a state show you the list of cities
 to avoid an overly-long list of cities. But when the form is submitted
 I don't want Cake to try to save the state since there's no direct
 association between user and state.

 Is there a magic setting in the form input to keep it from being set?
 Or do I have to handle it and null it out in the controller?

Model::save() strips them out for you by first checking for it in the
schema using hasField(). If it's not present, it's tossed out.

http://api.cakephp.org/view_source/model/

1307 foreach ($v as $x = $y) {
1308if ($this-hasField($x)  (empty($this-whitelist) ||
in_array($x, $this-whitelist))) {
1309list($fields[], $values[]) = array($x, $y);
1310}
1311}

The $whitelist there is used for when there are fields which do belong
to the model but, for whatever reason, you don't want to save their
values if present in the data. In that case, you'd pass an array of
the ones you DO want written to the DB as the 3rd param to save();
http://api.cakephp.org/class/model#method-Modelsave

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: How to use ORDER BY within Containable Behavior

2010-10-06 Thread cricket
On Tue, Oct 5, 2010 at 6:03 PM, Paul Bricks
eric.liechtenst...@googlemail.com wrote:
 I would like to have a sorted-array (order by) to print out in my Post-
 View.
 The Problem is, that the order-by-attribute (Category.name) lies
 deeper
 than attributes (Post.id, Tag.id, ...), which have to be ordered.

 Here is my example:

 Relations:
 Post -- hasMany -- Tag -- belongsTo -- Category


 PostsController:
 ...
 $posts = $this-Post-find('all', array (
        'contain' = array (
                'Tag' = array (
                        'Category' = array (
                                'fields' = array (
                                        'id',
                                        'name'
                                )
                        )
                )
        )
 ));
 $this-set('posts', $posts);
 ...


 Now i would like to to print out the posts-aray in my Post-View
 to get this ordered table (order-by Category.name ASC):

 Post.id         Tag.id          Category.name
 -
 1                       3                       Basketball
 1                       2                       Football
 2                       4                       Hockey
 4                       1                       Tennis


 And my Question is:
 Where do i have to put the order-clause to get this array, shown
 above.
 And if this will not work like this way, how will it work otherwise?

So, you want to order the Posts by Category? Is that correct?

Normally, one can include an 'order' param at the same level one would
put 'fields', at whatever level under 'contain'. However, I don't
think what you want to do is possible with a find() on Post. What you
could do, though, is run the find() on Category, taking advantage of
the chain of associations.

$data = $this-Post-Tag-Category-find(
'all',
array(
'fields' = array(
'Category.id',
'Category.name'
),
'order' = array('Category.name' = 'ASC'),
'contain' = array(
'Tag' = array(
'fields' = array(
'Tag.id',
'Tag.name' // for example
),
'Post' = array(
'fields' = array(
'Post.id',
'Post.title' // for example
)
)
)
)
)
);

Note that you should specify the fields for Post or you'll fetch
everything (which it appears you don't want). Also, you should get in
the habit of specifying the model name. There are situations where not
doing so can lead to bad queries (eg. Column 'id' in field list is
ambiguous).

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Fatal error: Out of memory - Even when there is no memory limit

2010-10-06 Thread j.blotus
when you do phpinfo() from inside that view, does it still show -1 for
memory limit?

On Oct 5, 11:28 am, Fuitad fui...@gmail.com wrote:
 Hello,

 I'm in charge of transferring a live CakePHP application from one
 server to another. I'm trying to get the new site to work but I'm
 hitting a weird error and I just can't figure it out.

 When I try to load the main page, I get this:

 Fatal error: Out of memory (allocated 13631488) (tried to allocate
 8192 bytes) in /home/haakqsm/public_html/app/views/nodes/display.ctp
 on line 1

 The problem is, this error happens no matter what memory_limit is. For
 example, it's set to -1 right now.

 php -i | grep memory
 trtd class=ememory_limit/tdtd class=v-1/tdtd
 class=v-1/td/tr

 Does anybody have any clue what could be the issue here? Both servers
 (the live one and the new one) have the same php modules installed and
 the same php.ini.

 

 Server Info:

 CentOS release 5.5 (Final)
 Kernel Information:  Linux 2.6.18-194.11.4.el5xen x86_64
 GNU bash, version 3.2.25(1)-release (x86_64-redhat-linux-gnu)
 Copyright (C) 2005 Free Software Foundation, Inc.

 # php -v
 PHP 5.2.14 (cgi) (built: Sep 30 2010 11:08:48)
 Copyright (c) 1997-2010 The PHP Group
 Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies
     with the ionCube PHP Loader v3.3.20, Copyright (c) 2002-2010, by
 ionCube Ltd.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Using Form type of GET makes input elements have blank name attributes?

2010-10-06 Thread cricket
On Tue, Oct 5, 2010 at 11:16 PM, Michael T michael.to...@gmail.com wrote:
 Hello,

 I have a form in a view which is created using the FormHelper in the
 following way:

 echo $this-Form-create(False, array('action' = 'something', 'type'
 = 'get'));

 I then have an input for the form defined in the following way:

 echo $this-Form-input('department', array('id' = 'department',
 'options' = $departments, 'empty' = '(select)'));

 When the form type is set to Get in this way, the HTML rendered for
 the form input does not contain a name attribute (the name attribute
 is empty):

 select name= id=department ... /select

 But when I change the form type to Post like this:

 echo $this-Form-create(False, array('action' = 'something', 'type'
 = 'post'));

 and render the same input, the resulting HTML is:

 select id=department name=data[department] ... /select

 Why does the name disappear for Get type forms?

Odd. Have a poke around FormHelper's source, beginning with the
_name() and text() methods. Set some Debugger::log() lines to catch
the $options being passed.

 I noticed that this
 hidden input is not rendered with Get, but it is with Post:

 div style=display: none;input type=hidden value=POST
 name=_method/div

I believe that's normal for a GET form.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Paypal integration

2010-10-06 Thread cricket
google 'cakephp paypal'. There are several plugins, components, etc.
out there that handle PP's non-API IPN method.

On Wed, Oct 6, 2010 at 5:17 AM, Warrior warcool1...@gmail.com wrote:
 Hi Guys!

 I am integrating my site with paypal, as per requirement I am not
 suppose to use the api credentials for integrating paypal with
 website.
 is there any way to integrate paypal directly without api integration?

 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.

 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en


Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Strange issue using mysqlnd and the character encoding

2010-10-06 Thread EJ
You might try to dump both databases and make sure the encoding on the
DB/tables is the same.
Depending on your system, one may default to utf8 and the other to
latin1.

Not sure if that's it or not but worth a look.

On Oct 5, 8:54 am, 5942marine jluken...@gmail.com wrote:
 Okay, let me give you a little background on the issue. Up until know,
 I've been using Cakephp 1.3.3 with PHP 5.3.2. Now, my site has two
 parts, a front end for users and my crawlers, which I run at home,
 again, using Cakephp 1.3.0

 My crawlers basically hit RSS feeds for twiter and google blog search.
 Now, ever since I decided to use my Mac Pro at home for the crawlers,
 instead of Ubutnu, I've ran into a issue. Basically, when I'm using
 Snow Leopard at home and the daemon is running, it seems to not encode
 some of my datarows that are inserted into the db. The only difference
 between my setups that I can tell, is that Ubuntu is still using the
 mysql api driver and Snow Leopard, is using the mysqlnd.

 On my dev site, I've been doing some debugging and found that my
 articles that have the issues, don't have a proper character encoding,
 thus is why i'm seeing some strange characters in the title, etc.

 Now, when I'm running Ubuntu at home for my crawlers, and it's
 updating my site, I never have any of these issues. Again, they're
 both running the same version of PHP and the only difference that I
 can tell when executing a phpinfo(); is the Driver that mysql is
 using.

 I've been working on this for the past week. I know it's an encoding
 issue, where the following characters seem to render incorrectly, such
 as - or |

 Anyways, just curious if anyone else has ran into some issues using
 the mysqlnd. I'm not even 100% that's the culprit, but from all my
 research, that's what I'm focusing on right now.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: How to keep Cake from trying to save certain form inputs ?

2010-10-06 Thread EJ
Thanks for your help cricket!
Something else might be going on as it seems to break unless I clear
those values out.
I'll try to do some more debugging but this definitely gives me a
clue.
I really appreciate your help.

On Oct 6, 9:00 pm, cricket zijn.digi...@gmail.com wrote:
 On Tue, Oct 5, 2010 at 3:25 PM, EJ funkybl...@hotmail.com wrote:
  Folks,

  I have a newbie question:

  I have a form that has certain inputs that just need to be ignored.
  For example a User may be associated (e.g. via HABTM) with a
  particular City
  The City may be associated with a State but I don't need an
  association between State and User.

  When I show the registration form, I want to use AJAX to show you a
  list of states and once you select a state show you the list of cities
  to avoid an overly-long list of cities. But when the form is submitted
  I don't want Cake to try to save the state since there's no direct
  association between user and state.

  Is there a magic setting in the form input to keep it from being set?
  Or do I have to handle it and null it out in the controller?

 Model::save() strips them out for you by first checking for it in the
 schema using hasField(). If it's not present, it's tossed out.

 http://api.cakephp.org/view_source/model/

 1307     foreach ($v as $x = $y) {
 1308    if ($this-hasField($x)  (empty($this-whitelist) ||
 in_array($x, $this-whitelist))) {
 1309    list($fields[], $values[]) = array($x, $y);
 1310    }
 1311    }

 The $whitelist there is used for when there are fields which do belong
 to the model but, for whatever reason, you don't want to save their
 values if present in the data. In that case, you'd pass an array of
 the ones you DO want written to the DB as the 3rd param to 
 save();http://api.cakephp.org/class/model#method-Modelsave

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en