>>Don't how to print the error message in the content area
You need to trigger the error only while printing the content. For example the code below will NOT print it within the content because you are not triggering the error within the content:
<?php
$x = (int)$_POST['INPUT'];
if( $x==3)
trigger_error("Incorrect input vector, array of values expected", E_USER_WARNING);
?>
<html>
<body>
<?php
getContent();
?>
</body>
</html>
You can work around it by simply setting a variable to TRUE if trigger_error should be called, but delay the call until the content.
<?php
global $triggerIt=FALSE;
$x = (int)$_POST['INPUT'];
if( $x==3)
?>
<html>
<body>
<?php
if( TRUE==$triggerIt)
{
trigger_error("Incorrect input vector, array of values expected", E_USER_WARNING);
}
else
{
?>
getContent();
<?php
}
?>
</body>
</html>
You would also need to put:
global $triggerIt=FALSE;
in the same file where you are defining your errorHandler function. IF you are using some sort of templating system, then the
if( TRUE==$triggerIt){...}else{...}
part would be placed in the template. On my example, the getContent() should be a function defined on a per-page basis that returns the content for the page in question as a string. However, if you are using some third-party templating system, you would need to find out how they are emitting the content.
Short answer to your question, I believe you are triggering the error_handler outside of the content. In case you haven't seen it, there is a sample error handler at: http://us2.php.net/manual/en/function.set-error-handler.php