Page 1 of 1

Puzzled by a mystery character

Posted: Sun May 18, 2008 2:18 pm
by Nick
This is something I have not encountered before, though I've used TP for years. It may not be a TP problem, but I can't think what else it could be.

I have a php script that calls a header file and a footer file. In the generated page a "1" appears at the juncture of the two scripts. It is in neither of the scripts. So I wonder how it is hiding in them.

I thought it may be because the character sets may have been different, but I have re-done the scripts starting with a file with a utf-8 signature (as described by Andrea ( http://forums.textpad.com/viewtopic.php ... 33b99a9144 ) but that has nmade no difference. (i did copy and paste the code from the originals into it, but that shouldn't causeit should it?)

cheers, Nick

Posted: Mon May 19, 2008 6:38 am
by MudGuard
Show the involved PHP files, otherwise it is impossible to help.

Posted: Mon May 19, 2008 7:34 am
by Nick
Hi Mudguard,

Here's the code for the three files. The "1" appears between the html of the header and the html of index.php:

/portfolio/back-to-back-unit/index.php:

<?php
$title = "Portfolio: Woolworth's Newspaper/ Magazine Rack";
$path = "../../";
echo include ("../../includes/header.php");

echo "<img class='portfolio' src=\"img_1.jpg\" width='400' height='300' alt='' /><br />";
echo "<p>Provided by News International, this unit is now installed in 300 Woolworths.</p>";
?>


<!-- Insert directory name of Previous page -->
<p><a href="../modular-display/">&laquo; Previous</a>


&nbsp;&nbsp;|&nbsp;&nbsp;
<a href="../">Portfolio</a>
&nbsp;&nbsp;|&nbsp;&nbsp;


<!-- Insert directory name of Next page - here this is set to the first in the series.
Remember to change the Next link in the previous portfolio page to the directory
you have saved this page to.-->
<a href="../racing_stand/">Next &raquo;</a></p>

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


*********************************************************


/includes/header.php:

<!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">
<head>
<title>Daedalus Design Portfolio: <?php echo $title; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="Description" content="Description Description Description Description Description Description Description Description Description Description" />
<meta name="Keywords" content="Keywords,Keywords,Keywords,Keywords,Keywords,Keywords,Keywords,Keywords,Keywords,Keywords,Keywords,Keywords,Keywords,Keywords" />
<meta http-equiv="expires" content="01 Apr 2000" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta http-equiv="imagetoolbar" content="no" />

<link rel="stylesheet" type="text/css" href="<?php echo $path; ?>css/main.css" />
<link rel="shortcut icon" href="favicon.ico" />
</head>

<body>
<div id="body">

<div id="header">
<?php
echo '<img src="'.$path.'images/daedalus_design.jpg" width="447" height="83" hspace="0" vspace="0" alt="DaedalusDesign.org" />';
?>
</div>

<div id="side">
<img src="<?php echo $path; ?>images/menu.jpg" width="208" height="380" border="0" alt="Menu" usemap="#menu" />
<map name="menu">
<area shape="poly" coords="35,8,165,4,180,14,182,64,173,77,39,80,25,69,24,15" href="<?php echo $path; ?>portfolio/" alt="Portfolio">
<area shape="poly" coords="53,96,114,95,128,103,128,164,117,178,53,177,38,166,37,106" href="<?php echo $path; ?>cv.htm" alt="cv">
<area shape="poly" coords="17,197,189,195,191,227,179,235,19,235" href="<?php echo $path; ?>why-daedalus.htm" alt="Why Daedalus?">
<area shape="poly" coords="28,248,192,242,203,252,203,288,193,299,32,303,18,290,17,258" href="<?php echo $path; ?>contact.htm" alt="Contact Daedalus Design">
<area shape="poly" coords="7,318,188,311,203,321,204,358,197,371,16,378,5,367" href="<?php echo $path; ?>" alt="Daedalus Design home page">
</map>
</div>

<div id="page">
<h1><?php echo $title; ?></h1>


********************************************************


/includes/footer.php:

<div id="footer">
<p class="footer">&copy;2008 Joe MacLeod-Iredale</p>
</div>
</div>
</div>
</body>
</html>

Posted: Mon May 19, 2008 7:40 am
by MudGuard
If include is successful, it returns 1.

You explicitly print this 1 into the output:

echo include ("../../includes/header.php");

Posted: Mon May 19, 2008 7:43 am
by Nick
Thanks.

Now I feel really stupid!!