Posted by Phil Latio on 05/14/07 23:32
Below I have some code and below that a template file which I want to use to
display the message lines. I just get a blank page so are the functions
"getMessageLine1" and "getMessageLine2" returning objects and not strings?
Just wondering how I work around this.
Cheers
Phil
-------- HelloWorld3.php ----------
<?php
$newClass = new PrintMessage("Hello World", "Yet another Hello World");
include("HelloWorld03.tpl.php");
class PrintMessage
{
private $messageLine1;
private $messageLine2;
function __construct($messageLine1, $messageLine2)
{
$this->messageLine1 = $messageLine1;
$this->messageLine2 = $messageLine2;
}
function getMessageLine1()
{
return $this->messageLine1;
}
function getMessageLine2()
{
return $this->messageLine2;
}
}
?>
------ HelloWorld03.tpl.php -------
<html>
<head>
<title>This is HelloWorld03.tpl.php</title>
</head>
<body>
<?php echo $newClass->getMessageLine1; ?>
<br />
<?php echo $newClass->getMessageLine2; ?>
</body>
</html>
[Back to original message]
|