output result of one function in another
| From: | webmaster at ipo dot asu dot edu | Date: | Thu, 02 Nov 2000 20:32:15 +0000 |
| Subject: | output result of one function in another | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-23452@lists.php.net to get a copy of this message | ||
Greetings,
A question concerning classes and functions, still learning about these.
Anyway, the main class has one function and the purpose of this function
is to create a template for nearly all the pages on our website. The
function passes two variables for the page title and heading fine.
class MainPage {
var $title;
var $header;
var $footer;
function FormatPage($title, $header, $footer){
print(..);
""
""
""
print("<table><tr><td>$footer</td></tr></table>");
""
}
}
class EndPage extends MainPage {
function Footer() {
print(..);
""
""
""
}
}
Page which calls the functions
$footer = new EndPage();
$page = new FormatPage();
$page-> MainPage($title, $header, $footer);
$footer->Footer();
The problem arises with the 3rd variable, is from a subclass of the main
class which has a function that form a page footer. From above I attempt
to assign the output of the Footer() function to the variable $footer and
place it in a cell in the table. The script prints "Object" where the
footer should be. It does print the footer but the output is after the
output of the MainPage function.
Any ideas on how to solve this problem? I've tried a number of different
things and there's something(probably something very simple) that I'm
missing.
Thanks.