Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End How to include php headers and footers on html site

  • This topic is empty.
Viewing 15 posts - 16 through 30 (of 32 total)
  • Author
    Posts
  • #108517
    hrechkaness
    Member

    I get this text

    Not Found

    The requested URL /phpinfo.php was not found on this server.

    #108518
    chrisburton
    Participant

    Is that file located in htdocs?

    #108519
    hrechkaness
    Member

    The only thing I have located in my htdocs so far is index.php, stylesheet.css, header.php

    #108520
    chrisburton
    Participant

    Move phpinfo.php inside htdocs and see if that solves it

    #108521
    hrechkaness
    Member

    Do I have to create a phpinfo.php file or is there an already existing one that came with MAMP?

    #108522
    chrisburton
    Participant

    @hrechkaness Follow this tutorial and reload Mamp. Then take a screenshot of the error.

    #108524
    hrechkaness
    Member

    Will do, I’ll post back once I’ve finished the tutorial

    #108573
    hrechkaness
    Member

    Alright, I finished the tutorial but it turns out, that wasn’t the answer to my problem. It was directly related to my header code. If I had listened to your advice in the beginning and changed it to the doc type to html5, I’m sure I wouldn’t be having this problem. Here is the code I had to delete to make my page run smoothly.

    Thanks for all your help. I’ll post back if I’m having any other issues but it looks like it should be smooth sailing from here. Cheers!

    #108580
    chrisburton
    Participant

    The tutorial would have allowed us to see where the problem was, not immediately solve it. Glad it’s now working.

    #131686

    How can I include header & footer if my content page is inside sub folder. Could you plz tell me what script i’ve to use if my pages inside folder / sub folder. so far i know and see here:

    if my pages without folder.

    #131690
    CrocoDillon
    Participant

    You can go inside subfolders with `include ‘subfolder/header.php’` or inside parent folder with `include ‘../header.php’`

    #142030
    arlenev1
    Participant

    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

    #177420
    rufncrus
    Participant

    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”

    #177424
    __
    Participant

    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'; ?>
    
    #210366
    dvermeersch
    Participant

    If you call this piece of code in a HTML page that contains references to CSS and JS files, then I suppose you need to place all files in the same folder as header.PHP so that the server knows where to call the php scripts?

Viewing 15 posts - 16 through 30 (of 32 total)
  • The forum ‘Back End’ is closed to new topics and replies.