Jump to content

Archived

This topic is now archived and is closed to further replies.

ToonMariner

OOP - child attributes

Recommended Posts

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]
<?php
class 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]<?php
class 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 99

For 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.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.