TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

April 13, 2024, 04:24:40 PM

Login with username, password and session length
Members
  • Total Members: 3,885
  • Latest: Growner
Stats
  • Total Posts: 195,154
  • Total Topics: 21,219
  • Online today: 70
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 1
  • Guests: 66
  • Total: 67
  • @rjen

"Today in History" block

Started by Lesmond, October 29, 2005, 01:25:30 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

bloc

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.


$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]

clickbouyow

#1
Excellent!  Thanks Bloc!  Works like a charm!

JayBachatero

nice block.  you should enable it here.  it would be a nice feature.

eldacar

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).

bloc

It could be done if they had a xml feed, or rss/rdf.. ;)

mastroale


crip

Thanks Bloc..

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

crip~

Skhilled

#7
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...

bloc

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. ;)

Skhilled