Re: [PHP] Anyone on the list using Moodle?

2005-08-17 Thread Jasper Bryant-Greene

wayne wrote:

I have one other question that I would like answered.
One of the respondents in the archive file to the
above question said that "in PHP objects don't
have to be explicitly instantiated", could someone
point me to some docs that explains this.The person
never did give an explanation.


The post I just sent to the list regarding your earlier question 
explains this. If you do not instantiate an object before using it, it 
is automatically instantiated as an object of the stdClass class. You 
can then add and read attributes, like an "array dressed up as an object."


Jasper

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Anyone on the list using Moodle?

2005-08-17 Thread wayne
On Wed, 2005-08-17 at 04:47 -0400, wayne wrote:
> On Tue, 2005-08-16 at 17:41 -0400, wayne wrote:
> > Hi,
> > Before I post some of the install script for
> > Moodle I thought that I would ask how
> > $CFG gets instantiated in the install.php script.
> > Thanks.
> > 
> Okay, I got a reply from a moodle user pointing
> me to an archive, apparently someone had the same
> question. The answer seems to be that $CFG is
> an array dressed up as an object.The books that
> I'm learning from don't show this concept. Could
> some kind soul give an example.
> Thanks.
> 
I have one other question that I would like answered.
One of the respondents in the archive file to the
above question said that "in PHP objects don't
have to be explicitly instantiated", could someone
point me to some docs that explains this.The person
never did give an explanation.
Thanks

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Anyone on the list using Moodle?

2005-08-17 Thread Jasper Bryant-Greene

wayne wrote:

Okay, I got a reply from a moodle user pointing
me to an archive, apparently someone had the same
question. The answer seems to be that $CFG is
an array dressed up as an object.The books that
I'm learning from don't show this concept. Could
some kind soul give an example.
Thanks.


http://php.net/manual/en/language.types.object.php

When you use the uninitialised $CFG as an object, an object of class 
stdClass is created. You can then assign and read stuff to and from its 
properties, basically like you said, as an "array dressed up as an object".


There's no real reason for doing this although it may be a hack because 
some of the required files in that script may expect a $CFG object to exist.


Jasper

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Anyone on the list using Moodle?

2005-08-17 Thread wayne
On Tue, 2005-08-16 at 17:41 -0400, wayne wrote:
> Hi,
> Before I post some of the install script for
> Moodle I thought that I would ask how
> $CFG gets instantiated in the install.php script.
> Thanks.
> 
Okay, I got a reply from a moodle user pointing
me to an archive, apparently someone had the same
question. The answer seems to be that $CFG is
an array dressed up as an object.The books that
I'm learning from don't show this concept. Could
some kind soul give an example.
Thanks.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Anyone on the list using Moodle?

2005-08-17 Thread wayne
On Tue, 2005-08-16 at 17:41 -0400, wayne wrote:
> Hi,
> Before I post some of the install script for
> Moodle I thought that I would ask how
> $CFG gets instantiated in the install.php script.
> Thanks.
> 
Attach is the first 85 line of the moodle install
script.What I would like to know is, if I put
some code like this after the use of $CFG->

$default_classes = get_declared_classes ();
print "" . "THE BEGINNING = ";
  foreach ($default_classes as $class_name)
 print 'the class is ==' . $class_name . '';

shouldn't I see the class that $CFG was instantiated
from?
Thanks.



wayne
Description: application/php
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Anyone on the list using Moodle?

2005-08-16 Thread Esteamedpw
have you tried their forums at moodle.org ?
 
- Clint


[PHP] Anyone on the list using Moodle?

2005-08-16 Thread wayne
Hi,
Before I post some of the install script for
Moodle I thought that I would ask how
$CFG gets instantiated in the install.php script.
Thanks.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php