external next up previous contents index
Next: The $www_utils package Up: 14.3 The Basic Applications Previous: Webby verbs

htext verbs

 

Each time you click on a object on the WWW interface (or when you navigate into a new room) the ``:text'' verb is called (normally it is inherited from core objects like #1, #3 ($room), #5 ($thing), #6 ($player) etc. So if you feel confident in code reading you might want to have a glance at those verbs sometimes. Type @d <any object>:htext to see from where the verb is inherited.

Bascially the ``:htext'' verbs generate the items for a full HTML page that are returned in a flat list of strings, generally the following:

  1. An HTML header + the global menu on top of the page + the big title, i.e. something like:

     <html>
     <head>
     <title>island</title>
     </head>
     <body>
     <form method="GET http://tecfamoo.unige.ch:7777/"><select name="verb">
     <option>help<option>browse<option>who<option>uptime<option>location
     <option>body<option>home<option>news<option>mail<option>sendmail</select>
     <input name="do" type=submit value="Do it!"> 
     <input name="command" size=50></form><p align=center>
     <hr>
     <h1 align="center">island</h1>
    Note that all those elements are comma separated ``STRINGS'' returned in a list!
  2. The description of the object
  3. The contents of its .htext property
  4. Object specfic items, e.g.

  5. ``webby verbs'' attached to each object, e.g. something like:

     <form method=GET action=http://tecfamoo.unige.ch:7777/key=209189437/1429>
     <input name="web_verb" type=submit value="help">
     This link will show you help and verb comments on this object
     </form>
  6. A footer, i.e. something like:
      </BODY>
      </HTML>

So if you decide to write your own :htext verb for an object or a generic, try to reproduce something along the same lines. Copy the generic verb that comes closest to your needs and adapt!

Also, make sure not to forget the ``webby verbs'' if there are some. ``Webby'' verbs by definition have a _web suffix in their name. (e.g. help_web is a webby verb, see section 14.3.1 ). The :htext verb must display those verbs. It uses the :list_web_verbs for that.

The text below is from MOOtiny's help system (dated oct 19 1995). Alternatively, you can directly access it at MOOtiny It may not totally fit what we have here at Tecfa.

>help htext-verbs

To have almost complete control over what is returned when an object
is viewed over the web, you should program the :htext verb on the
object.

:htext verbs are passed two arguments:  

The first (and most commonly used) is a list of strings which make up
the url, as they are on other woos.

The second is the information sent by the client to the MOO, containing
information about what version browser it is, what type of information
it will accept and so on.

:htext verbs are *not* passed any 'key' information (as they are on
most other woos), as you can use 'player' to know who is accessing the
verb.

:htext verbs should be +x, return html, and can refer to 'player' as
the object number of the person who is accessing the moo.  Remember,
though that any messages that you :tell to player will not be seen
by them over the web, so it's good to return them in the html as well.

Good html should be returned by the :htext verb.  As an aid to this,
there are two $www_utils verbs:  :do_html_header and :do_html_footer,
which may be useful.  To include _web verbs (see help web-verbs) in
your html, use object:list_web_verbs.  You can change which _web verbs
are shown by altering object:obvious_web_verbs.

The $www_utils are meant to aid the construction of :htext verbs.
Have a look at 'help $www_utils' for more information.

If you are interested in returning extra information for inclusion in
the headers (such as Content-type or Location), you may return two
arguments from the :htext verb rather than simply returning a list
of strings.  The first argument will contain the html as usual.  The
second argument is a list which contains header information such as
the mime type and so on.  There are utilities for creating these
headers in the $www_utils package.


next up previous contents index external
Next: The $www_utils package Up: 14.3 The Basic Applications Previous: Webby verbs

Daniel K. Schneider
Thu Apr 17 12:43:52 MET DST 1997