Help formatting XHTML output please?

I have a need to output formatted xhtml content. I am currently calling ob_start(‘ob_tidyhandler’) and ob_end_flush() appropriately, but the output is not what I expected.

Current output…


	<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
	<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en">
	<head>
	<title>Flash Cards</title>
	</head>
	<body>
<p>Hello world!</p>
	</body>
	</html>

Expected output…


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en">
    <head>
        <title>Flash Cards</title>
    </head>
    <body>
        <p>Hello world!</p>
    </body>
</html>

Please note, this was output from three different methods: render_header, render_content (the hello world line) and render_footer.

What do I need to do to make this format correctly?

Sorry if this is a dumb comment, but I would assume it depends on how your code is tabbed in the source files, and whether or not your PHP code is tabbed or not in the file pulling them in. What happens if you left align all your PHP bits (i.e. with no tabs)?

Thanks, but I figured it out, and found a bug as well.

It seems that ob_start(‘ob_tidyhandler’) doesn’t throw an exception if tidy is not installed. I installed it and now it works. Hope that saves somebody from the same headache. =/