View Full Version : How do I make an html file read code from a text file?
jacksont123
06-13-2006, 11:57 PM
say i have a file named code.ext with the contents of:
<li><a href="http://www.codingforums.com">CodingForums.com</a></li>
and i have an html file with the contents of, and it would read code.ext at the specific section:
<html>
<head>
</head>
<body>
<div name="codetext">
//read code.ext file here
</div>
<div name="text">
hello
</div>
</body>
</html>
_Aerospace_Eng_
06-14-2006, 12:08 AM
This can't be done with just HTML. You will need to use a server side language, more specifically server side includes. Depending on what your host allows will decide which language to use. Who is your webhost and what plan do you have with them?
jacksont123
06-14-2006, 12:34 AM
Then is it possible to do this with php -- and if so, how?
Currently my webhost is phpnet.us and it's free. :p
_Aerospace_Eng_
06-14-2006, 12:49 AM
Read this http://www.joe2torials.com/view_tutorial.php?view=3
simply done in php with the "include" or "require" commands:
<?php include ('code.ext'); ?>
<?php require ('code.ext'); ?>
the difference is, that require stops parsing, if an error occurs (file is missing), include writes an error message, but continues parsing the page.
jacksont123
06-14-2006, 05:49 PM
thanks for the help!
i really appreciate it. :D
SteelValor
06-15-2006, 02:58 PM
http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.