[Date Index][Thread Index]
[Date Prev][Date Next][Thread Prev][Thread Next]
Re: wml + frames = ouch
- From: nospam@thanx (Ralf S. Engelschall)
- Date: Wed, 14 Jan 1998 12:02:54 +0100 (MET)
Hello Stephen van Egmond, in a previous mail you wrote:
>[...]
> What I basically came up with is a post-processing. WML generates all its
> stuff into a file structured like so. Instead of a properly-formatted
> html file with tables, I have a file that might look like:
>
> ---8<---
> This is the title for the web browser, one line
> [navigator stuff goes here, multiple-lines]
> BEGIN-CONTENT!
> [content stuff goes here, multiple lines]
> ---8<---
>
> My postprocessing splits this into material for frames, noframes, with
> server-including to link it all. Let's say that our structured file
> filename.html came from filename.wml. After post-processing by perl, we'll
> have the following four files newly created:
> filename-nav
> filename-content
> filename-nav.html
> filename-content.html
>
> The first two contain, respectively, the left and right table cell
> contents; the next two are corresponding files that server-include the
> corresponding "cell", but formmated wihtin HTML so that it can be referred
> to from a <frameset>.
>
> Finally, my post-processor overwrites filename.html with a <frameset> page
> which refers to the filename-*.html files above, and in the <noframes>
> context creates a table which server-side includes the filename-nav and
> filename-content sections.
Oh now, don't do it this way with a postprocessor. WML ships with nine
powerful languages and never have found a situation where not at least one of
them can solve it. It your case pass 9 (Slice) is the key! Its purpose exactly
_is_ to create one or more output files according to some defined slices in
the structured document.
> So, after processing I have:
>
> filename.html:
> HTML
> HEAD
> STYLESHEET
> FRAMESET
> frame #1: source=filename-nav.html
> -> "filename-nav.html" server-includes "filename-nav"
>
> frame #2: source=filename-content.html
> -> "filename-content.html" server-includes "filename-content"
> /FRAMESET
> /HEAD
> NOFRAMES, BODY, TABLE, TR, TD
> server-include "filename-nav"
> /TD, TD
> server-include "filename-content"
> /TD, /TR, /TABLE, /BODY, /HTML
>[...]
> Can anybody think of a *better* way of doing this. My make process
> amounts to:
> rm *.html
> wmk -fs
> frameify *.html
>
> Which is only a trade-off in maintenance time. I lose a bit of wml's
> features on the encpsulating HTML, but none of it is especially complex.
>
> Note that the files on the web right now may not be quite right; lynx
> likes them, and that's all I know.
Sure, it can be done with WML. I've sit down and tried a first cut for your
situation. While I wouldn't create different nav-frame contents for each
content frame (I would use JavaScript rollovers which change on-the-fly), I
tries to do it exactly you want: My approach uses a template file
which arranges all stuff and then you only need one(!) single
WML input file to create all three output files.
Let's start: We have the template and the filename.wml test file:
| :> ls -l
| total 2
| -rw-r--r-- 1 rse users 242 Jan 14 11:54 filename.wml
| -rw-r--r-- 1 rse users 997 Jan 14 11:48 template.wml
| :> cat template.wml
| #use wml::std::page
|
| # create the frameset document
| [FRAMESET:
| <suck>
| <html>
| <head*>
| <frameset cols="30%,*">
| <frame src="$(frameset)-nav.html">
| <frame src="$(frameset)-content.html">
| </frameset>
| <noframes>
| <table>
| <tr>
| <td width"30%"><!--#include "$(frameset)-nav.html" --></td>
| <td><!--#include "$(frameset)-contents.html" --></td>
| </tr>
| </table>
| </noframes>
| </head*>
| </html>
| <<main..
| ..main>>
| :FRAMESET]
|
| # create the navigation frame
| [NAVFRAME:
| <suck>
| <page bgcolor="#ccccff" title="<<TITLE>>">
| We are in frameset named "$(frameset)"
| <<NAVFRAME>>
| <<main..
| ..main>>
| :NAVFRAME]
|
| # define container to fill the navigation frame
| <define-container navframe>
| ..NAVFRAME>>%body<<..
| </define-container>
|
| # define container to fill the navigation frame
| <define-container title>
| ..TITLE>>%body<<..
| </define-container>
|
| # create the contents frame
| [CONFRAME:\
| <suck>
| <page title="<<TITLE>>">
| <<CONFRAME>>
| <<main..
| ..main>>
| :CONFRAME]
|
| # per default enter the contents frame
| ..CONFRAME>>
| :> cat filename.wml
| #!wml -oNAVFRAME:a-nav.html -oCONFRAME:a-content.html -oFRAMESET:a.html@u+x
| #include 'template.wml' frameset=filename
|
| <title>The Title for FILENAME</title>
|
| <navframe>
| The navigation stuff for FILENAME
| </navframe>
|
| The contents of FILENAME
Now I run filename.wml through WML and receive the :
| :> wmk -f filename.wml
| wml -n -oNAVFRAME:filename-nav.html -oCONFRAME:filename-content.html
| -oFRAMESET:filename.html@u+x filename.wml
| :> ls -l
| total 5
| -rw-r--r-- 1 rse users 188 Jan 14 11:57 filename-content.html
| -rw-r--r-- 1 rse users 233 Jan 14 11:57 filename-nav.html
| -rwxr--r-- 1 rse users 297 Jan 14 11:57 filename.html
| -rw-r--r-- 1 rse users 263 Jan 14 11:57 filename.wml
| -rw-r--r-- 1 rse users 997 Jan 14 11:48 template.wml
Now the generated stuff itself:
| :> cat filename.html
| <html>
| <head>
| <frameset cols="30%,*">
| <frame src="filename-nav.html">
| <frame src="filename-content.html">
| </frameset>
| <noframes>
| <table>
| <tr>
| <td width"30%"><!--#include "filename-nav.html" --></td>
| <td><!--#include "filename-contents.html" --></td>
| </tr>
| </table>
| </noframes>
| </head>
| </html>
| :> cat filename-nav.html
| <html>
| <head>
| <title>The Title for FILENAME</title>
| </head>
| <body bgcolor="#ccccff" text="#000000" link="#333399" alink="#9999ff" vlink="#000066">
| We are in frameset named "filename"
| The navigation stuff for FILENAME
| </body>
| </html>
| :> cat filename-content.html
| <html>
| <head>
| <title>The Title for FILENAME</title>
| </head>
| <body bgcolor="#ffffff" text="#000000" link="#333399" alink="#9999ff" vlink="#000066">
| The contents of FILENAME
| </body>
| </html>
As you can see, WML is powerful enough to avoid any postprocessors ;_)
For the slicing stuff please read wml_p9_slice(1).
Greetings,
Ralf S. Engelschall
rse@engelschall.com
www.engelschall.com
______________________________________________________________________
Website META Language (WML) www.engelschall.com/sw/wml/
Official Support Mailing List sw-wml@engelschall.com
Automated List Manager majordomo@engelschall.com