FPDF or any other PDF export option for a cakePHP environment

2012-06-19 Thread DerekGardiner
I am trying to export a PDF from within a cakephp system. From my searches 
it seems that FPDF if the best option to export a PDF from an PHP 
environment. The only cakePHP tutorial i can find about it is a 2007 
tutorial: 
http://bakery.cakephp.org/articles/sdevore_myopenid_com/2007/01/27/pdf-helper-using-fpdf
 which 
is buggy and I can't seem to find anything newer. 

I would be very interested in what the community suggests is the best PDF 
strategy for a cakePHP environment and if there are any supporting 
(and relevantly new) tutorial for it.

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


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


url=controller/function appears now in my url address bar

2012-06-19 Thread elogic
Hi All,

I moved a site from one server and upgraded it from 1.3.x to 2.x and now in 
the url I am getting something like this: 
/units/staffindex?url=units%2Fstaffindex

The url=units%2Fstaffindex part is new to me. Any idea why it is now there 
and how do I get rid of it?

Everything works as normal, it's just not neat so I want it removed.

Thanks

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


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


Re: how to generate this sql

2012-06-19 Thread Adam Symonds
Thanks, worked perfectly.





On Wed, Jun 20, 2012 at 9:17 AM, dogmatic69  wrote:

> Sorry Cake creates the fields as Model__filed so it should be 'group' =>
> 'Timesheet.user_id, Timesheet.date HAVING Timesheet__count_name > 1',
>
> On Tuesday, 19 June 2012 23:52:43 UTC+1, elogic wrote:
>>
>> Thanks,
>>
>> This is what I ended up doing in my records controller function but I get
>> the following error:* Column not found: 1054 Unknown column 'count_name'
>> in 'having clause'
>>
>>
>> *
>>
>>  $this->Timesheet->**virtualFields = array(
>>  'count_name' => 'COUNT(Timesheet.id)'
>>  );
>>  
>>  $doubles = $this->Timesheet->find(
>>  'all',
>>  array(
>>
>>  'fields' => array(
>>  'Timesheet.user_id',
>>  'Timesheet.date',
>>  'count_name'
>>  ),
>>  'group' => 'Timesheet.user_id, 
>> Timesheet.date HAVING count_name > 1',
>>
>>  'order' => array(
>>  'count_name'
>>  )
>>  )
>>  );
>>  $this->set('doubles', $doubles);
>>
>>
>>
>> -
>> Thanks
>> Adam
>>
>>
>>
>>
>> On Wed, Jun 20, 2012 at 1:16 AM, dogmatic69 wrote:
>>
>>> Cake does not support HAVING but you can put it in the group as a string.
>>>
>>> Something like the following:
>>>
>>> $this->Timesheet->**virtualFields = array(
>>>  'count_name' => 'COUNT(id)'
>>> );
>>> $this->Timesheet->find(
>>>  'all',
>>> array(
>>> 'fields' => array(
>>> 'Timesheet.user_id',
>>>  'Timesheet.date',
>>> 'count_name'
>>> ),
>>>  'group' => 'Timesheet.user_id, Timesheet.date HAVING count_name > 1',
>>> 'order' => array(
>>>  'count_name'
>>> )
>>> )
>>> );
>>>
>>> On Tuesday, 19 June 2012 03:18:58 UTC+1, elogic wrote:

 Hi All,

 How do I go about generating the following SQL line using cakePHP from
 the timesheets controller?

 SELECT user_id, date, count(id) as count_name FROM `timesheets`GROUP BY
 user_id, date HAVING count_name > 1 ORDER BY count_name;

 Basically it is just checking for double up records mathching the date
 and user_id fields.

 Thanks

>>>  --
>>> Our newest site for the community: CakePHP Video Tutorials
>>> http://tv.cakephp.org
>>> Check out the new CakePHP Questions site http://ask.cakephp.org and
>>> help others with their CakePHP related questions.
>>>
>>>
>>> To unsubscribe from this group, send email to
>>> cake-php+unsubscribe@**googlegroups.comFor
>>>  more options, visit this group at
>>> http://groups.google.com/**group/cake-php
>>>
>>
>>  --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

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


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


Re: how to generate this sql

2012-06-19 Thread dogmatic69
Sorry Cake creates the fields as Model__filed so it should be 'group' => 
'Timesheet.user_id, Timesheet.date HAVING Timesheet__count_name > 1',

On Tuesday, 19 June 2012 23:52:43 UTC+1, elogic wrote:
>
> Thanks,
>
> This is what I ended up doing in my records controller function but I get 
> the following error:* Column not found: 1054 Unknown column 'count_name' 
> in 'having clause'
>
>
> *
>
>   $this->Timesheet->virtualFields = array(
>   'count_name' => 'COUNT(Timesheet.id)'
>   );
>   
>   $doubles = $this->Timesheet->find(
>   'all',
>   array(
>
>   'fields' => array(
>   'Timesheet.user_id',
>   'Timesheet.date',
>   'count_name'
>   ),
>   'group' => 'Timesheet.user_id, 
> Timesheet.date HAVING count_name > 1',
>
>   'order' => array(
>   'count_name'
>   )
>   )
>   );
>   $this->set('doubles', $doubles);
>
>
>
> -
> Thanks
> Adam
>
>
>
>
> On Wed, Jun 20, 2012 at 1:16 AM, dogmatic69 wrote:
>
>> Cake does not support HAVING but you can put it in the group as a string.
>>
>> Something like the following:
>>
>> $this->Timesheet->virtualFields = array(
>>  'count_name' => 'COUNT(id)'
>> );
>> $this->Timesheet->find(
>>  'all',
>> array(
>> 'fields' => array(
>> 'Timesheet.user_id',
>>  'Timesheet.date',
>> 'count_name'
>> ),
>>  'group' => 'Timesheet.user_id, Timesheet.date HAVING count_name > 1',
>> 'order' => array(
>>  'count_name'
>> )
>> )
>> );
>>
>> On Tuesday, 19 June 2012 03:18:58 UTC+1, elogic wrote:
>>>
>>> Hi All,
>>>
>>> How do I go about generating the following SQL line using cakePHP from 
>>> the timesheets controller?
>>>
>>> SELECT user_id, date, count(id) as count_name FROM `timesheets`GROUP BY 
>>> user_id, date HAVING count_name > 1 ORDER BY count_name;
>>>
>>> Basically it is just checking for double up records mathching the date 
>>> and user_id fields.
>>>
>>> Thanks
>>>
>>  -- 
>> Our newest site for the community: CakePHP Video Tutorials 
>> http://tv.cakephp.org 
>> Check out the new CakePHP Questions site http://ask.cakephp.org and help 
>> others with their CakePHP related questions.
>>  
>>  
>> To unsubscribe from this group, send email to
>> cake-php+unsubscr...@googlegroups.com For more options, visit this group 
>> at http://groups.google.com/group/cake-php
>>
>
>

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


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


Re: how to generate this sql

2012-06-19 Thread Adam Symonds
Thanks,

This is what I ended up doing in my records controller function but I get
the following error:* Column not found: 1054 Unknown column 'count_name' in
'having clause'


*

$this->Timesheet->virtualFields = array(
'count_name' => 'COUNT(Timesheet.id)'
);

$doubles = $this->Timesheet->find(
'all',
array(
'fields' => array(
'Timesheet.user_id',
'Timesheet.date',
'count_name'
),
'group' => 'Timesheet.user_id, 
Timesheet.date HAVING count_name > 1',
'order' => array(
'count_name'
)
)
);
$this->set('doubles', $doubles);



-
Thanks
Adam




On Wed, Jun 20, 2012 at 1:16 AM, dogmatic69  wrote:

> Cake does not support HAVING but you can put it in the group as a string.
>
> Something like the following:
>
> $this->Timesheet->virtualFields = array(
> 'count_name' => 'COUNT(id)'
> );
> $this->Timesheet->find(
> 'all',
> array(
> 'fields' => array(
> 'Timesheet.user_id',
> 'Timesheet.date',
> 'count_name'
> ),
> 'group' => 'Timesheet.user_id, Timesheet.date HAVING count_name > 1',
> 'order' => array(
> 'count_name'
> )
> )
> );
>
> On Tuesday, 19 June 2012 03:18:58 UTC+1, elogic wrote:
>>
>> Hi All,
>>
>> How do I go about generating the following SQL line using cakePHP from
>> the timesheets controller?
>>
>> SELECT user_id, date, count(id) as count_name FROM `timesheets`GROUP BY
>> user_id, date HAVING count_name > 1 ORDER BY count_name;
>>
>> Basically it is just checking for double up records mathching the date
>> and user_id fields.
>>
>> Thanks
>>
>  --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

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


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


Re: User Info from Auth Component

2012-06-19 Thread Max Dörfler

http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html#identifying-users-and-logging-them-in

"In 2.0 $this->Auth->login($this->request->data) will log the user in 
with whatever data is posted, whereas in 1.3 
$this->Auth->login($this->data) would try to identify the user first and 
only log in when successful."


I assume you are yousing 2.x. I guess this is what you are looking for. 
Call login() without params.


On 06/19/2012 11:18 PM, Joey Hauschildt wrote:
I am. All passwords in the db are hashed. The problem seems to be that 
instead of getting info from the users table, it is only filling 
debug($this->Session->read('Auth.User')); 
and debug($this->Auth->User()) with data from the form. Otherwise the 
password would be hashed. It has nowhere else to get an unhashed 
password from. This seems like a pretty poor choice for default 
behavior. I would prefer that my app didn't store passwords from the 
form anywhere.


On Tuesday, June 19, 2012 2:50:45 PM UTC-6, Jeremy Burns wrote:

You should be hashing the password before saving it.

Jeremy Burns
Class Outfit

http://www.classoutfit.com

On 19 Jun 2012, at 19:41:30, Joey Hauschildt wrote:


debug($this->Session->read('Auth.User'));
and debug($this->Auth->User()); both return:

array(
'User' => array(
'password' => '*',
'email' => 't...@example.com '
)
)

These are the fields that the user uses to log in. The password
isn't even hashed. When I print_r, it displays the actual
password. I would like to have access to other user info like an
ID or role. Do I need to use my own query to get this info or
should the Auth Component be grabbing that stuff for me?.

-- 
Our newest site for the community: CakePHP Video Tutorials

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


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



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



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


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



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


Re: User Info from Auth Component

2012-06-19 Thread Joey Hauschildt
I am. All passwords in the db are hashed. The problem seems to be that 
instead of getting info from the users table, it is only filling 
debug($this->Session->read('Auth.User')); 
and debug($this->Auth->User()) with data from the form. Otherwise the 
password would be hashed. It has nowhere else to get an unhashed password 
from. This seems like a pretty poor choice for default behavior. I would 
prefer that my app didn't store passwords from the form anywhere.

On Tuesday, June 19, 2012 2:50:45 PM UTC-6, Jeremy Burns wrote:
>
> You should be hashing the password before saving it.
>
> Jeremy Burns
> Class Outfit
>
> http://www.classoutfit.com 
>
> On 19 Jun 2012, at 19:41:30, Joey Hauschildt wrote:
>
> debug($this->Session->read('Auth.User')); and debug($this->Auth->User()); 
> both return:
>
> array(
> 'User' => array(
> 'password' => '*',
> 'email' => 't...@example.com'
> )
> )
>
> These are the fields that the user uses to log in. The password isn't even 
> hashed. When I print_r, it displays the actual password. I would like to 
> have access to other user info like an ID or role. Do I need to use my own 
> query to get this info or should the Auth Component be grabbing that stuff 
> for me?.
>
> -- 
> Our newest site for the community: CakePHP Video Tutorials 
> http://tv.cakephp.org 
> Check out the new CakePHP Questions site http://ask.cakephp.org and help 
> others with their CakePHP related questions.
>  
>  
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> at http://groups.google.com/group/cake-php
>
>
>

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


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


Re: User Info from Auth Component

2012-06-19 Thread Jeremy Burns | Class Outfit
You should be hashing the password before saving it.

Jeremy Burns
Class Outfit

http://www.classoutfit.com

On 19 Jun 2012, at 19:41:30, Joey Hauschildt wrote:

> debug($this->Session->read('Auth.User')); and debug($this->Auth->User()); 
> both return:
> 
> array(
>   'User' => array(
>   'password' => '*',
>   'email' => 't...@example.com'
>   )
> )
> 
> These are the fields that the user uses to log in. The password isn't even 
> hashed. When I print_r, it displays the actual password. I would like to have 
> access to other user info like an ID or role. Do I need to use my own query 
> to get this info or should the Auth Component be grabbing that stuff for me?.
> 
> -- 
> Our newest site for the community: CakePHP Video Tutorials 
> http://tv.cakephp.org 
> Check out the new CakePHP Questions site http://ask.cakephp.org and help 
> others with their CakePHP related questions.
>  
>  
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
> http://groups.google.com/group/cake-php

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


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


User Info from Auth Component

2012-06-19 Thread Joey Hauschildt
debug($this->Session->read('Auth.User')); and debug($this->Auth->User()); 
both return:

array(
'User' => array(
'password' => '*',
'email' => 't...@example.com'
)
)

These are the fields that the user uses to log in. The password isn't even 
hashed. When I print_r, it displays the actual password. I would like to 
have access to other user info like an ID or role. Do I need to use my own 
query to get this info or should the Auth Component be grabbing that stuff 
for me?.

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


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


Cake 2.1.3 bake error class appmodel not found

2012-06-19 Thread li9ht
http://stackoverflow.com/questions/11095805/cake-bake-2-1-3-appmodel-not-found 


got this error when baking 

Fatal error: Class 'AppModel' not found in 
C:\xampp\htdocs\cakephp\lib\Cake\Model\CakeSchema.php on line 308

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


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


Re: how to generate this sql

2012-06-19 Thread dogmatic69
Cake does not support HAVING but you can put it in the group as a string.

Something like the following:

$this->Timesheet->virtualFields = array(
'count_name' => 'COUNT(id)'
);
$this->Timesheet->find(
'all',
array(
'fields' => array(
'Timesheet.user_id',
'Timesheet.date',
'count_name'
),
'group' => 'Timesheet.user_id, Timesheet.date HAVING count_name > 1',
'order' => array(
'count_name'
)
)
);

On Tuesday, 19 June 2012 03:18:58 UTC+1, elogic wrote:
>
> Hi All,
>
> How do I go about generating the following SQL line using cakePHP from the 
> timesheets controller?
>
> SELECT user_id, date, count(id) as count_name FROM `timesheets`GROUP BY 
> user_id, date HAVING count_name > 1 ORDER BY count_name;
>
> Basically it is just checking for double up records mathching the date and 
> user_id fields.
>
> Thanks
>

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


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


Re: Using a plugin behaviour

2012-06-19 Thread Steve Found

On 19/06/12 09:49, Jeremy Burns wrote:
I'm just breaking my way into CakePHP 2. I'm trying to attach the 
SluggableBehavior from the CakeDC Utils Plugin to a model and am 
really struggling to find any decent resource that outlines the steps 
to do this. The official documentation on the usage of plugins, and 
specifically the usage of the CakeDC Utils Plugin is very thin and is 
therefore of very little use.


I've tried putting both of the following at the top of my model:

App::uses('SluggableBehavior', 'Utils.Behavior');
App::uses('SluggableBehavior', 'Utils/Behavior');

and I've set my $actsAs as follows:

var $actsAs = array('Utils.Sluggable');

but no joy. I'm on Cake 2.1.3 and my table already has both "name" and 
"slug" fields in place.


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



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


Do you need the App::uses() call ?

If you've loaded the Utils plugin in bootstrap.php, I think the $actsAs 
= array('Utils.Sluggable'); should know where to look as you are using 
the plugin syntax.


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



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


Re: Using a plugin behaviour

2012-06-19 Thread Jeremy Burns | Class Outfit
Yup - all plugins are loaded in bootstrap...

Jeremy Burns
Class Outfit

http://www.classoutfit.com

On 19 Jun 2012, at 10:59:11, Tilen Majerle wrote:

> you need to activate plugin
> 
> CakePlugin::load('Utils');
> --
> Lep pozdrav, Tilen Majerle
> http://majerle.eu
> 
> 
> 
> 2012/6/19 Jeremy Burns 
> I'm just breaking my way into CakePHP 2. I'm trying to attach the 
> SluggableBehavior from the CakeDC Utils Plugin to a model and am really 
> struggling to find any decent resource that outlines the steps to do this. 
> The official documentation on the usage of plugins, and specifically the 
> usage of the CakeDC Utils Plugin is very thin and is therefore of very little 
> use.
> 
> I've tried putting both of the following at the top of my model:
> 
> App::uses('SluggableBehavior', 'Utils.Behavior');
> App::uses('SluggableBehavior', 'Utils/Behavior');
> 
> and I've set my $actsAs as follows:
> 
>   var $actsAs = array('Utils.Sluggable');
> 
> but no joy. I'm on Cake 2.1.3 and my table already has both "name" and "slug" 
> fields in place.
> 
> What am I doing wrong?
> 
> -- 
> Our newest site for the community: CakePHP Video Tutorials 
> http://tv.cakephp.org 
> Check out the new CakePHP Questions site http://ask.cakephp.org and help 
> others with their CakePHP related questions.
>  
>  
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
> http://groups.google.com/group/cake-php
> 
> 
> -- 
> Our newest site for the community: CakePHP Video Tutorials 
> http://tv.cakephp.org 
> Check out the new CakePHP Questions site http://ask.cakephp.org and help 
> others with their CakePHP related questions.
>  
>  
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
> http://groups.google.com/group/cake-php

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


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


Re: Count (return as a number) associated data.

2012-06-19 Thread Steve Found
You would probably be better off having a countPosts() function in your 
User model which is...


public function countPosts( $userId ){
$count = $this->Post->find('count', array( 'condition' => 
array('user_id' => $userId) ) );

return $count;
}

That way you can add in more conditions later, there is a boolean 
'published' flag on the post for example,

your controller then calls $count = $this->User->countPosts($userId);

Counting array elements will work in this case, but if you want to 
further refine the counted records later,
it will get messy and you are duplicating functionality that the model 
already provides.


Steve (Ratty)


On 18/06/12 23:24, JonStark wrote:

Sorry, incomplete :

It will produce an array like :

array(
'User' =>  array(
'password' =>  '*',
'id' =>  '2',
'username' =>  'test',

),
'Post' =>  array(
(int) 0 =>  array(
'id' =>  '36',
'user_id' =>  '2', (...)

)
),

How can I display the number of Posts this user have ? (in this 
example 1) ?


Thanks a lot.

Le mardi 19 juin 2012 00:21:25 UTC+2, JonStark a écrit :

Let's say USer hasMany Post.

If i debug my user it will produce an array like :

User

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



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


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



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


Re: Using a plugin behaviour

2012-06-19 Thread Tilen Majerle
you need to activate plugin

CakePlugin::load('Utils');
--
Lep pozdrav, Tilen Majerle
http://majerle.eu



2012/6/19 Jeremy Burns 

> I'm just breaking my way into CakePHP 2. I'm trying to attach the
> SluggableBehavior from the CakeDC Utils Plugin to a model and am really
> struggling to find any decent resource that outlines the steps to do this.
> The official documentation on the usage of plugins, and specifically the
> usage of the CakeDC Utils Plugin is very thin and is therefore of very
> little use.
>
> I've tried putting both of the following at the top of my model:
>
> App::uses('SluggableBehavior', 'Utils.Behavior');
> App::uses('SluggableBehavior', 'Utils/Behavior');
>
> and I've set my $actsAs as follows:
>
> var $actsAs = array('Utils.Sluggable');
>
> but no joy. I'm on Cake 2.1.3 and my table already has both "name" and
> "slug" fields in place.
>
> What am I doing wrong?
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

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


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


Using a plugin behaviour

2012-06-19 Thread Jeremy Burns
I'm just breaking my way into CakePHP 2. I'm trying to attach the 
SluggableBehavior from the CakeDC Utils Plugin to a model and am really 
struggling to find any decent resource that outlines the steps to do this. 
The official documentation on the usage of plugins, and specifically the 
usage of the CakeDC Utils Plugin is very thin and is therefore of very 
little use.

I've tried putting both of the following at the top of my model:

App::uses('SluggableBehavior', 'Utils.Behavior');
App::uses('SluggableBehavior', 'Utils/Behavior');

and I've set my $actsAs as follows:

var $actsAs = array('Utils.Sluggable');

but no joy. I'm on Cake 2.1.3 and my table already has both "name" and 
"slug" fields in place.

What am I doing wrong?

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


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


Re: Problem with CakeEmail - rewrite default config and bcc delivery does not work

2012-06-19 Thread Anna P
I managed to switch to a "newsletter" layout by creating another
config in app/Config/Email.php :

public $newsletter = array(
'transport' => 'Mail',
'charset' => 'utf-8',
'headerCharset' => 'utf-8',
'layout' => 'default',
'template' => 'newsletter',
'emailFormat' => 'html',
);

and I load it like this:
$email = new CakeEmail('newsletter');

And now it works fine, it uses 'newsletter' layout.
But still, bcc doesn't work - email isn't delivered to recipients.

I've read in cookbook that bcc should  be an array where key is an e-
mail address and value is either name or e-mail, so I changed my bcc
array to something like this:

array(1) {
  [email @ domain.com]=>
  string(X) "email @ domain.com"
}

but it still doesn't work... (of course email in array is a real,
existing address). Please help anyone

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


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


Re: Caching part of view and user-specific sidebar problem

2012-06-19 Thread thanat
Yes, you can use requestAction from within an element.

in your element you can write
$data = $this->requestAction(array('controller' => 'test', 'action' =>
'getdataforelementaction' ));

and in your controller

public function getdataforelementaction() {
if (isset($this->params['requested'])) {
return $this->Modelname->find_your_data();
}
}

more at: http://book.cakephp.org/1.3/en/view/991/requestAction  or
http://book.cakephp.org/2.0/en/controllers.html#Controller::requestAction

On Jun 19, 12:25 am, Joris Vaesen  wrote:
> I've build an application with a where where users can see multiple items.
> These items are sorted by pagination.
>
> Because of the big amount of items per page would i like to do some caching.
> Because the page is using pagination, I can't cache the query.
>
> So I was thinking about caching the view, which works very well but one
> thing:
> The sidebar on the page is user-specific and may not be cached.
> So I separated this part in an element and used the  html
> comment technique.
>
> Now is my problem that i can't get any data in this element. The data for
> this element may not be cached.
> The only oppertunity thought of was doing some queries in de element to get
> recent data.
>
> But is this in any way possible to query from an element?

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


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