Thursday, February 28, 2013

Re: What happeened to the API Documentation on CakePHP.org?

That was a quick fix. Nice job :)

On Thursday, February 28, 2013 5:46:01 PM UTC+1, José Lorenzo wrote:
Issues have been fixed now, you can revisit the site and have an overview of all the classes. :)

On Thursday, February 28, 2013 2:56:38 PM UTC+1, Renan Gonçalves wrote:
There are some issues that are preventing us to have the full API featured on the website.


On Thursday, February 28, 2013 10:55:54 AM UTC+1, senser wrote:
I cannot agree. The new view of API is terrible for me. 
I liked to browse classes without typing their names and really loved all classes visible on single page.
Another annoying change is the order of class methods - it's not alphabetical anymore, but why ?!? How to find a particular method in class - I have to scroll and read (eventually) all class methods to find what I'm looking for.
And finally - I've never been interested of cake "packages", I've always looked for "classes". Now while reading HtmlHelperClass (for example) on the left panel I can select other "similar" helpers, but what if I want to read CakeResponse class. I have to use search box on the top, or must know the package that CakeResponse belongs to, and explore the package.

27 февруари 2013, сряда, 08:55:04 UTC+2, jodator написа:
Hi there,

they've changed the API yesterday, and i found it quite good.


I've found it by using the search box (it has a very nice autocomplete).

Just remember to choose CakePHP version.


On Tuesday, February 26, 2013 7:52:10 PM UTC+1, kdubya wrote:
Exactly. When I used to go there I could choose to see the ALL the classes and choose from an alphabetical list. Now it shows a structure off to the left but when I try to find something like Debugger it is nowhere I can find.

When I go to the 2.0 version of the API (http://api.cakephp.org/2.0) to the left there is a structure that makes some sense. Debugger is found under Utilities. Not so under 1.3.

Is there still some work going on here that the structure is not complete?

Ken

On Tuesday, February 26, 2013 1:26:43 PM UTC-5, kdubya wrote:
I can't find the classes anymore. I was specifically looking for the Debugger class in 1.3. The structure that used to be there until recently is gone. What happened? Did I miss something?

Ken

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Re: Hash.php

I don't have a copy of 2.2.5 here, and I can't navigate the new online
API, but I have 2.2.4 here. That foreach() assumes that $parts is an
array, but it shouldn't.

Do you get a stack trace? Have you tried installing DebugKit? It's worth it.

On Wed, Feb 27, 2013 at 1:45 PM, Ed Propsner <crotchfrog@gmail.com> wrote:
> (Cake 2.2.5) I recently started getting an error that reads:
> Warning (2): Invalid argument supplied for foreach()
> [CORE]/Cake/Utility/Hash.php, Line 50]
>
> Line 50 in Hash.php is part of get() function for the Hash class. Trying to
> debug anything in that function results in a memory allocation error. How is
> Hash being used and what kind of data is being presented to the function
> that it's running out of memory?
>
> There are only two users in the database at the moment and the error is only
> showing for one of them. The method in my Users controller that seems to be
> triggering the error is:
>
> public function view($id = null){
>
> if ($id == null){
> $id = $this->Auth->user('username');
> }
> $user = $this->User->getUser($id);
> $this->set(compact('user'));
> }
>
> getUser() in the User model is:
>
> public function getUser($id){
>
> if (is_numeric($id)){
> $user = $this->find('first', array(
> 'conditions' => array(
> 'User.id' => $id),
> 'contain' => array('Avatar', 'Bio', 'Role', 'Group')
> ));
> } else {
> $user = $this->find('first', array(
> 'conditions' => array(
> 'username' => $id),
> 'contain' => array('Avatar', 'Bio', 'Role', 'Group')
> ));
> }
> if ($user){
> return $user;
> } return false;
> }
>
> Wondering what Hash is looking for and why it's reporting an error with this
> particular method. The app has been running error free for quite some time
> and I can't think of anything I changed that would have produced the error.
>
> Any help is appreciated.
>
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to cake-php+unsubscribe@googlegroups.com.
> To post to this group, send email to cake-php@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

How to install without pear

I have a version of pear that is too old to install Cake 2.3.0 and I'm not in a position to upgrade it.  The readme.md is pretty slim on how to install it.  Is there a good current guide somewhere?

thanks


--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Re: help for cakephp2.x template

hi,
go here : /app/Views/Layouts/default.ctp  HTML file
go here : /app/webroot/css/  CSS file

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Re: beforeValidate can't modify my data

This isn't helpful:(

I think is not complicated?

W dniu czwartek, 28 lutego 2013 22:03:59 UTC+1 użytkownik André Luis napisał:
Try:

public function beforeValidate($options = array()) {
        $data=&$this->data['Photo'];
        foreach($data as $k=>$v){
            if(empty($v['name'])) unset($data[$k]);
        }
        return true;
    }

Em quarta-feira, 27 de fevereiro de 2013 20h58min12s UTC-3, kicaj escreveu:
I create form with many fields and fields for upload files (Photo.0.image, Photo.1.image).

How do I choose from my computer two files to upload and send form, then works perfectly. But sometimes I would like upload only one file (Photo.0.image) and the secend input file (Photo.1.image) leave empty. I prepare Photo::beforeValidate for this:

public function beforeValidate($options = array()) {
if(empty($this->data['Photo']['image']['tmp_name'])) {
unset($this->data['Photo']);
}
return true;
}

But my SaveAll() return false and results for pr($this->News->validationErrors) is:

Array (
[Photo] => Array (
[1] => Array ()
)
)

What going on?
Any idea?

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Re: beforeValidate can't modify my data

Try:

public function beforeValidate($options = array()) {
        $data=&$this->data['Photo'];
        foreach($data as $k=>$v){
            if(empty($v['name'])) unset($data[$k]);
        }
        return true;
    }

Em quarta-feira, 27 de fevereiro de 2013 20h58min12s UTC-3, kicaj escreveu:
I create form with many fields and fields for upload files (Photo.0.image, Photo.1.image).

How do I choose from my computer two files to upload and send form, then works perfectly. But sometimes I would like upload only one file (Photo.0.image) and the secend input file (Photo.1.image) leave empty. I prepare Photo::beforeValidate for this:

public function beforeValidate($options = array()) {
if(empty($this->data['Photo']['image']['tmp_name'])) {
unset($this->data['Photo']);
}
return true;
}

But my SaveAll() return false and results for pr($this->News->validationErrors) is:

Array (
[Photo] => Array (
[1] => Array ()
)
)

What going on?
Any idea?

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Re: beforeValidate can't modify my data

Thanks MaJerle.Eu for reply, but you're wrong.
If read my question carefully News hasMany Photo.
In Photo::beforeValidation() there is no $this->data['Photo']['0']['image'] but is $this->data['Photo']['image']) and Your code doesn't work.

I still looking solutions...

W dniu czwartek, 28 lutego 2013 07:57:41 UTC+1 użytkownik MaJerle.Eu napisał:
something like 

public function beforeValidate($options = array()) {
if(empty($this->data['Photo']['0']['image']['tmp_name'])) { //zero is added in array structure (Photo.0.image....
unset($this->data['Photo']);
}
return true;
}

I hope it helps

and if you have more fields than 2, you can make for loop and inside for just change this "zero" to 1, 2, 3, 4, 5... how many fields you have.

Have fun!

--
Lep pozdrav, Tilen Majerle


2013/2/28 kicaj <ki...@kdev.pl>
I create form with many fields and fields for upload files (Photo.0.image, Photo.1.image).

How do I choose from my computer two files to upload and send form, then works perfectly. But sometimes I would like upload only one file (Photo.0.image) and the secend input file (Photo.1.image) leave empty. I prepare Photo::beforeValidate for this:

public function beforeValidate($options = array()) {
if(empty($this->data['Photo']['image']['tmp_name'])) {
unset($this->data['Photo']);
}
return true;
}

But my SaveAll() return false and results for pr($this->News->validationErrors) is:

Array (
[Photo] => Array (
[1] => Array ()
)
)

What going on?
Any idea?

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+u...@googlegroups.com.
To post to this group, send email to cake...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Re: What happeened to the API Documentation on CakePHP.org?

Issues have been fixed now, you can revisit the site and have an overview of all the classes. :)

On Thursday, February 28, 2013 2:56:38 PM UTC+1, Renan Gonçalves wrote:
There are some issues that are preventing us to have the full API featured on the website.


On Thursday, February 28, 2013 10:55:54 AM UTC+1, senser wrote:
I cannot agree. The new view of API is terrible for me. 
I liked to browse classes without typing their names and really loved all classes visible on single page.
Another annoying change is the order of class methods - it's not alphabetical anymore, but why ?!? How to find a particular method in class - I have to scroll and read (eventually) all class methods to find what I'm looking for.
And finally - I've never been interested of cake "packages", I've always looked for "classes". Now while reading HtmlHelperClass (for example) on the left panel I can select other "similar" helpers, but what if I want to read CakeResponse class. I have to use search box on the top, or must know the package that CakeResponse belongs to, and explore the package.

27 февруари 2013, сряда, 08:55:04 UTC+2, jodator написа:
Hi there,

they've changed the API yesterday, and i found it quite good.


I've found it by using the search box (it has a very nice autocomplete).

Just remember to choose CakePHP version.


On Tuesday, February 26, 2013 7:52:10 PM UTC+1, kdubya wrote:
Exactly. When I used to go there I could choose to see the ALL the classes and choose from an alphabetical list. Now it shows a structure off to the left but when I try to find something like Debugger it is nowhere I can find.

When I go to the 2.0 version of the API (http://api.cakephp.org/2.0) to the left there is a structure that makes some sense. Debugger is found under Utilities. Not so under 1.3.

Is there still some work going on here that the structure is not complete?

Ken

On Tuesday, February 26, 2013 1:26:43 PM UTC-5, kdubya wrote:
I can't find the classes anymore. I was specifically looking for the Debugger class in 1.3. The structure that used to be there until recently is gone. What happened? Did I miss something?

Ken

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Re: Error on Model

Thats not a CakePHP but a MySQL error message…
do you enough disk space available on you server ?

Andras Kende


On Feb 28, 2013, at 3:27 AM, rogerbenevento <rogerbenevento@gmail.com> wrote:

Hello, sorry my english

I have a problem that I don't have idea what can be:
Error: SQLSTATE[HY000]: General error: 126 Incorrect key file for table '/tmp/#sql_405a_0.MYI'; try to repair it

Somebody can I help me?

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

help for cakephp2.x template

i'm a newbie using cakephp. could anyone help me on how to change the default template. 
i'm thinking on to use a different template for my project.... any tutorial or video tutorial if you have...
could you help me please...

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Auth doesn't work in iframe

Hello everyone,

I'm running a website with CakePHP 2.2.5 using the AuthComponent for login. Which works great. But when I include this website into an iframe, login is not possible anymore. Can someone verify this behavior for his own app? Just do

<!DOCTYPE HTML>
<html>
<title>iframe test</title>
<body>
    <iframe src="http://your-cakephp-app.com" width="700px" height="700px"></iframe>
</body>
</html>


Thank, Tobias

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Re: What happeened to the API Documentation on CakePHP.org?

There are some issues that are preventing us to have the full API featured on the website.

Check those: https://github.com/cakephp/cakephp-api-docs/issues

On Thursday, February 28, 2013 10:55:54 AM UTC+1, senser wrote:
I cannot agree. The new view of API is terrible for me. 
I liked to browse classes without typing their names and really loved all classes visible on single page.
Another annoying change is the order of class methods - it's not alphabetical anymore, but why ?!? How to find a particular method in class - I have to scroll and read (eventually) all class methods to find what I'm looking for.
And finally - I've never been interested of cake "packages", I've always looked for "classes". Now while reading HtmlHelperClass (for example) on the left panel I can select other "similar" helpers, but what if I want to read CakeResponse class. I have to use search box on the top, or must know the package that CakeResponse belongs to, and explore the package.

27 февруари 2013, сряда, 08:55:04 UTC+2, jodator написа:
Hi there,

they've changed the API yesterday, and i found it quite good.


I've found it by using the search box (it has a very nice autocomplete).

Just remember to choose CakePHP version.


On Tuesday, February 26, 2013 7:52:10 PM UTC+1, kdubya wrote:
Exactly. When I used to go there I could choose to see the ALL the classes and choose from an alphabetical list. Now it shows a structure off to the left but when I try to find something like Debugger it is nowhere I can find.

When I go to the 2.0 version of the API (http://api.cakephp.org/2.0) to the left there is a structure that makes some sense. Debugger is found under Utilities. Not so under 1.3.

Is there still some work going on here that the structure is not complete?

Ken

On Tuesday, February 26, 2013 1:26:43 PM UTC-5, kdubya wrote:
I can't find the classes anymore. I was specifically looking for the Debugger class in 1.3. The structure that used to be there until recently is gone. What happened? Did I miss something?

Ken

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Re: CakePHP 2.3.0 tutorial blog: Model file name and validation problems

On Wed, 27 Feb 2013 14:43:59 +0000 (UTC), Virgo Pärna <virgo.parna@mail.ee> wrote:
> I'm trying to learn CakePHP by doing tutorial blog (but that tutorial is 2.2 -
> mayby that's the problem) and I'm having two problems.
>
> When I name model file as Post.php, then every page outputs model at the top
> of web page.
> Like this:
> class Post extends AppModel { public $validate = array( 'title' =>
> array( 'rule' => 'notEmpty' ), 'body' => array( 'rule' => 'notEmpty' ) );
> } class Post extends AppModel { public $validate = array( 'title' =>
> array( 'rule' => 'notEmpty' ), 'body' => array( 'rule' => 'notEmpty' ) ); }

Ok, seems that model file needs to have <?php at the first line. This
is something that tutorial does not mention at all. And I'm rarely using php,
so it's easy to forgot, that php requires beginning tag.

--
Virgo Pärna
virgo.parna@mail.ee

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

Error on Model

Hello, sorry my english

I have a problem that I don't have idea what can be:
Error: SQLSTATE[HY000]: General error: 126 Incorrect key file for table '/tmp/#sql_405a_0.MYI'; try to repair it

Somebody can I help me?

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Re: Help / Source code for Simple Authentication tutorial

I had this problem and fixed it

in my AppController.php file  I had:
     class AppController extends Controller {

      public $components=array('DebugKit.Toolbar');
      public $helpers = array('Html', 'Form', 'Session');
      public $components = array('Session');

Removing the last 2 lines to a different controller (UsersController.php in my case)   got rid of the error :)



--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Re: What happeened to the API Documentation on CakePHP.org?

I cannot agree. The new view of API is terrible for me. 
I liked to browse classes without typing their names and really loved all classes visible on single page.
Another annoying change is the order of class methods - it's not alphabetical anymore, but why ?!? How to find a particular method in class - I have to scroll and read (eventually) all class methods to find what I'm looking for.
And finally - I've never been interested of cake "packages", I've always looked for "classes". Now while reading HtmlHelperClass (for example) on the left panel I can select other "similar" helpers, but what if I want to read CakeResponse class. I have to use search box on the top, or must know the package that CakeResponse belongs to, and explore the package.

27 февруари 2013, сряда, 08:55:04 UTC+2, jodator написа:
Hi there,

they've changed the API yesterday, and i found it quite good.


I've found it by using the search box (it has a very nice autocomplete).

Just remember to choose CakePHP version.


On Tuesday, February 26, 2013 7:52:10 PM UTC+1, kdubya wrote:
Exactly. When I used to go there I could choose to see the ALL the classes and choose from an alphabetical list. Now it shows a structure off to the left but when I try to find something like Debugger it is nowhere I can find.

When I go to the 2.0 version of the API (http://api.cakephp.org/2.0) to the left there is a structure that makes some sense. Debugger is found under Utilities. Not so under 1.3.

Is there still some work going on here that the structure is not complete?

Ken

On Tuesday, February 26, 2013 1:26:43 PM UTC-5, kdubya wrote:
I can't find the classes anymore. I was specifically looking for the Debugger class in 1.3. The structure that used to be there until recently is gone. What happened? Did I miss something?

Ken

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Re: How to echo and play videos in Cakephp

You can also use http://videojs.com/

On Thu, Feb 28, 2013 at 2:18 PM, Marcus James <marcomtl@gmail.com> wrote:
You can use jPlayer http://www.jplayer.org/

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Thanks & Regards

Chetan Patel

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Re: How to echo and play videos in Cakephp

You can use jPlayer http://www.jplayer.org/

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

How to echo and play videos in Cakephp

I have an application were by users can upload images and should be able to echo and play videos. My upload function works fine but challenge that i am having now is to echo and play the video. Here is how i am uploading the file

    function uploadFile() {
    $file = $this->data['CpdVideo']['file'];
    if ($file['error'] === UPLOAD_ERR_OK) {
    $id = String::uuid();
    if (move_uploaded_file($file['tmp_name'], WWW_ROOT . 'files/videos/' . $file['name'])) {
    $this->request->data['CpdVideo']['filename'] = $file['name'];
    $this->request->data['CpdVideo']['filesize'] = $file['size'];
    $this->request->data['CpdVideo']['filemime'] = $file['type'];
    return true;
    }
    }
    return false;
    }

Here is how i am saving the video

    if ($this->uploadFile() && $this->CpdVideo->save($this->data))

This how i am trying to echo and play the video in my view.ctp

    <?php echo $this->Html->media('files/videos'. $cpdVideo['CpdVideo']['filename'], array('fullBase' => true));

If any one could help me out that would be awesome

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Wednesday, February 27, 2013

Re: beforeValidate can't modify my data

something like 

public function beforeValidate($options = array()) {
if(empty($this->data['Photo']['0']['image']['tmp_name'])) { //zero is added in array structure (Photo.0.image....
unset($this->data['Photo']);
}
return true;
}

I hope it helps

and if you have more fields than 2, you can make for loop and inside for just change this "zero" to 1, 2, 3, 4, 5... how many fields you have.

Have fun!

--
Lep pozdrav, Tilen Majerle


2013/2/28 kicaj <kicaj@kdev.pl>
I create form with many fields and fields for upload files (Photo.0.image, Photo.1.image).

How do I choose from my computer two files to upload and send form, then works perfectly. But sometimes I would like upload only one file (Photo.0.image) and the secend input file (Photo.1.image) leave empty. I prepare Photo::beforeValidate for this:

public function beforeValidate($options = array()) {
if(empty($this->data['Photo']['image']['tmp_name'])) {
unset($this->data['Photo']);
}
return true;
}

But my SaveAll() return false and results for pr($this->News->validationErrors) is:

Array (
[Photo] => Array (
[1] => Array ()
)
)

What going on?
Any idea?

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

beforeValidate can't modify my data

I create form with many fields and fields for upload files (Photo.0.image, Photo.1.image).

How do I choose from my computer two files to upload and send form, then works perfectly. But sometimes I would like upload only one file (Photo.0.image) and the secend input file (Photo.1.image) leave empty. I prepare Photo::beforeValidate for this:

public function beforeValidate($options = array()) {
if(empty($this->data['Photo']['image']['tmp_name'])) {
unset($this->data['Photo']);
}
return true;
}

But my SaveAll() return false and results for pr($this->News->validationErrors) is:

Array (
[Photo] => Array (
[1] => Array ()
)
)

What going on?
Any idea?

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Re: [SOLVED] Calling functions in other controllers

the best place to start is with the book.

http://book.cakephp.org/2.0/en/index.html

Read through and work through the example applications

On Wednesday, February 27, 2013 12:10:27 PM UTC-5, Ganapathi Raman wrote:
Hi Friends,

   I am new to the Cake-PHP...I don't know how to start and where to start...So,Please guide me..

     Regards,

Ganapathi Raman.p

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Re: Not seeing validation errors with saveAll

Anyone? Are specific validation errors for a bunch of records even possible?

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Hash.php

(Cake 2.2.5) I recently started getting an error that reads:
Warning (2): Invalid argument supplied for foreach() [CORE]/Cake/Utility/Hash.php, Line 50]

Line 50 in Hash.php is part of get() function for the Hash class. Trying to debug anything in that function results in a memory allocation error. How is Hash being used and what kind of data is being presented to the function that it's running out of memory? 

There are only two users in the database at the moment and the error is only showing for one of them. The method in my Users controller that seems to be triggering the error is: 

public function view($id = null){
   
       if ($id == null){
           $id = $this->Auth->user('username');
       }
       $user = $this->User->getUser($id); 
       $this->set(compact('user'));
    }

getUser() in the User model is: 

public function getUser($id){
         
if (is_numeric($id)){ 
$user = $this->find('first', array(
            'conditions' => array(
                'User.id' => $id),
            'contain' => array('Avatar', 'Bio', 'Role', 'Group')
            )); 
} else { 
$user = $this->find('first', array(
            'conditions' => array(
                'username' => $id),
            'contain' => array('Avatar', 'Bio', 'Role', 'Group')
            )); 
}
        if ($user){
            return $user;
        } return false; 
    }

Wondering what Hash is looking for and why it's reporting an error with this particular method. The app has been running error free for quite some time and I can't think of anything I changed that would have produced the error. 

Any help is appreciated. 

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Re: Upgrading from 1.3.15 to 2.2.7 or 2.3

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Brian,

at the moment I am stuck with the same problem. See two of my other
recent posts here. Since I have had no success so far I can only tell
you that I had problems with both versions. So sorry no really helpful
advice from me, just sympathy ;)

Calamity Jane


Am 27.02.2013 18:11, schrieb lirc201:
> One more question. I currently have an application on 1.3.15 and want to
> use the upgrade-shell. Can I upgrade straight to 2.2.7 or 2.3 rather than
> the 2.0 branch that is generically mentioned in
> http://book.cakephp.org/2.0/en/console-and-shells/upgrade-shell.html#upgrade-shell.
> I tried a quick run through of the instructions with 2.0.6 and ran into
> some issues with the upgrade shell. I have not investigated the further
> but my app_controller was renamed to "<?php?".
>
> Thanks,
> Brian
>
>

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iEYEARECAAYFAlEuTx0ACgkQbOdiIJzHNKHf7QCgk9CpMu5tJ3BrBM9klB7DrWHS
f/8AoLGWSAmKzzzt+yO3xMBlGHs+tcz5
=PvX2
-----END PGP SIGNATURE-----

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

Re: Stuck with migration from 1.3 to 2.x / euromark plugin

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Euromark!

> It seems you have not very much experience with Cake and how plugins work.
True on that ;) Just used them once before.


> So it might not be wise
> to try to work with my plugin. You will most likely run into quite a few
> other problems, as well.
> Better stick to the official plugin and migration guide as well as the
> documentation there:
> http://book.cakephp.org/2.0/en/console-and-shells/upgrade-shell.html
I started with that at first but ended up in errors in the generated
code I didn't get away. I also asked for help on that here, but it seems
I am the only person having that problem. Subject was: Migration problem
"PHP Fatal error: Class 'Inflector' not found"

>
> In case you still want to go ahead:
> yes, you would have to create such an APP/Plugin folder with the plugin
> inside it as APP/Plugin/Upgrade.
>
> So far you seem to be on the right track. Try to clear the cache - it might
> still have 1.3 paths cached etc.
I did that, too. Didn't help. Sorry....

I guess I will give it a final try in a few days and if that doesn't
work out I will stay with 1.3.


Calamity Jane


> Mark
>
>
>
> Am Montag, 25. Februar 2013 20:52:33 UTC+1 schrieb acl68:
>>
> Hi euromark,
>
>
> some questions to your readme:
>
> a) Copy this plugin into your /app/Plugin folder
> My app doesn't have a Plugin folder just a plugins folder. So I created
> an empty folder Plugin.
> Was that correct?
>
> b) I copied the contents of the Zip file in that folder so that I have 3
> subfolders: Console, Lib, Test
> Was taht correct or should the folder upgrade-master go there?
>
> c) In your readmy you mention "Run any of the above commands." My
> problem is that nowhere above you mention any commands. That comes
> later. So to which commands are you referring?
>
> d) If I try to run the following command (being in my app folder)
> /var/www/cakephp-2.3.0/app$ ../lib/Cake/Console/cake Upgrade.Upgrade
> locations -v
>
>
> I get the following output:
> PHP MissingPluginException: Plugin Upgrade could not be found. in
> /var/www/cakephp-2.3.0/lib/Cake/Core/CakePlugin.php on line 142
> PHP Stack trace:
> PHP 1. {main}() /var/www/cakephp-2.3.0/lib/Cake/Console/cake.php:0
> PHP 2. ShellDispatcher::run($argv = array (0 =>
> '/var/www/cakephp-2.3.0/lib/Cake/Console/cake.php', 1 => '-working', 2
> => '/var/www/cakephp-2.3.0/app', 3 => 'Upgrade.Upgrade', 4 =>
> 'locations', 5 => '-v'))
> /var/www/cakephp-2.3.0/lib/Cake/Console/cake.php:43
> PHP 3. ShellDispatcher->dispatch()
> /var/www/cakephp-2.3.0/lib/Cake/Console/ShellDispatcher.php:67
> PHP 4. ShellDispatcher->_getShell($shell = 'Upgrade.Upgrade')
> /var/www/cakephp-2.3.0/lib/Cake/Console/ShellDispatcher.php:189
> PHP 5. class_exists('UpgradeShell')
> /var/www/cakephp-2.3.0/lib/Cake/Console/ShellDispatcher.php:239
> PHP 6. App::load($className = 'UpgradeShell')
> /var/www/cakephp-2.3.0/lib/Cake/Console/ShellDispatcher.php:0
> PHP 7. App::path($type = 'Console/Command', $plugin = 'Upgrade')
> /var/www/cakephp-2.3.0/lib/Cake/Core/App.php:542
> PHP 8. App::pluginPath($plugin = 'Upgrade')
> /var/www/cakephp-2.3.0/lib/Cake/Core/App.php:225
> PHP 9. CakePlugin::path($plugin = 'Upgrade')
> /var/www/cakephp-2.3.0/lib/Cake/Core/App.php:364
>
>
> MissingPluginException: Plugin Upgrade could not be found. in
> /var/www/cakephp-2.3.0/lib/Cake/Core/CakePlugin.php on line 142
>
> Call Stack:
> 0.0003 232072 1. {main}()
> /var/www/cakephp-2.3.0/lib/Cake/Console/cake.php:0
> 0.0095 317704 2. ShellDispatcher::run($argv = array (0 =>
> '/var/www/cakephp-2.3.0/lib/Cake/Console/cake.php', 1 => '-working', 2
> => '/var/www/cakephp-2.3.0/app', 3 => 'Upgrade.Upgrade', 4 =>
> 'locations', 5 => '-v'))
> /var/www/cakephp-2.3.0/lib/Cake/Console/cake.php:43
> 0.0637 1920272 3. ShellDispatcher->dispatch()
> /var/www/cakephp-2.3.0/lib/Cake/Console/ShellDispatcher.php:67
> 0.0638 1920576 4. ShellDispatcher->_getShell($shell =
> 'Upgrade.Upgrade')
> /var/www/cakephp-2.3.0/lib/Cake/Console/ShellDispatcher.php:189
> 0.0640 1922128 5. class_exists('UpgradeShell')
> /var/www/cakephp-2.3.0/lib/Cake/Console/ShellDispatcher.php:239
> 0.0640 1922424 6. App::load($className = 'UpgradeShell')
> /var/www/cakephp-2.3.0/lib/Cake/Console/ShellDispatcher.php:0
> 0.0641 1923032 7. App::path($type = 'Console/Command', $plugin
> = 'Upgrade') /var/www/cakephp-2.3.0/lib/Cake/Core/App.php:542
> 0.0641 1923168 8. App::pluginPath($plugin = 'Upgrade')
> /var/www/cakephp-2.3.0/lib/Cake/Core/App.php:225
> 0.0641 1923200 9. CakePlugin::path($plugin = 'Upgrade')
> /var/www/cakephp-2.3.0/lib/Cake/Core/App.php:364
>
> Dump $_SERVER
> $_SERVER['HTTP_HOST'] is undefined
> $_SERVER['SERVER_NAME'] is undefined
>
> Variables in local scope (#9):
> $_plugins = *uninitialized*
> $plugin = 'Upgrade'
>
> Error: Plugin Upgrade could not be found.
> #0 /var/www/cakephp-2.3.0/lib/Cake/Core/App.php(364):
> CakePlugin::path('Upgrade')
> #1 /var/www/cakephp-2.3.0/lib/Cake/Core/App.php(225):
> App::pluginPath('Upgrade')
> #2 /var/www/cakephp-2.3.0/lib/Cake/Core/App.php(542):
> App::path('Console/Command', 'Upgrade')
> #3 [internal function]: App::load('UpgradeShell')
> #4 [internal function]: spl_autoload_call('UpgradeShell')
> #5 /var/www/cakephp-2.3.0/lib/Cake/Console/ShellDispatcher.php(239):
> class_exists('UpgradeShell')
> #6 /var/www/cakephp-2.3.0/lib/Cake/Console/ShellDispatcher.php(189):
> ShellDispatcher->_getShell('Upgrade.Upgrade')
> #7 /var/www/cakephp-2.3.0/lib/Cake/Console/ShellDispatcher.php(67):
> ShellDispatcher->dispatch()
> #8 /var/www/cakephp-2.3.0/lib/Cake/Console/cake.php(43):
> ShellDispatcher::run(Array)
> #9 {main}
>
> Ouch....
> Ok the Ouch was mine ;) Just a test if you read until here.
>
> As always any help is appreciated!
>
> Calamity Jane
>
>
>
>
>
> Am 24.02.2013 15:48, schrieb euromark:
>>>> You did read the readme.txt right? :)
>>>> It answers all of your questions above and many more..
>>>>
>>>>
>>>> Am Sonntag, 24. Februar 2013 14:05:52 UTC+1 schrieb acl68:
>>>>>
>>>> Hi everybody,
>>>>
>>>>
>>>> after getting strange error messages with the default 2.0 migration
>>>> shell I tried it now with the improved version from euromark:
>>>> https://github.com/dereuromark/upgrade
>>>>
>>>>
>>>> Here the facts:
>>>> I am running Linux with php 5.4.
>>>> I downloaded cake 2.3.0 and euromarks plug-in.
>>>> After unpacking the new cake version to my webroot ( and setting all
>>>> rights to executable for me an my Apache) I renamed my 1.3 app to "app",
>>>> adapted the cake core path in my webroot/index.php so it points to the
>>>> Cake folder in the "lib" folder. I renamed app/config to app/Config and
>>>> added the CakePlugin::loadAll(); to the bootstrap.
>>>>
>>>>
>>>> Questions:
>>>> Where do the files from the plug-in go? Do they just stay in the
>>>> app/plug-in/upgrade-master folder? Or do I replace the files in the
>>>> default Cake Core folders with them?
>>>>
>>>> Can I tell the upgrade shell which app it should update, or do I have to
>>>> rename it to "app"?
>>>>
>>>> When I tried to let it run no files were changed but empty folders
>>>> "Model" Controller" etc were created under /app/Console/...
>>>>
>>>>
>>>> Exists there somewhere an extensive HowTo for using this plug-in? The
>>>> readme doesn't answer all my questions.
>>>>
>>>>
>>>> Also it works only if I call the shell with
>>>> /var/www/cakephp-2.3.0/app/Console$ ./cake upgrade all
>>>> and not
>>>> /var/www/cakephp-2.3.0/app/Console$ ./cake Upgrade.Upgrade all
>>>>
>>>> Thanks for any help! If I don't get this done within the next week I
>>>> will stay with 1.3. *sigh*
>>>>
>>>> Calamity Jane
>>>>
>>>>>
>>>>
>
>>
>

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iEYEARECAAYFAlEuTpgACgkQbOdiIJzHNKFFmQCggcegUvqdOpS+B6ECh4a4rvfm
vTQAoKxVspB+SmR7aYkn+ZDUnGti6716
=p/6H
-----END PGP SIGNATURE-----

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

Upgrading from 1.3.15 to 2.2.7 or 2.3

One more question.  I currently have an application on 1.3.15 and want to use the upgrade-shell.  Can I upgrade straight to 2.2.7 or 2.3 rather than the 2.0 branch that is generically mentioned in http://book.cakephp.org/2.0/en/console-and-shells/upgrade-shell.html#upgrade-shell.  I tried a quick run through of the instructions with 2.0.6 and ran into some issues with the upgrade shell.  I have not investigated the further but my app_controller was renamed to "<?php?".

Thanks,
Brian


--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Re: [SOLVED] Calling functions in other controllers

Hi Friends,

   I am new to the Cake-PHP...I don't know how to start and where to start...So,Please guide me..

     Regards,

Ganapathi Raman.p

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

[SOLVED] Calling functions in other controllers

Hello David,

Thanks very much for jogging my memory.  I was not trying to do anything out of scope but just have re-usable functions that I can call in other controllers.  I moved the getCart, and totals into the cart model and was able to greatly simplify my code.  Everything is working like a champ.

Thanks for the help from everyone.
Brian

On Wednesday, February 27, 2013 8:03:24 AM UTC-5, david...@gmail.com wrote:

On Wednesday, February 27, 2013 2:55:53 AM UTC+2, lirc201 wrote:
I'm in 2 different controllers.  In the checkout controller, I'm trying to call a function in the cart controller.

Are you sure that the function is in the cart controller?  The $uses variable indicates which other models this model will use (not which other controllers).  If you want to call a method on another controller you will need to use either App::Import or RequestAction.  If the error you are getting is an SQL error rather than a method not found error it would seem like the get() method is on the model.

In general, many people will tell you that calling one controller from another is a bad idea and should only be done as a last resort.

If it is true that you are managing to call a controller method then it may be simpler to move these methods into the Cart model which you would then be able to access from the $uses variable. 

If the methods are really on the model (or if you choose to move them there) you will need to be acting on a particular instance of Cart so you would do something like:
$this->Cart->id = $CartID; // assumes you already have the id of the cart you want
$Cart = $this->Cart->get(); // assumes that the only state information that get needs is the id and will read any additional information for itself

Alternatively, you may need to find the cart you are looking for and pass that information into the get call.  I.e.
$Cart = $this->Cart->find('first', array('conditions' => array('Cart.customer_id' => $CustomerID)));
$Total = $this->Cart->total($Cart);

As a side note:
One debugging method you could use when confronted with this type of situation is to copy and paste the query that generated the error directly into something like PhpMyAdmin and see what part of the query is causing the SQL error.  My guess is that in your case the query has a where clause with 'WHERE Cart.id=' with no id specified or something like that.

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Js helper using foreach loop.

I have an app the request several product and puts them in a foreach loop list. Refer to the first image below.

Each row is a form.

 When i Click ADD everything works Great, except!,! it creates a empty data base table row.  For some reason the data is not getting passed to the data base table. Refer to the second image below.

Here is my view code:
        <h2>Products</h2>
       
    <table>
        <tr>
            <th><?php echo 'ID'; ?></th>
            <th><?php echo 'Name'; ?></th>
            <th><?php echo 'Price'; ?></th>
            <th><?php echo 'QTY'; ?></th>
            <th><?php echo 'ADD ITEM' ?></th>
        </tr>
        <?php foreach ($products as $product): ?>
        <?php echo $this->Form->create('Item'); ?>
        <tr>
            <td><?php echo $product['Product']['id']; ?></td>
            <?php echo $this->Form ->input('product_id', array('type' => 'hidden', 'value' => $product['Product']['id'])); ?>
            <td><?php echo $product['Product']['name']; ?></td>
            <?php echo $this->Form ->input('description', array('type' => 'hidden', 'value' => $product['Product']['name'])); ?>
            <td><?php echo $product['Product']['price']; ?></td>
            <?php echo $this->Form ->input('price', array('type' => 'hidden', 'value' => $product['Product']['price'])); ?>
            <td><?php
                $qtyType = array(
                    '1' => '1',
                    '2' => '2',
                    '3' => '3',
                    '4' => '4',
                    '5' => '5',
                    '6'    => '6',
                    '7' => '7',
                    '8' => '8',
                    '9' => '9',
                    '10' => '10'
                    );
               echo $this->Form->input('qty', array('class' => 'input-small','label' => FALSE, 'type' => 'select', 'options' => $qtyType));
            ?>
          </td>
          <td>
              <?php echo $this->Form->input('customer_id', array('type' => 'hidden', 'value' => $custmerID)); ?>
                <?php echo $this->Form->input('order_id', array('type' => 'hidden', 'value' => $orderID)); ?>
                <?php echo $this->Js->submit('ADD', array(
                    'before' => $this->Js->get('#sending')->effect('fadeIn'),
                    'success' =>  $this->Js->get('#sending')->effect('fadeOut'),
                    'update' => '#success'
                )); ?>
                <?php echo $this->Form->end(); ?>   
          </td>
        </tr>
        <?php endforeach; ?>
    </table>

Here is my controller code:

/* add method */
    public function add() {
        $customerNo = $this->request->params['pass'][0];
        $orderID = $this->request->params['pass'][1];
        $this->loadModel('Customer');
        $custName = $this->Customer->field('name', array('id' => $customerNo));
        $this->set('customerName', $custName);
        $this->loadModel('Order');
        $orderID = $this->Order->getLastInsertID();
        ///////////////// this is where the magic happens
        if ($this->request->is('post')) {
            $this->Item->create();
            if ($this->Item->save($this->request->data)) {
                if($this->RequestHandler->isAjax()) {
                    $this->render('success', 'ajax');
                }else{
                $this->Session->setFlash(__('The item has been saved'));
                $this->redirect(array('action' => 'index'));
                }
            } else {
                $this->Session->setFlash(__('The item could not be saved. Please, try again.'));
            }
        }
        $order = $this->Item->Order->find('list');
        $this->set(compact('order'));
        $this->loadModel('Product');

        $keyValue = $this->Product->find('all', array(
            'fields' => array('id', 'name', 'price')
            ));
        $this->set('custmerID', $this->request->params['pass'][0]);
        $this->set('products', $keyValue);
        $this->set('orderID', $this->request->params['pass'][1]);
    }

 Any Help on what i am doing wrong would be a great help.


--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.