Welcome, Guest. Please Login or Register.
April 29, 2025, 06:57:18 PM
Home Help Search Log in Register
News: SMF is the next generation in forum software, almost completely re-written from the ground up, make sure you don't fall for cheap imitations that suffer from feature bloat!

YaBB SE Community  |  German User Help  |  Hilfe bzw. Diskussionen zu Mods  |  [alle Versionen ;-)] Random Quote « previous next »
Pages: [1] Reply Ignore Print
Author Topic: [alle Versionen ;-)] Random Quote  (Read 1024 times)
chris
Guest
[alle Versionen ;-)] Random Quote
« on: April 30, 2003, 08:40:24 AM »
Reply with quote

Da ich gestern zufällig auf einer anderen Site sowas gesehen habe *g* Heute mal wieder ein total sinnfreies MOD von mir...

Man öffne Subs.php und füge dort folgendes ein:

function yyRandomQuote()
{

   global $db_prefix;

   $sqlquery   = 'SELECT * FROM '.$db_prefix.'quotes ORDER BY RAND() LIMIT 1';
   $request   = mysql_query($sqlquery) or database_error(__FILE__, __LINE__);
   if ($request)
   {
      $qdata   = mysql_fetch_assoc($request);
      mysql_free_result($request);
      echo nl2br(htmlspecialchars($qdata['quote']));
   }

}


nun muss man irgendwo im Template noch <yabb RandomQuote> einfügen und das war es auch schon fast ;D

Zu guter letzt legt man noch folgende Tabelle an:

CREATE TABLE `yabbse_quotes` (
 `quote` text
) TYPE=MyISAM;


und fülle sie mit ein paar lustigen Zitaten.... z.B. mit einigen aus den Discworld-Romanen von Terry Pratchett:

INSERT INTO yabbse_quotes VALUES("It was all very well going about pure logic and how the universe was ruled by logic and the harmony of numbers, but the plain fact was that the disc was manifestly traversing space on the back of a giant turtle and the gods had a habit of going round to atheists\' houses and smashing their windows.\r\n\r\n(Colour of Magic)");
INSERT INTO yabbse_quotes VALUES("\'But it\'ll kill him!\'\r\n\'It could have been worse.\'\r\n\'What?\'\r\n\'It could have been us.\'\r\n\r\n(Colour of Magic)");
INSERT INTO yabbse_quotes VALUES("\'Where do shadows come from? That\'s where the wind is blowing!\'\r\n\r\n(Colour of Magic)");
INSERT INTO yabbse_quotes VALUES("\'You\'re your own worst enemy, Rincewind,\' said the sword.\r\nRincewind looked up at the grinning men.\r\n\'Bet?\'\r\n\r\n(Colour of Magic)");
INSERT INTO yabbse_quotes VALUES("The only reason for walking into the jaws of Death is so\'s you can steal His gold teeth.\r\n\r\n(Colour of Magic)");
INSERT INTO yabbse_quotes VALUES("This is to say: while it was true that they had just appeared in this particular set of dimensions, it was also true that they had been living in them all along. It is at this point that normal language gives up, and goes and has a drink.\r\n\r\n(Colour of Magic)");


( ein SQL-File mit über 900 Quotes gibt es hier: http://www.tagdocs.de/yse/discworld.zip )

und schon wird bei jedem Aufruf von YaBB ein zufälliger Spruch ausgegeben.....
Logged
Silent`
Noobie
*
Posts: 22


WWW
Re:[alle Versionen ;-)] Random Quote
« Reply #1 on: May 01, 2003, 03:18:36 PM »
Reply with quote

Klingt spitze, bietet auch endlich die Möglichkeit etwas individuelleres auf seinem Forum zu machen  ;)
Logged
Pages: [1] Reply Ignore Print 
YaBB SE Community  |  German User Help  |  Hilfe bzw. Diskussionen zu Mods  |  [alle Versionen ;-)] Random Quote « previous - next »
 


Powered by MySQL Powered by PHP YaBB SE Community | Powered by YaBB SE
© 2001-2003, YaBB SE Dev Team. All Rights Reserved.
SMF 2.1.4 © 2023, Simple Machines
Valid XHTML 1.0! Valid CSS

Page created in 0.075 seconds with 19 queries.