Ok so I have a basic php include like this...

<?php include('http://garbagewars.com/ora/site/statusbar.php?h=13&amp;w=250'); ?>

The amp; was added to the url so my site will accept the & symbol. But that's not my point, I would like to get my site to accept the above code but it does not, I am thinking its because it's not declared in the header file.

Here is the error I get...

XML Parsing Error: not well-formed
Location: http://www.garbagewars.com/comics.php
Line Number 226, Column 14: <img width=0 height=13 src=http://garbagewars.com/ora/images-ora/statusbar.jpg><img width=0 height=13 src=http://garbagewars.com/ora/images-ora/statusbar.jpg><img width=0 height=13 src=http://garbagewars.com/ora/images-ora/statusbar.jpg><img width=0 height=13 src=http://garbagewars.com/ora/images-ora/statusbar.jpg><img width=0 height=13 src=http://garbagewars.com/ora/images-ora/statusbar.jpg><img width=0 height=13 src=http://garbagewars.com/ora/images-ora/unstatusbar.jpg><img width=0 height=13 src=http://garbagewars.com/ora/images-ora/unstatusbar.jpg><img width=0 height=13 src=http://garbagewars.com/ora/images-ora/unstatusbar.jpg><img width=0 height=13 src=http://garbagewars.com/ora/images-ora/unstatusbar.jpg><img width=0 height=13 src=http://garbagewars.com/ora/images-ora/unstatusbar.jpg><img width=0 height=13 src=http://garbagewars.com/ora/images-ora/unstatusbar.jpg><img width=0 height=13 src=http://garbagewars.com/ora/images-ora/unstatusbar.jpg><img width=0 height=13 src=http://garbagewars.com/ora/images-ora/unstatusbar.jpg><img width=0 height=13 src=http://garbagewars.com/ora/images-ora/unstatusbar.jpg><img width=0 height=13 src=http://garbagewars.com/ora/images-ora/unstatusbar.jpg><img width=0 height=13 src=http://garbagewars.com/ora/images-ora/unstatusbar.jpg><img width=0 height=13 src=http://garbagewars.com/ora/images-ora/unstatusbar.jpg><img width=0 height=13 src=http://garbagewars.com/ora/images-ora/unstatusbar.jpg><img width=0 height=13 src=http://garbagewars.com/ora/images-ora/unstatusbar.jpg><img width=0 height=13 src=http://garbagewars.com/ora/images-ora/unstatusbar.jpg><img width=0 height=13 src=http://garbagewars.com/ora/images-ora/unstatusbar.jpg><img width=0 height=13 src=http://garbagewars.com/ora/images-ora/unstatusbar.jpg><img width=0 height=13 src=http://garbagewars.com/ora/images-ora/unstatusbar.jpg><img width=0 height=13 src=http://garbagewars.com/ora/images-ora/unstatusbar.jpg><img width=0 height=13 src=http://garbagewars.com/ora/images-ora/unstatusbar.jpg><img width=0 height=13 src=http://garbagewars.com/ora/images-ora/unstatusbar.jpg><img width=0 height=13 src=http://garbagewars.com/ora/images-ora/unstatusbar.jpg><img width=0 height=13 src=http://garbagewars.com/ora/images-ora/unstatusbar.jpg><img width=0 height=13 src=http://garbagewars.com/ora/images-ora/unstatusbar.jpg><img width=0 height=13 src=http://garbagewars.com/ora/images-ora/unstatusbar.jpg><img width=0 height=13 src=http://garbagewars.com/ora/images-ora/unstatusba
---------------------------

As you can see for some reason the error just repeats the include. I would like to get this include to work, plus I would like to be able to use javascript in my header.

Here is the header file my old friend and I designed, he is gone now. But I know this is where I need to declare everything for my site to accept it.

<?php

if( !defined('IN_SITE') )
{
	exit;
}

if( !defined('NO_ACCEPT_XHTML_HEADER') )
{
	/* Accept-header Code by NeoThermic (www.neothermic.com). Modified as needed by David McKim. */

$accept_header = explode( ',', $_SERVER["HTTP_ACCEPT"]);

$xhtml_value = preg_grep( '/^application\/xhtml\+xml(;q=(0\.\d{1,5}|1\.0|[01]))?$/i', $accept_header);
$xhtml_value = array_values($xhtml_value); // reset the keys

if (count($xhtml_value) == 0)
{
	$xhtmlxml = floatval(0.0); //if you're not specified anywhere, you don't support it
}
else
{
	// now parse the XHTML value found for any q-value
	if ( strpos($xhtml_value[0], 'q') === FALSE )
	{
		// with no q-value explicitly set, then your XHTML support is 1
		$xhtmlxml = floatval(1.0);
	}
	else
	{
		// with one specified, lets obtain it
		$qloc = strpos($xhtml_value[0], 'q');
		$qvalue = substr($xhtml_value[0], $qloc + 2 ); //we add two to skip past the = sign
		$xhtmlxml = floatval($qvalue);
	}
}

//now do the above but for text/html
$html_value = preg_grep( '/^text\/html(;q=(0\.\d{1,5}|1\.0|[01]))?$/i', $accept_header);
$html_value = array_values($html_value); //reset the keys

if (count($html_value) == 0)
{
	$texthtml = floatval(0.0); // if you're not specified anywhere, you dont' support it
}
else
{
	// now parse the HTML value found for any q-value
	if ( strpos($html_value[0], 'q') === FALSE )
	{
		// with no q-value explicitly set, then your HTML support is 1
		$texthtml = floatval(1.0);
	}
	else
	{
		// with one specified, let's obtain it
		$qloc = strpos($html_value[0], 'q');
		$qvalue = substr($html_value[0], $qloc + 2 ); // we add two to skip past the = sign
		$texthtml = floatval($qvalue);
	}
}

if ($xhtmlxml > $texthtml || ($xhtmlxml == $texthtml && $texthtml > 0))
{
	header("Content-type: application/xhtml+xml");
}
else

{
	header("Content-type: text/html; charset=UTF-8");
}
}

?>

<!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" lang="en" xml:lang="en">
<!-- GarbageWars.com Copyright (c) 2006 Garbage Wars Productions. All rights reserved.
http://www.garbagewars.com
All pages of www.garbagewars.com were coded by David McKim, do not use my code without my permission.
If someone is caught using my code this is considered stealing and he or she will be prosecuted to the fullest extent of the law. -->
<head>
<title><?php echo PAGE_TITLE; ?></title>
	<link rel="stylesheet" type="text/css" href="./css/main.css" />
	<link rel="stylesheet" type="text/css" href="./css/advertise.css" />
	<link rel="stylesheet" type="text/css" href="./css/art.css" />
	<link rel="stylesheet" type="text/css" href="./css/comics.css" />
	<link rel="stylesheet" type="text/css" href="./css/contacts.css" />
	<link rel="stylesheet" type="text/css" href="./css/donate.css" />
	<link rel="stylesheet" type="text/css" href="./css/fanwork.css" />
</head>

<body>
	<div id="wrapper">
		<div id="header" align="center">
			<div id="topmenu">
				<ul>
					<li class="first-li"><a href="http://www.garbagewars.com"><img src="./images/site/buttons/home.png" alt="Home" border="0" /></a></li>
					<li><a href="./comics.php"><img src="./images/site/buttons/comics.png" alt="Comics" /></a></li>
					<li><a href="./art.php"><img src="./images/site/buttons/art.png" alt="Art" border="0" /></a></li>
					<li><a href="./shop/"><img src="./images/site/buttons/shop.png" alt="Shop" border="0" /></a></li>
					<li><a href="./extras.php"><img src="./images/site/buttons/extras.png" alt="Extras" border="0"/></a></li>
					<li><a href="./contacts.php"><img src="./images/site/buttons/contacts.png" alt="Contacts" border="0" /></a></li>
					<li><a href="./links.php"><img src="./images/site/buttons/links.png" alt="Links" border="0" /></a></li>
				</ul>
			</div>
			</div>
			<div id="gutter"></div>

I hope someone can help me out XD I'd really like to use a lot of code that I have planned for my site. Im still learning some of this so I'd really appreciate if someone could help me.

    Ok, you have several problems:

    1. You are including a URL. Don't do it. EVER. Include files relatively by local paths. Don't include URLs, it does not do what you think it does and is highly dangerous.

    2. I suspect the XML error is coming from some client-side processing. Are you trying to return an XML file, or is the browser somehow deciding for itself? What browser are you using? What content type are you returning?

    If you return a content type of "application/xhtml+xml", as you are above, the document MUST BE WELL-FORMED.

    If you don't understand what well-formed is, go and read up on XML. HTML documents are usually not well-formed XML.

    The HTML which comes from statusbar.php is not even close to being well-formed XML.

    Mark

      MarkR wrote:

      Ok, you have several problems:

      1. You are including a URL. Don't do it. EVER. Include files relatively by local paths. Don't include URLs, it does not do what you think it does and is highly dangerous.

      2. I suspect the XML error is coming from some client-side processing. Are you trying to return an XML file, or is the browser somehow deciding for itself? What browser are you using? What content type are you returning?

      If you return a content type of "application/xhtml+xml", as you are above, the document MUST BE WELL-FORMED.

      If you don't understand what well-formed is, go and read up on XML. HTML documents are usually not well-formed XML.

      The HTML which comes from statusbar.php is not even close to being well-formed XML.

      Mark

      I understand about well-formed site, Im still working on that though.

      Ok so why is including a url dangerous?

      Im not too sure on that. Well I switch from Mozilla to Opera.

      My big question is why the hell did he declare XML and XHTML in my header file T_T I dont even think I use it in my entire site.

        Write a Reply...