If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 2 of 2
  1. #1
    Junior Member
    Join Date
    Nov 2015
    Member #

    PHP <head> Sections

    Is it possible to but the <head></head> section in a PHP file and <?php include the file into the index or any other page for that matter. I am putting this file in a sub directory include/phpincludes/head.php

    I have tried this and i know that the site is still there, but it is all white. The elements can be clicked on, but not seen. If this is something that can be done, what need to to be done to make it work properly, perhaps something with the links to style sheets or how it is called into the index page

    i am new to PHP coding of websites and i am finding it interesting, but i need some help getting basic file settings working. I am keeping it basic at this point and calling in the repetitive parts of the HTML site (head, header, navigation, footer, etc) in order to try to save myself some time in the long run.

    any suggestions would be helpful.


    Last edited by Ada01; Nov 29th, 2015 at 09:43 PM.


  3. #2
    Senior Member brandMatt's Avatar
    Join Date
    Oct 2015
    St .Catharines Ontario
    Member #
    51 times
    I often do this, but I try not to include the whole head, as it is very different from page to page. All pages should have a different title tag or meta information, then some might use different scripts or css files. For performance sake it's best to put any js files at the end of your document, though that's not always possible.

    Here is a sample:

            <?php include_once dirname(__FILE__) .'/includes/head.php'; ?>
            <title>Website Title | Page Title</title>
    I have no idea why your page is not showing up, try posting your code and I will help you resolve your issue.
    Last edited by brandMatt; Nov 30th, 2015 at 03:32 PM.

    My Web Site:
    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link. Some of us are really insecure and need those likes so that we feel important and smart, so come on, help us out, huh?

Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
All times are GMT -6. The time now is 05:54 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: