Friday, October 31, 2014

Access layout HTML in controller variable

HI,
In my cakephp 3 project I am using mandrill API to send email campaigns. So from a controller function I am creating the html section of the email and pass it to mandrill. Is there any way that I can access the html generating by a layout in controller function and to create the html to pass to the mandrill?

Thanks in advance,
Jipson

--
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.
For more options, visit https://groups.google.com/d/optout.

Re: Migrate Passwords

When users login successfully just take the password form the request data and hash it using Blowfish. 
Store the the new hash in a new column.  
Delete the simple hash for that user.
Modify your login to match Blowfish as well as Simple hash for some time. Once all your users have logged in at least once you can refactor it to use only Blowfish

I do trust you have everything over SSL... 

T


On Fri, Oct 31, 2014 at 4:02 AM, gonzela2006 <gonzela2006@gmail.com> wrote:
Hi,

How can I migrate my users passwords from SimplePasswordHasher to BlowfishPasswordHasher without interrupt my users to change their passwords?

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.
For more options, visit https://groups.google.com/d/optout.



--
=============================================================
Hire a CakePHP dev team : http://sanisoft.com
=============================================================

--
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.
For more options, visit https://groups.google.com/d/optout.

Re: Conditionally set defaultConnectionName

The easiest way is to alias the connection:

\Cake\Datasource\ConnectionManager::alias('default', 'admin');

What it does is that, when a table is created instead of passing the default connection it will pass the admin one.

On Friday, October 31, 2014 1:42:42 AM UTC+1, Joe Theuerkauf wrote:
Correct. When the Admin is logged in to that part of the site, the connection with the elevated account would be used for all requests so data edits can be performed. For the general user, the restricted connection would be used, where data edits aren't permitted (with limited exceptions granted to that db account). i don't want to mix data connections on a single request.

Thanks.
-joe


On Thursday, 30 October 2014 04:10:35 UTC-4, José Lorenzo wrote:
Let me see if I understood correctly: For certain admin actions you want to use the admin connection instead of default for ALL tables used in that request?

On Thursday, October 30, 2014 4:25:30 AM UTC+1, Joe Theuerkauf wrote:
i may be overthinking this - if so, tell me.

i'd like to have a DB config for the general website user, who needs only SELECT for most things, and a separate config for the Admin side of the site where other privileges are needed.

Since defaultConnectionName returns which config to use, is it possible to determine within that method which connection i need to return (Admin or basic) for the Table?

My original thought was to somehow set the connection i need in the controllers, as i have an abstract AdminController that the Admin-level controllers inherit from. But i don't see any obvious reference to doing this in the documentation. So i thought a conditional return from [Table]::defaultConnectionName might work.

If it's better just to use a single higher-privilege account for all purposes, so be it. Just thought i'd ask. :)

Thanks.
-joe t.

--
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.
For more options, visit https://groups.google.com/d/optout.

Thursday, October 30, 2014

Re: How can I access vendor file in cron or webroot

For cron create a shell :

Load the vendor in a similar fashion as you already doing it in the controller or just require_occe…

Andras Kende


On Oct 30, 2014, at 9:43 PM, Archana Goyal <archanagoyal07@gmail.com> wrote:

I am implementing payment gateway in CakePHP application. I stored functions of payment gateway in vendor and using in controller by importing. I want to create cron to check subscription of user in daily basis, so I need to use vendor file in cron. 
I did R&D for this on google but nothing found. Please help to get out from this problem.

--
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.
For more options, visit https://groups.google.com/d/optout.

How can I access vendor file in cron or webroot

I am implementing payment gateway in CakePHP application. I stored functions of payment gateway in vendor and using in controller by importing. I want to create cron to check subscription of user in daily basis, so I need to use vendor file in cron. 
I did R&D for this on google but nothing found. Please help to get out from this problem.

--
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.
For more options, visit https://groups.google.com/d/optout.

Re: Conditionally set defaultConnectionName

Correct. When the Admin is logged in to that part of the site, the connection with the elevated account would be used for all requests so data edits can be performed. For the general user, the restricted connection would be used, where data edits aren't permitted (with limited exceptions granted to that db account). i don't want to mix data connections on a single request.

Thanks.
-joe


On Thursday, 30 October 2014 04:10:35 UTC-4, José Lorenzo wrote:
Let me see if I understood correctly: For certain admin actions you want to use the admin connection instead of default for ALL tables used in that request?

On Thursday, October 30, 2014 4:25:30 AM UTC+1, Joe Theuerkauf wrote:
i may be overthinking this - if so, tell me.

i'd like to have a DB config for the general website user, who needs only SELECT for most things, and a separate config for the Admin side of the site where other privileges are needed.

Since defaultConnectionName returns which config to use, is it possible to determine within that method which connection i need to return (Admin or basic) for the Table?

My original thought was to somehow set the connection i need in the controllers, as i have an abstract AdminController that the Admin-level controllers inherit from. But i don't see any obvious reference to doing this in the documentation. So i thought a conditional return from [Table]::defaultConnectionName might work.

If it's better just to use a single higher-privilege account for all purposes, so be it. Just thought i'd ask. :)

Thanks.
-joe t.

--
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.
For more options, visit https://groups.google.com/d/optout.

Migrate Passwords

Hi,

How can I migrate my users passwords from SimplePasswordHasher to BlowfishPasswordHasher without interrupt my users to change their passwords?

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.
For more options, visit https://groups.google.com/d/optout.

Re: CakePHP 2.5 random hanging

Plus the login time was just going to the login page not submitting any login details.

On Thursday, October 30, 2014 1:24:16 PM UTC-4, scs wrote:
I have an application running on cakePHP 2.5 in two different servers both server from what I see are setup the same.

On the first server we are not having issues but on the second server a user would be using the application and a page would freeze. Other users can use the application with out any problems while the other user is frozen. If the frozen user tries to reload the page it makes another connection to the apache server that is also frozen. If the same user continues to reload the page manually it continues to make more connections that are all frozen. This still has no effect on other users using the application. There is no one controller/action that this is happening on. It even happens just going to a login page. Only way I have been able to clear this is restarting apache.

Has anyone seen an issue like this?

--
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.
For more options, visit https://groups.google.com/d/optout.

Re: CakePHP 2.5 random hanging

Nope recurse -1 also never happens same for a single user everytime. 

On Thursday, October 30, 2014 1:24:16 PM UTC-4, scs wrote:
I have an application running on cakePHP 2.5 in two different servers both server from what I see are setup the same.

On the first server we are not having issues but on the second server a user would be using the application and a page would freeze. Other users can use the application with out any problems while the other user is frozen. If the frozen user tries to reload the page it makes another connection to the apache server that is also frozen. If the same user continues to reload the page manually it continues to make more connections that are all frozen. This still has no effect on other users using the application. There is no one controller/action that this is happening on. It even happens just going to a login page. Only way I have been able to clear this is restarting apache.

Has anyone seen an issue like this?

--
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.
For more options, visit https://groups.google.com/d/optout.

Re: CakePHP 2.5 random hanging


On 30 Oct 2014, at 17:24, scs <scs2771@gmail.com> wrote:

I have an application running on cakePHP 2.5 in two different servers both server from what I see are setup the same.

On the first server we are not having issues but on the second server a user would be using the application and a page would freeze. Other users can use the application with out any problems while the other user is frozen. If the frozen user tries to reload the page it makes another connection to the apache server that is also frozen. If the same user continues to reload the page manually it continues to make more connections that are all frozen. This still has no effect on other users using the application. There is no one controller/action that this is happening on. It even happens just going to a login page. Only way I have been able to clear this is restarting apache.

Has anyone seen an issue like this?

are you doing any finds with recursive set higher than 2 on your user login? could be that one user has a lot of joins and your server is timing out when its trying to serve lots of related model data? 

might be a symptom you'd find for an admin but not for a light user?



--
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.
For more options, visit https://groups.google.com/d/optout.

....................................
Mike Karthäuser
Director, Brightstorm Ltd.

1, Brewery Court
North Street
Bristol
BS3 1JS

mikek@brightstorm.co.uk
www.brightstorm.co.uk
+44(0) 7939252144
....................................

CakePHP 2.5 random hanging

I have an application running on cakePHP 2.5 in two different servers both server from what I see are setup the same.

On the first server we are not having issues but on the second server a user would be using the application and a page would freeze. Other users can use the application with out any problems while the other user is frozen. If the frozen user tries to reload the page it makes another connection to the apache server that is also frozen. If the same user continues to reload the page manually it continues to make more connections that are all frozen. This still has no effect on other users using the application. There is no one controller/action that this is happening on. It even happens just going to a login page. Only way I have been able to clear this is restarting apache.

Has anyone seen an issue like this?

--
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.
For more options, visit https://groups.google.com/d/optout.

Re: Conditionally set defaultConnectionName

Let me see if I understood correctly: For certain admin actions you want to use the admin connection instead of default for ALL tables used in that request?

On Thursday, October 30, 2014 4:25:30 AM UTC+1, Joe Theuerkauf wrote:
i may be overthinking this - if so, tell me.

i'd like to have a DB config for the general website user, who needs only SELECT for most things, and a separate config for the Admin side of the site where other privileges are needed.

Since defaultConnectionName returns which config to use, is it possible to determine within that method which connection i need to return (Admin or basic) for the Table?

My original thought was to somehow set the connection i need in the controllers, as i have an abstract AdminController that the Admin-level controllers inherit from. But i don't see any obvious reference to doing this in the documentation. So i thought a conditional return from [Table]::defaultConnectionName might work.

If it's better just to use a single higher-privilege account for all purposes, so be it. Just thought i'd ask. :)

Thanks.
-joe t.

--
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.
For more options, visit https://groups.google.com/d/optout.

Wednesday, October 29, 2014

Conditionally set defaultConnectionName

i may be overthinking this - if so, tell me.

i'd like to have a DB config for the general website user, who needs only SELECT for most things, and a separate config for the Admin side of the site where other privileges are needed.

Since defaultConnectionName returns which config to use, is it possible to determine within that method which connection i need to return (Admin or basic) for the Table?

My original thought was to somehow set the connection i need in the controllers, as i have an abstract AdminController that the Admin-level controllers inherit from. But i don't see any obvious reference to doing this in the documentation. So i thought a conditional return from [Table]::defaultConnectionName might work.

If it's better just to use a single higher-privilege account for all purposes, so be it. Just thought i'd ask. :)

Thanks.
-joe t.

--
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.
For more options, visit https://groups.google.com/d/optout.

Re: find('all') with results using id as the index instead of 0,1,2,3,...

Thank you Dario...  The longer I work with Cake, the more cool stuff I find within!

--
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.
For more options, visit https://groups.google.com/d/optout.

Re: Converting an existing site using different framework to CakePHP

I think re-writing the app in the new framework will be your answer. Personally I have always found it easier to port an existing app over than write one from scratch because all your functionality, layouts, and database structures should already be defined. Unless there is tons of bespoke code that your app requires, I think you'll find it easier than you think. 

On Tuesday, 28 October 2014 17:28:41 UTC, Roscoe McGillicutty wrote:
Hi all -
 
I've recently begun working on a project for a friend.  He was previously working with another coder who was using his own home-grown web application framework.  The coder abruptly disappeared off the face of the earth, and I've been recruited to make sense of the site.  I've been able to do this with some success just using hard PHP coding, but figuring out the framework just from the code is a daunting task.
 
The previous coder had sites up for downloading editors for his framework, etc.  He has taken all those sites down.  So I can't just jump right into what he was working with.
 
My question is this: How difficult would it be to transfer the existing site over to CakePHP?  Or is that even possible at all?  If so, what would some of you suggest?
 
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.
For more options, visit https://groups.google.com/d/optout.

Re: Converting an existing site using different framework to CakePHP

Awesome!  This gives me a lot of insight.  Thanks :)

On Tuesday, October 28, 2014 1:28:41 PM UTC-4, Roscoe McGillicutty wrote:
Hi all -
 
I've recently begun working on a project for a friend.  He was previously working with another coder who was using his own home-grown web application framework.  The coder abruptly disappeared off the face of the earth, and I've been recruited to make sense of the site.  I've been able to do this with some success just using hard PHP coding, but figuring out the framework just from the code is a daunting task.
 
The previous coder had sites up for downloading editors for his framework, etc.  He has taken all those sites down.  So I can't just jump right into what he was working with.
 
My question is this: How difficult would it be to transfer the existing site over to CakePHP?  Or is that even possible at all?  If so, what would some of you suggest?
 
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.
For more options, visit https://groups.google.com/d/optout.

Re: Converting an existing site using different framework to CakePHP

Unless the existing/old framework is derived from CakePHP, there is little chance that the application is organized in such a way that you can "import" it into CakePHP (or in any other popular framework for that matter).
Even a "manual" conversion is likely to require a lot of time and to produce an half-baked (pardon the pun) solution.
I would recommend to go back to the requirements, or reverse-engineer them from the existing application, and develop it from scratch, perhaps reusing only specific functions/algorithms from the old code.

Good luck

--
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.
For more options, visit https://groups.google.com/d/optout.

Re: Virtual fields or other solution

Read about hash::combine method.


El lunes, 27 de octubre de 2014 12:26:57 UTC+1, Salines escribió:
Hi there,

need a little help, 

I have a simple model where the data is stored in the following format: 

id | product_id | period | price ..
------------------------------------
1  | 1          | 10     | 9.99
2  | 1          | 20     | 18.99
3  | 1          | 30     | 27.99


Each product will have more 'period' data stored in a relational table. 

When we browse all the products I should show these periods as virtual fields. 

eg 

id | name          | period 10 | 20 Period | Period 30
-------------------------------------------------- --------
1  | sweet product | 9.99      | 18.99     | 27.99



Can someone give me directions? 

thank you

--
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.
For more options, visit https://groups.google.com/d/optout.

Tuesday, October 28, 2014

Re: Security Component is Ruining my Life



On Mon, Oct 27, 2014 at 10:38 PM, Florian Krämer <burzum@doomzone.de> wrote:
I've turned the idea into an implementation. Proof of concept goes here: https://github.com/burzum/cakephp/commit/9d8f6b4cb7653dd14130af68dbc632e9055d8d76
 
Cool! I will try this out...

Tarique

--
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.
For more options, visit https://groups.google.com/d/optout.

Re: After I change my User.name, can not log in..

Ok, I solved my problem. 
After the admin save user settings without password fields in the User model we have beforesave method, which returns a hash password, in this case the function create a new password from scratch and save it into the database. 

solution: 

UsersController :: admin_edit (): 

put a dummy data 

$this -> request -> data ['User']['dummy'] == true;

 
User model

public function beforeSave($options = array())
{
        if(!isset($this->data['User']['dummy'])) {
       $this->data['User']['password'] = AuthComponent::password(
         $this->data['User']['password']
       );
}
        return true;
    }


--
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.
For more options, visit https://groups.google.com/d/optout.

After I change my User.name, can not log in..

Ok friends 

The situation is as follows: 

Admin has the ability to change the name, email address and other profile information of users, but this form does not contain the password field. 

When admin, save the changes, a user can not log in. I looked in the database there is a password unchanged. 

But when I set the password field (which is mandatory) in the form, and save all together, the user can log in without a problem. 


For login information using email and password.

fields in the user table: 
id, name, email, password, group_id, ... 


What could be, sessions? 
How to solve this problem?

--
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.
For more options, visit https://groups.google.com/d/optout.

Pagination in element

I have news with comments. I'd like to paginate comments but I have the errors like this:

Notice (8): Undefined index: count [CORE\Cake\View\Helper\PaginatorHelper.php, line 646]

and of course I don't see numbers, links etc.

 
 
Do you have any idea how to solve this problem? Thanks!
 
 
Component:
public function viewFromNewsId($news_id = null) {  $this->NewsComment->recursive = 0;  $this->Paginator->settings = array('conditions' => array('NewsComment.news_id' => $news_id, 'NewsComment.is_active' => '1'), 'limit' => 5, 'order' => array('NewsComment.id' => 'desc'));  $newsComments = $this->Paginator->paginate('NewsComment');  if (isset($this->params['requested'])){  return $newsComments;  }  }
 
Element:
$newsIdFromUrl = $this->params['pass'][0];  $newsComments = $this->requestAction("newsComments/viewFromNewsId/$newsIdFromUrl");  foreach($newsComments as $newsComment):  $this->App->showNewsComment($newsComment);  endforeach;  echo $this->Paginator->counter('Liczba newsów: {:count} | ');  echo $this->Paginator->prev('<< wstecz', null, null, array('class' => 'disabledText'));  echo $this->Paginator->numbers(array('separator' => ' ', 'before' => ' | ', 'after' => ' | ', 'modulus' => '10'));  echo $this->Paginator->next('dalej >>', null, null, array('class' => 'disabledText'));  echo "<br />";
 
View: echo $this->element('newsViewComments');

--
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.
For more options, visit https://groups.google.com/d/optout.

Converting an existing site using different framework to CakePHP

Hi all -
 
I've recently begun working on a project for a friend.  He was previously working with another coder who was using his own home-grown web application framework.  The coder abruptly disappeared off the face of the earth, and I've been recruited to make sense of the site.  I've been able to do this with some success just using hard PHP coding, but figuring out the framework just from the code is a daunting task.
 
The previous coder had sites up for downloading editors for his framework, etc.  He has taken all those sites down.  So I can't just jump right into what he was working with.
 
My question is this: How difficult would it be to transfer the existing site over to CakePHP?  Or is that even possible at all?  If so, what would some of you suggest?
 
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.
For more options, visit https://groups.google.com/d/optout.

Re: base.css in cake3

It is a full version of foundation version 5

On Tuesday, October 28, 2014 2:52:30 PM UTC+1, cesar calvo wrote:
Hi ,anyone knows if full package of zurb-foundation is included on base.css and if yes what version is?

best regards

--
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.
For more options, visit https://groups.google.com/d/optout.

base.css in cake3

Hi ,anyone knows if full package of zurb-foundation is included on base.css and if yes what version is?

best regards

--
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.
For more options, visit https://groups.google.com/d/optout.

cant open uploaded file

Hi, I am trying to open a file that has been uploaded to attachments folder on a cakephp project. I have a list of files I select after uploading . This works fine on my PC but on the remote server it is throwing a 503 error which I have no idea in what to do . The error logs show nothing.

 public function download2($attachment_id = null){  		  		$file = $this->Tutor->Attachment->find('first', array('conditions' => array('Attachment.id' => $attachment_id), 'recursive' => -1));  		//pr($file); die;  		if(!empty($file)){      		$this->response->file($file['Attachment']['url'], array('name' => $file['Attachment']['org_filename']));  			//Return reponse object to prevent controller from trying to render a view  			return $this->response;			  		}    	  		else{  			$this->Session->setFlash(__('Error encountered while downloading the file. Please, try again.'),'flash_alert');  		}  		     }

--
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.
For more options, visit https://groups.google.com/d/optout.

Re: validation criteria at least 3 fileds are not empty

You are correct. With custom validation methods or with the validation callbacks you can extend the validation process to to more than what it is designed to do.

On Tuesday, October 28, 2014 8:06:19 AM UTC+1, Radharadhya Dasa wrote:
As I understand validation handles only one filed. Am I wrong?

rrd

2014. október 26., vasárnap 19:33:14 UTC+1 időpontban John Andersen a következőt írta:
Good to see that you are trying to solve this :)

I would still have gone with rolling my own validation, just by extending the validator, so it can validate a record also, not only fields.

Anyway, I am not moving to CakePHP 3.x, so will not be able to give further ideas on that, but I do hope you find a solution in the end.

Enjoy, John

On Thursday, 23 October 2014 12:12:11 UTC+3, Radharadhya Dasa wrote:
I checked to cookbook and find out that validation handles singe fields. So I used beforeSave for this.

public function beforeSave(Event $event, Entity $entity, ArrayObject $options){
   
if((!empty($entity->name) + !empty($entity->contactname) + !empty($entity->zip_id)
         
+ !empty($entity->address) + !empty($entity->phone) + !empty($entity->email)
         
+ !empty($entity->birth->time)) >= 3){
       
return true;
   
}
   
else{
       
//Error: __('At least 3 info should be filled');
       
return false;
   
}
}

But I have a problem and a question.

The above gives me this error message:
Warning (4096): Argument 1 passed to App\Model\Table\ContactsTable::beforeSave() must be an instance of App\Model\Table\Event, instance of Cake\Event\Event given, called in /home/rrd/public_html/sanga/vendor/cakephp/cakephp/src/Event/EventManager.php on line 266 and defined [APP/Model/Table/ContactsTable.php, line 85]

What is the proper way to do it?

The question is how to define an error message what will be flashed to the user?




2014. október 18., szombat 15:41:28 UTC+2 időpontban John Andersen a következőt írta:
Assuming you are still using CakePHP 3.0

I have not seen any built-in rules for this kind of validation, so my best guess is to roll your own.
See section "Custom Validation Rules" under "Validation" in the CakePHP 3.0 book. That should help you on the way.

Enjoy, John

On Saturday, 18 October 2014 16:21:57 UTC+3, Radharadhya Dasa wrote:
Hi,

Is there a way to check if at least 3 fileds are not empty? I have 8 fileds and any of those could be empty, but at least 3 of them should be not empty. Is there any build in validation rule, or how to do it? Should I do it on beforeSave?

rrd

--
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.
For more options, visit https://groups.google.com/d/optout.

[Question] Acl query error

Hello guys, I'm totally newbie in CakePHP.
Now I'm working on acl. I've set my access to administrator which can do anything. 
But when i call method/action add or anything that i don't allow in beforeFilter() method there is an error like this 

Error: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'Aro0.foreignKey' in 'where clause' 
SQL Query: SELECT `Aro`.`id`, `Aro`.`parent_id`, `Aro`.`model`, `Aro`.`foreign_key`, `Aro`.`alias` FROM `dotcore`.`aros` AS `Aro` INNER JOIN `dotcore`.`aros` AS `Aro0` ON (`Aro`.`lft` <= `Aro0`.`lft` AND `Aro`.`rght` >= `Aro0`.`rght`) WHERE `Aro0`.`model` = 'Group' AND `Aro0`.`foreignKey` = '1' ORDER BY `Aro`.`lft` DESC


Please 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.
For more options, visit https://groups.google.com/d/optout.

Re: validation criteria at least 3 fileds are not empty

As I understand validation handles only one filed. Am I wrong?

rrd

2014. október 26., vasárnap 19:33:14 UTC+1 időpontban John Andersen a következőt írta:
Good to see that you are trying to solve this :)

I would still have gone with rolling my own validation, just by extending the validator, so it can validate a record also, not only fields.

Anyway, I am not moving to CakePHP 3.x, so will not be able to give further ideas on that, but I do hope you find a solution in the end.

Enjoy, John

On Thursday, 23 October 2014 12:12:11 UTC+3, Radharadhya Dasa wrote:
I checked to cookbook and find out that validation handles singe fields. So I used beforeSave for this.

public function beforeSave(Event $event, Entity $entity, ArrayObject $options){
   
if((!empty($entity->name) + !empty($entity->contactname) + !empty($entity->zip_id)
         
+ !empty($entity->address) + !empty($entity->phone) + !empty($entity->email)
         
+ !empty($entity->birth->time)) >= 3){
       
return true;
   
}
   
else{
       
//Error: __('At least 3 info should be filled');
       
return false;
   
}
}

But I have a problem and a question.

The above gives me this error message:
Warning (4096): Argument 1 passed to App\Model\Table\ContactsTable::beforeSave() must be an instance of App\Model\Table\Event, instance of Cake\Event\Event given, called in /home/rrd/public_html/sanga/vendor/cakephp/cakephp/src/Event/EventManager.php on line 266 and defined [APP/Model/Table/ContactsTable.php, line 85]

What is the proper way to do it?

The question is how to define an error message what will be flashed to the user?




2014. október 18., szombat 15:41:28 UTC+2 időpontban John Andersen a következőt írta:
Assuming you are still using CakePHP 3.0

I have not seen any built-in rules for this kind of validation, so my best guess is to roll your own.
See section "Custom Validation Rules" under "Validation" in the CakePHP 3.0 book. That should help you on the way.

Enjoy, John

On Saturday, 18 October 2014 16:21:57 UTC+3, Radharadhya Dasa wrote:
Hi,

Is there a way to check if at least 3 fileds are not empty? I have 8 fileds and any of those could be empty, but at least 3 of them should be not empty. Is there any build in validation rule, or how to do it? Should I do it on beforeSave?

rrd

--
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.
For more options, visit https://groups.google.com/d/optout.

Monday, October 27, 2014

test cakephp

test cakephp

--
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.
For more options, visit https://groups.google.com/d/optout.

edit two models data in a single view

so I have two models, family and students, each family could have several students. I want to use one view (edit view for family) for both family and students editing. 

<!-- File: /app/View/Families/edit.ctp -->

<h1>Edit family</h1>

<?php echo $this->Form->create('Family'); ?>
<table>
<?php echo $this->Form->input('id', array('type'=>'hidden'));  ?>
<tr> <td> <?php echo $this->Form->input('father'); ?> </td>
     <td> <?php echo $this->Form->input('mother'); ?> </td> </tr>
<tr> <td> <?php echo $this->Form->input('address'); ?> </td>
       <td> <?php echo $this->Form->input('zip'); ?> </td> </tr>
<tr> <td> <?php echo $this->Form->input('phone'); ?> </td>
     <td> <?php echo $this->Form->input('email');  ?> </td> </tr>

<?php foreach ($students as $student): ?>
<tr> <td> <?php echo $this->Form->input('Student.Name'); ?> </td>
     <td> <?php echo $this->Form->input($student['Student']['Birthday']); ?> </td>
   </tr>
          <?php endforeach;?>
<?php echo $this->Form->end('Save Post'); ?>

I can see the current value for family model in the form but, it does not show the current student info in the form.  

"CakePHP will assume that you are editing a model if the 'id' field is present in the
data array. If no 'id' is present (look back at our add view), CakePHP will assume that you are inserting a
new model when save() is called."

So I guess I am missing this portion "id" field for the second model "student".  but the "student" table has a "family_id" referencing back to the "id" field of "family' table

So how I can fix this?



--
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.
For more options, visit https://groups.google.com/d/optout.

Re: Security Component is Ruining my Life

I've turned the idea into an implementation. Proof of concept goes here: https://github.com/burzum/cakephp/commit/9d8f6b4cb7653dd14130af68dbc632e9055d8d76

This will output the dirty fields as a list below the error message. I hope this is going to make it into the core. :)

On Sunday, October 19, 2014 12:26:44 AM UTC+2, glk wrote:
Florian... What a wonderful idea. 

Just wish I understood all of Cake well enough to help implement.  I've fought with the Security Component many times and, although I've never lost, it has created many headaches.  Hope the Development team can add this functionality during debugging.

--
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.
For more options, visit https://groups.google.com/d/optout.

Re: Going back to the page after changes

Whoops, I sent the wrong answer, here again

public function edit($id = null) {
if (!$this->Article->exists($id)) {
throw new NotFoundException(__('Invalid article'));
}
if ($this->request->is(array('post', 'put'))) {
if ($this->Article->save($this->request->data)) {
$this->Session->setFlash(__('The article has been saved.'));
return $this->redirect($this->request->data['Article']['referer']);
} else {
$this->Session->setFlash(__('The articlecould not be saved. Please, try again.'));
}
} else {
$options = array('conditions' => array('Article.' . $this->Article->primaryKey => $id));
$this->request->data = $this->Article->find('first', $options);
}
$this->set('referer',$this->referer();
}


edit.ctp

 
 <?php echo $this->Form->hidden('referer', array('value' =>$referer)); ?>




--
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.
For more options, visit https://groups.google.com/d/optout.

Re: Going back to the page after changes

$this->redirect(array('action' => 'view',$id));

--
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.
For more options, visit https://groups.google.com/d/optout.

Re: Going back to the page after changes

Anyone have any suggestions?

On Sunday, October 19, 2014 9:11:06 AM UTC-5, Steven Scaffidi wrote:
Hi - If I have a list of articles and someone makes a change to one of those articles on page 2 for example. How can I redirect the user back to page 2 after the change? I've tried using $this->redirect($this->referer()); but that doesn't seem to work. Any help is greatly 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.
For more options, visit https://groups.google.com/d/optout.

Re: Virtual fields or other solution

I forgot to say, the results should be sorted by periods

--
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.
For more options, visit https://groups.google.com/d/optout.

Virtual fields or other solution

Hi there,

need a little help, 

I have a simple model where the data is stored in the following format: 

id | product_id | period | price ..
------------------------------------
1  | 1          | 10     | 9.99
2  | 1          | 20     | 18.99
3  | 1          | 30     | 27.99


Each product will have more 'period' data stored in a relational table. 

When we browse all the products I should show these periods as virtual fields. 

eg 

id | name          | period 10 | 20 Period | Period 30
-------------------------------------------------- --------
1  | sweet product | 9.99      | 18.99     | 27.99



Can someone give me directions? 

thank you

--
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.
For more options, visit https://groups.google.com/d/optout.