Content last modified Monday 6 March 2017
hop to #bottom
Categories:
Author:
Current version:
0.1
About It:
Get it:
Rate it:
  • Helpful?
  • 2 Yes
  • 0 No
Flag it:

If you'd like to provide updated information and do not have access to directly edit, please contact the site admin; thanks!

dru_random_text

Random Text grabs a random text string from either a database table or a text file. This could be useful for all sort of things from a quote-of-the-day to a random site strap line, to anything really.

To randomize from file, you simply upload a text file to your site containing the items to be picked from. You can specify your own delimiter, but the default is one item per line (omit the delimiter attribute for one-per-line). Set the source to “file” and the path to the full path to your file.

<txp:dru_random_text source="file" path="/path/to/text/file" delimiter="|" />

To randomize from a database table, the plugin picks a named column from a random row in a named table. The table needs to be in the same database that TXP is using. You specify table and column attributes, and set the source attribute to “database”.

<txp:dru_random_text source="database" table="textpattern" column="Title" />
Article Request Count:
Initially released:
April 2004
Posted here:
21 Feb 2005

If there is a comment form at the Information URL, you may want to leave your comments/questions there for quicker feedback. Otherwise, comment away:

Your comment will NOT be submitted until you click the 'Submit' button on the next pageload.

Commented (1)

dwelve:
You need to modify $txpcfg[‘doc_root’] to $txpcfg[‘txpath’] to get it to work with the default file random.txt!

Subscribe to this article's comments RSS feed. [ ? ]   View Recent Comments across the site.

You know you want to visit the Archives.

Browse

Categories


Articles

There are also tag clouds, 'cause those are fun.
Published with Textpattern