Question about variable scope, object and $html

2007-05-23 Thread Ming

Hi,

I am new to Cake and I have a question.

For the file below (email.php), I do not understand where does the
render in
$this-controller-render($this-thtml) come from.

$controller ($this-controller) is a variable whose domain is limited
to this class. But it seems $this-controller is an object and it has
a render function

I searched the entire project and there are 3 render functions:

The 1st  is in app/controllers/components/output.php,
the 2nd is in cake/libs/view/view.php
the 3rd is in cake/libs/controller/controller.php

For this class (EmailComponent), which render function does it really
call? Why?

The confusing part for me, why $this-controller is an object instead
of a variable? I am using two different PHP IDE, after entering $this-
controller-, there is no code hint (if entering $this-, code hints
will popup controller, for example).

Additionally, I got to know the $html helper from cake's online
tutorial. But where is $html declared? I cannot find it.

Thanks,



App/controllers/components/email.php
?php
/*
 * EmailComponent for CakePHP
 *
 * @author  gwoo [EMAIL PROTECTED]
 * @version 0.10.5.1797
 * @license OPPL
 *
 */
class EmailComponent extends Object
{
var $thtml;
var $headers = null;
var $to = null;
var $from = null;
var $subject = null;
var $cc = null;
var $bcc = null;
var $controller;


function message()
{
//Output buffer starts here
ob_start();
$this-controller-render($this-thtml);

//Get buffer content and clean buffer
$mail = ob_get_clean();
return $mail;
}

function send()
{

$headers  = $this-headers
.Content-Transfer-Encoding: quoted-printable\n
.From: $this-from\n
.Return-Path: $this-from\n
.CC:$this-cc\n
.BCC:$this-bcc\n;

$success = mail($this-to, $this-subject, $this-message(),
$headers);
return $success;
}

}

?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Question about variable scope, object and $html

2007-05-23 Thread Ming

By the way, I tried to get help from capk's online API. But cake's API
interface is pretty different with those of Java, Pear, or CPAN.
Sounds need some time to get familiar with it.

On May 23, 1:45 pm, Ming [EMAIL PROTECTED] wrote:
 Hi,

 I am new to Cake and I have a question.

 For the file below (email.php), I do not understand where does the
 render in
 $this-controller-render($this-thtml) come from.

 $controller ($this-controller) is a variable whose domain is limited
 to this class. But it seems $this-controller is an object and it has
 a render function

 I searched the entire project and there are 3 render functions:

 The 1st  is in app/controllers/components/output.php,
 the 2nd is in cake/libs/view/view.php
 the 3rd is in cake/libs/controller/controller.php

 For this class (EmailComponent), which render function does it really
 call? Why?

 The confusing part for me, why $this-controller is an object instead
 of a variable? I am using two different PHP IDE, after entering 
 $this-controller-, there is no code hint (if entering $this-, code hints

 will popup controller, for example).

 Additionally, I got to know the $html helper from cake's online
 tutorial. But where is $html declared? I cannot find it.

 Thanks,

 

 App/controllers/components/email.php
 ?php
 /*
  * EmailComponent for CakePHP
  *
  * @author  gwoo [EMAIL PROTECTED]
  * @version 0.10.5.1797
  * @license OPPL
  *
  */
 class EmailComponent extends Object
 {
 var $thtml;
 var $headers = null;
 var $to = null;
 var $from = null;
 var $subject = null;
 var $cc = null;
 var $bcc = null;
 var $controller;

 function message()
 {
 //Output buffer starts here
 ob_start();
 $this-controller-render($this-thtml);

 //Get buffer content and clean buffer
 $mail = ob_get_clean();
 return $mail;
 }

 function send()
 {

 $headers  = $this-headers
 .Content-Transfer-Encoding: quoted-printable\n
 .From: $this-from\n
 .Return-Path: $this-from\n
 .CC:$this-cc\n
 .BCC:$this-bcc\n;

 $success = mail($this-to, $this-subject, $this-message(),
 $headers);
 return $success;
 }

 }

 ?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Question about variable scope, object and $html

2007-05-23 Thread John David Anderson (_psychic_)

It might help us if we knew what you were trying to do, or why you  
needed to know this...

-- John

On May 23, 2007, at 2:45 PM, Ming wrote:


 Hi,

 I am new to Cake and I have a question.

 For the file below (email.php), I do not understand where does the
 render in
 $this-controller-render($this-thtml) come from.

 $controller ($this-controller) is a variable whose domain is limited
 to this class. But it seems $this-controller is an object and it has
 a render function

 I searched the entire project and there are 3 render functions:

 The 1st  is in app/controllers/components/output.php,
 the 2nd is in cake/libs/view/view.php
 the 3rd is in cake/libs/controller/controller.php

 For this class (EmailComponent), which render function does it really
 call? Why?

 The confusing part for me, why $this-controller is an object instead
 of a variable? I am using two different PHP IDE, after entering $this-
 controller-, there is no code hint (if entering $this-, code hints
 will popup controller, for example).

 Additionally, I got to know the $html helper from cake's online
 tutorial. But where is $html declared? I cannot find it.

 Thanks,

 

 App/controllers/components/email.php
 ?php
 /*
  * EmailComponent for CakePHP
  *
  * @author  gwoo [EMAIL PROTECTED]
  * @version 0.10.5.1797
  * @license   OPPL
  *
  */
 class EmailComponent extends Object
 {
 var $thtml;
 var $headers = null;
 var $to = null;
 var $from = null;
 var $subject = null;
 var $cc = null;
 var $bcc = null;
 var $controller;


 function message()
 {
   //Output buffer starts here
 ob_start();
 $this-controller-render($this-thtml);

 //Get buffer content and clean buffer
 $mail = ob_get_clean();
 return $mail;
 }

 function send()
 {

 $headers  = $this-headers
   .Content-Transfer-Encoding: quoted-printable\n
   .From: $this-from\n
   .Return-Path: $this-from\n
   .CC:$this-cc\n
   .BCC:$this-bcc\n;

   $success = mail($this-to, $this-subject, $this-message(),
 $headers);
   return $success;
 }

 }

 ?


 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Question about variable scope, object and $html

2007-05-23 Thread Ming

Hey John,

This script is from an app built on top of cakephp, and to maintain
this app is part of my new job. There are 557 files totally in app/
models, app/controllers, and app/views, and I want to go through all
over them so that I can work on the app.

Thanks,


On May 23, 2:10 pm, John David Anderson (_psychic_)
[EMAIL PROTECTED] wrote:
 It might help us if we knew what you were trying to do, or why you
 needed to know this...

 -- John

 On May 23, 2007, at 2:45 PM, Ming wrote:



  Hi,

  I am new to Cake and I have a question.

  For the file below (email.php), I do not understand where does the
  render in
  $this-controller-render($this-thtml) come from.

  $controller ($this-controller) is a variable whose domain is limited
  to this class. But it seems $this-controller is an object and it has
  a render function

  I searched the entire project and there are 3 render functions:

  The 1st  is in app/controllers/components/output.php,
  the 2nd is in cake/libs/view/view.php
  the 3rd is in cake/libs/controller/controller.php

  For this class (EmailComponent), which render function does it really
  call? Why?

  The confusing part for me, why $this-controller is an object instead
  of a variable? I am using two different PHP IDE, after entering $this-
  controller-, there is no code hint (if entering $this-, code hints
  will popup controller, for example).

  Additionally, I got to know the $html helper from cake's online
  tutorial. But where is $html declared? I cannot find it.

  Thanks,

  

  App/controllers/components/email.php
  ?php
  /*
   * EmailComponent for CakePHP
   *
   * @author  gwoo [EMAIL PROTECTED]
   * @version 0.10.5.1797
   * @licenseOPPL
   *
   */
  class EmailComponent extends Object
  {
  var $thtml;
  var $headers = null;
  var $to = null;
  var $from = null;
  var $subject = null;
  var $cc = null;
  var $bcc = null;
  var $controller;

  function message()
  {
 //Output buffer starts here
  ob_start();
  $this-controller-render($this-thtml);

  //Get buffer content and clean buffer
  $mail = ob_get_clean();
  return $mail;
  }

  function send()
  {

  $headers  = $this-headers
 .Content-Transfer-Encoding: quoted-printable\n
 .From: $this-from\n
 .Return-Path: $this-from\n
 .CC:$this-cc\n
 .BCC:$this-bcc\n;

 $success = mail($this-to, $this-subject, $this-message(),
  $headers);
 return $success;
  }

  }

  ?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Question about variable scope, object and $html

2007-05-23 Thread Chris Hartjes

On 5/23/07, Ming [EMAIL PROTECTED] wrote:

 Hey John,

 This script is from an app built on top of cakephp, and to maintain
 this app is part of my new job. There are 557 files totally in app/
 models, app/controllers, and app/views, and I want to go through all
 over them so that I can work on the app.

 Thanks,

I highly suggest you read the CakePHP manual before you even attempt
to figure this out.  From your comments I take it that you do not have
a lot of experience with MVC frameworks built in PHP.  If you did, a
lot of the questions you are asking would be easier to answer.

-- 
Chris Hartjes

My motto for 2007:  Just build it, damnit!

@TheBallpark - http://www.littlehart.net/attheballpark
@TheKeyboard - http://www.littlehart.net/atthekeyboard

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Question about variable scope, object and $html

2007-05-23 Thread John David Anderson (_psychic_)


On May 23, 2007, at 3:27 PM, Ming wrote:


 Hey John,

 This script is from an app built on top of cakephp, and to maintain
 this app is part of my new job. There are 557 files totally in app/
 models, app/controllers, and app/views, and I want to go through all
 over them so that I can work on the app.

Part of the magic of using a framework is *not* knowing what  
everything does. Not many of us walk through Cake's source, not  
because we don't care, but because we really don't need to.

Are you tracking down a bug or something?

-- John

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Question about variable scope, object and $html

2007-05-23 Thread Ming

Yes, this app has many bugs. So far I have found nearly 100 bugs. I am
using both Zend studio and phpedit to debug it. I have quite a few
java and perl experience, but do not have too much php experience.

Thanks,


On May 23, 2:34 pm, John David Anderson (_psychic_)
[EMAIL PROTECTED] wrote:
 On May 23, 2007, at 3:27 PM, Ming wrote:



  Hey John,

  This script is from an app built on top of cakephp, and to maintain
  this app is part of my new job. There are 557 files totally in app/
  models, app/controllers, and app/views, and I want to go through all
  over them so that I can work on the app.

 Part of the magic of using a framework is *not* knowing what
 everything does. Not many of us walk through Cake's source, not
 because we don't care, but because we really don't need to.

 Are you tracking down a bug or something?

 -- John


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Question about variable scope, object and $html

2007-05-23 Thread Ming

I read it, and I did the online tutorial line by line. But I still do
not quite understand. Back to my question, is $this-controller an
object? But $controller is a variable defined in this class.Or maybe
$controller is a variable passed by reference that points to an
object?

For the $html (introduced in the blog tutorial), as I never declare
it. Is it a global variable (global object?)? If yes, where is it
declared?

Many thanks,


On May 23, 2:31 pm, Chris Hartjes [EMAIL PROTECTED] wrote:
 On 5/23/07, Ming [EMAIL PROTECTED] wrote:



  Hey John,

  This script is from an app built on top of cakephp, and to maintain
  this app is part of my new job. There are 557 files totally in app/
  models, app/controllers, and app/views, and I want to go through all
  over them so that I can work on the app.

  Thanks,

 I highly suggest you read the CakePHP manual before you even attempt
 to figure this out.  From your comments I take it that you do not have
 a lot of experience with MVC frameworks built in PHP.  If you did, a
 lot of the questions you are asking would be easier to answer.

 --
 Chris Hartjes

 My motto for 2007:  Just build it, damnit!

 @TheBallpark -http://www.littlehart.net/attheballpark
 @TheKeyboard -http://www.littlehart.net/atthekeyboard


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---