Saturday, March 31, 2012

Re: Email mock not working

Hey,

The component is not a problem, it's working fine.
But when I'm testing the code it sends e-mails every time, making the
tests last much longer.
How can I correct it?

Thanks,
Thiago


On 31 mar, 02:03, LITTO CHACKO <li...@axtecindia.com> wrote:
> Why don't you use the cakephp builtin component email???? it is nice and
>
>
>
>
>
>
>
>
>
> > easy to use
> > it can be include by:_
> > public $components = array('Session','Email');
>
> > and can be used to send email by:_
> > $pass = array('fullname'=>$name,'password'=>$p,'url'=>$url,
> > 'reference'=>$reference,'email'=>$email);
> > $this->set('emailValues',$pass);
> > $this->Email->to = $email;
> > $this->Email->subject = 'Welcome Mail fromjustdeals.com';
> > $this->Email->replyTo = 'no-re...@image.com';
> > $this->Email->from    = 'no-reply<no-re...@image.com>';
> > $this->Email->template = 'account_created';
> > $this->Email->sendAs = 'html';
> > $this->Email->send();
>
> > you have a corresponding  account_created.ctp(as in example) file in the
> > folder views_>emails->html->...
>
> > thanks ;
>
> --
> Litto Chacko
> Axtec Softwares

--
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.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: MenuBuilder doesn't work with cakephp 2.0 (or 2.1)

@750riderAce,
 
I'm not the same Thomas :)
But i had the same problem a minute ago.
 
Where you have "View ---> helpers ---> MenuBuilderHelper.php"
it should read "View ---> Helper ---> MenuBuilderHelper.php"
 
 

On Friday, March 30, 2012 5:02:21 PM UTC+2, 750riderAce wrote:
Thomas... could you please post waht exactly you have under each directory?

I'm using 2.1.1 and I did exactly the same setup that you did, but I'm still
getting the "Helper class MenuBuilderHelper could not be found" error

this is what I do have:
*app
  Plugin
    MenuBuilder
      Controller  ---> Component ---> MenuGathererComponent.php
      Test
      View ---> helpers ---> MenuBuilderHelper.php*
the line *CakePlugin::load('MenuBuilder');* was added to
*/app/config/bootstrap.php*

*The code in /app/Controller/Appcontroller.php*:

  *  var $helpers = array('Form', 'Html', 'MenuBuilder.MenuBuilder');
plus the sample code under beforeFilter() method*
In my default.ctp the following code:

        *<div id="header">
            <?php echo $this->MenuBuilder->build('main-menu'); ?>      
        </div>*

is this exactly what you have?

thanks
750riderAce


--
View this message in context: http://cakephp.1045679.n5.nabble.com/MenuBuilder-doesn-t-work-with-cakephp-2-0-or-2-1-tp5120624p5606930.html
Sent from the CakePHP mailing list archive at Nabble.com.


On Friday, March 30, 2012 5:02:21 PM UTC+2, 750riderAce wrote:
Thomas... could you please post waht exactly you have under each directory?

I'm using 2.1.1 and I did exactly the same setup that you did, but I'm still
getting the "Helper class MenuBuilderHelper could not be found" error

this is what I do have:
*app
  Plugin
    MenuBuilder
      Controller  ---> Component ---> MenuGathererComponent.php
      Test
      View ---> helpers ---> MenuBuilderHelper.php*
the line *CakePlugin::load('MenuBuilder');* was added to
*/app/config/bootstrap.php*

*The code in /app/Controller/Appcontroller.php*:

  *  var $helpers = array('Form', 'Html', 'MenuBuilder.MenuBuilder');
plus the sample code under beforeFilter() method*
In my default.ctp the following code:

        *<div id="header">
            <?php echo $this->MenuBuilder->build('main-menu'); ?>      
        </div>*

is this exactly what you have?

thanks
750riderAce


--
View this message in context: http://cakephp.1045679.n5.nabble.com/MenuBuilder-doesn-t-work-with-cakephp-2-0-or-2-1-tp5120624p5606930.html
Sent from the CakePHP mailing list archive at Nabble.com.

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

Bug with the "action" form tag in this->data?

Hi,
I've discovered a strange behavior in this->data. I have a form with checkboxes that looks like this:

<form action="/participants/xls" method="post" (...)>
<input type="checkbox" name="data[Participant][1][id]"  value="1" id="Participant1Id"/>
<input type="checkbox" name="data[Participant][2][id]"  value="2" id="Participant2Id"/>
<input type="checkbox" name="data[Participant][3][id]"  value="3" id="Participant3Id"/>

When I check this->data, the array looked like this (in 2.0.0 alpha, the only old version i have here):
Array
(
    [Participant] => Array
        (
            [1] => Array
                (
                    [id] => 1
                )
            [2] => Array
                (
                    [id] => 2
                )
        )

    [action] => /myapp/participants/xls
)

Now the array looks like this (since 2.0.3):
Array
(
    [Participant] => Array
        (
            [1] => Array
                (
                    [id] => 1
                )
            [2] => Array
                (
                    [id] => 2
                )
            [3] => Array
                (
                    [action] => /myapp/participants/xls
                )
        )
)

The action is in the model entry.
Do I do the mistake or is there a problem with the data array?

--
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.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: redirecting problem

Did it make a difference for you or are you still having problems with the redirect? 

The difference would be in naming conventions

Sticking with conventions, 'seller' in your redirect should be plural 'sellers' to reference controllers.
Singular 'Seller' to reference the model of the same name. 

Also, 
---> and u told me to do this
---> try::  $this->redirect('/sellers/message'); 

of course do not use try:: in your code, just $this->redirect('/sellers/message');
(sorry if that confused you, it's a bad habit of mine)

On Saturday, March 31, 2012 1:12:14 AM UTC-4, LITTO CHACKO wrote:
@crotch 
i wrote like this..
  $this- >redirect('/seller/message/'); 

and u told me to do this
try::  $this->redirect('/sellers/message');


what's the difference between two???? is it same???
Litto Chacko
Axtec Softwares

--
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.com For more options, visit this group at http://groups.google.com/group/cake-php

Image Upload

I wanted to upload a picture of the user via ajax. I checked the media plugin but found it a little bit hard seeing all those instructions. Is there any better way ? What is the best way ?
I was thinking of using the submit option of the jshelper . And i created the following page. 



<?php

echo $this->Form->create('Photo',array('type'=>'file'));
echo $this->Form->file('Photo.image');
echo $this->Js->Submit('Add Picture',array('url'=>'/users/savepicture','class'=>'button',
'before'=>$this->Js->get('#right-box')->effect('fadeOut') ,
'success'=>$this->Js->get('#right-box')->effect('fadeIn'),'update'=>'#right-box'
));
echo $this->Form->end(); 
echo $this->Js->writebuffer();
?>


In the controller I tried to debug ($this->data) just to get an understanding of how the file is uploaded . But i see no data being uploaded . The debug returns an empty array . Help 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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

Time niceShort & timeAgoInWords (Bug?)

Hi

I have the time in my database saved as GMT and also I use UTC in
cakephp (core file)

everything is working fine with niceShort and when I print the time
from database I get the time in GMT

but when I use timeAgoInWords I can see it's using the system time not
GMT.

is this a bug or something wrong with my setup?

--
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.com For more options, visit this group at http://groups.google.com/group/cake-php

Problem with Cake shell

Hi
I try to use cake shell but I get an fatal error because in my
bootstrap.php I use App:build() and the fatal error tells me that th
method App::build is undefined when I run my cake shell instead with a
normal web page all works fine
Many Thanks
Marco

--
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.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: Doubt regarding sessions in cakephp

I don't like session approaches, at least if it not correctly coded (the keys in the session must not overwrite themselves using several tabs at the same time). this really annoys people because they always get unnecessarily black-holed due to this concurrency problem.

if it doesnt have to be highest security you can also use the session-less approach:
as a math captcha it also tries to do justice to all frontend users (I got some positive feedback from handycapped people on my cake based social network site saying that they could work with this thousand times better than those image things).
you can always combine it with the Security component to maximize security.


Am Samstag, 31. März 2012 03:09:56 UTC+2 schrieb Gabriel Vila Real:
Hi Litto

It looks like some php.ini configuration has to be done. Compare your local php.ini file with production php.ini file, and check the session configurations.

-- 
Gabriel Vila Real



On Thu, Mar 29, 2012 at 02:39, LITTO CHACKO <litto@axtecindia.com> wrote:
hai, buddies.... iam currently working in a project which contains as
many forms.. so i have to attach captcha to each form for ensuring
security... so the problem is that... actually captcha is working with
help of sessions... u all know.. whwn iam testing it on local server
it works fine.... with captcha and submitting form.. but whwn i do the
same in main server.. i didn't get the value of captcha stored in
session??? pls anyone clear this doubt by giving effective
solutions??? beacuse of this pblm by project is in vain....

--
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.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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: Send email Shell Application

@LITTO CHACKO:
he wants to use it inside a shell, so he has to use the CakeEmail class (and not the compontent!)

take a look at this question (as he already figured it out pretty good):
the only thing missing is that he should pass some settings to the class (in this case SMTP to send emails via this protocol)
other than that is is fully functional

also note that you should set the domain manually for Emails sent via CLI


Am Freitag, 30. März 2012 20:56:26 UTC+2 schrieb Fernando:
I'm using cake 2.1 and I need to send emails by a Shell Application. I
found no documentation about it. How can I do 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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

Friday, March 30, 2012

Cache errors

Although my site and cache is functioning, my debug log is littered
with errors similar to this:

2012-03-30 23:45:28 Notice: Notice (8): unserialize() [<a
href='function.unserialize'>function.unserialize</a>]: Error at offset
4065 of 4085 bytes in [/var/www/clients/client1/_sites/cakes/1_3_13/
cake/libs/cache/file.php, line 190]
2012-03-31 04:59:18 Notice: Notice (8): unserialize() [<a href='http://
php.net/function.unserialize'>function.unserialize</a>]: Error at
offset 1056757 of 1056757 bytes in [/var/www/clients/client1/_sites/
cakes/1_3_13/cake/libs/cache/file.php, line 190]

Anyone got any pointers please?

--
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.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: redirecting problem

@crotch 
i wrote like this..
  $this- >redirect('/seller/message/'); 

and u told me to do this
try::  $this->redirect('/sellers/message');


what's the difference between two???? is it same???
Litto Chacko
Axtec Softwares

--
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.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: Email mock not working



Why don't you use the cakephp builtin component email???? it is nice and easy to use
it can be include by:_
public $components = array('Session','Email');

and can be used to send email by:_
$pass = array('fullname'=>$name,'password'=>$p,'url'=>$url,
'reference'=>$reference,'email'=>$email);
$this->set('emailValues',$pass);
$this->Email->to = $email;
$this->Email->subject = 'Welcome Mail fromjustdeals.com';
$this->Email->replyTo = 'no-reply@image.com';
$this->Email->from    = 'no-reply<no-reply@image.com>';
$this->Email->template = 'account_created';
$this->Email->sendAs = 'html';
$this->Email->send();

you have a corresponding  account_created.ctp(as in example) file in the folder views_>emails->html->... 

thanks ;



--
Litto Chacko
Axtec Softwares

--
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.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: redirecting problem

try::  $this->redirect('/sellers/message');

On Friday, March 30, 2012 4:42:47 AM UTC-4, LITTO CHACKO wrote:
hai guys, i have to met with other problem.. the problem is that whwn
i tried to submit a form .... it saves all data nad when it is asked
to redirect after saving it..it doesn't work???

  if ($this->Email->send()) {

                                                               $this-
>redirect('/seller/message/');
                                                       }
}

it will enter this loop..but after that it is not performing the
redirection action?? why??

--
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.com For more options, visit this group at http://groups.google.com/group/cake-php

Email mock not working

Hello,

I'm trying to use the mock when testing the e-mail sender. But it's
not working.
My code is:

$Users = $this->generate('Users', array('components' => array(
'Email' => array(
'sendConfirmationEmail'))));

$Users->Email->expects($this->once())->method('sendConfirmationEmail')-
>will($this->returnValue(true));

I'm using the EmailComponent in the UsersController, and the
sendConfirmationEmail is the method I want to mock. Can anybody help
me?

Thanks,
Thiago

--
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.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: Send email Shell Application


Why don't you use the cakephp builtin component email???? it is nice and easy to use
it can be include by:_
public $components = array('Session','Email');

and can be used to send email by:_
$pass = array('fullname'=>$name,'password'=>$p,'url'=>$url,
'reference'=>$reference,'email'=>$email);
$this->set('emailValues',$pass);
$this->Email->to = $email;
$this->Email->subject = 'Welcome Mail from justdeals.com';
$this->Email->replyTo = 'no-reply@image.com';
$this->Email->from  = 'no-reply<no-reply@image.com>';
$this->Email->template = 'account_created';
$this->Email->sendAs = 'html';
$this->Email->send();

you have a corresponding  account_created.ctp(as in example) file in the folder views_>emails->html->... 

thanks ;

Litto Chacko
Axtec Softwares

--
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.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: Send email Shell Application


I found no documentation about it.

What means "it"?
http://book.cakephp.org/2.0/en/console-and-shells.html
http://book.cakephp.org/2.0/en/core-utility-libraries/email.html

--
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.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: Doubt regarding sessions in cakephp

Hi Litto

It looks like some php.ini configuration has to be done. Compare your local php.ini file with production php.ini file, and check the session configurations.

-- 
Gabriel Vila Real



On Thu, Mar 29, 2012 at 02:39, LITTO CHACKO <litto@axtecindia.com> wrote:
hai, buddies.... iam currently working in a project which contains as
many forms.. so i have to attach captcha to each form for ensuring
security... so the problem is that... actually captcha is working with
help of sessions... u all know.. whwn iam testing it on local server
it works fine.... with captcha and submitting form.. but whwn i do the
same in main server.. i didn't get the value of captcha stored in
session??? pls anyone clear this doubt by giving effective
solutions??? beacuse of this pblm by project is in vain....

--
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.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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: paginator with user defined page sizes...

Hey,

seems a bit too complicated to me...

I suggest you just wrap the dropdown in a form, use a submit on the
same page ($this->Form->create('Modelname', array('url' => $this-
>here));) to send the form to the same action you're in at this
moment.

In your controller use a RequestHandler-Part to get changes of the
dropdown and write them into a session variable. Then use a paginator
defintion directly within the controller, and set the limit of the
paginator to the value of the depending session-key.

That should be a 2-minute task, if you have any questions just ask, I
will post the code for you if you cannot get any further.

Hint:
To define the paginator from within an action (and not globally for a
whole controller), use the following code in your action:

public function index() {
$this->paginate['Modelname'] = array(
'conditions' => array(
'Modelname.deleted' => false),
'limit' => 10,
'order' => array(
'Modelname.created' => 'DESC'
)
);
$results = $this->paginate('Modelname');
$this->set(compact('results'));
}

(the code above implies you would use a condition on not-deleted
entries and an ordering of the field created in a descending way)

Second hint: replace the hard-coded limit of 10 to a Session key (e.g.
$this->Session->read('Settings.Model.action.limit'); )

On 30 Mrz., 09:04, Thomas <goo...@ellis-events.com> wrote:
> Nobody that can help?
>
>
>
>
>
>
>
> On Tuesday, March 27, 2012 10:23:12 AM UTC+2, Thomas wrote:
>
> > Am Montag, 26. März 2012 17:01:49 UTC+2 schrieb 100rk:
>
> >> Form using GET method, dropdown named 'limit' or 'show' with onchange = '
> >> *this.form*.submit();' - see pagination settings 'paramType' and
> >> 'maxLimit'.
>
> >>http://book.cakephp.org/2.0/en/core-libraries/components/pagination.h...
>
> > Works - nearly :-)
>
> > I added the form and select elements to my template:
>
> > index.ctp:
>
> > <?php
> >     echo $this->Form->create(FALSE);
> >     echo $this->Html->link('Add Post', array('controller' => 'posts',
> > 'action' => 'add'));
> >     echo '<br><br>'.$this->Paginator->numbers(array('before'=>'Pages: '));
>
> >     $options = array( 2 => 'two', 4 => 'four');
> >     echo '&nbsp;Show '.$this->Form->select('recordlimit', $options,
> > array('value'=>2, 'empty' => FALSE, 'onChange'=>'this.form.submit();')).'
> > records per page.';
> > ?>
>
> > And the following code in PostsController.php:
>
> > <?php
> > class PostsController extends AppController {
> >     public $name = 'Posts';
> >     public $helpers = array('Html', 'Form');
> >     public $components = array('Session');
> >     public $paginate = array(
> >             'paramType' => 'querystring',
> >             'limit' => 2,
> >             'order' => array(
> >                 'Post.title' => 'asc'
> >             )
> >         );
>
> >     function beforeFilter(){
> >         $this->paginate['limit'] =
> > intval($this->request->data('recordlimit'));
> >     }
>
> > In the debugger, I can now see that the "limit" option of the paginator
> > gets set to 4 if I select option "four", but I only get a single record and
> > a total of 5 pages (one record per page) shown after this.
>
> > I also don't know how I can access the current limit of the paginator from
> > the view to set the correct option in the select.
>
> > Also, the direct page links always look like this (limit = 1):
>
> >http://localhost/cakephp/posts?/posts=&page=2&limit=1
>
> > I know I'm nearly there - but CakePHP is quite complex and the learning
> > curve steep for me.
>
> > I urgently need results so any help is appreciated very much.
>
> > Thanks!
> > Thomas

--
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.com For more options, visit this group at http://groups.google.com/group/cake-php

Send email Shell Application

I'm using cake 2.1 and I need to send emails by a Shell Application. I
found no documentation about it. How can I do 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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: After a while Cache is not writeable

You'll have to configure that for _cake_core_ cache, see http://book.cakephp.org/2.0/en/development/configuration.html#core-cache-configuration

--
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.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: After a while Cache is not writeable

This happens if you run console shell/task as root user with su or cron. Either specify user www-data in crontab, or change cache configuration to 'mask' => 0644, or - don't use FileEngine in production.

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

Re: 'Listen' for new database entries from a plugin

Thanks for the replies

Events are probably what i need.
All to do now is upgrading to 2.1 :)

On Mar 30, 5:57 pm, Thomas Ploch <profipl...@googlemail.com> wrote:
> If you are using CakePHP 2.1, use CakeEvent to dispatch events for inter
> plugin communication:http://book.cakephp.org/2.0/en/core-libraries/events.html
>
> On 30.03.2012 16:45, rainerpl wrote:
>
>
>
>
>
>
>
> > Hi
>
> > I was wondering , if it is possible to write a plugin, that 'knows' if
> > for example a new user registers.
>
> > E.g would it be possible to write a plugin, that automatically
> > duplicates/backs up user registration data, without requiring any
> > modifications to the User model.
> > (I know i could easily make it using User model alone, but im trying
> > to learn how to make plugins.)

--
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.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: MenuBuilder doesn't work with cakephp 2.0 (or 2.1)

Thomas... could you please post what exactly you have under each directory?

I'm using 2.1.1 and I believe I made exactly the same setup that you did, but I'm still getting the "Helper class MenuBuilderHelper could not be found" error

this is what I do have:
app
  Plugin
    MenuBuilder
      Controller  ---> Component ---> MenuGathererComponent.php
      Test
      View ---> helpers ---> MenuBuilderHelper.php

the line CakePlugin::load('MenuBuilder'); was added to /app/config/bootstrap.php

The code in /app/Controller/Appcontroller.php:

    var $helpers = array('Form', 'Html', 'MenuBuilder.MenuBuilder');
plus the sample code under beforeFilter() method

In my default.ctp I have the following code:

        <div id="header">
            <?php echo $this->MenuBuilder->build('main-menu'); ?>      
        </div>


is this exactly what you have?

thanks
750riderAce

On Friday, March 30, 2012 10:15:19 AM UTC-4, Thomas wrote:

Basically I now have the following setup which I copied from the git repository:

app
  Plugin
    MenuBuilder
      Controller
      Test
      View

I added the following line to /app/config/bootstrap.php:

CakePlugin::load('MenuBuilder');

This is the code I added to /app/Controller/Appcontroller.php:

    var $helpers = array('Form', 'Html', 'MenuBuilder.MenuBuilder');

Then I added the code from the MenuBulder sample to the beforeFilter() function in the appcontroller.

In my default.ctp I just put the following code:

        <div id="header">
            <?php echo $this->MenuBuilder->build('main-menu'); ?>      
        </div>

...that was it basically - I hope I did not forget something :)

On Thursday, March 29, 2012 1:16:44 PM UTC+2, GoneShootin wrote:
Thomas

Can you go through how you got it working? I'm beating my head against
a brick wall trying to get this to work on 2.1.x!

--
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.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: MenuBuilder doesn't work with cakephp 2.0 (or 2.1)

Thomas... could you please post waht exactly you have under each directory?

I'm using 2.1.1 and I did exactly the same setup that you did, but I'm still
getting the "Helper class MenuBuilderHelper could not be found" error

this is what I do have:
*app
Plugin
MenuBuilder
Controller ---> Component ---> MenuGathererComponent.php
Test
View ---> helpers ---> MenuBuilderHelper.php*
the line *CakePlugin::load('MenuBuilder');* was added to
*/app/config/bootstrap.php*

*The code in /app/Controller/Appcontroller.php*:

* var $helpers = array('Form', 'Html', 'MenuBuilder.MenuBuilder');
plus the sample code under beforeFilter() method*
In my default.ctp the following code:

*<div id="header">
<?php echo $this->MenuBuilder->build('main-menu'); ?>
</div>*

is this exactly what you have?

thanks
750riderAce


--
View this message in context: http://cakephp.1045679.n5.nabble.com/MenuBuilder-doesn-t-work-with-cakephp-2-0-or-2-1-tp5120624p5606930.html
Sent from the CakePHP mailing list archive at Nabble.com.

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


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

Re: Troubleshooting the CakeDC TinyMCE helper plugin.

I had to copy the TinyMCE js lib from the the plugin js folder to the /app/webroot/js folder and edit the plugins helper file.  Something to do with plugin routing causing issues.

--
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.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: cakePHP Data into Google Charts

I've outputted some charts (combocharts - near identical to column chart) using the visualization api and got the model to output an array like:

Array
(
    [labels] => Array
        (
            [0] => Age
            [1] => Clients
            [2] => Not Offered
            [3] => Accepted Offer
            [4] => Declined Offer
        )

    [16] => Array
        (
            [0] => 16
            [1] => 10
            [2] => 7
            [3] => 5
            [4] => 0
        )

    [17] => Array
        (
            [0] => 17
            [1] => 27
            [2] => 22
            [3] => 13
            [4] => 4
        )

    [18] => Array
        (
            [0] => 18
            [1] => 13
            [2] => 8
            [3] => 7
            [4] => 2
        )

    [19] => Array
        (
            [0] => 19
            [1] => 12
            [2] => 6
            [3] => 6
            [4] => 1
        )

    [20] => Array
        (
            [0] => 20
            [1] => 8
            [2] => 2
            [3] => 6
            [4] => 0
        )

    [21] => Array
        (
            [0] => 21
            [1] => 7
            [2] => 4
            [3] => 3
            [4] => 0
        )

)

I then ran this through the following
foreach($arrayFromModel AS $row) {
  $chartData[] = json_encode($row);
}

and ended up with:
Array
(
    [0] => ["Age","Clients","Not Offered","Accepted Offer","Declined Offer"]
    [1] => ["16",10,7,5,0]
    [2] => ["17",27,22,13,4]
    [3] => ["18",13,8,7,2]
    [4] => ["19",12,6,6,1]
    [5] => ["20",8,2,6,0]
    [6] => ["21",7,4,3,0]
)

With an array of this type you use the following google function to get your data table:
var data = google.visualization.arrayToDataTable([".join(',', $chartData)."]);

Hope this is of some help, phpMagpie

--
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.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: 'Listen' for new database entries from a plugin

If you are using CakePHP 2.1, use CakeEvent to dispatch events for inter
plugin communication:
http://book.cakephp.org/2.0/en/core-libraries/events.html

On 30.03.2012 16:45, rainerpl wrote:
> Hi
>
> I was wondering , if it is possible to write a plugin, that 'knows' if
> for example a new user registers.
>
> E.g would it be possible to write a plugin, that automatically
> duplicates/backs up user registration data, without requiring any
> modifications to the User model.
> (I know i could easily make it using User model alone, but im trying
> to learn how to make plugins.)
>


--
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.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: MenuBuilder doesn't work with cakephp 2.0 (or 2.1)

in controller I setup the data for menus



        $main = array(
            array(
                'title' => 'Home',
                'url' => '/',
            ),
            array(
                'title' => 'About',
                'url' => '/about',
            ),
            array(
                'title' => 'Articles',
                'url' => '/articles',
            ),
            array(
                'title' => 'Categories',
                'url' => '/categories',
            ),
            array(
                'title' => 'Projects',
                'url' => '/projects',
            ),
            array(
                'title' => 'Contact',
                'url' => '/contact',
            ),
        );

$this->set('mainMenu', $menu);

then in view
echo $this->MenuBuilder->build('mainMenu');



 - S




On 30 March 2012 15:15, Thomas <google@ellis-events.com> wrote:

Basically I now have the following setup which I copied from the git repository:

app
  Plugin
    MenuBuilder
      Controller
      Test
      View

I added the following line to /app/config/bootstrap.php:

CakePlugin::load('MenuBuilder');

This is the code I added to /app/Controller/Appcontroller.php:

    var $helpers = array('Form', 'Html', 'MenuBuilder.MenuBuilder');

Then I added the code from the MenuBulder sample to the beforeFilter() function in the appcontroller.

In my default.ctp I just put the following code:

        <div id="header">

            <?php echo $this->MenuBuilder->build('main-menu'); ?>      
        </div>

...that was it basically - I hope I did not forget something :)


On Thursday, March 29, 2012 1:16:44 PM UTC+2, GoneShootin wrote:
Thomas

Can you go through how you got it working? I'm beating my head against
a brick wall trying to get this to work on 2.1.x!

--
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.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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: 'Listen' for new database entries from a plugin

Add something to the User->afterSave method and check the $created variable - if it's true then do your backups, if it's false it's an update so do nothing.

Jeremy Burns
Class Outfit

http://www.classoutfit.com

On 30 Mar 2012, at 15:45:03, rainerpl wrote:

Hi

I was wondering , if it is possible to write a plugin, that 'knows' if
for example a new user registers.

E.g would it be possible to write a plugin, that automatically
duplicates/backs up user registration data, without requiring any
modifications to the User model.
(I know i could easily make it using User model alone, but im trying
to learn how to make plugins.)

--
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.com For more options, visit this group at http://groups.google.com/group/cake-php

'Listen' for new database entries from a plugin

Hi

I was wondering , if it is possible to write a plugin, that 'knows' if
for example a new user registers.

E.g would it be possible to write a plugin, that automatically
duplicates/backs up user registration data, without requiring any
modifications to the User model.
(I know i could easily make it using User model alone, but im trying
to learn how to make plugins.)

--
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.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: MenuBuilder doesn't work with cakephp 2.0 (or 2.1)


Basically I now have the following setup which I copied from the git repository:

app
  Plugin
    MenuBuilder
      Controller
      Test
      View

I added the following line to /app/config/bootstrap.php:

CakePlugin::load('MenuBuilder');

This is the code I added to /app/Controller/Appcontroller.php:

    var $helpers = array('Form', 'Html', 'MenuBuilder.MenuBuilder');

Then I added the code from the MenuBulder sample to the beforeFilter() function in the appcontroller.

In my default.ctp I just put the following code:

        <div id="header">
            <?php echo $this->MenuBuilder->build('main-menu'); ?>      
        </div>

...that was it basically - I hope I did not forget something :)

On Thursday, March 29, 2012 1:16:44 PM UTC+2, GoneShootin wrote:
Thomas

Can you go through how you got it working? I'm beating my head against
a brick wall trying to get this to work on 2.1.x!

--
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.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: redirecting problem

ini_set() work correctly?

--

LiJunLe@gmail.com | Public Key | Twitter | SinaWeibo



On Fri, Mar 30, 2012 at 16:42, LITTO CHACKO <litto@axtecindia.com> wrote:
hai guys, i have to met with other problem.. the problem is that whwn
i tried to submit a form .... it saves all data nad when it is asked
to redirect after saving it..it doesn't work???

 if ($this->Email->send()) {

                                                              $this-
>redirect('/seller/message/');
                                                      }
}

it will enter this loop..but after that it is not performing the
redirection action?? why??

--
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.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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

After a while Cache is not writeable

Hi!

I have a strange problem with my cakephp-Installation on Ubuntu 10.04
Server: Everything works fine but after a while i get the warning:

fopen(/rootdir/cakephp/app/tmp/cache/persistent/cake_core_default_de-
de) [function.fopen]: failed to open stream: Permission denied [CORE/
cake/libs/cache/file.php, line 142]

If i examine the file its owned by root.

Then i set the right owner (www-data) and everything works fine (for a
while). I cant figure out what happen. Everything else (tmp-Dir,
cachedir a.s.o.) is not affected...only the above file.

Thanks!

Best regards,
Kai.

--
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.com For more options, visit this group at http://groups.google.com/group/cake-php

redirecting problem

hai guys, i have to met with other problem.. the problem is that whwn
i tried to submit a form .... it saves all data nad when it is asked
to redirect after saving it..it doesn't work???

if ($this->Email->send()) {

$this-
>redirect('/seller/message/');
}
}

it will enter this loop..but after that it is not performing the
redirection action?? why??

--
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.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: Controller can't access the Session

i also came across same problem.... i arranged the code such that after initialising session.. read the variables in session....and not put other codesbetween this.. if u do it.. u can get the result.. 

On Fri, Mar 30, 2012 at 12:19 AM, Miles J <mileswjohnson@gmail.com> wrote:
On a side note, you are including tons of models.

You don't need to include every model if specific models have associated models you can utilize. You should also load models on a per action basis using loadModel().

On Sunday, March 18, 2012 5:37:02 PM UTC-7, Felipe Roman wrote:
Hi,

Has someone ever seen only one controller does not access the cake session ?

The session works fine for all controllers except for one specific
controller. I tried debug the problem but I didn't find the reason.

The controller code:

class ExecutivosController extends AppController {

        var $name = 'Executivos';
        var $uses = array('Executivo', 'FormacaoAcademica',
'FormacaoComplementar', 'Executivo', 'Empresa', 'Unidade', 'Cargo',
'ExecutivoCargo', 'AtuacaoProfissional', 'ExecutivoIdioma', 'Decisao',
'Mobilidade', 'PotencialProntidao', 'Arquivo', 'Usuario');
        var $components = array('RequestHandler', 'Email');

        function index() {

                // Get login information
                $Login = $this->Session->read('Login');

                debug($_SESSION);
                debug($Login);

and the others controllers are similar:

<?php
class CargosController extends AppController {

        var $name = 'Cargos';
        var $uses = array('Cargo', 'Empresa', 'Unidade', 'Executivo',
'RespostaColaboradore');
        var $components = array('RequestHandler', 'Email');

        function index() {
            // Le informações de login
            $Login = $this->Session->read('Login');

            debug($_SESSION);
            debug($Login);


When I access the Cargos controller all session information are
printed by debug funcion as expected, when I try access the first one
the Session and $_SESSION is empty. If I reload the second one again
the session values are still there (it means the session isn't
erased).

The app_controller.php file:

class AppController extends Controller {
    var $helpers = array('Html', 'Javascript', 'Session', 'Ajax',
'Time', 'Form');

    function  beforeFilter() {
        //debug($this);
        if (($this->name != "Usuarios") or ($this->action != 'login')){

            if($this->Session->read('Login')) {
            } else {
                $this->Session->setFlash(__('Efetue o login para
acessar o sistema', true));
                $this->redirect(array('controller' => 'usuarios',
'action' => 'login'));
            }
        }
    }

Has someone have any ideas why the Executivos controller can't access
the session ?

Thanks

--
Best Regards,
Felipe Roman
Phone 55 51 8454 8110
LinkedIn http://au.linkedin.com/in/feliperoman

--
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.com For more options, visit this group at http://groups.google.com/group/cake-php



--
Litto Chacko
Axtec Softwares

--
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.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: problem of captcha

@mike.. thank god now the problem with captcha is solved..... i don't
know what made it to work.... i have made some arrangements with the
code and get the captcha component work.. but now problem is it is not
redirecting to corresponding page..... any suggestions:-

if ($this->Email->send()) {

$this->redirect('/seller/message/');
}
}

it will enter this loop..but after that it is not performing the
redirection action?? why??

--
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.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: paginator with user defined page sizes...

Nobody that can help?

On Tuesday, March 27, 2012 10:23:12 AM UTC+2, Thomas wrote:


Am Montag, 26. März 2012 17:01:49 UTC+2 schrieb 100rk:
Form using GET method, dropdown named 'limit' or 'show' with onchange = 'this.form.submit();' - see pagination settings 'paramType' and 'maxLimit'.

http://book.cakephp.org/2.0/en/core-libraries/components/pagination.html#pagination-with-get-parameters

Works - nearly :-)

I added the form and select elements to my template:

index.ctp:

<?php
    echo $this->Form->create(FALSE);
    echo $this->Html->link('Add Post', array('controller' => 'posts', 'action' => 'add'));
    echo '<br><br>'.$this->Paginator->numbers(array('before'=>'Pages: '));

    $options = array( 2 => 'two', 4 => 'four');
    echo '&nbsp;Show '.$this->Form->select('recordlimit', $options, array('value'=>2, 'empty' => FALSE, 'onChange'=>'this.form.submit();')).' records per page.';
?>
 
And the following code in PostsController.php:

<?php
class PostsController extends AppController {
    public $name = 'Posts';
    public $helpers = array('Html', 'Form');
    public $components = array('Session');
    public $paginate = array(
            'paramType' => 'querystring',
            'limit' => 2,
            'order' => array(
                'Post.title' => 'asc'
            )
        );   

    function beforeFilter(){
        $this->paginate['limit'] = intval($this->request->data('recordlimit'));       
    }
   
In the debugger, I can now see that the "limit" option of the paginator gets set to 4 if I select option "four", but I only get a single record and a total of 5 pages (one record per page) shown after this.

I also don't know how I can access the current limit of the paginator from the view to set the correct option in the select.

Also, the direct page links always look like this (limit = 1):

http://localhost/cakephp/posts?/posts=&page=2&limit=1

I know I'm nearly there - but CakePHP is quite complex and the learning curve steep for me.

I urgently need results so any help is appreciated very much.

Thanks!
Thomas

--
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.com For more options, visit this group at http://groups.google.com/group/cake-php

Thursday, March 29, 2012

Re: problem of captcha

On Thu, Mar 29, 2012 at 13:07, LITTO CHACKO <litto@axtecindia.com> wrote:
> hello ,   @mike
>
>
> my local server is linux centos.. my main server is also linux... i
> don't know what is problem with server.. everything works fine in
> local...but when iam uploading it to the mainserver..it is showing
> problems... can't fix yet....it happens to every session in my
> project.. pls help...

What are the problems that it's showing when you upload to the server?

--
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.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: Cost of cakePHP2 developers

lol, depend on the country, you cannot count it in USD. Converting it into burger is better. Say, in my country, 1 hours of senior developer can buy only 2 burgers :((

On Wed, Mar 28, 2012 at 5:03 PM, DerekGardiner <derek.gardiner@gmail.com> wrote:
Does anyone know what the typical hourly rate of a cakephp dev (in
USD) would be? For a junior, intermediate and senior developer?

--
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.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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: CakePHP Controller Testing with DB Sessions

Thanks for the tip. I'm sure this is the more "Cakey" way to do it. I
used the quick fix above for now but will definitely look into this in
the future. Thanks!

On Mar 29, 1:49 pm, Rodrigo Rodrigues Moyle <rodrig...@gmail.com>
wrote:
> Mock you SessionComponent to not access the database.

--
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.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: CakePHP Controller Testing with DB Sessions

That was just the quick fix I needed right now. Thanks!

On Mar 29, 3:51 am, Mike Griffin <griff...@gmail.com> wrote:
> Have you tried creating the cake_sessions table in your test database?
>
> I think you have to manually create the tables in the test database
> before you can use them.
>
> Mike.
>
>
>
>
>
>
>
> On Wed, Mar 28, 2012 at 20:57, jcrens8392 <runner1...@gmail.com> wrote:
> > Hi all,
>
> > I'm new to Cake and had controller test cases working fine.
>
> > However, I just recently switched to DB sessions and now all my controller
> > test cases throw a MissingTableException:
>
> > Table cake_sessions for model Session was not found in datasource test.
>
> > I have no idea even where to begin on this. Any ideas!
>
> > Thanks!
>
> > --
> > Our newest site for the community: CakePHP Video Tutorials
> >http://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
> > others with their CakePHP related questions.
>
> > To unsubscribe from this group, send email to
> > cake-php+unsubscribe@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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: XML DataSource or solution

Hello Carlos,

I have a similar requirement, and was not able to find an XML data source anywhere. 

The closest I have seen to one is this one, which is half finished (and also dual data source which is not what I need):


It seems that your own attempt is half finished as well. Does anyone know of a fully functional XML or Text Data Source for Cake PHP 2.x?

Thanks,
Pete

On Thursday, February 10, 2011 2:00:28 PM UTC-6, Carlos Paparoni wrote:
Hi everyone, I'm new to CakePHP and started using it in hopes of
developing a project assigned to me in a course at my university as
quickly as possible.

The project requires that I avoid the use of databases completely,
relying on XML files (or rather, file) to load, display, add, remove,
search and save data.

However, Cake relies mostly on databases, and while I managed to
actually avoid the use of any, and read the XML file, I don't know
where to go from there. I completed the blog tutorial and adapted it
for the project (mainly the index view), but that is what I have so
far.

I was searching online for a solution, but didn't find any (except for
code snippets here and there about writing a XML DS from scratch). I
thought about using the Array DataSource (since I can convert the XML
file into an array) but don't really know how exactly to implement
that.

Any ideas or suggestions? I would really appreciate some help.

--
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.com For more options, visit this group at http://groups.google.com/group/cake-php

XML or Text based Data Source?

Hello All,

I have a small application I wish to write that requires storing data
to either XML files or Plain Text files. I am therefore searching for
either an XML or a Text Data Source for CakePHP 2.1, and was surprised
that I am not able to find such Data Sources.

Can anyone shed some light on this matter?

Thanks,
Pete

--
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.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: isAuthorized() is never called

Hi,

I wrote this code moths ago:
abstract class AppController extends Controller {
    //...

    public $components = array(
        'Session',
        'Auth' => array(
            'loginRedirect' => array('controller' => 'pages', 'action' => 'index'),
            'logoutRedirect' => array('controller' => 'abouts', 'action' => 'index'),
            'authorize' => array('Controller'),
            'authError' => "You are not authorized to view this page."
        )
    );

    function beforeFilter() {
        $this->Auth->allow('index');
        $this->set('userId', $this->Auth->user('id'));
        $this->set('userRole', $this->Auth->user('role'));
        $this->set('userName', $this->Auth->user('username'));
        $this->set('isLoggedIn', $this->Auth->loggedIn());
    }

    public function isAuthorized($user) {
        if (isset($user['role']) && $user['role'] === 'admin') {
            return true; //Admin can access every action
        }
        return false; // The rest don't
    }
}

2012. március 28., szerda 15:09:03 UTC+2 időpontban Sony a következőt írta:
Hi,

When I run a action, the access is refused because the method
isAuthorized() is never called.

AppController :

<?php

class AppController extends Controller {

        public $helpers = array ('Html', 'Form', 'Session', 'Time');

        public $components = array('Session', 'Auth');

        public function beforeFilter()
        {
                $this->Auth->userModel = 'User';
                $this->Auth->fields = array('username' => 'username', 'password' =>
'password');
                $this->Auth->loginAction = array('controller' => 'users', 'action'
=> 'login');
                $this->Auth->loginRedirect = '/';
                $this->Auth->loginError = 'Nom d\'utilisateur ou mot de passe
incorrects.';
                $this->Auth->logoutRedirect = '/';
                $this->Auth->authError = 'Vous n\'avez pas accès à cette page.';
                $this->Auth->autoRedirect = true;
                $this->Auth->authorize = 'controller';

                debug('beforeFilter');
        }

        public function isAuthorized($user = null)
        {
                debug('isAuthorized');
                die();
                return true;
        }
}

My others controllers do not implement beforeFilter or isAuthorized.

--
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.com For more options, visit this group at http://groups.google.com/group/cake-php