Forum Moderators: coopster
Anyways, on the non php pages, the include files show up fine. On the php pages, none of the navigation shows up! Grrrr. So I figured, "hey, now would be a great time to start using php for all of my navigation files". Well here is a short list of all the variations I tried with both php and includes and the end result was either the navigation still didnt show or it showed with an error like this to the right of the links: ");?>
Things I tried:
<?php include_once("topnav.htm");?>
<?php echo("<!--#include virtual="/topnav.htm"-->);?>
<?php include_once("""<!--#include virtual="/topnav.htm"-->""");?>
<?php include_once("<!--#include virtual='/topnav.htm'-->");?>
<?php include_once("/topnav.htm");?>
<?php include_once("<!--#include virtual="/sitemenu.htm"-->");?>
<?php include_once("<!--#include virtual=\"/sitemenu.htm\"-->");?>
<?php include_once("/sitemenu.htm");?>
<?php include_once("sitemenu.htm");?>
<?php include("sitemenu.htm");?>
Any suggestions? Thanks, Khem
- fine as long as the path is right
2.<?php echo("<!--#include virtual="/topnav.htm"-->;?>
- you didn't escape quotes and missed a set of quotes, should be
<?php echo("<!--#include virtual=\"/topnav.htm\"-->";?>
though there isn't really any point to echo'ing an SSI include, just include with php
3.<?php include_once("""<!--#include virtual="/topnav.htm"-->""");?>
uh, not totally sure what is going on here, won't work. I skipped over all the includes with includes similar to the above.
4. <?php include_once("/topnav.htm");?>
<?php include_once("/sitemenu.htm");?>
<?php include_once("sitemenu.htm");?>
<?php include("sitemenu.htm");?>
all of these seem fine but it all depends on whether the path is right.
where are topnav and sitemenu located in relation to the root of your site ie. /
include("/var/www/html/topnav.htm"); //hardcoded
or
include($_SERVER["DOCUMENT_ROOT"]."/topnav.htm"); //using PHP's $_SERVER global
I imagine the second version is better because it makes the script portable(move it to any server).
I was doin too many things at once, the second one mentioned is the way to go.
my earlier post with /topnav.htm would never work. includes are based on the file system and don't care about site roots etc so you need the $_SERVER['DOCUMENT_ROOT'] to give it a clue.
sry about that
Warning: open_basedir restriction in effect. File is in wrong directory in /home/httpd/vhosts/tundrageckos.com/httpdocs/tundra-geckos-available-geckos.php on line 68
Warning: Failed opening '/var/www/html/topnav.htm' for inclusion (include_path='.:/usr/share/pear') in /home/httpd/vhosts/tundrageckos.com/httpdocs/tundra-geckos-available-geckos.php on line 68
If I add the code to a .html page, then nothing shows in the navigation.
****OK I changed the path and now it works fine on the PHP pages. Time to see if I can get this to work with the html pages***
Khem