Free-Conversant Support / Randomizer Simple Macro
 Home   About Conversant   Free Sites   Hosting   Support   XML-RPC 

Search




Subject Randomizer Simple Macro
Posted 4/13/2000; 6:43 PM by Philippe Martin
Last Modified 4/13/2000; 7:22 PM by Philippe Martin
In Response To (#Top of Thread.)
Label None. Read 2022
<Previous Next> Thread: Forward chronological view Reverse chronological view Hierarchical outline view Edit Reply

Inserting random pieces of text or images

You may want to insert random pieces of text, or even random images in your pages. That's quite easy.

First create a new message in your site, that you'll use as a container. Put in the body of this message the pieces of text or the image tags you want to insert randomly. Each one must be on its own line, and you shouldn't have empty lines. In other words, the delimiter is the carriage return, and everything between two carriage returns is a field.

Then, in your template or in the body of another message, put the following simple macro call:

<!--#randomizer(N)-->

In this macro call, N is the number of your container message. At each rendering, this macro call will be replaced with a field randomly chosen in the message N.

Of couse, you may have several different container messages. And you can also call the same macro, pointing to the same container, several times in a page or in a template. You'll never get the same field twice in the page.

Do you wonder what would happen if you call the macro four times with three fields in your container message? In this case, one of the macro calls would be replaced with an empty string.

<Previous Next> Thread: Forward chronological view Reverse chronological view Hierarchical outline view Edit Reply
ENCLOSURES

None.
REPLIES

Re: Randomizer Simple Macro
4/13/2000 by Seth Dillingham
On Thursday, April 13, 2000 at 11:47 PM, Philippe Martin <flip@macrobyte.net>

Re: Randomizer Simple Macro
4/13/2000 by Sean McMains
Crikey! Another feature request granted. Perhaps I'll name our upcoming baby

Feature Request RE: Randomizer Simple Macro
2/2/2001 by Brian Carnell
It would be cool if there were a way to reload just the random content with


TRACKBACKS