GetSimple Support Forum

Full Version: php include to files outside GS doesn't work inside theme
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm using GS for only certain areas of my site. I want to include my nav bar and my footer from the site's root inside a theme page but I can't get it to work.

So my site is at (say) mysite.org and my GS pages are in mysite.org/getsimple/theme/mytheme.

Now when I create my theme page I want to link the nav and footer to my main site files which are here:

mysite.org/footer.php
mysite.org/nav.php

but this won't work.

This is correct - but it doesn't work:

<?PHP include ('../../../footer.php'); ?>

All of these return the correct path:

$myfooter = "mysite.org/footer.php";
$myfooter = "http://".$_SERVER['HTTP_HOST'].'/footer.php';
$myfooter = "http://'.parse_url($url, PHP_URL_HOST) . '/footer.php'";

but none of them work inside the include.

Any ideas?

Thanks
Charles
1. Did you try to move files to theme directory ?
2. Are you sure your hosting provider has php include/require/fopen functions enabled ?
The files work inside the theme directory - with an include - and fopen is enabled on the site. It's a work around which is OK but it means if I change the nav or the footer I'll have to change it in two places which sort of defeats the purpose of an include. Strange that I can't get the root of the site to be recognised outside of GS.
charles_i Wrote:This is correct - but it doesn't work:

<?PHP include ('../../../footer.php'); ?>

Try with:
Code:
<?php include '../footer.php'; ?>
I was sure that I had tried that (and every level) but I guess not because it works! Thanks!