Re: CakePHP

2011-11-22 Thread Sathia S
What is difference between CakePHP and Codeigniter ??

# In Codeigniter,  can load model even in views.
But I think we cannot do that in cakephp.

# Codeigniter doesnt have any auth component or acl ,
but cakephp does.

# Codeigniter does'nt have ajax helper. By default cakephp has.
-- 
Regards

sathia

Here I share my experience with open source
http://www.sathia27.wordpress.com
http://www.sathia27.wordpress.comhttp://www.lquery.comhttp://www.sathia27.wordpress.com/
http://www.sathia27.wordpress.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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Infinite re-direct during login

2011-11-22 Thread Mamdoohi
hi
for any page that you want load without authentication, you must add this 
code in your beforeFilter() function in ony controller

$this-Auth-allow('your_page')

-- 
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


How to track the referer when error 404 happens?

2011-11-22 Thread heohni
Hi,

I using this app_error handler:

?php
class AppError extends ErrorHandler{

function __construct($method, $messages) {
Configure::write('debug', 2);
parent::__construct($method, $messages);
}
function _outputMessage($template) {
$this-controller-render($template);
$this-controller-afterFilter();

App::import('Core', 'Email');
$email = new EmailComponent;

$email-from = 'CakePHP cakephp...@xxx.de';
$email-to = 'Developer m...@mail.de';
$email-sendAs = 'html';
$email-subject = 'Error!';

$email-send($this-controller-output);

$this-controller-output = null;
$this-controller-render('error404');
echo $this-controller-output;
}
}
?

How can I also send the referer in order to see what link the user
used to get to this 404 error page?
Any ideas?

Thanks folks!

-- 
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 track the referer when error 404 happens?

2011-11-22 Thread AD7six


On Tuesday, 22 November 2011 11:45:42 UTC+1, heohni wrote:

 Hi,

 I using this app_error handler:

 ?php
 class AppError extends ErrorHandler{

 function __construct($method, $messages) {
 Configure::write('debug', 2);
 parent::__construct($method, $messages);
 }
 function _outputMessage($template) {
 $this-controller-render($template);
 $this-controller-afterFilter();

 App::import('Core', 'Email');
 $email = new EmailComponent;

 $email-from = 'CakePHP cakep...@xxx.de';
 $email-to = 'Developer m...@mail.de';
 $email-sendAs = 'html';
 $email-subject = 'Error!';

 $email-send($this-controller-output);

 $this-controller-output = null;
 $this-controller-render('error404');
 echo $this-controller-output;
 }
 }
 ?

 How can I also send the referer in order to see what link the user
 used to get to this 404 error page?
 Any ideas?


How about: By including it in the message?

I think you'll find emailing someone every time there's a 404 will just 
drown their email whenever a problem occurs.

AD



-- 
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: loginError still notify even though i successfully logged in

2011-11-22 Thread AD7six


On Saturday, 19 November 2011 05:21:18 UTC+1, danswater wrote:

 Hi guys, i downloaded cakephp 1.3 and follow the CakePHP 1.3 App Dev
 CookBook on creating an application with authentication.
 I create the AppController class and set the $components in this
 following settings:
 public $components = array(
 'Auth' = array(
 'authorize' = 'controller',
 'autoRedirect' = false,
 'loginRedirect' = array(
 'admin' = false,
 'controller' = 'users',
 'action' = 'dashboard'
 ),
 'loginError' = 'Invalid account specified',
 'authErro' = 'You don\'t have the right permission'
 ),
 'Cookie',
 'Session'
 );

 my problem is the loginError. Evertime i successfully logged in to the
 application, loginError still shows.
 can you guys help me? thanks..

Do you get no error message when you login with username+password, and only 
see that error message when you login with email+password?

Show some code in your answer please.

AD

-- 
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: CakePHP

2011-11-22 Thread Mike Karthauser

On 22 Nov 2011, at 09:10, Sathia S wrote:

 What is difference between CakePHP and Codeigniter ??
 
 # In Codeigniter,  can load model even in views.
 But I think we cannot do that in cakephp.

why would you want to load model in the view?

you'd load model data in the controller and set it in the view. silly old 
codeigniter..



Mike Karthäuser
Director, Brightstorm Ltd.

1, Brewery Court
North Street
Bristol
BS3 1JS

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






-- 
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: CakePHP

2011-11-22 Thread Sathia S


 why would you want to load model in the view?
 you'd load model data in the controller and set it in the view. silly old
 codeigniter..

 ya silly. that will not be perfect MVC if we load model in views.
I mentioned negative point about that.

-- 
--
Regards
sathia

Here I share my experiments with open source.
http://www.sathia27.wordpress.com
http://www.sathia27.wordpress.com/http://www.lquery.comhttp://www.sathia27.wordpress.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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: CakePHP

2011-11-22 Thread rchavik

On Tuesday, November 22, 2011 6:00:24 PM UTC+7, Mike Karthauser wrote:


 why would you want to load model in the view?


I have come across this requirement/need.  And this is something that I've 
been wondering myself, i.e: are we allowed to instantiate a model in views 
by the rules of MVC?

From http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller, 
Overview section, number 4 on the list.

A view queries the model in order to generate an appropriate user interface

 
That sounds like that views are actually allowed to interact with models.  
So, to answer my own question above, occasionally I do use models + custom 
finds in views. :)

-- 
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


Auth issue with Multi-app enviroment

2011-11-22 Thread Ernesto
Hi all.

i have a multi-app enviroment (more apps sharing the same core).

two of those apps are using Cake's AuthComponent.

i followed the cake's conventions so both apps have
- an UsersController
- a UserModel

and, in theyr own db (they use different DBs)
- a users table, with username and password fields

Let's say i'm logged in the first app.
If i log in from the second one i get disconnected from the first.

This is weird! it looks like a Session issue to me. Maybe the second login 
is overwriting the first one

Any advice?

PS: sry for my bad english

-- 
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: CakePHP

2011-11-22 Thread Kane The Pirate
It can be done in MVC application, but it is recommended in case of having
issue to render the view with the controllers' data. Also the main logic of
the code is in the controller, so taking just the model data you are
limiting the capacity of the data processing

Em 22 de novembro de 2011 10:46, rchavik rcha...@gmail.com escreveu:


 On Tuesday, November 22, 2011 6:00:24 PM UTC+7, Mike Karthauser wrote:


 why would you want to load model in the view?


 I have come across this requirement/need.  And this is something that I've
 been wondering myself, i.e: are we allowed to instantiate a model in views
 by the rules of MVC?

 From http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller,
 Overview section, number 4 on the list.

 A view queries the model in order to generate an appropriate user interface


 That sounds like that views are actually allowed to interact with models.
 So, to answer my own question above, occasionally I do use models + custom
 finds in views. :)

  --
 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: CakePHP

2011-11-22 Thread euromark
But I think we cannot do that in cakephp.

you can use models anywhere in the complete cakephp framework - even
in the subsubsubsub element of a view if you want to.
simply be using ClassRegistry::init(ModelName)
But that doesnt mean that you should...^^



On 22 Nov., 13:56, Kane The Pirate kanethepir...@gmail.com wrote:
 It can be done in MVC application, but it is recommended in case of having
 issue to render the view with the controllers' data. Also the main logic of
 the code is in the controller, so taking just the model data you are
 limiting the capacity of the data processing

 Em 22 de novembro de 2011 10:46, rchavik rcha...@gmail.com escreveu:









  On Tuesday, November 22, 2011 6:00:24 PM UTC+7, Mike Karthauser wrote:

  why would you want to load model in the view?

  I have come across this requirement/need.  And this is something that I've
  been wondering myself, i.e: are we allowed to instantiate a model in views
  by the rules of MVC?

  Fromhttp://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller,
  Overview section, number 4 on the list.

  A view queries the model in order to generate an appropriate user interface

  That sounds like that views are actually allowed to interact with models.
  So, to answer my own question above, occasionally I do use models + custom
  finds in views. :)

   --
  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+unsubscr...@googlegroups.com For more options, visit this group
  athttp://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: Auth issue with Multi-app enviroment

2011-11-22 Thread Ernesto
It looks like i solved my issue modifying

Configure::write('Session', array('cookie' = APP_DIR));

3 CakePHP

-- 
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 track the referer when error 404 happens?

2011-11-22 Thread euromark
I did that for while - after upgrading the application
jesus christ. I can tell you.
I would have gotten hundreds of mails per second

With session token (and one email per session every HOUR)
it went down to a lot ;)

Anyway - the thing is, that a browser opens invalid urls all the time
especially InternetExplorer, especially with some bogus and rotten
software/plugins
(including some Antivirus Utility).
So even if you just log them away, there are quite a lot of entries to
log.

so if you do that, you should restrict the logging to session (as
above) and even better
to a valid logged in user. this is better than letting all bots of
this world create mail traffic for you.
that works for me in in upgrading phases and reports back to be in
real time.
most times it is a click then which will have a valid referer you can
work with.

for the referer you can use

/**
 * get the current referer
 * @param bool $full (defaults to false and leaves the url untouched)
 * @return string $referer (local or foreign)
 * 2011-11-02 ms
 */
public static function getReferer($full = false) {
$ref = env('HTTP_REFERER');
$forwarded = env('HTTP_X_FORWARDED_HOST');
if ($forwarded) {
$ref = $forwarded;
}
if (empty($ref)) {
return $ref;
}
if ($full) {
$ref = Router::url($full);
}
return $res;
}


On 22 Nov., 11:54, AD7six andydawso...@gmail.com wrote:
 On Tuesday, 22 November 2011 11:45:42 UTC+1, heohni wrote:

  Hi,

  I using this app_error handler:

  ?php
  class AppError extends ErrorHandler{

      function __construct($method, $messages) {
          Configure::write('debug', 2);
          parent::__construct($method, $messages);
      }
      function _outputMessage($template) {
          $this-controller-render($template);
          $this-controller-afterFilter();

          App::import('Core', 'Email');
          $email = new EmailComponent;

          $email-from = 'CakePHP cakep...@xxx.de';
          $email-to = 'Developer m...@mail.de';
          $email-sendAs = 'html';
          $email-subject = 'Error!';

          $email-send($this-controller-output);

          $this-controller-output = null;
          $this-controller-render('error404');
          echo $this-controller-output;
      }
  }
  ?

  How can I also send the referer in order to see what link the user
  used to get to this 404 error page?
  Any ideas?

 How about: By including it in the message?

 I think you'll find emailing someone every time there's a 404 will just
 drown their email whenever a problem occurs.

 AD









-- 
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


Remember Me with Cookie and Auth Component

2011-11-22 Thread Jordy van Kuijk
Hi all,

I'm trying to add a remember me checkbox into my login form.
When users check the box, they log in and a cookie ('Auth.User') is
stored, with 'email' and 'password' fields (this works).
Now in my AppController, I want to see if users can log back in using
their cookie.

I have the following code:

//inside AppController.php
public function beforeFilter(){

  $cookie = $this-Cookie-read('Auth.User');

  if (is_array($cookie)  !$this-Auth-user())
{
$this-Auth-login($cookie);
debug($this-Auth-user());
}
}

The debug shows me that the user object in Auth contains the email
address and password.
Is there a way to load all of the additional data into the user object
(like firstname, lastname, etc...)?
My UsersController contains the following login function:

public function login(){

$this-autoRender = false;
if($this-request-is('post')){
if($this-Auth-login()){

//see if the remember me cookie has to be set
if(!empty($this-request-data)  
$this-request-data['User']
['remember_me']){
$cookie = array();
$cookie['email'] = $this-data['User']['email'];
$cookie['password'] = $this-data['User']['password'];
$this-Cookie-write('Auth.User', $cookie, true, '+2
weeks');
return $this-redirect('../index');
}
else{
//we logged in, but the user does not 
want to have a cookie.
return $this-redirect('../index');
}
}
else {
//we tried to log in the user but it failed

$this-Session-setFlash($this-Auth-authError);
return $this-redirect('../index');
}
}
if(empty($this-request-data)){
$cookie = $this-Cookie-read('Auth.User');
if(!is_null($cookie)){

echo('we found cookie, now trying to log you in 
with it');

if($this-Auth-login($cookie)){


$this-Session-delete('Message.auth');

//return $this-redirect('../feed');
} else{
//invalid cookie
  $this-Cookie-del('Auth.User');
}
}
else{
//users accesses this page without a cookie
return $this-redirect('../index');
}
}
}

Please note that I am very new to CakePHP.
Thanks in advance,

Jordy


-- 
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: Write unit test for a controller that uses AuthComponent in CakePHP 2.0.3

2011-11-22 Thread Shukuboy
Hi,

I've also had to deal with testing controllers that use Auth
lately.Auth has improved heaps since 1.3 but it still seems to be
coupled with various bits and pieces of the core, and hence you might
get different behaviours between the website and testing.

I recommend mocking out Auth and getting it to return the value you
expect, in this case if your logged in user is 1, you can use
something like this :
$Users-Auth-expects($this-once())-method('user')
   - with( 'id' )
-will($this-returnValue(1));

Check out
- 
http://book.cakephp.org/2.0/en/development/testing.html#using-mocks-with-testaction
and if you need more info on phpunit :
- 
http://www.phpunit.de/manual/current/en/test-doubles.html#test-doubles.mock-objects

The new move to phpunit in Cake 2, was a great idea.  It's quite
powerful and allows you to do almost everything you need while unit
testing.

Hope this helps,
Shuku

-- 
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: Remember Me with Cookie and Auth Component

2011-11-22 Thread Miles J
Here you are: https://github.com/milesj/cake-auto_login

On Nov 22, 10:23 am, Jordy van Kuijk jvank...@gmail.com wrote:
 Hi all,

 I'm trying to add a remember me checkbox into my login form.
 When users check the box, they log in and a cookie ('Auth.User') is
 stored, with 'email' and 'password' fields (this works).
 Now in my AppController, I want to see if users can log back in using
 their cookie.

 I have the following code:

 //inside AppController.php
 public function beforeFilter(){

   $cookie = $this-Cookie-read('Auth.User');

   if (is_array($cookie)  !$this-Auth-user())
         {
                 $this-Auth-login($cookie);
                 debug($this-Auth-user());
         }

 }

 The debug shows me that the user object in Auth contains the email
 address and password.
 Is there a way to load all of the additional data into the user object
 (like firstname, lastname, etc...)?
 My UsersController contains the following login function:

 public function login(){

                 $this-autoRender = false;
                 if($this-request-is('post')){
                         if($this-Auth-login()){

                                 //see if the remember me cookie has to be set
                                 if(!empty($this-request-data)  
 $this-request-data['User']
 ['remember_me']){
                                         $cookie = array();
                         $cookie['email'] = $this-data['User']['email'];
                         $cookie['password'] = $this-data['User']['password'];
                         $this-Cookie-write('Auth.User', $cookie, true, '+2
 weeks');
                         return $this-redirect('../index');
                                 }
                                 else{
                                         //we logged in, but the user does not 
 want to have a cookie.
                                         return $this-redirect('../index');
                                 }
                         }
                         else {
                                 //we tried to log in the user but it failed
                                 
 $this-Session-setFlash($this-Auth-authError);
                                 return $this-redirect('../index');
                         }
                 }
                 if(empty($this-request-data)){
                         $cookie = $this-Cookie-read('Auth.User');
                         if(!is_null($cookie)){

                                 echo('we found cookie, now trying to log you 
 in with it');

                                 if($this-Auth-login($cookie)){

                                         
 $this-Session-delete('Message.auth');

                                         //return $this-redirect('../feed');
                                 } else{
                                         //invalid cookie
                                   $this-Cookie-del('Auth.User');
                                 }
                         }
                         else{
                                 //users accesses this page without a cookie
                                 return $this-redirect('../index');
                         }
                 }
         }

 Please note that I am very new to CakePHP.
 Thanks in advance,

 Jordy

-- 
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: routing and seo = changing language

2011-11-22 Thread daf182
Hi,

You can store the user's language in session to use it during the
browsing, or you could use the Accept-Language header sent by the
browser to guess the user language, use this function:
CakeRequest::acceptLanguage();
Or you can even ask it that user has a language for instance
CakeRequest::acceptLanguage('en'); would return true if browser send
'en' in Accept-Language header.

You can see where that 8 is found in the request object if you print
it out with:
debug($this-request);

Or from the manual:
If you are planning to use custom named arguments with your route,
you have to make the router aware of it using
the :php:meth`Router::connectNamed()` function. So if you want the
above route to match urls like /cooks/some_action/type:chef we do:

?php
Router::connectNamed(array('type'));
Router::connect(
'/cooks/:action/*', array('controller' = 'users')
);

For more detail about named parameters consult with this part of the
book:
http://book.cakephp.org/2.0/en/development/routing.html?highlight=routing#named-parameters

bye

On nov. 21, 13:10, heohni heidi.anselstet...@consultingteam.de
wrote:
 And another question:

 I would like to route this path: domain.com/search-in/categoryname/
 categoryId

 to this domain domain.com/items/search/cat:8
 means controller=items, action=search ... but how can I pass the cat:
 8 where the number 8 is a variable number?

-- 
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


query($method, $params, $this) references what?

2011-11-22 Thread Dennis Dix
In the cake model class (model.php) and the call_ function the
statement:

$return = $db-query($method, $params, $this);

references what function/method?

It doesn't appear to call the function query() inside model.php.

Is the function it calls a cakephp function or just a php function? I
can't seem to find any information anywhere about it.

(The reason I'm asking is I'm trying to track down what happens when
you use the statement findById or something similar.)

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


query($method, $params, $this) references what?

2011-11-22 Thread Dennis Dix
In the cake model class (model.php) and the call_ function the
statement:

$return = $db-query($method, $params, $this);

references what function/method?

It doesn't appear to call the function query() inside model.php.

Is the function it calls a cakephp function or just a php function? I
can't seem to find any information anywhere about it.

(The reason I'm asking is I'm trying to track down what happens when
you use the statement findById or something similar.)

Thanks for any help

(Note: I tried posting this earlier but it never made it to the forum.)

-- 
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


Confused: Trying to get values from a table outside of the controller.

2011-11-22 Thread GG
I have a PostsController. I have a posts table. I can easily get the
information I need from that table. I am trying to get information
from my periods table, from my posts controller. I am confused on how
to best do that. This is how I get the information from my posts
table.

( I am getting all info in the posts table, where user_id = *logged in
user*, class_period = 1, and created on todays date.)

$this-set('period1', $this-Post-find('all', array(
   
'conditions'=array('user_id'=$this-Session-
read('Auth.User.id'), 'class_period'=1, 'created' = date('Ymd'))
   )));


( I want to get all info in the periods table, where user_id=*logged
in user* )

But I do not know how to get the values of the periods table from the
PostsController.

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


Problem masking errors in cakePhP

2011-11-22 Thread rach
Hi,

We are using PHP 5.3.5, and cakePHP 1.3.7. We are not able to mask the
error messages we are getting - 'Strict Standards, Fatal errors.
The problem we are running into is -

We tried this solution.

Configure::write('debug', 0);
and
Configure::write('log', false);
in core.php but it did not work.

Currently we are commenting  echo $_this-_output($data); in
debugger.php to stop notice/warnings but we are unable to stop strict-
standard/ Fatal errors

Right now, we cannot move to a diff. version of CakePHP as we have an
upcoming imp. milestone and so we want to avoid any regressions that
might happen as a result of moving to a diff. version. We may try that
later on.


We are looking to -
1.) either mask the errors we are getting?
2.) any other way to handle these errors so that they do not get
displayed to a user?


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


Mask Fatal and Strict-standard errors

2011-11-22 Thread Bhoomit
Hi,

We are using PHP 5.3.5, and cakePHP 1.3.7.

We are not able to mask the error messages we are getting - 'Strict
Standards, Fatal errors. The problem we are running into is -

We tried this solution.


Configure::write('debug', 0);
and
Configure::write('log', false);


in core.php but it did not work.

currently we are commenting  echo $_this-_output($data); in
debugger.php to stop notice/warnings but we are unable to stop strict-
standard/ Fatal errors

Right now, we cannot move to a diff. version of CakePHP as we have an
upcoming imp. milestone and so we want to avoid any regressions that
might happen as a result of moving to a diff. version. We may try that
later on.


We are looking to -
1.) either mask the errors we are getting?
2.) any other way to handle these errors?

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


Displaying temp view using beforeSave/beforeRender ?

2011-11-22 Thread rs
Hi,

I've started using Cake as of late but have run into a problem which I
hope one of the master bakers can easily resolve :)

I'm looking for a way to show a temporary view while things work in
the background, my web server is located far from some users and
there is a slight lag on loading of certain pages, most of the logic
is in the models and controllers but the user has no information that
things are still in the works until the view has loaded.

Basically, is there a way to show some HTML/view temporarily until all
the model/controller logic and execution is complete and then show the
required final view?

Thanks a lot!
R.

-- 
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


cakephp 1.3 with javascript

2011-11-22 Thread jason for
Hi folks,
I'm almost done with my 1st cakephp site and it's looking good, but
could look better with a bit of javascript dynamically changing my
view.
Here's my code;

$(document).ready(function()
{
$(#event_id).change(function()
{
$.post(
manualpayment,
{value: 12 });
});
});

class AccountsController extends AppController {

var $name = 'Accounts';
var $helpers = array('Js' = array('prototype', 'scriptaculous.js?
load=effects'), 'Ajax', 'Form', 'Html');
public $components = array('RequestHandler');

SNIPPED

function manualpayment()
{

SNIPPED

if ($this-RequestHandler-isAjax())
{
$players = $this-Account-Player-find('list');
$this-set(compact('players', 'events'));

echo $this-render('/accounts/manualpayment', 'ajax');
   CakeLog::write('debug', isAjax is true);
}
else
{


I'm trying to handle the ajax request in function manualpayment(). The
request does reach here as I can see the 'isAjax is true' in the debug
log. However, I don't get the a new view rendered, in fact, the call
to render appears to have no effect. I've stored the output from the
render call in the debug log and it contains a bunch of HTML.

I've done plenty of digging into other articles about AJAX and cakephp
and the majority of the problems appear to be getting duplicate HTML
into the view, my problem is the opposite, nothing appears to change!

EDIT: Just checked firebug and it looks like there is a duplicate set
of view data returning to the browser, but it's still not being drawn
on the browser (either firefox or IE)

Hopefully someone out there can help. I'm pulling my hair out!

Thanks,

Jason.

-- 
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


site not quite working on local xampp, but running on unix server

2011-11-22 Thread KennyB
Although I've done a lot of php / mysql development, I am very new to
cake.

I am doing some work on my local machine for a client and am looking
at a site that another company built using cake.

The site includes a simple search form which accepts a zip and returns
a list of matching items.

When I grabbed the cake files and the associated database, the site
looked great locally, but the search form is returning no items.

I've tracked the issue to the getColumnType($column) function in C:\my-
path\cake\libs\model\model.php and the line 982, which is if
(isset($cols[$column])  isset($cols[$column]['type'])) {

Using debug, I can see that $column is 'zip' (NB. the lowercase z) and
that $cols is an array which contains an element with the key 'Zip'.
This means that isset($cols[$column]) fails so the type is returned as
null.

I understand this should be the case as associative arrays are case
sensitive.

What I don't understand is how it is working on the server, or is
there any configuration settings I can use to get it working locally
without changing any of the code.

I have done a straight copy from the server and I double-checked and
the server matches my local copy in that the database has the
'Zip' (capital first letter) field and the form element has the name
'zip'.

Anyone know if there is some configuration setting that I can set for
my local xampp install? I am running Windows 7 Pro. and have a
basically unaltered XAMPP 1.7.3 install wich comes with PHP Version
5.3.1

thanks
Kenn

-- 
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


Call to a member function create() on a non-object error cakePHP

2011-11-22 Thread Taby
Hola, que tal?
necesito de ayuda de alguien que pueda ayudarme con este error
mi vista es :

div id=login_form
?php if ( !empty( $error ) ) { ?
div class=message_error
span?php e( $error ); ?/span
/div
?php } ?

?php echo $form-create('Ingreso',array('action'='index'));  ?
// -- error
table
tr
thUsuario:/th
td?php e($form-text('usu_username')) ?/td
/tr
tr
thContrasentilde;a:/th
td?php e($form-text('usu_password', 
array('type' =
'password'))) ?/td
/tr
tr
thnbsp;/th
td?php echo $form-submit('Ingresar', 
array('id' =
'submit_login')); ?/td
/tr
tr
thnbsp;/th
td?php echo $html-link('¿Ha olvidado su 
contraseña?', '/
Usuarios/reestableceContrasena/'); ?/td
/tr
/table
?php echo $form-end(); ?
/div

-- controller

?php
class IngresosController extends AppController {

var $name   = 'Ingresos';
var $uses   = array ( 'Usuario') ;//usaremos solo el modelo
usuario
var $helpers= array ( 'Html','Form') ;



function index (  )
{
$this-layout = 'inicio_layout'; //layout por hacer...

if ( !empty ( $this-data )  )
{
//aqui se reciben los datos de la vista
$user = $this-data['Ingreso']['usu_username'];
$pass = sha1 ( $this-data['Ingreso']['usu_password'] ) ;

$usuario = $this-Usuario-find ( 'first', array
( 'conditions'=array ( 'usu_username'=$user,'usu_password'=
$pass )  )  ) ;

// si existe el usuario y contraseña, se crea la session
de el y se redirije al sistema q deberia llamarse inicio/inicio
if ( !empty ( $usuario )  )
{
//escribe la session del usuario
$this-Session-write ( 'usuario',$usuario['Usuario'] ) 
;

$this-redirect ( array ( 'controller' = 
'Inicio','action'
= 'Inicio' )  ) ;

}//sino da mensaje de error
else
$this-set ( 'error', 'Nombre de usuario y/o
contraseña incorrecto.'  ) ;

}
}


function logout (  )
{
// destruye la sesiones activas
$this-Session-del ( 'usuario' ) ;
//por si acaso mata todas las sessiones
$this-Session-destroy (  ) ;
//redirecciona a la pagina de ingreso, para volver a ingresar.
$this-redirect ( array ( 'controller' = 'Ingresos','action'
= 'Index' )  ) ;

}

}

?


Por favor ayuda !!.

Gracias..

-- 
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


Student wanting your views on CakePHP

2011-11-22 Thread david mitchell
Hi, Coders.

I am currently studying Website Development at the University of
Bolton and am doing my final dissertation on the features, usability
and comparison of 3 of the top 5 PHP Frameworks taken from (http://
www.phpframeworks.com/top-10-php-frameworks/) (CodeIgniter, CakePHP,
PHPDevShell) and would be very pleased if you could spent 2 minutes to
fill in this short questionnaire which will help my investigation and
research further into Frameworks.

http://www.surveymonkey.com/s/KWFQ9DV

Regards, David

-- 
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


How to get information in a mysql table from a different controller.

2011-11-22 Thread GG
I have two tables, a posts table, and a periods table.

The posts table has a user_id, title, body, period.

The periods table has a user_id, title, period.

I can easily get the information from the posts table in my
PostsController.php:

$this-set('period1', $this-Post-find('all', array(
   
'conditions'=array('user_id'=$this-Session-
read('Auth.User.id'), 'class_period'=1)
   )));

But I cannot get the information from the periods table. I think this
would be the equivalent of a Left Join?

I would like to echo all periods with a user_id that matches the
(Auth.User.id).

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: Student wanting your views on CakePHP

2011-11-22 Thread gremlin

I would first recommend that you use a list less than 4 years old.


On Nov 22, 12:16 pm, david mitchell shadowdavid...@googlemail.com
wrote:
 Hi, Coders.

 I am currently studying Website Development at the University of
 Bolton and am doing my final dissertation on the features, usability
 and comparison of 3 of the top 5 PHP Frameworks taken from 
 (http://www.phpframeworks.com/top-10-php-frameworks/) (CodeIgniter, CakePHP,
 PHPDevShell) and would be very pleased if you could spent 2 minutes to
 fill in this short questionnaire which will help my investigation and
 research further into Frameworks.

 http://www.surveymonkey.com/s/KWFQ9DV

 Regards, David

-- 
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: Confused: Trying to get values from a table outside of the controller.

2011-11-22 Thread Ma'moon
If there is any kind of association between `Post` and `Period` models then
you can easily play with model's `recursive` flag to obtain what you want,
otherwise you may manually load `Period` model in your `PostsController`
and fetch the information you seek, code language:
$this-loadModel('Period');
$this-set('periods', $this-Period-find('all'));

On Mon, Nov 21, 2011 at 7:53 PM, GG jairusk...@gmail.com wrote:

 I have a PostsController. I have a posts table. I can easily get the
 information I need from that table. I am trying to get information
 from my periods table, from my posts controller. I am confused on how
 to best do that. This is how I get the information from my posts
 table.

 ( I am getting all info in the posts table, where user_id = *logged in
 user*, class_period = 1, and created on todays date.)

 $this-set('period1', $this-Post-find('all', array(

 'conditions'=array('user_id'=$this-Session-
 read('Auth.User.id'), 'class_period'=1, 'created' = date('Ymd'))
   )));


 ( I want to get all info in the periods table, where user_id=*logged
 in user* )

 But I do not know how to get the values of the periods table from the
 PostsController.

 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: Mask Fatal and Strict-standard errors

2011-11-22 Thread Walther
Hi,

Firstly, you do not mask fatal or strict errors. You fix them. Fatal
erros mean that there is something wrong in your code and php cannot
continue parsing your code. If you mask a fatal error, your user
will simply get a white screen. Strict errors mean that
you are doing something that will probably break in a future version
of php.

Post some of your errors and we'll help you fix them.

I also recommend you upgrade to the latest CakePHP 1.3 version for
security and stability reasons. All CakePHP point releases are fully
tested, and you do not need to worry about regression errors.

Simply put, ignoring pho notices, warnings, strict and fatal errors is
asking for trouble. Don't hide them, fix them.

Also, don't edit CakePHP core files, ever!

On Nov 22, 8:24 am, Bhoomit bhoomit.2...@gmail.com wrote:
 Hi,

 We are using PHP 5.3.5, and cakePHP 1.3.7.

 We are not able to mask the error messages we are getting - 'Strict
 Standards, Fatal errors. The problem we are running into is -

 We tried this solution.

 Configure::write('debug', 0);
 and
 Configure::write('log', false);

 in core.php but it did not work.

 currently we are commenting  echo $_this-_output($data); in
 debugger.php to stop notice/warnings but we are unable to stop strict-
 standard/ Fatal errors

 Right now, we cannot move to a diff. version of CakePHP as we have an
 upcoming imp. milestone and so we want to avoid any regressions that
 might happen as a result of moving to a diff. version. We may try that
 later on.

 We are looking to -
 1.) either mask the errors we are getting?
 2.) any other way to handle these errors?

 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: Problem masking errors in cakePhP

2011-11-22 Thread Walther
You don't need to post the same message twice under different users.

On Nov 22, 8:23 am, rach rachna.ema...@gmail.com wrote:
 Hi,

 We are using PHP 5.3.5, and cakePHP 1.3.7. We are not able to mask the
 error messages we are getting - 'Strict Standards, Fatal errors.
 The problem we are running into is -

 We tried this solution.

 Configure::write('debug', 0);
 and
 Configure::write('log', false);
 in core.php but it did not work.

 Currently we are commenting  echo $_this-_output($data); in
 debugger.php to stop notice/warnings but we are unable to stop strict-
 standard/ Fatal errors

 Right now, we cannot move to a diff. version of CakePHP as we have an
 upcoming imp. milestone and so we want to avoid any regressions that
 might happen as a result of moving to a diff. version. We may try that
 later on.

 We are looking to -
 1.) either mask the errors we are getting?
 2.) any other way to handle these errors so that they do not get
 displayed to a user?

 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


Observer Pattern in CakePHP 2.0

2011-11-22 Thread amiable_indian
Hi All:

I would like to implement observer pattern [1] in my project and would like 
to hear your suggestions regarding cake's way of doing it the right way. 
Most web searches led me to an article [2] written in 2009. I am sure a lot 
of things have changed since then :)

In my project (*which tracks movement of domain names and ipaddresses*), I 
am looking to implement observer pattern where whenever the subject (*e.g. 
domain name*) changes (*e.g. moves to a new ipaddress*), it triggers 
multiple observers such as reputation, blacklisted, whitelisted, ranking, 
geo-location, etc...

Thanks in Advance,

[1] http://en.wikipedia.org/wiki/Observer_pattern 
[2] 
http://nuts-and-bolts-of-cakephp.com/2009/08/10/observer-pattern-the-cakephp-way/

-- 
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


afterFind via a hasmany relationship with paginate

2011-11-22 Thread #2Will
Hello,

When doing this

$projects = $this-paginate();

and project hasmany round, should afterFind in Round be called?  I put
a bit of debug code in there and it isn't being run.

If it isn't supposed to because it is related data no worries, just
wondering if it supposed to do it and I have dones something wrong or
not?

Thanks

w

-- 
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: Mask Fatal and Strict-standard errors

2011-11-22 Thread Bhoomit
Hi Walther,

Thanks for the reply. You have a point that we don't mask these errors
we fix them but I cant show fatal error in production, so I want to
mask Fatal error and show default page or some default error and log
the actual error to fix it.

Strict standard errors we are getting is below:

Strict Standards: Non-static method Configure::read() should not be
called statically, assuming $this from incompatible context in /var/
www/hachi-2.0/cake/libs/debugger.php on line 308 Strict Standards: Non-
static method Configure::getInstance() should not be called
statically, assuming $this from incompatible context in /var/www/
hachi-2.0/cake/libs/configure.php on line 155 Strict Standards: Non-
static method CakeLog::write() should not be called statically,
assuming $this from incompatible context in /var/www/hachi-2.0/cake/
libs/debugger.php on line 311 Strict Standards: Non-static method
String::insert() should not be called statically, assuming $this from
incompatible context in /var/www/hachi-2.0/cake/libs/debugger.php on
line 311 Strict Standards: Non-static method CakeLog::getInstance()
should not be called statically, assuming $this from incompatible
context in /var/www/hachi-2.0/cake/libs/cake_log.php on line 230

We are also trying to migrate to new version as you recommended.

Thanks

On Nov 23, 9:25 am, Walther waltherl...@gmail.com wrote:
 Hi,

 Firstly, you do not mask fatal or strict errors. You fix them. Fatal
 erros mean that there is something wrong in your code and php cannot
 continue parsing your code. If you mask a fatal error, your user
 will simply get a white screen. Strict errors mean that
 you are doing something that will probably break in a future version
 of php.

 Post some of your errors and we'll help you fix them.

 I also recommend you upgrade to the latest CakePHP 1.3 version for
 security and stability reasons. All CakePHP point releases are fully
 tested, and you do not need to worry about regression errors.

 Simply put, ignoring pho notices, warnings, strict and fatal errors is
 asking for trouble. Don't hide them, fix them.

 Also, don't edit CakePHP core files, ever!

 On Nov 22, 8:24 am, Bhoomit bhoomit.2...@gmail.com wrote:







  Hi,

  We are using PHP 5.3.5, and cakePHP 1.3.7.

  We are not able to mask the error messages we are getting - 'Strict
  Standards, Fatal errors. The problem we are running into is -

  We tried this solution.

  Configure::write('debug', 0);
  and
  Configure::write('log', false);

  in core.php but it did not work.

  currently we are commenting  echo $_this-_output($data); in
  debugger.php to stop notice/warnings but we are unable to stop strict-
  standard/ Fatal errors

  Right now, we cannot move to a diff. version of CakePHP as we have an
  upcoming imp. milestone and so we want to avoid any regressions that
  might happen as a result of moving to a diff. version. We may try that
  later on.

  We are looking to -
  1.) either mask the errors we are getting?
  2.) any other way to handle these errors?

  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: Confused: Trying to get values from a table outside of the controller.

2011-11-22 Thread Jeremy Burns | Class Outfit
Don't just rely on recursion. Always use the containable behaviour.

Jeremy Burns
Class Outfit

http://www.classoutfit.com

On 23 Nov 2011, at 02:05, Ma'moon wrote:

 If there is any kind of association between `Post` and `Period` models then 
 you can easily play with model's `recursive` flag to obtain what you want, 
 otherwise you may manually load `Period` model in your `PostsController` and 
 fetch the information you seek, code language:
 $this-loadModel('Period');
 $this-set('periods', $this-Period-find('all'));
 
 On Mon, Nov 21, 2011 at 7:53 PM, GG jairusk...@gmail.com wrote:
 I have a PostsController. I have a posts table. I can easily get the
 information I need from that table. I am trying to get information
 from my periods table, from my posts controller. I am confused on how
 to best do that. This is how I get the information from my posts
 table.
 
 ( I am getting all info in the posts table, where user_id = *logged in
 user*, class_period = 1, and created on todays date.)
 
 $this-set('period1', $this-Post-find('all', array(
   
 'conditions'=array('user_id'=$this-Session-
 read('Auth.User.id'), 'class_period'=1, 'created' = date('Ymd'))
   )));
 
 
 ( I want to get all info in the periods table, where user_id=*logged
 in user* )
 
 But I do not know how to get the values of the periods table from the
 PostsController.
 
 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

-- 
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 track the referer when error 404 happens?

2011-11-22 Thread heohni
Hi Mark,

I am only dealing on a small project, so I don't get as much emails
luckely :-)

I will try your code, thanks a lot!!

Bye



On 22 Nov., 17:55, euromark dereurom...@googlemail.com wrote:
 I did that for while - after upgrading the application
 jesus christ. I can tell you.
 I would have gotten hundreds of mails per second

 With session token (and one email per session every HOUR)
 it went down to a lot ;)

 Anyway - the thing is, that a browser opens invalid urls all the time
 especially InternetExplorer, especially with some bogus and rotten
 software/plugins
 (including some Antivirus Utility).
 So even if you just log them away, there are quite a lot of entries to
 log.

 so if you do that, you should restrict the logging to session (as
 above) and even better
 to a valid logged in user. this is better than letting all bots of
 this world create mail traffic for you.
 that works for me in in upgrading phases and reports back to be in
 real time.
 most times it is a click then which will have a valid referer you can
 work with.

 for the referer you can use

         /**
          * get the current referer
          * @param bool $full (defaults to false and leaves the url untouched)
          * @return string $referer (local or foreign)
          * 2011-11-02 ms
          */
         public static function getReferer($full = false) {
                 $ref = env('HTTP_REFERER');
                 $forwarded = env('HTTP_X_FORWARDED_HOST');
                 if ($forwarded) {
                         $ref = $forwarded;
                 }
                 if (empty($ref)) {
                         return $ref;
                 }
                 if ($full) {
                         $ref = Router::url($full);
                 }
                 return $res;
         }

 On 22 Nov., 11:54, AD7six andydawso...@gmail.com wrote:



  On Tuesday, 22 November 2011 11:45:42 UTC+1, heohni wrote:

   Hi,

   I using this app_error handler:

   ?php
   class AppError extends ErrorHandler{

       function __construct($method, $messages) {
           Configure::write('debug', 2);
           parent::__construct($method, $messages);
       }
       function _outputMessage($template) {
           $this-controller-render($template);
           $this-controller-afterFilter();

           App::import('Core', 'Email');
           $email = new EmailComponent;

           $email-from = 'CakePHP cakep...@xxx.de';
           $email-to = 'Developer m...@mail.de';
           $email-sendAs = 'html';
           $email-subject = 'Error!';

           $email-send($this-controller-output);

           $this-controller-output = null;
           $this-controller-render('error404');
           echo $this-controller-output;
       }
   }
   ?

   How can I also send the referer in order to see what link the user
   used to get to this 404 error page?
   Any ideas?

  How about: By including it in the message?

  I think you'll find emailing someone every time there's a 404 will just
  drown their email whenever a problem occurs.

  AD

-- 
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: cakephp 1.3 with javascript

2011-11-22 Thread Zaky Katalan-Ezra
Where in the code you get the returned data and try to put it in the page?

On Tue, Nov 22, 2011 at 1:31 PM, jason for jsnfo...@googlemail.com wrote:

 Hi folks,
 I'm almost done with my 1st cakephp site and it's looking good, but
 could look better with a bit of javascript dynamically changing my
 view.
 Here's my code;

 $(document).ready(function()
 {
$(#event_id).change(function()
{
$.post(
manualpayment,
{value: 12 });
});
 });

 class AccountsController extends AppController {

var $name = 'Accounts';
var $helpers = array('Js' = array('prototype', 'scriptaculous.js?
 load=effects'), 'Ajax', 'Form', 'Html');
public $components = array('RequestHandler');

 SNIPPED

function manualpayment()
{

 SNIPPED

if ($this-RequestHandler-isAjax())
{
$players = $this-Account-Player-find('list');
$this-set(compact('players', 'events'));

echo $this-render('/accounts/manualpayment',
 'ajax');
   CakeLog::write('debug', isAjax is true);
}
else
{


 I'm trying to handle the ajax request in function manualpayment(). The
 request does reach here as I can see the 'isAjax is true' in the debug
 log. However, I don't get the a new view rendered, in fact, the call
 to render appears to have no effect. I've stored the output from the
 render call in the debug log and it contains a bunch of HTML.

 I've done plenty of digging into other articles about AJAX and cakephp
 and the majority of the problems appear to be getting duplicate HTML
 into the view, my problem is the opposite, nothing appears to change!

 EDIT: Just checked firebug and it looks like there is a duplicate set
 of view data returning to the browser, but it's still not being drawn
 on the browser (either firefox or IE)

 Hopefully someone out there can help. I'm pulling my hair out!

 Thanks,

 Jason.

 --
 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: Problem masking errors in cakePhP

2011-11-22 Thread Zaky Katalan-Ezra
Create app_error file;
?php
class AppError extends ErrorHandler {
function _outputMessage($template) {
$this-controller-log($this,'err');
$this-controller-beforeFilter();
parent::_outputMessage($template);
}
}
?


Taken from here:
http://www.bradezone.com/2009/05/21/cakephp-beforefilter-and-the-error-error/

On Tue, Nov 22, 2011 at 8:23 AM, rach rachna.ema...@gmail.com wrote:

 Hi,

 We are using PHP 5.3.5, and cakePHP 1.3.7. We are not able to mask the
 error messages we are getting - 'Strict Standards, Fatal errors.
 The problem we are running into is -

 We tried this solution.

 Configure::write('debug', 0);
 and
 Configure::write('log', false);
 in core.php but it did not work.

 Currently we are commenting  echo $_this-_output($data); in
 debugger.php to stop notice/warnings but we are unable to stop strict-
 standard/ Fatal errors

 Right now, we cannot move to a diff. version of CakePHP as we have an
 upcoming imp. milestone and so we want to avoid any regressions that
 might happen as a result of moving to a diff. version. We may try that
 later on.


 We are looking to -
 1.) either mask the errors we are getting?
 2.) any other way to handle these errors so that they do not get
 displayed to a user?


 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