[Back to Tutorial]


Thou swag-bellied clack-dish !


The source used to create this page is listed below.
It makes use of two standard text files - nouns.txt and adjectives.txt.

<<
    // Insult Generator
    // Orig Date  : 10/3/96
    // Orig Author: creed
    
    // This template demonstrates some of SiphonScript's text handling 
    // functions. It makes use of two text files: one with a list of 
    // adjectives, and one with a list of nouns. Each file is formatted 
    // with each word on a single line.

    // Read in the list of available adjectives each time this template
    // is run. Then, split each adjective into a list variable with 
    // a carriage return as the delimiter.
    adj = readFile(template_path & "adjectives.txt");
    adj = split(adj, "\r");
	
    // Read in the list of available nouns and split as above.
    noun = readFile(template_path & "nouns.txt");
    noun = split(noun, "\r");
	
    // Draw the HTML that builds the page header.
>>
<html>
<head><title>Shakespearean Insult Generator</title></head>
<body bgcolor="ffffff">
<hr noshade>
<p>
<center><h2>Thou
<<
    // choose randomly between 1 and 3 adjectives and print them
    repeat (random(3)) times
        print random(adj) & " ";
    end repeat;
	
    // then print a random noun
    print random(noun);
	
    // Draw the remainder of the HTML.
>>
!</h2></center>
</body>
</html>