Questions addressed by this recipe
The randomsection.phpΔ script makes it possible to insert a random quote from another page into the current one. It does this by defining a
Note: A previous version of this page used a different approach, see RandomQuote-OldVersion for that recipe.
Next, create a page containing quotations to be included. Each quotation should be preceded by a unique anchor -- i.e., using the
Then, to dynamically insert a random quote from a page, use
Reload this page to see the quotes change.
Note that the quotations can contain arbitrary markup, such as wikistyles, links to other pages or sites, and the like.
Kinda pointing out the obvious but this plugin is also perfect for setting up a "did you know" function, similar to mediawiki's. I set it up for mine and it works like a charm, thanks :D - Com
You can use this feature to display random banners throughout a wiki. Create a banners page and instead of a quotes, put
Because of some strange quirk in the include make sure the anchor [[#anchor]] is on a separate line to the quote or image.
I changed this script slightly to allow for including only between two specific anchors instead of using only one anchor to delineate. This lets you keep quotes and other content on a nicely formatted page and pull only your anchored contents out (rather than everything between the anchors).
On line 43, change
That's it! Just add the word 'end' into the anchor format string. I'm not a coder but this solution seems to be working perfectly fine so far. After you've modified the script, simply wrap the sections you want to be pulled in
How is this a 'quote of the day' script if there's no option to set the randomness interval? I want a banner to rotate on a daily basis, not on every reload... --jibegod
Quote of the day
"Human nature is not a machine to be built after a model, and set to do exactly the work prescribed for it, but a tree, which requires to grow and develop itself on all sides, according to the tendency of the inward forces which make it a living thing."
J S Mill, On Liberty
"Such are the differences among human beings in their sources of pleasure, their susceptibilities of pain, and the operation on them of different physical and moral agencies, that unless there is a corresponding diversity in their modes of life, they neither obtain their fair share of happiness, nor grow up to the mental, moral, and aesthetic stature of which their nature is capable."
John Stuart Mill, On Liberty (1859)