Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2004-04-05 20:50:06

Drew
Plugin Author
From: Red pillar box, Baker St.
Registered: 2004-02-15
Posts: 53
Website

[plugin] [ORPHAN] dru_random_text

Grabs a random text string from either a database table or a text file.

From file:
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 delimited attribute for one-per-line). Set the source to “file” and the path to the full path to your file.

<code><txp:dru_random_text source=“file” path=”/path/to/text/file” delimiter=”|” /></code>

From database table:
The plugin will pick a named column from a random row in a named table. The table needs to be in the same database that TXP is using. Specify table and column attributes, and set the source to “database”.

<code><txp:dru_random_text source=“database” table=“textpattern” column=“Title” /></code>

Again, take it steady as I’ve not tested this plugin exhaustively. It should be pretty stable though.

Download dru_random_text.txt.tgz

Last edited by Drew (2004-04-05 20:50:50)


drew mclellan

Offline

#2 2004-04-13 18:04:22

ReinierBiz
Archived Plugin Author
From: the Netherlands, Rotterdam
Registered: 2004-04-07
Posts: 42
Website

Re: [plugin] [ORPHAN] dru_random_text

Works great! Thanks a lot.

Ps. I’m using it to display random movie quotes on my site (in production).

Last edited by ReinierBiz (2004-04-13 18:04:51)


VC88 | Nah, there weren’t really eighty-eight of them. They just called themselves “The Crazy 88.”

Offline

#3 2004-04-29 05:56:25

davidm
Member
From: Paris, France
Registered: 2004-04-27
Posts: 719

Re: [plugin] [ORPHAN] dru_random_text

I am going to test it I was also looking for this…. The plugin section is full of good surprises :-) Thx


.: Retired :.

Offline

#4 2004-05-02 14:04:26

firefox360
New Member
From: Canada
Registered: 2004-05-02
Posts: 4
Website

Re: [plugin] [ORPHAN] dru_random_text

I’ve installed this plug-in, but it’s giving me an error. When I load the page with the plugin on, this error shows up at the top (as all PHP, MySQL errors do…)

Warning: filesize(): Stat failed for http://earlytsunami.angkorwat-tour.com/quotes.txt (errno=2 – No such file or directory) in /tmp/pluginsR6RRgC on line 23

I’ve checked and my webbrowser is propregating to the quotes.txt file, but I’m not sure about the /tmp/pluginsR6RRgC file. And actuallyt I just noticed this, the number and letter combination after /tmp/plugins***** changes everytime I load the page. Now what kind of error is it? The command I’ve place in my page is this:

<txp:dru_random_text source=“file” path=“http://earlytsunami.angkorwat-tour.com/quotes.txt” delimiter=”|” />

So I’m guessing thats not causing the problem. So what else it?


The waves shall carry away the burdens one may hold…

Offline

#5 2004-05-02 14:31:09

mamash
Member
From: Prague
Registered: 2004-02-21
Posts: 127
Website

Re: [plugin] [ORPHAN] dru_random_text

I’m not familiar with this plugin, but “http://earlytsunami.angkorwat-tour.com/quotes.txt” is an URL, definitely not a valid file path. You have to use something like “/quotes.txt” – it might have to be an absolute path (similar to the paths you use in your config.php”.


Who’s gonna textdrive you home tonight?

Offline

#6 2004-05-02 14:47:07

firefox360
New Member
From: Canada
Registered: 2004-05-02
Posts: 4
Website

Re: [plugin] [ORPHAN] dru_random_text

Okay I’ll try that and see if that works thanks mamash!


The waves shall carry away the burdens one may hold…

Offline

#7 2004-05-02 14:50:12

firefox360
New Member
From: Canada
Registered: 2004-05-02
Posts: 4
Website

Re: [plugin] [ORPHAN] dru_random_text

Woah now it’s even worser than before! More error messages. This is what I get now:

Warning: fopen(/quotes.txt): failed to open stream: No such file or directory in /home/firefox/txptmp/pluginsOZc1Dk on line 22

Warning: filesize(): Stat failed for /quotes.txt (errno=2 – No such file or directory) in /home/firefox/txptmp/pluginsOZc1Dk on line 23

Warning: fread(): supplied argument is not a valid stream resource in /home/firefox/txptmp/pluginsOZc1Dk on line 23

Warning: fclose(): supplied argument is not a valid stream resource in /home/firefox/txptmp/pluginsOZc1Dk on line 25

Hmmm… I used Deans guide for the PHP in safemode stuff so now instead of /tmp it’s /home/firefox/txptmp/

Any ideas?


The waves shall carry away the burdens one may hold…

Offline

#8 2004-05-02 15:06:57

mamash
Member
From: Prague
Registered: 2004-02-21
Posts: 127
Website

Re: [plugin] [ORPHAN] dru_random_text

OK. the “/quotes.txt” was just an example and obviosly doesn’t work for you. Why don’t you check the paths in your config.php and create rhe random text path accordingly?

  1. I don’t think the safe mode patch was necessary. You simply provided a non-existent link to a file.
  2. Are you sure you didn’t forget a slash in your tmp directory? Does the /home/firefox/txtmp/ directory really exist?
  3. Seems like your random text direcotry should be “/home/firefox/quotes.txt”, or “/home/firefox/textpattern/quotes.txt” – I can’t guess.

Who’s gonna textdrive you home tonight?

Offline

#9 2004-05-02 21:08:05

firefox360
New Member
From: Canada
Registered: 2004-05-02
Posts: 4
Website

Re: [plugin] [ORPHAN] dru_random_text

Ok it finally works now, and I have a perfect random quotes system! It turns out I need a absolute path to the quotes file, which was located at, /home/firefox/public_html/earlytsunami/quotes.txt Once I edited the file it seemed to do the trick perfectly! Thanks everyone for helping especially mamash!


The waves shall carry away the burdens one may hold…

Offline

#10 2004-09-01 07:53:15

Martagnan
Member
From: Humberside - uk
Registered: 2004-06-21
Posts: 90
Website

Re: [plugin] [ORPHAN] dru_random_text

Can this plugin be time sensitive? for example:

6am to Midday – uses a ‘morning’ txt file.
Midday to 6pm – uses an ‘afternoon’ txt file.
etc… etc..

My reason for this is that messages could then be made appropriate to the time of day?

Offline

#11 2004-09-01 15:06:43

tmacwrig
Archived Plugin Author
Registered: 2004-03-06
Posts: 204
Website

Re: [plugin] [ORPHAN] dru_random_text

<pre>

$now = getdate();
if($now[“hours”] > 12) {
$file = “morning.txt”;
} else {
$file = “afternoon.txt”;
}

</pre>

that should give you a base if you want to hack it together.

Offline

#12 2004-09-01 15:21:37

Martagnan
Member
From: Humberside - uk
Registered: 2004-06-21
Posts: 90
Website

Re: [plugin] [ORPHAN] dru_random_text

I know nothing of PHP so although I understand what your code is doing I wouldnt know how to use it :(

Offline

Board footer

Powered by FluxBB