Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I link HTML page to txt files?

Status
Not open for further replies.

zcole

Technical User
Feb 17, 2004
28
0
0
US
I have a number of web-pages that use the same template for each page. I would like to be able to set this site up for an easy re-design, as it will likely change often. I would like to have my pages link to a single text file, or some other file that includes the template information (i.e. header, footer). Then if I need to change the template, all I would have to do is change the source code of the template ONCE, as opposed to changing it on every single page in the site.

I do not want to use frames.
Thanks, I appreciate your help!
 
you can set you template to use
<!--#include file=<%=MyFile%>--> files wich you only change once.

[tt]

buffalo.gif height="60px" width="30px"

[sup]​
 
zcole wrote: &quot;would like to have my pages link to a single text file, or some other file that includes the template information (i.e. header, footer).&quot;

This is the wrong approach. You need to create a template file that sucks up data instead of data files that suck-up layout. Use ASP/PHP/other scripting to build the layout.

Check out this article:

Hope this helps.
 
Yes, that is exactly what I need to do. However, I do not know ASP/PHP at all. I have researched books on it, but am unsure of which route to go. I have some literatrue on ASP.net, and how to use the .net framework. Is that what I should try to focus on learning, or do you think there is a better more efficient way to train myself?
Thanks -
 
[tt]There are hundreds of book that could help you learning .asp, aspx, php, etc... but I've found it better search google for things like &quot;Whatever Tutorial&quot; and start implenting from there ...

[tt]

buffalo.gif height="60px" width="30px"

[sup]​
 
You want a content management system. There are some ready made solutions like phpNuke (GNU project) which run off an SQL database if you have that.

If limited to text I will generally use SSI but the following solution only works on new servers like Apache 2+ (not the version shipped by Sun Microsystems).

<html>
..this is my standard template for all pages..

<!--#include virtual=&quot;${path_info}.txt&quot; -->

..end template..
</html>


mydomain.com/uri_to_template/path_info?query_string

You could use just the $query_string (suitable for older servers) but people are more likely to mess up the url :(

Using path_info is robust because it looks like a normal url.

----------
I'm willing to trade custom scripts for... [see profile]
 
&quot;You need to create a template file that sucks up data instead of data files that suck-up layout.&quot;

normal HTML file with your div elements on
cascading stylesheets file with layout controls for the HTML file
then your content files as txts

using the SSI directive stated above:

<!--#include virual=&quot; &quot; -->
(in between the &quot;'s put your file name extention and location (if not in the same folder as the html page))

HTML page
---------

<html>
<link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;layout.css&quot;>
<body>
<div class=&quot;ltoc&quot;>
<!--#include virtual=&quot;ltoc.txt&quot; -->
</div>
<iframe name=&quot;content&quot; class=&quot;main&quot;>Browser compatability message
</iframe>
</body>
</html>

CSS file
--------

.ltoc {
position: absolute;
left: 10px;
top: 10px;
}

.main {
position: relative;
left: 10px;
top: 0px;
}

~*Gwar3k1*~
&quot;To the pressure, everything's just like: an illusion. I'll be losing you before long...&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top