Updated: 29/11/2002; 12:19:26 a.m..
Myelin: Radio Dev
A blog for testing stuff: SharpBlog, Comment Monitor, etc
        

Thursday, 21 November 2002

I just built a template that will let you include the contents of a story.  No idea if this is a standard function, so I've rolled it myself:

<%

on readText (leafName) {

local (pc = file.getpathchar ());

local (path = user.radio.prefs.wwwFolder + radio.data.folderNames.wwwStoriesSubFolderName + pc);

local (atts);

local (fn = path + leafName + ".txt");

file.open (fn);

local (s = "");

while not file.endOfFile (fn) {

local (line = file.readLine (fn));

if string.patternMatch ("#", line) != 1 { s = s + line; };

};

return (s);

};

scratchpad.readText = readText;

""

%>

Now, when I want to include a story, I put something like this:

<% scratchpad.readText ("myStoryName") %>

At first I tried using getFileAttributes, but that didn't give me the body text.  This way is pretty low level though; there's got to be a function for it somewhere.  Anyone know?


12:48:43 AM    comment []

© Copyright 2002 Phillip Pearson.
 
November 2002
Sun Mon Tue Wed Thu Fri Sat
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
Oct   Dec


Click here to visit the Radio UserLand website.

Subscribe to "Myelin: Radio Dev" in Radio UserLand.

Click to see the XML version of this web page.

Click here to send an email to the editor of this weblog.