Re: select lists

by "Greg Rundlett" <greg(at)freephile.com>

 Date:  Sun, 30 Jul 2000 09:58:40 -0400
 To:  "eric williams" <eric_alt(at)hotmail.com>,
<hwg-languages(at)hwg.org>
 References:  hotmail rcbowen
  todo: View Thread, Original
Three things (maybe more) come together to make a webpage: Content,
Presentation and Functionality (aka Logic).
The best way to program, and maintain or extend your sites/applications is
to modularize these things as distinct entities that you can bring together
in the appropriate fashion when and as needed.  You have separate albeit
similar methods for achieving this with each file type: HTML, CSS, and JS.

For HTML, name all your content files .shtml.  Then you can use the file
include directive to include another file's contents at the time the user's
request is served back (repsonse sent) to the client browser.
The syntax is like this:
<!--#include file="msgboard.txt"-->
or,
<!--#include virtual="msgboard.txt"-->
Make sure you configure your server so that it will recognize the #include
directives.   This is a step that often goes overlooked, because I believe
it is turned on by default with Apache, but just as often, ISP's turn the
feature off in your particular site.  Once your site webserver is configured
to look for file includes, and the file extension is .shtml, you can include
any file content into another document.  Note that the included file does
not need to have it's own HTML <HEAD> and related tags if it's included in
the <BODY> of another document.  In fact, the included file doesn't even
have to be HTML, it could be just text.  Usually, the page is constructed
with HTML that sets up the layout using tables and graphics etc., and then
the "content" is included into a <TD> where the page is designed to hold the
main content.
(see Rich Bowen's post for more info on #includes)

For CSS, create a separate CSS file, and link to it in the <head>
The syntax is like this:
<LINK REL="STYLESHEET" TYPE="text/css" HREF="../../style/homepage.css">
Once you do this, you can use any of the styles you've defined within your
document (or sitewide if the <LINK> is in all your pages).  For example, you
might have defined a class in your .CSS file named "biz".  In your document
you simply apply the style: <div class="biz">&nbsp;</div>.  By linking to
the style sheet, you can change the presentation of your page elements with
one swift edit to the .css file.
(see blooberry.com http://www.blooberry.com/indexdot/css/index.html, or
webreference.com http://webreference.com/authoring/languages/html/css.html
for more info)

For JavaScript, create a separate JavaScript file (contains nothing but
JavaScript), and link to it in the <HEAD>
The syntax is like this:
<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript1.2"
SRC="../../js/nav.js">
<!-- this is the include for the navigation javascript functions -->
</SCRIPT>
Once this is setup, you can use any of the variable, objects or functions
that are defined in your .JS file.  That is because they are loaded into the
browsers memory space at the time the file is parsed and rendered on the
client-side--just as if you had typed the whole thing in at the top of your
file.
An example of including a function who's return value is defined in an
external .JS file would then look like this:
<script language=javascript>
<!--
ultimate_nav();
//-->
</script>
(see JavaScript.com for more info)


----- Original Message -----
From: Rich Bowen <rbowen(at)rcbowen.com>
To: eric williams <eric_alt(at)hotmail.com>; <hwg-languages(at)hwg.org>
Sent: Sunday, July 30, 2000 8:16 AM
Subject: Re: select lists


> eric williams wrote:
> >
> > Dumb question #32:
> > The first part of every page is identical: CSS, JS and HTML, can I put
them
> > in a separate file to import like you do with CSS alone? I know I cant
use
> > #include, tried it before and netscape just ignored it. My pages are all
> > .shtml because of the perl counter #exe.
>
> With SSI (aka shtml) you can include another page with:
> <!--#include virtual="/url/of/local/page" -->
>
> See http://apachetoday.com/news_story.php3?ltsn=2000-06-12-001-01-PS,
> http://apachetoday.com/news_story.php3?ltsn=2000-06-19-002-01-NW-LF-SW,
> and
> http://apachetoday.com/news_story.php3?ltsn=2000-06-26-001-01-NW-LF-SW
> for a more detailed treatment of SSI.
>
> Rich
> --
> Rich(at)cre8tivegroup.com
> Director of Web Application Development  -  The Creative Group
>                                  http://www.cre8tivegroup.com/
> Author - Apache Server Unleashed - http://apacheunleashed.com/

HWG: hwg-languages mailing list archives, maintained by Webmasters @ IWA