Validation errors at validator.w3.org

Discussion in 'HTML & Website Design' started by chrisj, Sep 11, 2007.

  1. #1
    Because my main page is www.website.com/index.php I have validation errors.

    Is it possible to validate a php home page? If not what should I do to remedy this?

    Here's what it stated:

    Unable to Determine Parse Mode!
    It was not possible to reliably choose a parsing mode for this document, because:

    the MIME Media Type (text/html) can be used for XML or SGML document types. No known Document Type could be detected
    No XML declaration (e.g <?xml version="1.0"?>) could be found at the beginning of the document.
    The validator is falling back to SGML mode.

    No DOCTYPE found! Attempting validation with HTML 4.01 Transitional.
    The DOCTYPE Declaration was not recognized or is missing.
     
    chrisj, Sep 11, 2007 IP
  2. jmhyer123

    jmhyer123 Peon

    Messages:
    542
    Likes Received:
    25
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You can still validate PHP files they just interpret it as HTML (because that's what is output ;)) That error just means you need to put a doctype at the top of your page

    e.g:
    <!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">
    Code (markup):
    That would be XHTML 1.0 Transitional
     
    jmhyer123, Sep 11, 2007 IP
  3. chrisj

    chrisj Well-Known Member

    Messages:
    606
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    101
    #3
    Thank you for your help. I appreciated it.
    However, when I add your suggestion to the top of the php file,
    I get this error:

    Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\Inetpub\website.com\httpdocs\homepage\index.php:3) in C:\Inetpub\website.com\httpdocs\homepage\index.php on line 10

    As you can see below, line 10 I believe is:
    session_start();

    Can someone help me remedy this error and move forward with validation, please?

    <!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">
    <?php
    /**
    *   @file: 			index.php
    *   @author blank
    *   @description:	main page
    */
    	session_start();
    
    	include_once "db_config.php";
    	include_once "classes/system.php";
    	include_once "classes/main_menu.php";
    	include_once "classes/tools.php";
    
    	$command = tools::get_field_value("command");
    	$param 	 = tools::get_field_value("param");
    
    	$main_menu = new main_menu($system);
    
    	$content	 = $main_menu->parse_command($command,$param);
    
    	echo $content;
    	?>
    Code (markup):
     
    chrisj, Sep 11, 2007 IP
  4. jamesicus

    jamesicus Peon

    Messages:
    477
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Yes, for example my page http://jp29.org/test.php (Serving XHTML 1.0) produces this Validation output
    As has already pointed out, the Validator is requesting a Doctype be affixed to the head of your page - required for Validation. I recommend you use the Strict Doctype (required for Accessibility compliance - precludes deprecated elements) ..........

    <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
    <html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-us' lang='en-us'>

    .......... substitute your own lang attribute if needed. I assume you wish to serve your page as HTML (no XML capability per W3C XHTML 1.0 recommendation Appendix C) and so I have ommitted the XML prolog.
     
    jamesicus, Sep 11, 2007 IP
  5. chrisj

    chrisj Well-Known Member

    Messages:
    606
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    101
    #5
    I don't understand the point of your reply.

    Are you saying that I should add your suggestion to the top of the php file,
    leave the errors at the top of the viewed page, and continue validating?

    Shouldn't I remedy these new errors first? Can someone help me, please?

    Since I put your suggestion at the top of the file, I have these two errors showing on the viewed home page:

    Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\Inetpub\website.com\httpdocs\homepage\index.php:3) in C:\Inetpub\website.com\httpdocs\homepage\index.php on line 10
    
    Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\Inetpub\website.com\httpdocs\homepage\index.php:3) in C:\Inetpub\website.com\httpdocs\homepage\index.php on line 10
    
    Code (markup):
     
    chrisj, Sep 11, 2007 IP
  6. jamesicus

    jamesicus Peon

    Messages:
    477
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Well, the URL you provided in your initial post is no longer live -- please provide it again so we can see what you are trying to do here.
     
    jamesicus, Sep 11, 2007 IP
  7. jamesicus

    jamesicus Peon

    Messages:
    477
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Refer to my previous response. I suggest you research and become familiar with HTML/XHTML and the W3C Markup Validation process before you proceed any further.
     
    jamesicus, Sep 11, 2007 IP
  8. chrisj

    chrisj Well-Known Member

    Messages:
    606
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    101
    #8
    Thank you for your reply. I'm hoping to get more of a specific reply regarding the errors I'm receiving.

    Can anyone else please help me with the errors I've received?

    Thank you.
     
    chrisj, Sep 11, 2007 IP