# How do I pull code from another HTML file into another?



## Perseus (Nov 10, 2005)

I have an html file called head.hml, and in between the <ul>s in: <div class="one"><ul> ... </ul></div> I want to insert the code that is contained within story.html I DO NOT want to manually type in the code from story.html into head.html, I need head.html to be able to pull the code from this file...I started thinking of using <link rel ...> but that can only go in the <head> tag. Any ideas?


----------



## HateEternal (Nov 10, 2005)

Perseus said:
			
		

> I have an html file called head.hml, and in between the <ul>s in: <div class="one"><ul> ... </ul></div> I want to insert the code that is contained within story.html I DO NOT want to manually type in the code from story.html into head.html, I need head.html to be able to pull the code from this file...I started thinking of using <link rel ...> but that can only go in the <head> tag. Any ideas?



Does copy paste count as manually typing it in? 

Depending on the way its used  you could use an iframe, or make a php page instead of pure html

then all you need to do is put the php tags where want to insert the other page and call 
	
	



```
include "story.html";
```

I'm not sure of any other way of doing it w/o using a server page technology. I suppose you could do it in JavaScript...


----------



## Perseus (Nov 10, 2005)

Well, I am using Perl, in addition to averything else. Any Perl commands I could use? I'll consider your suggestions, thanks!


----------



## HateEternal (Nov 10, 2005)

Perseus said:
			
		

> Well, I am using Perl, in addition to averything else. Any Perl commands I could use? I'll consider your suggestions, thanks!



In that case it shouldn't be much of a problem

A quick google search turned up this info:
http://www.htmlgoodies.com/beyond/webmaster/article.php/3473341

Basically if you have server side includes enabled you can do almost the same thing as I was suggesting with php.

In the worse case, you might be able to just open the file for reading and echo out all it's text to the browser.


----------



## kainjow (Nov 10, 2005)

```
#!/usr/bin/perl
$html = `curl 'http://www.somewhere.com/somehtml.html'`;
print $html;
```


----------

