Current location: Hot Scripts Forums » General Web Coding » HTML/XHTML/XML » Referencing HTML code from a second file


Referencing HTML code from a second file

Reply
  #1 (permalink)  
Old 07-17-05, 09:55 PM
msoucy msoucy is offline
Newbie Coder
 
Join Date: Apr 2004
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Question Referencing HTML code from a second file

Can anyone tell me is it possible to reference HTML code in one file that actually resides in a second file? Here is what I mean. I'm in the process of revamping a web site, and I would like to have the HTML code for my navigation menu reside in one HTML file, and have that file be referenced by all of the HTML pages on my web site without having to physically copy that code into each HTML page. I want to be able to maintain the code for my navigation menu in only one file. I hope I've made myself clear here.
Reply With Quote
  #2 (permalink)  
Old 07-17-05, 10:56 PM
Christian's Avatar
Christian Christian is offline
Community VIP
 
Join Date: Mar 2005
Location: ProgrammingTalk
Posts: 2,449
Thanks: 0
Thanked 6 Times in 5 Posts
You can do this with php, but you need to have php on your web server. Just change include/nava.php to your navigation page's location.

PHP Code:

<?php include 'include/nava.php'?>

Reply With Quote
  #3 (permalink)  
Old 07-18-05, 12:25 AM
End User's Avatar
End User End User is offline
Level II Curmudgeon
 
Join Date: Dec 2004
Posts: 3,027
Thanks: 14
Thanked 35 Times in 33 Posts
Quote:
Originally Posted by msoucy
Can anyone tell me is it possible to reference HTML code in one file that actually resides in a second file? Here is what I mean. I'm in the process of revamping a web site, and I would like to have the HTML code for my navigation menu reside in one HTML file, and have that file be referenced by all of the HTML pages on my web site without having to physically copy that code into each HTML page. I want to be able to maintain the code for my navigation menu in only one file. I hope I've made myself clear here.
You can do it without PHP by using SSI (server side includes).

To include a file do this:

<!--#include file="/some/path/to/mtfile.htm"-->

Syntax varies slightly, some servers insist on using 'virtual' instead of 'file, but do some seraches and you'll find plenty of info.
__________________
I don't live on the edge, but sometimes I go there to visit.
-------------------------------------------------------------------------
Sanitize Your Data | Oracle Date & Substring Functions | Code Snippet Library | [url=http://www.codmb.com/Call Of Duty[/url]
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP code to edit a text file mdhall Script Requests 12 12-23-10 04:03 AM
html tutoral thefrtman HTML/XHTML/XML 5 04-27-09 10:25 AM
Saving php generated file as html file GS300 PHP 0 12-29-04 03:34 AM
pull code from a file nassau PHP 4 10-03-04 10:18 PM
Can anyone help me ? (problem using php variables in html db insert code) chronic_ PHP 2 06-13-04 11:19 AM


All times are GMT -5. The time now is 08:45 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.