tmccartney66 Posted June 12, 2004 Posted June 12, 2004 I'm trying to get an oft-changing navigation bar to appear in my web pages dynamically. The file to be included is called links.htm and resides in the top-level public_html directory. It's a full-blown html file with headers, body tags, everything. The command I'm using to include it is <!--#include virtual="links.htm" -->. I'm testing it in http://www.fairhousingforkerry.org/template.htm, which is in the same directory as links.htm. I added "Options +Includes" to the .htaccess file on my account as well as to a file called .htaccess.1086880578. So it's not working. Can anyone tell me what I'm missing? Thanks, Tracey Quote
bellringr Posted June 12, 2004 Posted June 12, 2004 I'm not 100% positive, but don't you have to save the file as a .inc file rather than an htm file? I know at work our includes are named sidenav.inc Quote
tmccartney66 Posted June 12, 2004 Author Posted June 12, 2004 I think the include file can be pretty much whatever you want to call it, as long as it contains HTML code. Your work probably calls it .inc so that it's obvious it's an include. Anyhoo, I got it working - I had to break down and rename all the files .shtml, but now it's fine. Thanks! Quote
TCH-Bruce Posted June 12, 2004 Posted June 12, 2004 To use the #include directive your pages have to end in .shtml You could use PHP to include content in your .htm and .html documents by adding this line to your .htaccess file. AddType application/x-httpd-php .htm .html Quote
tmccartney66 Posted June 13, 2004 Author Posted June 13, 2004 You could use PHP to include content in your .htm and .html documents by adding this line to your .htaccess file. AddType application/x-httpd-php .htm .html Surely it's not as simple as that, is it? Isn't there a PHP script or app I'd need, or a database? As you can see, I know NOTHING about PHP. Quote
LisaJill Posted June 13, 2004 Posted June 13, 2004 That line will tell it to look for php - this is the code to include files: ><? include("filename.php") ?> and you can use paths in that too (ie /home/username/public_html/includes/filename.php) if you want. hope that helps. =) Quote
TCH-Bruce Posted June 13, 2004 Posted June 13, 2004 (edited) And the file that you are including doesn't have to be PHP. You could simply change your virtual include to read and it would work. <?php include $_SERVER['DOCUMENT_ROOT']."/links.htm"; ?> Edited June 13, 2004 by TCH-Bruce Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.