The World’s Leading Microsoft .NET Magazine
   
 
timstall

Donate Today!

Search Box

 

Calendar

««Mar 2010»»
SMTWTFS
  12
3
456
7
8
9
10
111213
14151617181920
21222324252627
28293031

My RSS Feeds








Mailing List

Most Popular Tags

                                                           

Using a single html file for easy management

posted Friday, 28 October 2005

Normally you want to split your html objects (like styles, scripts, and data) into separate files to make things more reusable. However sometimes when you're creating an internal developer report (for status, confirmation, quick info, etc...), it's easier to give the user a single html file than a whole collection of files. For example, suppose you're making an internal WinForms tool that assists with some development task, and then generates an Html status report. As a single file, it's easier to mail to others or copy into different directories,.

An html page can have several components, each as separate, physical files:

  • The main html page itself
  • A style sheet
  • External JavaScripts
  • Inline frames
  • Images
  • An Xml data source

We can embed both the style sheet and JavaScript into the head of the main html file itself:

<html>
<
head
>
<
title>Security Rights</title>


<Style>
.TableHeader
{
    font-weight: bold;
    background-color: #FFFFCC;   
}
</Style>


<script language=javascript>
<!--
function DoStuff() {
   
//...
}
//-->
</script>


</head>
<
body>

We can imitate some features of inline frames via CSS by scrolling inline tables.

If you're already automatically generating the report, then you've already essentially split data from presentation and therefore you can also hardcode the data directly into the Html itself.

That leaves us with Images - which I'm not sure of any way to embed images into an Html file.

However all in all, having the option of putting your styles, scripts, inline frames, and data all into a single file may make it easier to manange for internal reports.

links: digg this    technorati