Grow your CSS skills. Land your dream job.

How to include php headers and footers on html site

  • # July 9, 2013 at 11:41 am

    hrechkaness you’re the MAN. I have two more weeks before graduation in a Web MultiMedia Design class. I love it from UX to php. The instructors just touch on php the rest is on me.
    Just reading your post and comments have got me where I wanted to be with the include tag.
    Thanks

    # August 3, 2014 at 9:42 am

    PHP code< ?php include 'header.php'; ?>and < ?php include 'footer.php'; ?> in this post no longer works.

    Please update post to <?php include('header.php'); ?> and <?php include('footer.php'); ?>

    “Cheers”

    __
    # August 3, 2014 at 10:57 am

    PHP code < ?php include 'header.php'; ?> and < ?php include 'footer.php'; ?> in this post no longer works.

    What do you mean by this? What are you trying to do, and what is the problem you are encountering? Please describe what you are trying to do, what actually happens, and any error messages.

    Please update post to <?php include('header.php'); ?> and <?php include('footer.php'); ?>

    include (require, et.al.) are language constructs, not functions. Placing parenthesis around the filename is not necessary, and, in fact, can be misleading.

    The only thing wrong, syntax-wise, with your example above was the space between the < and ?php. I don’t know if that is an actual typo in your code, or just how you wrote it here.

    <?php include 'header.php'; ?>
    <!-- HTML content  -->
    <?php include 'footer.php'; ?>
    
Viewing 3 posts - 31 through 33 (of 33 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".