create new tag
, view all tags

RandomQuotePluginDev Discussion: Page for developer collaboration, enhancement requests, patches and improved versions on RandomQuotePlugin contributed by the TWikiCommunity.
• Please let us know what you think of this extension.
• For support, check the existing questions, or ask a new support question in the Support web!
• Please report bugs below

Feedback on RandomQuotePlugin

I'm working on a plugin that will pull a "random" quote from a database and put it on a page, possibly using some sort of format string like the HeadlinesPlugin.

Would people be more interested in something that uses a MySQL back-end or something that pulls from a TWiki topic? (e.g. RandomQuotes)

-- JasonTromm - 03 Jul 2003

I'd definitely opt for reading from a TWiki topic. This would allow everyone to easily add quotes without building up a web front-end for the MySQL database. And, of course, it'd save me from installing MySQL.

-- ClausBrod - 03 Jul 2003

One of the best features of Twiki is low requirements. Requiring a database for your plugin could substantialy lower interesrt in your plugin - I would not be interested in database, but will if in Twiki pages.

-- PeterMasiar - 03 Jul 2003

I implemented the plugin without a database. It uses a special topic in the Main Web called RandomQuotes for storage. You just put the quotes into a table between %STARTINCLUDE% and %STOPINCLUDE% and the plugin parses the table.

Thanks for the advice.

-- JasonTromm - 03 Jul 2003

Excellent. Do you have some sample database, like Murphy's laws, or Devil's dictionary?

In RandomQuotePlugin you wrote that web and filename are parameters. So are they hardcoded for now, left for todo? And maybe some default variables set in plugin, so I do not have to repeat filename all over the place?

-- PeterMasiar - 04 Jul 2003

Web and filename default to Main and RandomQuotes respectively. I'll add some plugin variables to allow you to set them in WebPreferences. You can also supply the web and filename in the %RANDOMQUOTE{...}% parameters.

I've got two sample databases. Murphys Law and FoundersQuotes. The Murphy's Law quotes are included in the Plugin Package.

-- JasonTromm - 07 Jul 2003

I'm starting a collection of Quote Databases. If anyone else is using this Plugin and has created their own database, let me know and I'll add you to my list. (Or you can add yourself to the list, since this is TWiki after all.)

-- JasonTromm - 11 Jul 2003

I changed your signature in the Plugins topic so that your name shows up properly in the PluginPackage index table. Best to reflect that in the next release.

-- PeterThoeny - 19 Jul 2003

FYI: Clicking on either Murphys Law and FoundersQuotes results in the following error (in my browser):
DBI connect('trommett_mt:localhost','trommett_mt',...) failed: Access denied for user: 'trommett_mt@localhost' (Using password: YES) at ../lib/TWiki/Plugins/RefererPlugin.pm line 465

-- AlexLane - 29 Jul 2003

The Trommetter.com site was hacked yesterday which resulted in the errors you see above. Those errors are gone now.

-- JasonTromm - 30 Jul 2003

I think I've found some small bugs in the way the plugin reads the random quotes page. It seems to be leaving a "\n" following the %STARTINCLUDE%, resulting in a empty quote. Since the size of the quotes list is off, it also allows a quote for the table header to be displayed. These are both quickly seen if you have a quotes page with 1 entry.

-- SethTaplin - 30 Jul 2003

checked into CVS

-- WillNorris - 14 Feb 2005

I make a little change that works:

in the line 312:

  • was:
    # remove everything before %STARTINCLUDE% and after %STOPINCLUDE%
    $topicText =~ s/.*?%STARTINCLUDE%//s;
  • now is:
    # remove everything before %STARTINCLUDE% and after %STOPINCLUDE%
    $topicText =~ s/.*?%STARTINCLUDE%\n[^\n]*\n//s;

and in the line 319:

  • was:
    srand(time ^ 22/7);
    my $quote = int (rand(@quotes)) + 1;
  • now is:
    srand(time ^ 22/7);
    my $quote = int (rand(@quotes));

Now the plugin gets only the quotes (whithout the frist table line) and do not exist the blank quote.

-- AurelioAHeckert - 04 Apr 2005

after the line $topicText =~ /.*//s; (line 314) I put:

   # Now, a table of quotes can be created dynamically:
   $topicText = TWiki::Func::expandCommonVariables($topicText);

I did it to create quotes by this way:

| *Author* | *Saying* | *Category* |
%SEARCH{search="%META:FORM\{name=\"NoticiaForm\"\}[%]" regex="on" excludetopic="NoticiaTemplate"
web="HotLine" noheader="on" nosearch="on" nosummary="on" nototal="off" order="topic" reverse="on"
format="| $formfield(Autor) |[[$web.$topic][$formfield(Título)]]| Notícia |"  limit="7"}%
Now i can put an random recent notice on my frist page.

-- AurelioAHeckert - 12 Apr 2005

Just tried downloading the plugin, and it appears to be empty.

-- TimWegner - 31 May 2006

Indeed. The history file was corrupted, so I removed it. Please try again, it should work now.

-- PeterThoeny - 31 May 2006

Thanks Peter. Downloaded OK, installed on TWiki 4.0.2 OK, but when trying to edit the RandomQuotes file, which is formatted as a table, it wouldn't edit (from within TWiki) because it expected there to be a file called WebForm. This file is mentioned in a meta tag. I just deleted the meta tag and it works. Looks like this plugin needs updating. It also contains an old copy of the plugin documentation, with dead links to Jason Tromm's website. I'd be happy to fix this myself when I get a little more confident, but as yet I barely know what I'm doing, and I'm not sure I'm ready to rebuild a plugin yet smile

-- TimWegner - 04 Jun 2006

Nice that this Plugin from 2003 works in TWiki 4.

Yes, the WebForm is obsolete and should be removed. Please feel free to repackage the Plugin. See also HandlingCairoDakarPluginDifferences, it has some info on how to package Plugins so that it runs on Cairo and Dakar.

-- PeterThoeny - 06 Jun 2006

A request for enhancement: This plugin can also be useful for other purposes. I use it to learn vocabulary for a foreign language, to display a random word.

For this it would be useful if the fields were not called $author etc., but e.g. $french etc. It would also be useful to have more than 3 columns.

Could this plugin be modified that the names of the variables are not hard coded, but are taken from the table, e.g. the column labels?

-- StephanMatthiesen - 01 Jan 2007

The fixes that AurelioAHeckert mentions on 04 Apr 2005 are NOT in the current version of the plugin.

-- Vicki Brown - 2013-05-23

Related Topics: RandomQuotePlugin, Quote Databases

Edit | Attach | Watch | Print version | History: r21 < r20 < r19 < r18 < r17 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r21 - 2013-05-23 - VickiBrown
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2018 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.