www.webdeveloper.com
Results 1 to 5 of 5

Thread: New to PHP - trying to include a folder location

  1. #1
    Join Date
    Feb 2014
    Posts
    4

    Exclamation New to PHP - trying to include a folder location

    Hi all,

    I have my site on a windows server, trying to use include to include php doc located at \includes\header.php

    But it is not working, i have tried this

    <?php include ("includes/header.php"); ?>

    and

    <?php $path = 'c:\inetpub\wwwroot\WEBSITE\includes';
    set_include_path($path);
    include ("header.php") ?>

    I have also tried changing the php.ini config line for the includes location, still no joy.

    Any help really appreciated!

    Thanks

  2. #2
    Join Date
    Feb 2012
    Location
    Tallahassee, FL
    Posts
    280
    What does your file structure look like? The first solution should work, assuming the structure is correct.

  3. #3
    Join Date
    Feb 2014
    Posts
    4
    The php pages (actual web documents that were html) are all in the same folder. This folder has a sub-h inside folder "includes" which inside has the header.php footer.php and nav.php files.

    To test, iif I put this in the doc <?php echo '<p>Hello World</p>'; ?> it works so I know php is working ok.

    The header.php files contains:
    <?php
    <header id="mainheader">
    <h1 class="ch1"><span>content content content xxxxxxx.co.uk </h1>
    <span class="csh1">xxxxxxxxxxxxxxxxx</span>

    </header>
    ?>;

  4. #4
    Join Date
    Feb 2012
    Location
    Tallahassee, FL
    Posts
    280
    Quote Originally Posted by disaac81 View Post
    The header.php files contains:
    <?php
    <header id="mainheader">
    <h1 class="ch1"><span>content content content xxxxxxx.co.uk </h1>
    <span class="csh1">xxxxxxxxxxxxxxxxx</span>

    </header>
    ?>;
    Is that LITERALLY what it says? That's invalid PHP and wont do anything. Try replacing that, with this (I just removed the <?php ?> tags):
    Code:
    <header id="mainheader">
    <h1 class="ch1"><span>content content content xxxxxxx.co.uk </h1>
    <span class="csh1">xxxxxxxxxxxxxxxxx</span>
    
    </header>

  5. #5
    Join Date
    Feb 2014
    Posts
    4
    your a star, I feel silly now, the book never said remove the tags, the text editor adds them automatically for a php document.

    Thank you so much!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles