...

View Full Version : Having problems with Includes on new website



AirfieldCards
04-12-2012, 07:39 PM
Hi People.

I am building a website which started out it's life as a free template.

A lot of the CSS and HTML was written.

However, I am trying to add an "includes" for the side menu so that I only have to do the menu once and it will be the same for all pages.

Here is the code for my page.


<!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">
<head>
<title>LED Lighting Buyer Beware of cheaply manufactured alternatives.</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<div id="wrapper">
<div id="title">
<h1>GreenerU Ltd.</h1>
</div>
<div id="header"><img src="img/led_lights_logo.jpg" alt="LED Lights Image" /></div>
<div class="container">
<ul id="navCircle">
<li><a href="index.html">Home</a></li>
<li><a href="beware.html">Buyer Beware</a></li>
<li><a href="dialight.html">Dialight</a></li>
<li><a href="savings.html">Savings</a></li>
<li><a href="carbon.html">Carbon Reduction</a></li>
<li><a href="sad.html">S.A.D.</a></li>
<li><a href=""></a></li>
</ul>
</div>
<div id="content">
<h2>Buyer <span style="color: #11b74b;"> Beware</span></h2>
<blockquote><p>Please do not read this website and think that you can simply go onto e-bay, purchase LED lamps in place of your existing ones and save a fortune. </p> Yes you can do that, and they will work, for a while, but inevitably they will fail. </blockquote>
<h2>Why will they <span style="color: #11b74b;"> fail?</span></h2>
<p><img class="imgleft" align="left" hspace="10" src="img/earth_large_bulb_150.png" alt="box" title="box" />They will fail because they have not been properly designed to keep cool. Overheating LEDs and badly designed driver circuits can dramatically affect lamp life</p> <p> Not only will they fail premeturely but they will at that point damage your perception of the technology. God forbid that this happens to you. If you have spent a fortune on what you thought was going to last for years, you are up the creek without a paddle. So much for the lamps paying for themselves over time.</p>

<h2>Damaging the core <span style="color: #11b74b;">reputation </span>of the technology</span></h2>
<p><img class="imgright" src="img/earth_large_bulb_150.png" alt="box" title="box" /><p> This is the single biggest fear that I have as lighting supplier. LED lamps if correctly designed can and will last for 20 years plus. It is the badly designed LED lamps out there that give me sleepless nights. When you are up the creek without a paddle, you will rue the day you ever bought them. This is why we are not only delighted to be agents for Dialight, but this is also why you should speak to us about it and not anyone else. We all know that if the salesman says it then it's bull****, but if the customer says it then it's true. All we will say, is come and see some Dialight customers who have had their lamps for years.

<?PHP include "sidelinks.php";?>

</div>
<div id="right-col">
<h2>Updates</h2>
<div class="scroll">
<h3>January 2007</h3>
<p class="news">Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi pretium magna et purus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Donec eros.</p>
<h3>January 2006</h3>
<p class="news">Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi pretium magna et purus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Donec eros.</p>
</div>

<h2>Articles</h2>

<?PHP include "sidelinks.php";?>
<ul class="side">

<li><a href="http://www.free-css.com/">Snapp Happy</a></li>
<li><a href="http://www.free-css.com/">TODC</a></li>
<li><a href="http://www.free-css.com/">Andreas Viklund</a></li>
<li><a href="http://www.free-css.com/">James Koster</a> </li>
<li><a href="http://www.free-css.com/"> CSS play</a></li>
<li><a href="http://www.free-css.com/">Listamatic</a></li>
</ul>
<h2>Links</h2>
<ul class="side">
<li> <a href="http://www.free-css.com/">Link One</a></li>
<li> <a href="http://www.free-css.com/">Link Two</a></li>
<li> <a href="http://www.free-css.com/">Link Three</a></li>
</ul>
<h2>Links</h2>
<ul class="side">
<li> <a href="http://www.free-css.com/">Link One</a></li>
<li> <a href="http://www.free-css.com/">Link Two</a></li>
<li> <a href="http://www.free-css.com/">Link Three</a></li>
</ul>
</div>
<div style="clear:both;"></div>
<div id="footer">Copywright 2012 GreenerU Ltd, All rights reserved.</div>

</div>
</body>
</html>

All it does when I call the <?PHP include "sidelinks.php";?> is make everything following it disappear.

Here is the CSS file



body {
margin : 0;
padding : 0;
text-align : left;
font : 75% "Trebuchet MS", verdana, arial, sans-serif;
line-height : 1.5em;
background : #6db859 url(img/bg.jpg) top center repeat-y;
color : #000;
}
/*CONTAINER*/
#wrapper {
position : relative;
width : 1000px;
margin-right : auto;
margin-left : auto;
padding : 0;
border : 0px solid green;
background : #fff;
}
/*TOP TITLE BAR*/
#title {
width : 995px;
margin-left : 5px;
padding : 0;
text-align : right;
background : #fff;
color : #000;
}
#title h1 {
margin : 0;
padding : 10px;
font-size : 175%;
/*text-transform : uppercase;*/
letter-spacing : 5px;
background : inherit;
color : #BCE0A8;
}
/*BANNER*/
#header {
background : url(images/led_lights_logo.jpg) no-repeat;
width : 995px;
height : 200px;
margin : 0 0 0 5px;
padding : 0 0 0 0;
}
/*TOP NAVIGATION*/
.container {
width : 995px;
height : 35px;
margin : 10px 0 10px 5px;
}
#navCircle {
margin : 0;
padding : 0 0 35px 3px;
border-bottom : 3px solid #b2d094;
}
#navCircle li {
margin : 0;
padding : 0;
display : inline;
list-style-type : none;
}
#navCircle a:link, #navCircle a:visited {
float : left;
font-size : 1.3em;
padding : 0 20px 5px 5px;
text-decoration : bold;
background : inherit;
color : #457C05;
}
#navCircle a:link.active, #navCircle a:visited.active, #navCircle a:hover {
background-color : inherit;
color : #000;
background : url(img/arrow1.gif) no-repeat bottom center;
}
/*MAIN CONTENT*/
#content {
width : 700px;
float : left;
margin-top : 0;
margin-left : 11px;
padding : 5px;
border-right : 3px solid #b2d094;
}
#content p {
padding : 0 20px;
}
/*SIDEBAR*/
#right-col {
width : 175px;
margin : 5px 0 0 750px;
border-left : 1px none #28460a;
padding : 3px;
}
/*FOOTER*/
#footer {
margin : 50px 0 0 0;
padding : 5px;
font : 90% "Trebuchet MS", verdana, arial, sans-serif;
background : #4b692d;
color : #fff;
}
#footer a:link, #footer a:visited {
background : inherit;
color : #b2d094;
}
#footer a:hover {
background : inherit;
color : #fff;
text-decoration : none;
}
/*SCROLLBAR*/
div.scroll {
overflow : auto;
height : 10em;
width : 150px;
padding : 1ex;
margin : 0 0 30px 5px;
border : 1px solid #345411;
background : #BCE0A8;
color : #000;
}
/*TYPOGRAPHY*/
h2 {
margin : 20px;
font-size : 140%;
text-transform : uppercase;
letter-spacing : 5px;
background : inherit;
color : green;
}
h3 {
margin : 5px;
font-size : 120%;
letter-spacing : 5px;
background : inherit;
color : green;
}
blockquote {
font-weight : bold;
font-style : italic;
color : #b29b35;
}
/*LINKS*/
a img {
border : none;
}
a:link, a:visited {
text-decoration : none;
background : inherit;
color : #457C05;
}
a:hover {
text-decoration : underline;
background : inherit;
color : #666;
}
ul.side {
list-style-type : square;
padding : 0;
margin : 0;
background : inherit;
color : #457C05;
}
.side li {
padding-left : 0.2em;
margin-left : 2em;
}
/*CLASSES*/
.news {
font-size : 90%;
background : inherit;
color : #000;
}
.imgleft {
float : left;
border : 0px solid #345411;
padding : 5px;
margin-right : 15px;
}
.imgright {
float : right;
border : 0px solid #345411;
padding : 5px;
margin-left : 15px;
}


Any help would be really appreciated to tell me what is going on.

Fou-Lu
04-12-2012, 08:07 PM
What is in sidelinks.php?
The CSS is irrelevant to PHP world, so you don't need to really include that here. Describe "disappear". Is the HTML source terminated at that point? What is in the resulting HTML source?

AirfieldCards
04-12-2012, 08:35 PM
The sidelinks.php file which I am trying to link to has the following only in the page.


<?PHP

<html>
Testing 123

</html>
echo Testing 456

?>
<html>
Testing HTML
</html>

All of those inside and outside of the various tags was me simply testing to see if any of it showed up but nothing does.

The page is here
http://www.greeneru.co.uk/vince_html/beware.php

and it it should eventually look like this one when finished.
http://www.greeneru.co.uk/vince_html/beware.html

I can't get my head around the
-
-
-
-
-
-
-
that is now where the side menu should be?

Fou-Lu
04-12-2012, 08:44 PM
You have a parse error, so the "disappear" is caused by a fatal error. The whole <html> type blocks need to be treated as a string if you want to print them out:


print '<html>';
echo 'Testing 123';

Quotes are required for any strings you use.

Since you are not actually processing anything, you can just remove the entire <?php ...?> block. The output will just be the HTML, although with the include you don't want to include the <html> blocks, you just want whatever you intend to show at the location of the include.

AirfieldCards
04-12-2012, 10:16 PM
Brilliant, thanks I'm now sorted.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum