Re: Web Authoring: HTML Inline File Inclusion Into "skeleton" HTML pages?

Thanks to all of you for your considerate input to my question how to do "Client Side Includes" for web article authoring.

While most ideas I've seen so far eventually circulated around doing Server Side Includes instead -- which is not desirable e.g. for local testing, or if include file names are determined dynamically --, I now found a simple and elegant solution to this problem:

I wrote a small Java Applet that receives a file name as parameter from JavaScript, runs on the browser, reads the file from the web server, and returns a string with the file contents to JavaScript on the page.  JavaScript is then free to document.write() the file contents into the page at the appropriate position.

I've been testing it in my test environment and it seems to work fine with all browsers > v3 (NS3's JVM can't network).  I even managed to do without NS' "LiveConnect" that apparently is limited to PC based browsers.  The only remaining issue before using it 'live' on a web site is to find a way to make 100% sure I don't call the Applet from my JavaScript before the browser finished loading it -- it seems browsers do not offer too much of control here, unfortunately.  If anyone has an idea...

I will keep this board posted with progress if there is interest.

Thanks again for everybody's input
Ulf Brandes

----- Original Message ----- 
  From: William Randolph Royere III 
  To: Ulf C Brandes 
  Sent: Friday, July 14, 2000 8:00 AM
  Subject: Re: Web Authoring: HTML Inline File Inclusion Into "skeleton" HTML pages?


  Ulf - try PHP3 or PERL, like this: 
  On the submission page: 

  <textarea name=article cols=xx rows=xx wrap=physical></textarea> 

  In php: 

  $article = $contents{'article'}; (if perl, or not, if php) 
  $header = `cat header.dat`; 
  $footer =  `cat footer.dat`; 

  # open the new file for input.. 
     open(OUTPUTFILE, ">whatever_you_decide_here.html"); 

  # set the header 
     print OUTPUTFILE $header; 

  # set preformatting for the article 
     print "<pre>\n"; 

  # commit the article... 
     print OUTPUTFILE $article; 

  # stop preformatting 
     print "</pre>\n"; 

  # set the footer.. 
     print OUTPUTFILE $footer; 

  # get out. 
     close(OUTPUTFILE); 
    
  The problem of preformatting going across the page won't exist if you limit the textarea's size to begin with. (And naturally, new lines and such are interpreted along with everything else). Or, if you need to ultimately dump that into an sql database, load it all into a big array value and then dump it at the script's end. 

  Retreival, if you don't write the html into the stored file, is the reverse: 

  $header = `cat header.dat`; 
  $footer =  `cat footer.dat`; 

       print "$header\n"; 
       print "<pre>\n"; 

      open(ARTICLE, "some-file.html"); 
         while(<ARTICLE>) { print; } 
      close(ARTICLE); 

      print "</pre>"; 
      print "$footer\n"; 

  This type of situation is probably more efficient, as you never commit HTML to the stored file. 
    
    

  Ulf C Brandes wrote: 

      A discussion about multi-source web article authoring:  How would one include HTML text snippets into a "skeleton" HTML layout page in a way that the browser simply reads the HTML snippet *inline* into the code and composes it with the rest of the page, just like the browser is doing it for any <img src="picture.gif">? I've seen interesting discussions on this forum around a proposed new <include src="text.html"> tag for HTML.  The discussions seemed to focus, though, on inclusion of *recurrent* code e.g. for navigation bars, or address footers.  For these purposes I agree that DHTML or <OBJECT>s may be the better solution. However, how would one set up a web page that allows less-HTML savvy people to contribute short articles, without exposing them to the risk of potentially messing up all the page layout because they e.g. accidentally delete a critical layout tag elsewhere? I am looking for a solution like <include src="article.html"> where the webmaster sets up a skeleton HTML page with such <include> statements, while the browser would request such HTML snippets from the server like any .gif file, and interpret the result as if the included HTML code had been resident in the original document.  The "skeleton" page would provide the layout and framework, other people could submit their articles in HTML, and all the webmaster has to do is put the right <include> tags into the skeleton HTML.  People could even update the file later without anyone needing to "recompile" the skeleton as with some HTML editors' macro capabilities. IMHO, for the purpose of article inclusion, an "inline include" tag would definitely add value. Coming from a TeX background I'd be surprised if such an essential aide to multi-source text authoring did not exist in HTML.  Imagine a PhD thesis in HTML without the possibility to include subtext files, and the problem becomes obvious. Of course, anchor tags would be an option, but only if the subdocuments are large enough to justify a whole empty page being opened.  For authoring and layouting the presentation of *short* articles, anchor tags are a questionable solution. Alternatively, <OBJECT>s would do, but they require the size of the article to be known upfront.  Otherwise, cluttering the page with scrollbar'ed subwindows does not render a satisfactory page layout.  Is there a better answer?  Would it e.g. be possible to include HTML inline via a Java applet?  Are we overlooking a basic feature? Ulf Brandes
    

Received on Wednesday, 26 July 2000 15:13:59 UTC