Jag wrote:
Quote:
Hello there!
At the beginning, I'm apologize
for my weak english skills.
I got a problem with the class
which I include from the other
file. It's hard to me to explain
it clearly, so I just give you
files:
>
index.php:
>
<?php
include("someclass.inc.php");
$c=new classA();
$c->SayHallo();
include("another.php");
?>
>
comeclass.inc.php:
>
<?php
class classA()
{
function __construct()
{
echo 'Constructing...';
}
function SayHello()
{
echo "Hello, cruel world.";
}
}
?>
>
another.php:
>
<?php
>
First try:
$c->SayHello(); // error :/
>
Second try:
$c=new classA(); // ALMOST works. It
$c->SayHallo(); // defines second
// instance of the
// class ClassA.
// Unfortunetly, I
// need to work on
// the same instance.
?>
>
Hope somebody helps me - how to define
class and work with one and the same
instance?
>
If this is another page (not included in either of the two previous
files), then $c is no longer available. At the end of the page it gets
destroyed.
If you must work on the same instance, then you will need to store the
object in the $_SESSION in the first page and retrieve in the second.
And P.S. You're English skills are very good.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================