I normally use http://validator.w3.org/ to validation my XHTML, however, in my current project, I've used PHP as well & all my files has ".php" extention so can't use this site to validation my XHTML codes. Mainly the PHP I've used is for the "include" function to share navigation, header, footer, etc. across all the pages.

How do I go about validating these pages (having extention ".php" but has "xhtml" codes within).

One of the example is of Privacy page i.e. "Privacy.php":

<div id="header">
<?php include("inc/header.inc");?> 
</div>

<?php include("inc/head.inc");?>

<body>
<?php include("inc/banner_topmenu.inc");?>
<?php include("inc/left_right_content.inc");?>

<div id="centerContent">
<p class="first-letter">
This privacy statement discloses the privacy policies of All Inclusive Web Design. It applies solely to this website itself along with its content <span class="italic">(text and images)</span>. All Inclusive Web Design is committed to respecting your privacy. We have structured our website so that, you can visit it without identifying yourself or revealing any personal information.</p>

<p>Under the Data Protection Act 1998, we have a legal duty to protect any personal information we collect from you. We do not pass on your details to any third party. Your visit to All Inclusive Web Design is anonymous and hence no personal information is recorded or gathered, unless when you fill in the contact form to contact us.</p>

<p>If you do not wish to be contacted using any of the details you provide us through the Contact form, please say so when sending the form.</p>
</div>

<?php include("inc/footer.inc");?>

</body>
</html>

Recommended Answers

All 11 Replies

Who says you can't validate? Just copy and paste the URL into the appropriate spot on the validator page.

Who says you can't validate? Just copy and paste the URL into the appropriate spot on the validator page.

I wish to validate one page at a time, I'm afraid, so I can understand what's happening in each line.

Browse to your page. Select "View Source". Copy it all. Paste it into the appropriate spot on the validator page.

Browse to your page. Select "View Source". Copy it all. Paste it into the appropriate spot on the validator page.

I'm afraid, I already tried doing so, but becase of "php's include" file, having "header" elsewhere & "body" tag elsewhere, etc. it continues to show the errors.

I tried using the "browse" button & uploaded the file, but sadly came across message saying:

Sorry, I am unable to validate this document because its content type is application/x-php, which is not currently supported by this service.

I still don't understand. The validator allows you to validate something you paste in, or a URL. In either case, PHP renders HTML. You shouldn't be pasting the PHP, you should be pasting the results of the PHP program.

To repeat:

Browse to your file. View Source. Copy. Paste.

I still don't understand. The validator allows you to validate something you paste it, or a URL. In either case, PHP renders HTML. You shouldn't be pasting the PHP, you should be pasting the results of the PHP program.

To repeat:

Browse to your file. View Source. Copy. Paste.

Oh OK, will give it a go tomorrow morning now. It's time to doze off now before my brain cells stops working. Thanks.

I still don't understand. The validator allows you to validate something you paste in, or a URL. In either case, PHP renders HTML. You shouldn't be pasting the PHP, you should be pasting the results of the PHP program.

To repeat:

Browse to your file. View Source. Copy. Paste.

Everything works OK, except that I've certain "Flash .swf" files and am getting errors in "embed" code.

Does that mean Flash element DOES NOT get validated in XHTML ???

These are very basic errors, such as:

>> Line 10 column 31: there is no attribute "src".

<div id="centerTop"><embed src="welcome.swf" height="500" width="500"/></div>

>> Line 10 column 52: there is no attribute "height".

<div id="centerTop"><embed src="welcome.swf" height="500" width="500"/></div>

The "embed" element isn't within the XHTML specification. It's been replaced by "object".

The "embed" element isn't within the XHTML specification. It's been replaced by "object".

As I kicked-off with solving each error, there were many flash codes that weren't of XHTML standard. I managed to get it sorted out by researching over Internet.

I'm now left down to 2 (from originally 36 errors, mostly being flash based).

>> Line 60 column 218: there is no attribute "allowScriptAccess".

...er" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwa


>> Line 60 column 280: there is no attribute "pluginspage".

...ation/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashpl


What exactly these two "allowScriptAccess" and "pluginspage" do, since if it doesn't do much, I suppose getting rid of it (provided the flash element plays well in cross browser) would be an option ???

I don't know what they do. You haven't shown the entire element, so I don't know if you're still trying to use "embed', or if you've switched over to "object".

This page documents problems and and workarounds for XHTML and Flash.

I don't know what they do. You haven't shown the entire element, so I don't know if you're still trying to use "embed', or if you've switched over to "object".

This page documents problems and and workarounds for XHTML and Flash.

I switched over to Object, just as you recommended & has no "embed" in it, anymore. I also got rid of "ID" tags, on which I was having error. Alongside, I have "data" instead of "src".

The entire code can be seen on:

<!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" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>All Inclusive Web Design</title>
<link rel="stylesheet" type="text/css" href="style.css"/>
<script type="text/javascript">AC_FL_RunContent = 0;</script>
<script type="text/javascript" src="AC_RunActiveContent.js"></script>
</head>

<body>
<div id="header">
			Text-size:&nbsp;&nbsp;
			<a href="">normal</a>&nbsp; |&nbsp;
			<a href="">large</a>&nbsp; |&nbsp;
			<a href="">x-large</a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<?php echo date("l, d F Y");?>
<br/>
</div>

<div id="banner">
<!--url's used in the movie-->
<a href="contact.php"></a>
<a href="about.php"></a>
<a href="owner.php"></a>
<a href="template.php"></a>
<a href="services.php"></a>
<!--text used in the movie-->
<!-- saved from url=(0013)about:internet -->
<script type="text/javascript">
	if (AC_FL_RunContent == 0) {
		alert("This page requires AC_RunActiveContent.js. In Flash, run \"Apply Active Content Update\" in the Commands menu to copy AC_RunActiveContent.js to the HTML output folder.");
	} else {
		AC_FL_RunContent(
			'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0',
			'width', '700',
			'height', '150',
			'src', 'banner',
			'quality', 'best',
			'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
			'align', 'middle',
			'play', 'true',
			'loop', 'true',
			'scale', 'showall',
			'wmode', 'window',
			'devicefont', 'false',
			'id', 'banner',
			'name', 'banner',
			'menu', 'true',
			'allowScriptAccess','sameDomain',
			'movie', 'banner',
			'salign', ''
			); //end AC code
	}
</script>
<noscript>
	<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="700" height="150" align="middle">
	<param name="allowScriptAccess" value="sameDomain" />
	<param name="movie" value="banner.swf" /><param name="quality" value="best" /><param name="bgcolor" value="#009900" />	<object data="banner.swf" width="700" height="150" name="banner" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
	</object>
</noscript>
</div>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.