|
From: <tra...@hu...> - 2001-06-13 19:49:29
|
Yeah...I figured that part out :) Someone was kind enough to point out a thread on Slashcode (http://slashcode.com/comments.pl?sid=01/03/31/2236215&cid=2) that outlines what he had to do to get it working. I replaced the newmotd sub with the following code: my $fortune = `/usr/games/fortune -s`; my $dbh = DBI->connect('DBI:mysql:MYSLASHDBNAME','MYSLASHUSERNAME'); $fortune = $dbh->quote($fortune); my $SQL = "UPDATE templates SET template=$fortune WHERE name='motd'"; $dbh->do($SQL); $dbh->disconnect; And added 'use DBI;' to the begining of the script with all the other 'use' statements. Works like a charm now. At Wed, 13 Jun 2001 10:45:22 -0800 (AKDT), Nathan Vonnahme <na...@th...> wrote: > > >Changes in the vars don't show up until you stop/restart apache. You'll >have much better luck using a block or a template. Probably a template, >then you include it like > >[% INCLUDE motd %] > >-n > > >On Tue, 12 Jun 2001 tra...@hu... wrote: > >> So, can anyone provide any insight on this? >> >> Thanks! >> >> ---------- Forwarded message ---------- >> Date: Sun, 10 Jun 2001 13:47:31 -0500 (EDT) >> Subject: Fortune/MOTD Slash 2.0.0 >> From: tra...@hu... >> Reply-to: tra...@hu... >> To: sla...@li... >> >> As everyone probably knows, Slash 2.0.0 just has "Bite my shiny metal >ass! >> -- Bender" hardcoded for the MOTD template. After seeing this and >reading >> the comments in that particular template, I'm assuming that for whatever >> reason, the Fortune/MOTD function is not operational upon the initial >install. >> >> Question is, what is the proper way to get this function working? >> >> I've messed around with setting it up as a Block as the comments hint >at, >> but can't figure out how to get that displayed in the index page >when not >> logged in as an Admin. >> >> So, I tried setting it up as a variable (motd) and had Slashd update >that >> field in the 'vars' table with the following code: >> >> sub newmotd { >> return unless -x '/usr/games/fortune'; >> chomp(my $t = `/usr/games/fortune -s`); >> $slashdb->setVar('motd', $t); >> } >> >> I've edited the footer templates to: >> >> [% constants.motd %] >> >> instead of >> >> [% INCLUDE motd %] >> >> since it should be getting the text from the var motd instead of the >template. >> >> The field in the 'vars' table gets updated just fine when Slashd runs >the >> code, but the index page doesn't get updated unless I stop and restart >Slash >> AND Apache. >> >> Another question I suppose is is this a good way of doing it? Or >is there >> a better way? >> >> Any words of wisdom will be appreciated. >> >> Thanks. >> >> Free, encrypted, secure Web-based email at www.hushmail.com > > >_______________________________________________ >Slashcode-general mailing list >Sla...@li... >http://lists.sourceforge.net/lists/listinfo/slashcode-general > Free, encrypted, secure Web-based email at www.hushmail.com |