ToonMariner Posted April 18, 2006 Share Posted April 18, 2006 another oop prob!!!!I want to use an attribute created in a child class in its parent - not having much luck.The impudent child!!![code]<?phpclass login_check extends page { public function draw_loginform() { $username = isset($_POST['username']) ? $_POST['username'] : NULL; $this->loginhtml = <<<HTMLSTART<div id="loginform"> <form action="cmslobby.php" name="loginfrm" id="loginfrm" method="post" enctype="application/x-www-form-urlencoded" target="_self" lang="en" dir="ltr"> <label lang="en" dir="ltr" for="username">Username:</label> <input name="username" type="text" id="username" tabindex="1" title="UserName" dir="ltr" lang="en" size="10" maxlength="20" value="$username"><br /> <label lang="en" dir="ltr" for="password">Password:</label> <input name="password" type="password" id="password" tabindex="2" title="Password" dir="ltr" lang="en" size="10" maxlength="20"><br /> <input type="hidden" name="refurl" id="refurl" value="$this->self"> <input name="login" type="submit" id="login" tabindex="3" title="Login" dir="ltr" lang="en" value="Login"><br /> </form></div><div class="clear"></div> HTMLSTART;}?>[/code]The disspaing parent...[code]<?phpclass page { public function pagehead_Section () { echo <<<HTMLSTART<div id="header"> <h1><a href="/admin/cmslobby.php" target="_self" title="Foundry CMS Home"><span>Foundry CMS</span></a></h1>HTMLSTART; echo login_check::$loginhtml; echo <<<HTMLSTART</div>HTMLSTART; }}?>[/code]Other properties exist in there of course but these are the bits I can't get to work.The error returned is:Fatal error: Access to undeclared static property: login_check::$loginhtml in C:\Program Files\Apache Group\Apache2\htdocs\nas\admin\includes\class\page.inc.php on line 99For those incredibly sharp people teh $this->self is set in the parent constructor function and is $_SERVER['PHP_SELF'] - but that has no bearing on the error returned...Any help much appreciated. Link to comment https://forums.phpfreaks.com/topic/7723-oop-child-attributes/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.