Log in

View Full Version : PHP - includes ( characters)



dreid
08-20-2009, 02:53 PM
H! a website that I have developed has the same sidebar and footer information on every page. So I have them both set up as "includes" so I can just make changes on the one page for the site.


The problem is that the footer include is putting in some weird characters and perhaps I have been staring at it too long but I can't figure out why it is doing it. These character are not in my code but they do appear when I view the source.......


Here is one page from the site:

http://www.barrycommercial.com/sales-new.php


and here is the footer (include) page which appears fine when it is not called by the above page.

http://www.barrycommercial.com/Includes/footer.html


Thanks in advance,

D:)

JShor
08-20-2009, 03:06 PM
You need to post code in order for us to help you for this case.

dreid
08-20-2009, 03:56 PM
Thanks! Code from page:



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<title>BARRY COMMERCIAL REAL ESTATE, Brokerage</title>
<link href="CSS/stylesheet.css" rel="stylesheet" type="text/css" /><!--[if IE]>
<style type="text/css">
/* place css fixes for all versions of IE in this conditional comment */
.twoColElsRtHdr #sidebar1 { padding-top: 30px; }
.twoColElsRtHdr #mainContent { zoom: 1; padding-top: 15px; }
/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */
</style>
<![endif]-->

<script type="text/javascript"></script>
<style type="text/css">
<!--
body,td,th {
font-family: Arial, Helvetica, sans-serif;
}
body {
background-color: #000;
background-image: url(background1.jpg);
background-repeat: repeat-x;
}
a:link {
color: #000;
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #000;
}
a:hover {
text-decoration: none;
color: #3C9673;
}
a:active {
text-decoration: none;
color: #000;
}
-->
</style></head>

<body class="twoColElsRtHdr">

<!-- REST OF BODY CONTENT BELOW HERE -->

<div id="container">
<div id="header">
<img src="img/barrybannernew.gif" width="800" height="140">
<!-- end #header --></div>
<div id="header2"><?php include("Includes/menu.html"); ?>

</div>
<!-- end #header2 -->

<div id="sidebar1"><?php include("Includes/rightbanner.html"); ?></div>

<div id="mainContent">

<table width="750" border="0" cellpadding="0">
<tr>
<td bgcolor="#3C9673" height="10" colspan="4" class="headings">Retail</td>

</tr>
<tr>
<td width="132"><img src="properties/718-8AVE/james-tn.gif" width="122" height="122"></td>
<td width="189"><a href="properties/718-8AVE/james.php" target="_self" class="text" ><strong>James Building</strong><br /><br>
$2,300,000<br /><br />
<img height="20" alt="" src="img/b38.gif" width="20" border="0"> more details</a></td>
<td width="137"><img src="properties/heritage/heritagepointe-tn.gif" width="122" height="122" /></td>
<td width="205"><a href="properties/heritage/heritage.php" target="_self" class="text"> <strong>The Village Centre at the Lake at Heritage Pointe | Calgary, Alberta</strong><br><br>
$1,830,000&nbsp;&nbsp;(Phase3)<br />
$2,485,000&nbsp;&nbsp; (Phase 4)<br><br>
<img height="20" alt="" src="img/b38.gif" width="20" border="0"> more details</a></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td bgcolor="#3C9673"height="15" colspan="4" class="headings">&nbsp;&nbsp;&nbsp;&nbsp;Office</td>


</tr>
<tr>
<td><img src="properties/cpi/cpi-tn.gif" width="122" height="122" /></td>
<td><a href="properties/cpi/cpi.php" target="_self"><strong>CPI Building</strong><br>
<p>$1,500,000 (main floor)<br>
$1,500,000 (second floor)<br>
$1,600,000 (third floor)<br><br>
<img height="20" alt="" src="img/b38.gif" width="20" border="0"> more details</a></td>
<td><img src="properties/evergreen/evergreen-tn.gif" width="122" height="122" /></td>
<td><a href="properties/evergreen/evergreen.php" target="_self" class="text" ><strong>Evergreen Professional Centre<br>
Calgary, Alberta</strong><br /><br>
$3,200,000<br /><br />
<img height="20" alt="" src="img/b38.gif" width="20" border="0"> more details</a></td>

</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td bgcolor="#3C9673" height="15" colspan="2"class="headings">Multi Residential </td>
<td bgcolor="#3C9673" height="15" colspan="2"class="headings">Industrial </td>

</tr>
<tr>
<td><img src="properties/fourplex/fourplex-tn.gif" width="122" height="122"></td>
<td><strong><a href="properties/fourplex/fourplex.php" target="_self" class="text" >Four-plex<br>
650 - 652 McDougall Road NE</strong><br>
<p>Unit 1 $315,000<br>
Unit 2 $330,000<br>
Unit 3 $350,000<br>
Total $965,000<br>


<br>
<img height="20" alt="" src="img/b38.gif" width="20" border="0"> more details
</a></td>
<td><img src="img/yourpropertyhere.jpg" width="158" height="122" /></td>
<td>&nbsp;</td>
</tr>
<tr>
<td bgcolor="#3C9673"height="15" colspan="4" class="headings">Development Land</td>

</tr>
<tr>
<td><img src="properties/inglewood/inglewood-tn.gif" width="122" height="122" /> </td>
<td><p><a href="properties/inglewood/inglewood.php" target="_self" class="text"><strong>Vacant Land - Inglewood | Calgary Alberta</strong><br>
<br>
$1,200,000<br>
<img height="20" alt="" src="img/b38.gif" width="20" border="0"> more details</a></td>
<td class="text"><img src="properties/taradale/taradale-tn.gif" width="122" height="122"></td>
<td><a href="properties/taradale/taradale.php" target="_self" class="text"><strong>Taradale Residential Development Lands | Calgary Alberta</strong><br><br>
$3,600,000<br><br>
<img height="20" alt="" src="img/b38.gif" width="20" border="0"> more details</a></td>
<td>&nbsp;</td>
</tr>
<tr>
<td><img src="properties/dewinton/dewinton-tn.gif" width="122" height="122"></td>
<td><a href="properties/dewinton/dewinton.php" target="_self" class="text"><strong>Vacant Land - Heritage Pointe | DeWinton, Alberta</strong><br>
<br>
$3,900,000<br><br>
<img height="20" alt="" src="img/b38.gif" width="20" border="0"> more details</a></a></td>
<td class="text"><img src="properties/didsbury/didsbury-tn.gif" width="122" height="122"></td>
<td><a href="properties/didsbury/didsbury.php" target="_self" class="text"><strong>Didsbury Residential Development Lands | Didsbury, Alberta</strong><br><br>
$2,900,000</a><br><br>
<img height="20" alt="" src="img/b38.gif" width="20" border="0"> more details</a> </td>

</tr>
<tr>
<td><img src="img/stanleysquare/stanley-tn.gif" width="122" height="122" /></td>
<td><a href="properties/stanleysquare/stanleysquare.php" target="_self" class="text"><strong>Stanley Square | Calgary, Alberta<strong><br><br>$5,500,000</a><br><br> <img height="20" alt="" src="img/b38.gif" width="20" border="0"> more details</a> </td>
<td class="text"></td>
<td>&nbsp;</td>

</tr>
</table>

</div><!-- end #mainContent -->


<div id="footer"><?php include("Includes/footer.html"); ?>
</div>
<!-- end #container --></div>
</body>
</html>



Code from Includes footer page:


<html>
<body>
<p align="center">Registered and Associated Member of:<br><br>
<a href="http://www.rics.org/" title="RICS - Royal Institute of Chartered Surveyors" target="_blank"><img src="http://www.barrycommercial.com/Includes/img/ricslogonew.gif" width="273" height="36" border="0"alt="RICS - Royal Institute of Chartered Surveyors"></a>&nbsp;<a href="http://www.aicanada.ca/" title="Appraisal Institute of Canada" target="_blank"><img src="http://www.barrycommercial.com/Includes/img/aic_logo.gif" width="30" height="30" border="0" ></a>&nbsp;<a href="http://www.abrea.ab.ca/" target="_blank"><img src="http://www.barrycommercial.com/Includes/img/area_logo.gif" alt="Alberta Real Estate Association" width="75" height="36" border="0" title="Alberta Real Estate Association"></a>&nbsp;<a href="http://www.crewcalgary.com/" target="_blank"><img src="http://www.barrycommercial.com/Includes/img/crew_logo.gif" alt="Commercial Real Estate Women - Calgary" width="59" height="36" border="0" title="Commercial Real Estate Women - Calgary"></a><a href="http://www.orea.com/" target="_blank">&nbsp;<img alt="OREA" src="http://www.barrycommercial.com/Includes/img/logo_orea.gif" width="83" border="0" title="Ontario Real Estate Association"></a>&nbsp;<a href="http://www.reco.on.ca/" target="_blank"><img alt="RECO" src="http://www.barrycommercial.com/Includes/img/logo_reco.gif" width="44" border="0" title="RECO"></a>&nbsp;<a href="http://www.creb.com/" target="_blank" title="Calgary Real Estate Board"><img src="http://www.barrycommercial.com/Includes/img/creb.gif" height="36" border="0"></a>&nbsp;<a href="http://www.glgcouncils.com/" target="_blank"><img src="http://www.barrycommercial.com/Includes/img/glgroup_logo.gif" alt="Gerson Lehrman Group Council" width="102" height="38" border="0" title="Gerson Lehrman Group Council"></a>&nbsp;&nbsp;<img src="http://www.barrycommercial.com/Includes/img/icx.jpg" alt="" width="60" height="40" border="0">
<br>
</p>


<p><strong>BARRY COMMERCIAL REAL ESTATE CORP., Brokerage </strong>&nbsp;&nbsp; |&nbsp;&nbsp; 750, 330 - 5th Avenue SW Calgary, AB&nbsp;&nbsp; |&nbsp;&nbsp;T2P 0L4&nbsp;&nbsp; |&nbsp;&nbsp; t: 403.589.5599 &nbsp;|&nbsp;&nbsp; f: 403.257.5317 <br />
</p>
</body>
</html>

JShor
08-20-2009, 04:36 PM
That was pretty complex, but I figured it out by viewing the page source. The <html> and <body> tags are already called by the sales-new.php page. Recalling them would produce a brand new HTML batch.

Solution: Remove the <html></html> and <body></body> tags from all of the includes' pages, and that should solve your problem.

HTH:)

dreid
08-20-2009, 06:31 PM
Hi, thanks so much I have changed the code, but I am still getting weird characters:

CODE - with Html/body tags removed

<p align="center">Registered and Associated Member of:<br><br>
<a href="http://www.rics.org/" title="RICS - Royal Institute of Chartered Surveyors" target="_blank"><img src="http://www.barrycommercial.com/Includes/img/ricslogonew.gif" width="273" height="36" border="0"alt="RICS - Royal Institute of Chartered Surveyors"></a>&nbsp;<a href="http://www.aicanada.ca/" title="Appraisal Institute of Canada" target="_blank"><img src="http://www.barrycommercial.com/Includes/img/aic_logo.gif" width="30" height="30" border="0" ></a>&nbsp;<a href="http://www.abrea.ab.ca/" target="_blank"><img src="http://www.barrycommercial.com/Includes/img/area_logo.gif" alt="Alberta Real Estate Association" width="75" height="36" border="0" title="Alberta Real Estate Association"></a>&nbsp;<a href="http://www.crewcalgary.com/" target="_blank"><img src="http://www.barrycommercial.com/Includes/img/crew_logo.gif" alt="Commercial Real Estate Women - Calgary" width="59" height="36" border="0" title="Commercial Real Estate Women - Calgary"></a><a href="http://www.orea.com/" target="_blank">&nbsp;<img alt="OREA" src="http://www.barrycommercial.com/Includes/img/logo_orea.gif" width="83" border="0" title="Ontario Real Estate Association"></a>&nbsp;<a href="http://www.reco.on.ca/" target="_blank"><img alt="RECO" src="http://www.barrycommercial.com/Includes/img/logo_reco.gif" width="44" border="0" title="RECO"></a>&nbsp;<a href="http://www.creb.com/" target="_blank" title="Calgary Real Estate Board"><img src="http://www.barrycommercial.com/Includes/img/creb.gif" height="36" border="0"></a>&nbsp;<a href="http://www.glgcouncils.com/" target="_blank"><img src="http://www.barrycommercial.com/Includes/img/glgroup_logo.gif" alt="Gerson Lehrman Group Council" width="102" height="38" border="0" title="Gerson Lehrman Group Council"></a>&nbsp;&nbsp;<img src="http://www.barrycommercial.com/Includes/img/icx.jpg" alt="" width="60" height="40" border="0">
<br>
</p>


<p><strong>BARRY COMMERCIAL REAL ESTATE CORP., Brokerage </strong>&nbsp;&nbsp; |&nbsp;&nbsp; 750, 330 - 5th Avenue SW Calgary, AB&nbsp;&nbsp; |&nbsp;&nbsp;T2P 0L4&nbsp;&nbsp; |&nbsp;&nbsp; t: 403.589.5599 &nbsp;|&nbsp;&nbsp; f: 403.257.5317 <br />
</p>

JShor
08-20-2009, 08:46 PM
After some googling I came up with this:
http://en.wikipedia.org/wiki/Byte-order_mark

and by viewing your page source you have no encoding set, so it's not defaulting to UTF-8.

Try putting this after your <head> tag:


<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>

dreid
08-20-2009, 09:01 PM
Thanks !!!! When I posted my code I removed some of the meta tag information so it wouldn't be so long to read for you... but what I had was:

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

and what worked was your suggestion of ...... charset=UTF-8

Thanks again, I will have to read up on these! I use dreamweaver (I know some people don't like it) but I assumed it would put in the right information regarding charset....

Thanks
D

JShor
08-20-2009, 11:10 PM
It's Frontpage that everyone hates, but I personally prefer to code things completely myself. That way I KNOW the HTML is valid [plus, for me, it's a lot faster].

Glad things worked out for you.

soodgniit
02-16-2012, 11:24 AM
yes it gets remove by adding meta tag in header.

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>