html parts...

In a simple html file (without use of php, asp, etc) codes, it is possible to have parts linked/imported from different files. For exampel to have:

indext.html
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <********link header.html***********> 
  <title>JS Bin</title>
</head>
<body>
<div>
    <********link body.html***********> 
</div>
     <********link footer.html***********> 
</body>
</html>

Open in new window


If not, maybe java script or Jekyll is the solution. I prefer java script because I am familiar with it somewhat.

Thank you.
LVL 34
Mike EghtebasDatabase and Application DeveloperAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Conner TurnerSenior DirectorCommented:
Hi eghtebas,

Unfortunately in HTML5 there is no way to externally reference or link .html files you could try using the JavaScript method where you can reference a .js file and have your html content included within document.write(""); functions
this would allow you to import them through the use of <script> tags.

HTH,
Conner
0
Dave BaldwinFixer of ProblemsCommented:
HTML has never been able to do that.  If your server supports SHTML with Server Side Includes, you can.  http://en.wikipedia.org/wiki/Server_Side_Includes
0
Mike EghtebasDatabase and Application DeveloperAuthor Commented:
Hi Conner and Dave,

Do you have a sample Java Script version I can use to develop what I want?

Thank you,

Mike
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

Conner TurnerSenior DirectorCommented:
Hi eghtebas,

By using the document,write function to include HTML you can link it within your current .html file

Example:

// Example JavaScript Code
document.write("<p>Write your HTML Inside of the Write Function</p>");
document.write("<h1>Making sure to include new lines of HTML within the wrote function</h1>");
document.write("<p>Indentation and Nesting will not work with some tags</p>");

Open in new window


Then save you JavaScript file with a .js extension and import it into your html file like so:

<!-- Example HTML Code -->
<script src="myFile.js"></script>

Open in new window


Making sure to change the src path to the stored js file.

HTH,
Conner
0
Dave BaldwinFixer of ProblemsCommented:
Well, I do but I have to say that it's not necessarily a good idea.  While you can load content with javascript / AJAX, the search engines won't see it because the search robots still don't run javascript.  You are Much better off using ASP or PHP with their 'include' facilities than using javascript to do this.  The 'includes' become part of the 'original' file that loads and the search robots see everything that was included.
0
Mike EghtebasDatabase and Application DeveloperAuthor Commented:
Hi Dave,

Thank you for the good advise. Here the idea is to learn how it is done in java script. So, if you have a sample, you may consider posting it here.

I have done some work with includes in asp but I am not using asp now. It is not an active web page.

Thanks,

Mike
0
Dave BaldwinFixer of ProblemsCommented:
Here's an example you can try:  http://www.javascriptkit.com/script/script2/ajaxpagefetcher.shtml  JavascriptKit http://www.javascriptkit.com/ and DynamicDrive http://www.dynamicdrive.com/ both have a lot of useful scripts.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Mike EghtebasDatabase and Application DeveloperAuthor Commented:
Thank you.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
HTML

From novice to tech pro — start learning today.