Chopping the header and footer out of my CSS layout to be used as PHP includes.

2 replies
  • WEB DESIGN
  • |
First off, I'd like to thank all of the Warriors who have been helping me with this project. I've learned so much from all of you and I'm already much better than I was at the beginning of this. I've learned the basics of how to build a site with DIVs/CSS rather than with nasty tables, a little bit more about design, and I've scraped the surface of PHP. Once I finish this project I actually plan to take what I have learned and create simple and easy to understand tutorials about everything I learn, that way I can share them with others who need help and are new to web design and development.

Anyways, I've built the home page of the site. Here it is. Now I need to figure out how to take the header and footer out, and put them in PHP files so that they will work as includes, for the obvious reasons.

So a couple of questions I have are:
  1. Does a PHP file have to start with <html> or anything like that or is it just the code. For example, if I wanted my header.php to just be "Touchstone Ranch" in H1 format, would the entire php file just be the <H1> tags and text?
  2. Will I need to include the CSS into my header and footer php files or will it get added automatically through the page, as it will have the CSS include.

I thought that maybe I could just cut the whole #header div out of the index page, place it in my header.php, include it and it would work. But for some reason it did not. So I need to know how to take it out and make it work properly.
#chopping #css #footer #header #includes #layout #php
  • Profile picture of the author Neodism
    So I'm made some progress on my own. I've got the includes going and all, but the footer ended up sort of messed up. Although I pulled the code from the page that was already working, it is distorted on the PHP page I'm working on.

    Also, I made a DIV for content and it doesn't grow with my content. My words go down through the footer and even farther.

    Touhstone Ranch
    Signature
    Free Web Design from Neodism.
    {{ DiscussionBoard.errors[5206124].message }}
  • Profile picture of the author robinhoodtech
    Originally Posted by Larches View Post

    First off, I'd like to thank all of the Warriors who have been helping me with this project. I've learned so much from all of you and I'm already much better than I was at the beginning of this. I've learned the basics of how to build a site with DIVs/CSS rather than with nasty tables, a little bit more about design, and I've scraped the surface of PHP. Once I finish this project I actually plan to take what I have learned and create simple and easy to understand tutorials about everything I learn, that way I can share them with others who need help and are new to web design and development.

    Anyways, I've built the home page of the site. Now I need to figure out how to take the header and footer out, and put them in PHP files so that they will work as includes, for the obvious reasons.

    So a couple of questions I have are:
    1. Does a PHP file have to start with <html> or anything like that or is it just the code. For example, if I wanted my header.php to just be "Touchstone Ranch" in H1 format, would the entire php file just be the <H1> tags and text?
    2. Will I need to include the CSS into my header and footer php files or will it get added automatically through the page, as it will have the CSS include.
    I thought that maybe I could just cut the whole #header div out of the index page, place it in my header.php, include it and it would work. But for some reason it did not. So I need to know how to take it out and make it work properly.
    Answers
    1.) is no include files don't have to have anything specific ie <html>. You could just have <H1>Touchstone Ranch</H1> if you wanted.
    2.) If you have the CSS already in the page, you don't need it in the header. Better would be to put it in the header if it is the same for all pages, and then no need to repeat it in the page.

    Hope that helps.
    {{ DiscussionBoard.errors[5206659].message }}

Trending Topics