![]() |
Configuring WB |
About | Install | Config | Usage | Copyright | F.A.Q. |
---|
To define a new billboard you will simply create a directory into the billboard root. The name of the directory will be the name of the new billboard. Supposing you want a new billboard named News you will do:
> mkdir /var/www/http/BillBoards/News
Note: You can use any name for your billboards, except for names beginning with '.', which are reserved for special actions. |
You must then ensure that the web server program has the right permissions to read, write and create files under the News directory. You must thus change the ownership of the directory to the user id that the web server is using when running. Standard Apache installations will often use the username apache (but this may be different on your web server: if you have followed installation directions, this should be the same owner owning the billboard root directory). Supposing it is actually apache:
> chown apache /var/www/http/BillBoards/NewsNow your billboard is up and running and you might start to use it, but you might want to customize it a little bit to adapt it to your needs.
Most items are self explaining or their purpose may be undestood by reading comments in the file, a few items deserve some more discussion.
index_header, index_item, index_footer, doc_header, doc_footerThese variables may be used to customize the document index and the document display pages generated by WB. Each variable is an array of strings and each element will generate a line of HTML code after being processed as detailed below.
The document index will be generated as an HTML document as follows:
The document display page, instead, is generated as:
- Text generated by index_header.
- for each document, a block generated by index_item
- Text generated by index_footer.
To generate text the definition strings are processed to apply string substitution so that some "variables" are substituted with their values.
- Text generated by doc_header.
- Document body
- List of links to attachments (if any)
- Text generated by doc_footer.
E.g.: the default values of the five items are:
index_header = ['<h3>Index for billboard: <i>%(BBOARD)s</i></h3><blockquote><ul>'] index_item = ['<p><li> %(DATE)s %(EXPIR)s', '<br><a href=%(HREF)s>%(TITLE)s</a>'] index_footer = ['</ul></blockquote>'] doc_header = ['%(DATE)s %(EXPIR)s', '<h3>%(TITLE)s</h3>'] doc_footer = []As you may see the lines resemble HTML code except for the special symbols: %(VAR)s which indicate variable substitution, i.e.: the symbol in parentheses will be substituted with the value of the named variable.
Note: You need to know a little bit of Python syntax to write customization strings. Here's a very short resume: 1) Comment lines begin with "#"; 2) strings are enclosed in either double quote (") or single quote ('). When using double quotes, if you need to put a literal double quote character into the string you must escape it with backslash (E.g.: \"). The same happens when enclosing in single quote. 3) arrays are enclosed in brackets: [ ], elements in arrays are separated by commas; 4) it is safe to start a new line after a comma. |
The following variables are defined and can be used for index generation:
Where it can be used | |||||||
---|---|---|---|---|---|---|---|
Var name | Meaning | index header | index item | index footer | doc header | doc footer | mail body |
AUTHOR | Document author's name | NO | YES | NO | YES | YES | YES |
BBOARD | Current billboard name | YES | YES | YES | YES | YES | YES |
DATE | Document date | NO | YES | NO | YES | YES | YES |
EXPIR | Document expiration date1 | NO | YES | NO | YES | YES | YES |
HREF | URL pointing to document | NO | YES | NO | YES | YES | YES |
IF_AUTHOR* | Document author's string. Format is defined in author_fmt; empty, if no author specified | NO | YES | NO | YES | YES | YES |
N_ITEMS | Number of items in list | YES | YES | YES | NO | NO | NO |
TITLE | Document title | NO | YES | NO | YES | YES | YES |
SEARCH | HTML code to insert a search form. The content of the string is defined by variable search_fmt; It may be empty, if no search form is desired. | YES | NO | YES | NO | NO | NO |
Beware: if a variable is mispelled or not defined an error will result and no index will be displayed.
> python /var/www/http/BillBoards/News/wb.iniNo output should result.
Now you are ready to start putting documents into your billboard, or maybe to define a new billboard.
date expir ascending descendingWords are separated by spaces in the string and may be written in any order. If conflicting words are specified one will prevail at random.
Vocabulary files are stored in the billboard root directory and are named: english.voc, italiano.voc, and so on. You may use one of those as template to write a new one (please, if you do so consider to send it to me to be added in the next distribution of WB).
Available vocabularies and values for each term in them can be shown by a special URL:
http://my.web.site/cgi-bin/wb.py?.voc