Archive of UserLand's first discussion group, started October 5, 1998.

Re: Here documents (was: Frontier 6 Outliner)

Author:Philip Suh
Posted:1/10/1999; 6:13:00 PM
Topic:Frontier 6 Outliner
Msg #:1954 (In response to 1909)
Prev/Next:1953 / 1955

Here documents are very powerful, but personally, I'm not a fan of keeping formatting html text inside of scripts. I like to keep all that separate from my code.

My preferred solution that gives me something similar to here doc functionality:

1. Put the html text with variable markers into a regular frontier outline. I call this outline a stencil, which is a template for a portion of a page.

It might look like:

===begin stencil====

Name:

Group:

Picture:

[[#username]]

[[#usergroup]]

[[#userimg]]

===end stencil===

2. In my script I then call a routine 'stencilStuffer' that will take a string, and substitute the variable markers with the values I want.

The parameters for the stencilStuffer script looks like this:

on stencilStuffer (s, markerlist, datalist) local (i, ct); ct = sizeOf (markerList) for i = 1 to ct { s = string.replaceall (s, "[[#" markerlist[i] "]]", datalist[i]); } return (s)

I'd call it in a script like this (pseudocode):

local (adrStencil, mList ={}, dList = {}, ttr) ; // text to return adrStencil = @websites.filsa.["#stencils"].stencilname mList = {"username", "usergroup", "userimg"}; dList[1] = getUserName (user); dList[2] = getUserGroup (user); dList[3] = html.data.standardmacros.iamgeRef (user); ttr = stencilstuffer (adrStencil^, mList, dList);

I do agree that outputting in HTML can be onerous and difficult in Frontier, and that anything that makes it easier is much appreciated. I just don't know if bringing here documents is necessarily the answer that you want.

Regards,

Phil




This page was archived on 6/13/2001; 4:47:09 PM.

© Copyright 1998-2001 UserLand Software, Inc.