Skip to main content
gamedev.net
🔒 Locked

[web] External HTML

Started by levjs Jan 31, 2006 at 9:52 AM 11 replies 950+ views
Original Post
levjs
levjs
Hi, On my site I have a menu on the side of all my pages. Is there any way to store the html in a separate file, and then have each page take the code from that file so when I change the menu, I don't have to go through each separate page and change everything? Thanks Levi
Kalasjniekof
Kalasjniekof
Would frames be an option? If not, read this article about alternate ways. (next time try googling for it, this article appeared on top when I searched for "include html")
Much luck!
Avatar God
Avatar God
Yep, frames can be a nice way to cut down on maintenance time, especially if you're changing the main navigation.

Frames, however, do cause problems with some older browsers, and might screw up search engines. I don't know if there's a better way to do this yet (without some sort of scripting, anyhow). iFrames exist, but I don't know what they are or how they work.

That being said, most people don't have any problems with frames.

Here's the source for one of my sites:

<html><head><title>2004 McDermott Scholars</title><link rel="stylesheet" href="style.css" type="text/css"></head><!-- Frame Layout --><FRAMESET COLS="203,*" border=0 frameborder=false> <FRAME SRC="left.htm" NAME="LEFT" SCROLLING="NO" NORESIZE> <FRAME SRC="main.htm" NAME="MAIN" SCROLLING=AUTO NORESIZE></FRAMESET></html>

In particular, I don't care if some people can't view the site, and I want to spend as little time as possible changing it.
gsgraham.comSo, no, zebras are not causing hurricanes.
Xeee
Xeee
SSI is exactly what you want, but the webserver must support it(Apache supports it and IIRC IIS).
for me I've used it to build my website without any problems.
makes maintenance much easier.
xee..
coderx75
coderx75
Almost any web server will have this capability.

[SSI or ASP]
< !--#include file="myfile.inc"-- >

[ColdFusion]


[PHP]



etc.
Quit screwin' around! - Brock Samson
Wan
Wan
I'd say use either &#106avascript (included in a &#106avascript file) to generate the HTML or use server-side scripting like ASP or PHP. The latter would be the best method in my opinion, but I don't know whether that's an option for you.<br><br>Personally I do not care for (i)frames much, for all the reasons Avatar God gave.<br>If you want to it properly, you will also have to include some scripting to make sure people cannot navigate to pages without the frameset (change the location of the page when there's no frameset around it). IFrames can be used, but it can be hard to make 'em look consistent for every browser (the right dimensions, no scrollbars or borders etc.).
levjs
levjs
I personally don't like frames.

I've been trying out the using server sides, but it won't work for some reason. Is it true it will only work in .asp files?
Levi
Sander
Sander
No, it'll work with SSI (*.shtml), ASP, PHP and many more, but the exact syntax varies per language and also depends on what serverside scripting languages you have installed on the server.
levjs
levjs
Ok, I've got it working. : ) Thanks to all of you. I have one other question, what is the difference between using HTML files versus php or asp files. Are there advatages to using one of the other?
Levi
coderx75
coderx75
Quote:
Original post by levjs
Ok, I've got it working. : ) Thanks to all of you. I have one other question, what is the difference between using HTML files versus php or asp files. Are there advatages to using one of the other?
Levi

HTML files (w/o &#106avascript) are static. ASP, PHP, ColdFusion, etc. are server-side scripting lanuages and allow for dynamic content. For instance, if you have a database and want to display a table on a page, you can use any of these languages to do so. Any changes to your data immediately show up on your page.
Quit screwin' around! - Brock Samson
Rob Loach
Rob Loach
Quote:
Original post by levjs
Ok, I've got it working.
What did you end up using?

Rob Loach [Website] [Projects] [
levjs
levjs
Sorry, I was in a hurry in the last post. I ended up using server side includes. This is going to be so much easier than how I had it before. Thanks everyone for their help.
Sander
Sander
The differences:

HTML is static. Unchangable (unless you edit it manually).
SSI is like a C preprocessor. It can do a few nice things like incudes, but that's about it.
PHP, ASP and the rest are server side scripting languages. They are full-blown programming languages who's output is a HTML page. That means that you can have (complex) logic inside that changes the HTML that the users see on the fly.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.