New Message: Re: random images in stories

webmaster at userland.com webmaster at userland.com
Fri Sep 17 09:17:45 PDT 2004


A new message was posted:

Address: http://manila.userland.com/discuss/msgReader$568

By: Gary McSpadden (gmcspadden at dvusd.org)

I put it in the story. Didn't try it with static images but that might be my next experience.
I will try to explain. If I get it wrong then I hope someone will jump in nicely and explain.

\{return("\""+"kenzie"+(random(1,5))+"\\"")}
The return macro is returning the string I have set up between ( )
The "\"" is giving me the " that I need for the image name shortcut, you know enclosing the shortcut in quotes. The + symbol links the " to the name of the graphic. In my code the word kenzie is enclosed in quotes because it is a text string. The next + sign links that text to the random macro which is providing the number that I have on the photo shortcuts. So now I have built that string to "kenzie1 "kenzie2 etc. The next +"\"" gives me the closing quote for the shortcut.
On my page this returns "kenzie1" "kenzie2" and so on, which provides the shortcut for the 5 images that I named kenzie1 kenzie2 kenzie3 kenzie4 and kenzie5.
Make sure that you use a ( and not a { for the random macro. That is Upper case 9 parentheses and not curly brackets. (random(1,5)) and not \{random(1,5)}

This is on a site that I use for messing around with Manila so I can try things out before I answer questions from the teachers using the server in our district. If you want to see the page go to http://mrm.myteacher.dvusd.org. Refresh the page and the photo will change. If the random macro gives the same number then the graphic won't change so just keep refreshing.




More information about the Frontier-Users mailing list