SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    Resident OCD goofball! bronze trophy Serenarules's Avatar
    Join Date
    Dec 2002
    Posts
    1,911
    Mentioned
    26 Post(s)
    Tagged
    0 Thread(s)

    Question 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...
    HTML Code:
    	<!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...
    HTML Code:
    <!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?

  2. #2
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,219
    Mentioned
    457 Post(s)
    Tagged
    8 Thread(s)
    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)?

  3. #3
    Resident OCD goofball! bronze trophy Serenarules's Avatar
    Join Date
    Dec 2002
    Posts
    1,911
    Mentioned
    26 Post(s)
    Tagged
    0 Thread(s)
    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. =/


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •