Help organizing my php and html

fallenapples

In Runtime
Messages
386
Location
Toronto, Ontario
Originally I created a site with html and css both in the same document. I created two pages, one English and one French. Now after further researching, I want to better organize my site. I saved copies of the html versions in php. I added an <?php include('footer.php'); ?> tag with the footer file saved in the same directory as the site pages. But it will not show help? How can I fix this and how can I fix create a separate css style sheet. Here is my code form the English page

Code:
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Road Links</title>
<style type="text/css">
.headingtitle {
	font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
	font-size: 30px;
	color: #FFF;
}
.headingtitlesub {
}
#headingtitlesub {
}
#titie {
	color: #000;
	letter-spacing: 1em;
}
#headinginfo {
	color: #FFF;
	letter-spacing: 0em;
	font-size: 38px;
	font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
}
#paragraphone {
	color: #FFF;
	font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
}
#paragraphtwo {
}
#paragraphthree {
	color: #FFF;
}
#paragraphfour {
	color: #FFF;
}
#paragraphtwo {
	font-size: 30px;
	color: #FFF;
}
#language {
	letter-spacing: 0em;
	font-size: 24px;
	font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
	border-top-style: none;
	border-right-style: none;
	border-bottom-style: none;
	border-left-style: none;
	color: #FFF;
}
#title {
	letter-spacing: 1.5em;
	font-weight: bold;
	font-size: 40px;
	font-family: "Cooper Black";
	color: #FFF;
}
body {
	background-image: url(yrm.jpg);
	background-repeat: repeat;
}
a:link {
	color: #FFF;
}
a:visited {
	color: #FFF;
}
</style></head>



<body>
<p align="right" class="headingtitle" id="titie"><span id="language"><a href="Roadlinksfr.html">Français</a></span></p>
<h1 align="center" class="headingtitle" id="title">ROAD LINKS<span id="headinginfo"><br>
  <strong>1-888-962-1322 </strong><br>
  <a href="mailto:service@roadlinks.net">service@roadlinks.net</a></span></h1>
<hr>
<p align="center" class="headingtitle"><span id="paragraphone">24 HOUR Contact Center for urgent mobile mechanical service in the transport industry</span>.</p>
<hr>
<p align="center" class="headingtitle"><span id="paragraphtwo">Call us for immediate service in most major Canadian cities and the spaces in between. Service fees are payable by an major credit card.</span></p>
<hr>
<p align="center" class="headingtitle"><span id="paragraphthree">We are founded on the principals of excellent service, information technology and establishing quality relationsips with customers and service providers</span>.</p>
<hr>
<p align="center" class="headingtitle"><span id="paragraphfour">We invite your queries and questions whether you are interested in using our services or becoming a service provider.</span></p>
<hr>
<p align="center" class="headingtitle"> </p>
<p><br>
</p>
<style type="text/css">
#footer { clear:both; margin:auto; height: 19px; text-align:center;
}
<?php include('footer.php'); ?>
</body>
</html>
 
Last edited by a moderator:
Please please please use code tags when posting code. Makes it easier to read.

Now then... to start with...

To put CSS in an external file, take your entire <style> block, and put it in a .CSS file. You don't need the <style> tags in the CSS file, just the raw CSS code. Then include this in your HTML's <head> tags (where mystyles.css is the name of your CSS file):
Code:
<link rel="stylesheet" type="text/css" href="mystyle.css">

What does your footer.php look like?

Also, you don't need parentheses when including the external files apparently. See similar examples here:
http://php.about.com/od/tutorials/ht/template_site.htm
 
Last edited:
Code:
<style type="text/css">
#footer { clear:both; margin:auto; height: 19px; text-align:center; color: yellow;
}
</style>
<div id="footer">
		<p>Copyright © PS 2014 | Designed by PS</a> | Valid <a href="http://jigsaw.w3.org/css-validator/">CSS</a> & 
		<a href="http://validator.w3.org/">HTML5</a></p>
</div>

I got it to work. The folder was not in the correct directory. However the font color shows in black when I open it up with the entire file. When I open up the footer.php doc by itself, the color is yellow, the way I would like it to be.
 
I'm guesssing your main CSS file is probably overwriting the CSS style you have inline in the footer.

Put that style block from your footer in your CSS file, and it should use it.
 
Thank you. I copied the css code and linked the stylesheet. Now I won't have to create each page from scratch. Is it by standard that .css comes first then the html? Or is it just to make the code easier to read and organize?
 
Thank you. I copied the css code and linked the stylesheet. Now I won't have to create each page from scratch. Is it by standard that .css comes first then the html? Or is it just to make the code easier to read and organize?

Do you mean that the CSS link goes in the <head> tag? Yes, that's where it's supposed to go. The <head> gets loaded before the <body>, so the stylesheet is loaded for when the page renders.
 
So add the php include code between the style tags? or the actual footer's html/css code itself?

What? No.

Not sure what you're going on about. The only time I mentioned <style> blocks were when I said to move the CSS styling from the page to it's own file.
 
Back
Top Bottom