Login  |  Register
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome, Guest. Please login or register.
Did you miss your activation email?

August 19, 2022, 04:42:21 AM

Login with username, password and session length
Members
  • Total Members: 3843
  • Latest: Tricky
Stats
  • Total Posts: 193479
  • Total Topics: 21088
  • Online today: 51
  • Online ever: 1035
  • (November 26, 2020, 04:45:12 AM)
Users Online
Users: 0
Guests: 45
Total: 45

Author Topic: "Today in History" block  (Read 36671 times)

0 Members and 1 Guest are viewing this topic.

Offline bloc

  • Founder
  • *
  • Posts: 5229
    • Bloc
"Today in History" block
« on: October 28, 2005, 06:25:30 PM »
Here is a block that will show "today in history" - the sql data file kindly provided by clickbouyow.

Pretty straightforward - just insert the code into a phpblock and adjust accordingly:
$my_height = set this to number of lines before it will have a scrollbar..some texts are very long. :)
import the sql file in the attached zip-file to your database. If you do not, it will give an database error.

Code: [Select]
$my_height = 15;
$today = mktime();
$today_day = date("j", $today);
$today_month = date("n", $today);

$request = db_query("SELECT pn_yid, pn_content FROM nuke_ephem WHERE pn_did=$today_day AND pn_mid=$today_month ORDER BY pn_yid ASC", __FILE__, __LINE__);
if (mysql_num_rows($request) > 0)
{
echo '<div style="height: '.$my_height.'ex; overflow: auto;">';
while($row = mysql_fetch_assoc($request)){
echo '<b>' . $row['pn_yid'] . '</b> - ' . $row['pn_content'] . '<br />';
}
                echo '</div>';
mysql_free_result($request);
  }

[attachment deleted by admin]
« Last Edit: January 14, 2007, 03:27:32 PM by Bloc »

clickbouyow

  • Guest
Re: "Today in History" block
« Reply #1 on: October 28, 2005, 07:16:34 PM »
Excellent!  Thanks Bloc!  Works like a charm!
« Last Edit: January 14, 2007, 03:55:24 PM by clickbouyow »

JayBachatero

  • Guest
Re: "Today in History" block
« Reply #2 on: October 28, 2005, 08:19:47 PM »
nice block.  you should enable it here.  it would be a nice feature.

eldacar

  • Guest
Re: "Today in History" block
« Reply #3 on: October 28, 2005, 09:32:35 PM »
It would be interesting to see if it could be taken from something like http://en.wikipedia.org/wiki/October_29 instead of the database table (which wouldn't be updated).

Offline bloc

  • Founder
  • *
  • Posts: 5229
    • Bloc
Re: "Today in History" block
« Reply #4 on: October 29, 2005, 01:52:09 AM »
It could be done if they had a xml feed, or rss/rdf.. ;)

mastroale

  • Guest
Re: "Today in History" block
« Reply #5 on: October 29, 2005, 02:49:56 AM »
Great block! thanks!

crip

  • Guest
Re: "Today in History" block
« Reply #6 on: October 29, 2005, 06:59:41 AM »
Thanks Bloc..

now may-be I can learn some history. ;)

crip~

Offline Skhilled

  • Beta Tester
  • *
  • Posts: 1179
  • Once you stop learning, you stop living!
    • Doc Skillz
Re: "Today in History" block
« Reply #7 on: October 29, 2005, 09:51:30 AM »
This is a great block but can you add your own days in history to it? Or even delete certain ones? Some people might want to remember certain things while others might want to forget some...
« Last Edit: October 29, 2005, 09:53:15 AM by Skhilled »

Reading can seriously damage your ignorance!

Offline bloc

  • Founder
  • *
  • Posts: 5229
    • Bloc
Re: "Today in History" block
« Reply #8 on: October 29, 2005, 10:46:34 AM »
Its all in the database tables..so you need to add or delete there. To administrate it through otherwise you would need a separate script.

If the table was expanded with an extra "on/off" field, you could even add/remove and turn off existing ones, either for all members or selected membergroups. ;)

Offline Skhilled

  • Beta Tester
  • *
  • Posts: 1179
  • Once you stop learning, you stop living!
    • Doc Skillz
Re: "Today in History" block
« Reply #9 on: October 29, 2005, 07:53:14 PM »
Thanks, Bloc!

Reading can seriously damage your ignorance!