CK wrote:
private function buildInt(){
<!--Script 10.1- calculator.php-->
<form action="calculator.php" method="post">
//Form elements omitted for brevity....
</form>
}
}
?>
This is returned to the browser:
"Parse error: syntax error, unexpected '<' in
/Users/chris/Sites/php/oop/class.calculator.php on line 20"
Your buildInt() function jumps directly from PHP into HTML output,
without first closing the currently open PHP tag. It needs to be:
private function buildInt()
{
?>
<!--Script 10.1- calculator.php-->
.. blah blah ..
<?php
}
The approach you are taking for this is going to cause you headaches in
the future. I would strongly recommend that you make your class file do
one of two things:
1) ECHO out the HTML, rather than dropping in and out of PHP. It gets
real messy, real quick, especially when embedded in class files.
2) Build-up the HTML into a string and return it back to the calling PHP
script, which can then echo it as required. I.e capture the output of
your class, don't let the class itself ever output anything. (i.e. start
to separate the presentation from the logic, if only mildly in this case)
Cheers,
Rich
--
Zend Certified Engineer
http://www.corephp.co.uk
"Never trust a computer you can't throw out of a window"
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php