Assuming you have

class WebPage {
var $property1;
    function get_property1()
    {
        return $this->$property1;
    }
}


class Sample extends WebPage{
}

To access $property1 from your WebPage class just do

$page = new Sample;
$prop1 = $page->get_property1();

Otherwise try to send a snippets of code to see exactly what's you'r doing
:)

Regards,
Hatem

----- Original Message -----
From: "Michael Hall" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, January 13, 2003 7:19 AM
Subject: [PHP] class inside class


> --
>
> G'day:
>
> I am using a 'wrapper' class to create all the boilerplate HTML on a
website,
> plus do stuff like authentication and print menus etc according to
properties
> set dynamically within the class.
>
> The actual content of each page is generated by seperate 'content'
classes.
> These classes are 'embedded' within and instantiated within the wrapper
class,
> but are otherwise independent of it.
>
> This system allows for something approaching a PHP "object publishing"
> application, which is where I'm heading.
>
> My problem is that now I need to get at the values of some wrapper class
> properties from within a content class: in other words, I need to access
the
> dynamically assigned values of the properties of one class, from inside
another
> class (which is embedded within the first, though I'm not sure that really
> matters).
>
> I can't use the $this-> mechanism because the value is inside a different
> class.
> I can't use the first class's handle (eg $page , from $page = new
WebPage())
> because the embedded class doesn't know about it.
> I have been playing around with declaring globals, and with PHP's
class/object
> functions, but have got nowhere yet.
>
>
> Is this possible, and if so, does anyone have any pointers? Hope my
description
> of the problem makes sense.
>
> TIA
> Mick
>
> ----------------------------------------------------
> MICHAEL HALL                 Web Development Officer
> Batchelor Institute of Indigenous Tertiary Education
> W: [EMAIL PROTECTED]                (08) 8951 8352
> H: [EMAIL PROTECTED]                    (08) 8953 1442
> ----------------------------------------------------
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


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

Reply via email to