Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
php include to files outside GS doesn't work inside theme
#1
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
Reply
#2
1. Did you try to move files to theme directory ?
2. Are you sure your hosting provider has php include/require/fopen functions enabled ?
Addons: blue business theme, Online Visitors, Notepad
Reply
#3
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.
Reply
#4
charles_i Wrote:This is correct - but it doesn't work:

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

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




Users browsing this thread: 1 Guest(s)