Rebol Talk Forum  |  Getting Started  |  Newbie Help  |  Topic: Rebol in a WWW Browser
Pages: [1] Print
Author Topic: Rebol in a WWW Browser  (Read 244 times)
leke
Jr. Member
**
Offline Offline

Posts: 92


View Profile WWW
Rebol in a WWW Browser
« on: September 13, 2004, 02:47:11 AM »

I am trying to get this to print out my entire fonts folder in a web browser (one font per line).
I managed

Code:
fonts: read %/c/windows/fonts/
foreach font fonts [print font]

which does what I want in the console, but it only prints one font when I try it out in the browser.

Here's what I have

Code:
REBOL []

fonts: read %/c/windows/fonts/
outfilename: %rebol-html!.html

html: copy rejoin [
{
<html>
<head>
<title>Outputting Rebol in a WWW Browser</title>
</head>
<body>
}

foreach font fonts [font]

{
</body>
</html>
}
]

write outfilename html
browse outfilename

I am eventually going to display a user defined string in each font on their system, with the font name along side it.  
Logged

CarlRead
Full Member
***
Offline Offline

Posts: 105


View Profile
Rebol in a WWW Browser
« Reply #1 on: September 13, 2004, 03:10:33 AM »

Your problem is the...
Code:
foreach font fonts [font]
only returns the last value despite the FOREACH looking through all the fonts.  To make it work you'd need to add each font to a string and then return the string when the FOREACH finishes.

My approach would be to just add the fonts to your html string without trying to do it all in the one REJOIN.  ie, something like this...

Code:
REBOL []

fonts: read %/c/windows/fonts/
outfilename: %rebol-html!.html

html: copy {
<html>
<head>
<title>Outputting Rebol in a WWW Browser</title>
</head>
<body>
}

foreach font fonts [append html rejoin ["<p>" font "</p>^/"]]

append html {
</body>
</html>
}

write outfilename html
browse outfilename
Hope that helps.
Logged

- Carl Read
Pages: [1] Print 
Rebol Talk Forum  |  Getting Started  |  Newbie Help  |  Topic: Rebol in a WWW Browser
Jump to:  

  
Quick Search...

Advanced search
  
Welcome, Guest. Please login or register.
Did you miss your activation email?
November 20, 2008, 05:39:10 AM
Username: Password: Session Length:
  

News: 01-09-08

Alpha version of REBOL 3 has been released!


  
2285 Posts in 594 Topics by 3708 Members
Latest Member: cialissactiv

  Rebol Talk Forum | Powered by SMF 1.0.9.
© 2001-2005, Lewis Media. All Rights Reserved.

RT design by Defiant Pc