REBOL

Creating Your Own REBSite

Back to Viewtop Main Page

How do I create a Rebsite?

Any web server can be used to publish folders and files to the REBOL/View desktop. Here are the steps that are required.

  1. Create an index.r file. This is currently done with a text editor. (But we expect to have a small REBOL application that will create it for you in the future.)
  2. Upload your index.r file to a web server. This is done with FTP, the same way that you would upload an html file to a web server.
  3. Upload any other files that are referred to from your index.r file. You can create subdirectories that also include their own index.r files.
  4. Test your site by running REBOL/View and clicking on the GOTO text button in the top bar. Enter the URL for your site and see how it works.
  5. Once you have it working, you can add your index.r file to the master directory in the REBOL.com/Sites folder. Click on the Add Sites icon to add your link.

Your Reb site will now be live. Any changes that you make to your index.r will be seen by anyone who visits your site on the Reb.

Index File Structure

Folders are created with index files. Each index file specifies the icons, actions, attributes, and the look of a folder.

Folder index files are written as normal REBOL text files. The index files are loaded by REBOL/View and are shown in the desktop. The format of an index file is a simple dialect describes the folder and it icons. This format is optimized to create results with very few words. It's much easier than creating an HTML file.

Index files have the following general format:

 headerA normal REBOL header block, but not evaluated. This header must contain a TYPE field. See below.
 folderAttributes that describe the folder and how it should appear.
 iconsA list of icons to be displayed in the folder. Each icon may include optional information about itself.

An very simple example index file looks like:

REBOL [type: 'index]

file "Hello" %hello.r
file "Calendar" %calendar.r
folder "Documents" %documents.r

The sections below describe the details.

Header

Index files must begin with a standard REBOL header to identify that they contain REBOL information. A header can contain many fields of information (see the REBOL/Core User Guide). However, all fields are optional, with the exception of the TYPE field. For index files, the TYPE field must be set to 'index.

Here is an example of a minimal header:

REBOL [type: 'index]

You can also include a title, author, date/time, version, and much more. Here is an example:

REBOL [
    Title: "A Cool Reb Site"
    Author: "Luke"
    Email: luke@rebol.com
    Version: 1.2.3
    Date: 24-Apr-2001/10:30
    Type: 'index
]

This information can be used by REBOL desktop search engines.

Folder Attributes

The index file header can be followed by a set of attributes that describe the folder and create a custom look for it. These attributes can appear in any order.

 summaryThe summary keyword is followed by a string that provides a description of the folder. For example: summary "This folder contains documents." If the summary is longer than one line, then use { } for quotes, not ".
 text-colorThe text-color word is followed by a color tuple that sets the color of the icon text and folder path text. It can be followed by a second color that will be used when the mouse pointer hovers over the text. For example: text-color 255.255.0 would show yellow text and text-color 155.0.0 0.100.0 would show red text that changes color to green when the mouse passes over it.
 backdropThe backdrop word can be followed by several values that specify the properties of the folder's backdrop. See the description below.

The backdrop properties can include any of the following:

 imageSpecifies a file to be loaded and used as the image for the folder. Either a file or URL can be specified. For example, using: backdrop http://www.rebol.com/view/nyc.gif would create an NYC backdrop.
 colorThe color of the backdrop can be set by following the backdrop keyword by a color tuple. For example, backdrop 0.128.128 would create a teal colored backdrop.
 effectSpecial effects can be applied to the backdrop by providing an effect block. See the REBOL/View guide for details on effects. As an example, you can create an gradient backdrop with an effect block of: backdrop [gradient 0x1 0.160.120 80.30.0]. Note that no EFFECT keyword is used to do this.
 tileAn image can be tiled across the folder panel by specifying the tile keyword. This is an effect shortcut. It can be provided with the effect block above as well. To tile an image, you could write: backdrop tile %leaves.gif

Here is an example index file that include folder attributes:

REBOL [type: 'index]

summary {
    This is the home to all types of distributed
    calendars.  We also host calendar servers.
}

text-color 100.0.0 0.0.100

backdrop %calendar.gif [contrast -30 luma 30]

Icons

Simple Icons

There are two basic types of icons: a folder and a file. Both types use a similar syntax.

The basic syntax for a file icon is:

file "name" %file.r

The icon will display the specified name, and it will refer to the given file. Note that the file name is preceded with a % which tells REBOL that it is a file.

The file name can also be a URL:

file "name" http://www.example.com/file.r

Similarly, the syntax for a folder is:

folder "name" %index.r

A folder icon will be displayed with the given name. The file name is that of another index file that describes the folder and its contents. The file can also be a URL:

folder "name" http://www.rebol.com/index.r

Email Icons

The top level of every Reb site should include an icon to allow users to send email comments back to the operators of the site. This can easily be done with an email icon. To create an email icon, follow the syntax:

file "Contact" luke@rebol.com

The icon will be displayed with an email image. When a user selects the icon, the REBOL default email sender will pop up.

Icon Help Info

Both folder and file icons can include a comment that describes the purpose of the icon. This information is displayed whenever the mouse pointer passes over the icon. To add this info, use the syntax:

file "name" %file.r info "This is info about the icon."

For folders it appears the same:

folder "name" %index.r info "This is info about a folder."

Be sure to provide the word INFO before the info string. If you forget it, the string will be used as the name of the icon.

Icon Images

The graphic image that is used for an icon depends on the icon file's suffix. For instance .r, .txt, .gif, .jpg, and other suffixes will automatically display their associated icons.

In addition you can create custom icon images. To do so, use the syntax:

file "name" %file.r icon %image.gif

The icon image can be a .gif, .jpg, .png, or .bmp.

If an image is larger than the size of an icon, it will be automatically rescaled to fit into the icon.

The icon image can also be a URL. For example:

file "name" %file.r icon http://www.example.com/icon.gif

Icon Effects

The simplest effect is to change the text color of an icon. This is done by providing an RGB color tuple. For example:

file "name" %file.r 0.0.200

Will change the icon text name to blue.

Additional icon effects can be created by specifying an effect block. See the REBOL/View User Guide for a complete list of effects.

Here are a few example icon effects:

file "name1" %file.r effect [invert]

file "name2" %file.r effect [contrast 20]

file "name3" %file.r effect [gradcol 1x1 200.0.0 0.0.200]

file "name4" %file.r effect [blur]

file "name5" %file.r effect [grid 5x5 0.0.0]

file "name6" %file.r effect [flip 1x1]

They would appear as:

By combining effects, hundreds of effect possibilities exist with a single image.

Auto Updating Icon Files

When the user clicks an icon, the file associated with it will be downloaded from the network, and it will be stored in a local cache. The next time the icon is clicked, the file will be retrieved from the cache, rather than being downloaded from the network again.

What happens if the file is updated on the server? It will not be downloaded again, and the user will be using the old file. There are two solutions to this problem:

  1. Give the new file a different name.
  2. Provide a file stats block as part of your index file.

The first solution is obvious. The file will be downloaded because it's name has been changed and there is no local cached copy of the file.

The second solution is more powerful. It compares the cached file's datestamp and file size with those known by the server. This information can be provided within the icon specification in the index file. The file will only be downloaded if it needs to be.

To enable this auto updating of files, the index file must include additional information for every icon that you want updated. Each icon must include a block that specifies its file size and date. The date must be in standard REBOL date/time/zone format. Here is an example:

icon "name" %file.r [2345 10-Apr-2000/10:20-7:00]

A simple way to create this block is to use REBOL. Here is an example script that does so. Cut and paste the result into your index file.

REBOL [Title: "Create Icon Date/Size Stats"]

file: %desktop.txt
probe reduce [size? file  modified? file]
halt

Desktop Skins

In REBOL/View 1.3, you can control the background and text colors for the bookmark and folder areas (see index file information). However, REBOL/View does not currently provide other graphical customization (skins). A future version of REBOL/View will allow customization and skinning.

MakeDoc2 by REBOL - 15-Jun-2005