In web design, what's the best method to include html from one file into another? (apart from using PHP)
I'm not able to use a CMS, and don't need to really, as it'll only be about 10 pages in size.
However, I usually use PHP to include template HTML, e.g. the navigation menu, headers and footers, that will be repeated on each page,
but i've been told the servers don't support PHP (and my mind was blown....) anyway, i'm looking for another way to do it.
I been looking at Javascript and SSI examples, and would like input from other web designers on what would be the best solution.
You can leave an optional "tip" with Mahalo's virtual currency, Mahalo Dollars. If you are asking a difficult question that might require some research, or if you'd like a wide variety of feedback, a higher tip often leads to more answers to your question.
M$6 Answers
http://www.zytrax.com/tech/web/ssi.htm
http://www.jlk.net/apache/example_ssi.shtml
Javascript can be disabled by the user and can sometimes cause problems with alternative browsers such as small screen mobile devices.
While I completely agree that including things like the header, footer, and nav are best done though includes, I would consider the client's eventual update process.
Since it is internal, what tool will the client be using to update it with?
Before encoding each page with html includes, make sure that the software they'll be using supports wysiwyg editing that includes the nav, header and footer or they'll be confused. I know that FrontPage had a problem with this and older versions of Dreamweaver also do.
You can leave an optional "tip" with Mahalo's virtual currency, Mahalo Dollars. If you are asking a difficult question that might require some research, or if you'd like a wide variety of feedback, a higher tip often leads to more answers to your question.
M$Although the iFrame is considered "dirty code" by many of my colleagues, it still has its place in 'net for "quick and dirty" projects. Many of the samples I have done are on intranets as well being hosted on low-budget servers (a workstation pretending to be a server!), but here are some internet items that may be of interest:
ecommerce layouts:
iframe used to port other info pages within
http://www.imvu.com/shop/product.php?products_id=1368265
iframe used to port the same information into several pages:
http://www.imvu.com/shop/product.php?products_id=3660160
http://www.imvu.com/shop/product.php?products_id=3938946
http://www.imvu.com/shop/product.php?products_id=3454504
also from this site - although not scrolling, iframes are used for the rental information:
http://www.safetysystemshawaii.com/concrete-formwork/box-culvert-traveler-system/max-a-form/index.html
http://www.safetysystemshawaii.com/traffic-control-safety/automated-traffic-control-805/intellistrobe-afad-lane-intrusion-safety-system/index.html
profile layouts:
fixed, artistic layout with the same info page from above ported in
http://avatars.imvu.com/kryztilia
business layout:
http://www.oneshotsupplies.com
You can also apply CSS to your iframe, or multiple iframes on the same page for a look that some may not call frame sets upon first glance. I cannot show you my samples of such as they are on our intranet!
Low budget, time constraints, server software or "workstation hosts" - iframes are excellent to use in such shoestring situations. Just remember to make your doc type transitional and follow the other guidelines here:
http://www.w3schools.com/TAGS/tag_iframe.asp
Iframes are still a viable way to code pages that have the same look and feel of dynamic sites, without all the dynamic code.
You can leave an optional "tip" with Mahalo's virtual currency, Mahalo Dollars. If you are asking a difficult question that might require some research, or if you'd like a wide variety of feedback, a higher tip often leads to more answers to your question.
M$You can leave an optional "tip" with Mahalo's virtual currency, Mahalo Dollars. If you are asking a difficult question that might require some research, or if you'd like a wide variety of feedback, a higher tip often leads to more answers to your question.
M$there are plenty of reasons not to use PHP - to use it simply to include html between pages is folly. you'd be opening yourself up to the potential security risks of PHP just to have a functionality that can be done with something else, reducing your exposure to risk of security holes. SSI all the way!
However, if they don't support PHP... are they going to be apache servers? Or are they just not willing to install it.
http://httpd.apache.org/docs/1.3/howto/ssi.html.html is a very useful link - especially the Including a standard footer section. http://httpd.apache.org/docs/1.3/howto/ssi.html.html#includingastandardfooter
You can leave an optional "tip" with Mahalo's virtual currency, Mahalo Dollars. If you are asking a difficult question that might require some research, or if you'd like a wide variety of feedback, a higher tip often leads to more answers to your question.
M$SSI would be your best way to do it. See if you host supports ASP or any other languages. If not then you could use the ancient FRAMESET and do the site in frames. Granted this is not the best solution but it would give the desired result.
-------------------------------------------------------------------------------------------------
The Include Command
When you mention SSI, this is the event most people think of. Here's the concept:
You have 50 files on your Web site. At the top of each of the files is a greeting that you'd like to change daily. You could either go into every page, every day, and change the greeting or you could have a text file that each of your 500 files include. Then you would change just that one text page and all the other pages would update. That's the concept of the include command.
Every page on the HTML Goodies Web site uses include commands, but you'd never know it by looking at the source code. When you View Source on one of the Goodies pages, there is text and coding galore before you actually get to the meat of the tutorial. I don't write any of that. I use an include to get the job done. Two lines of code, and all that text just magically pops in there.
Here's how you do it.
The File Argument
Under the heading of the include command there are two arguments. These arguments work much the same as an attribute under an HTML tag. An example would be the SIZE attribute under the FONT tag.
The format of any include command line looks like this:
The command (in this case "include") is followed by the argument (in this case "file") and then what "file" represents.
Sharp-eyed HTML folk will notice that the format looks a lot like an HTML comment. Basically, it is. This command line will not appear on the page. What will appear is the file it represents.
Please Note This:
The format for these SSI command lines is not at all forgiving. You must do the coding correctly or it simply will not work. If it doesn't work, there's no error message to help you. You're left high and dry and wondering what the heck is wrong. Try very hard to get it right the first time.
Follow these rules:
* Commands and arguments are in lowercase letters
* The double quotes around the value are required
* There is no space until after the command
* That hash mark (#) is required
* There is a space after the second double quote, before the second double hyphen (at the end)
That's not being too picky is it?
That said, let's look at the format of the File Argument:
!--#include file="included.html" --
The format above will create an SSI that will include the text found in the file "included.html".
Why Use "file="?
You use "file=" when the file that will be included is held within the same directory as the file that is calling for it. You can also use the file argument when the file is within a subdirectory of the directory containing the file that is calling for it. This is the one I use every time I create an SSI.
Good Luck
HTML Goodies
You can leave an optional "tip" with Mahalo's virtual currency, Mahalo Dollars. If you are asking a difficult question that might require some research, or if you'd like a wide variety of feedback, a higher tip often leads to more answers to your question.
M$You can leave an optional "tip" with Mahalo's virtual currency, Mahalo Dollars. If you are asking a difficult question that might require some research, or if you'd like a wide variety of feedback, a higher tip often leads to more answers to your question.
M$