Note: most of that applies to the other E_Web MOOs.
The E_Web interface has a nice object browser. So the first thing
you might want to try is simply looking at an object from the web.
E.g. if your object is #2108
you can look at it from a www browser
with an URL like http://tecfa.unige.ch:7778/objbrowse/2108.
When you access an object via E_Web with an URL like:
http://tecfa.unige.ch:7778/4026/ the MOO will return a list of html strings produced by
the verb <object>:http_request
, in this case:
#4026:http:request
.
If you want to put some simple static information on the Web there
are two solutions:
.htext
property
(see below).
:http_request
verb on themselves or a parent).
.htext
property
To put html in the .htext property, simply @edit <object>.htext
.
E.g. look at the http://tecfa.unige.ch:7778/4026/.
Note that all objects at TecfaMOO do have an .htext property (that is
btw also being used by the WWW Interface). On other E_WEBbed MOOs
such a property may or may not exist. If it does not, just write your
own :http\_request
verb and add a property like .htext
to you object.
You can write a :http_request
verb yourself that will return
information that will be displayed to the user.
Here is an example which we shall discuss.
To see what it does, please have a look at
&e_thing test.
As an example, here is the code for the
Generic E_WEBbed Thing (&_thing).
@program &e_thing:http_request this none this
1: // A short cut to the html utils
2: hu = $ehtml_utils;
3: //
4: // Let's return the name of the object as title and main header
5: //
6: title = this.name;
7: lines = {hu:title(title), hu:heading1(title)};
8: //
9: // Insert the standard description of the object in <pre> format
10: //
11: desc = $list_utils:listify_if_needed(this.description);
12: lines = {@lines, @hu:pre(desc)};
13: //
14: // Insert the contents of the .htext property
15: //
16: if (this.htext)
17: lines = {@lines, @$list_utils:listify_if_needed(this.htext)};
18: else
19: lines = {@lines, "No .htext available - "};
20: endif
21: //
22: // Insert a pointer to the object browser
23: //
24: lines = {@lines, "<hr>", &object_browser:object_anchor(this, 1), "(Inspection)"};
25: return lines;
26: /* Last edited on Wed Jan 15 12:36:33 1997 GMT+1 by Kaspar (#85). */
--
Some explanations:
hu = $ehtml_utils;
in line 2
will just allow us to use a shortcut later in the code.
7: lines = {hu:title(title), hu:heading1(title)};
generates a list like:
{"<title>e_thing Test</title>", "<h1>e_thing Test</h1>"}that is associated with a variable
lines
that we shall use to return
generated html on line 25
.description
property) of the object. The
$list_utils:listify_if_needed
method will simply test if the argument is a list. If it is not,
it will make a list. The expression lines = {@lines, @hu:pre(desc)};
will simple append the elements of ``desc'' (a list of description strings)
to the contents of ``lines'' and surround it with
HTML <pre> ...</pre>
tags. It's a frequently seen pattern in MOO code.
As you can see you can return dynamically all sorts of information. As an exercice you now should create an object, e.g. with
@create $thing named My super E_Web object, mseo
Next you can copy the
:http_request verb from
the Generic E_WEBbed Thing (#4152).
@copy &e_thing:http_request to xxx:http_request
The you can try to modify the verb, in order to display information differently or add things like the object's location, it's owner and so forth.