Forums

how to include a file from outside of the wordpress directory (5 posts)

  1. ashbryant
    Member
    Posted 3 years ago #

    Hi,

    I have wordpress installed in a blog directory on a site. (www.thesite.co.uk/blog/) I need to include a navigtion file that holds the html for the "main site" in to the wordpress theme I am building, but when I try to use a standard php include, I fails to load it in.

    How do I make this work? I don't really have to have two copies of the same file (one inside the WP dir & one outside in the main site) as it could lead to updating issues.

    Any ideas??

    Thanks

    Ash

  2. richarduk
    Member
    Posted 3 years ago #

    Try

    <php include('(bloginfo('url')/whatever.inc')?>

    or

    <?php require_once("./whatever.inc"); ?>

    Can't guarantee either of them, haven't tested, let me know if either of them works

  3. ashbryant
    Member
    Posted 3 years ago #

    nope nothing, sorry.

    Any other ideas??

  4. richarduk
    Member
    Posted 3 years ago #

    Absolute urls don't work? e.g http:www/whatever.com/whatever.inc

    The other thing is that you usually have to go up directories from the theme e.g
    \..\..\..\whatever.inc

  5. RochesterSubway
    Member
    Posted 3 years ago #

    I found a solution to this that works for me. Instead of an absolute path using http, try this...
    include($_SERVER['DOCUMENT_ROOT']."/include/whatever.inc");

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags