![]() ![]() |
| theKiwi |
Apr 27 2006, 10:23 AM
Post
#1
|
|
Advanced Member Group: Administrators Posts: 1,799 Joined: 20-February 03 From: Caledonia, Michigan, USA Member No.: 67 |
The following code will generate a list of people who died on this day with their birth year and name. The name is a link to their page.
The lines that are currently commented out (after the lines at the head) I put there to suppress generating the list on New Year's day since anyone who had only a year for their date was assumed to be on 1 January, so the lists were impossibly long and the server load quite high. I don't now remember why they are commented out though. PS I've now added this file as an attachment. Roger CODE <? //===================================================== // deaths.php // Author: Jeff Grantham genealogy.kb5wck.com // with additions for Linking by Roger Moffat // http://roger.lisaandroger.com //===================================================== include_once("config.php"); include_once("genlib.php"); //$today = date("m/d"); //if ($today != "01/01") { tng_db_connect($database_host, $database_name,$database_username,$database_password) or exit; $query2 = @mysql_query("SELECT personID, lastname, firstname, gedcom, YEAR(deathdatetr) AS DeathYear FROM $people_table WHERE MONTH( deathdatetr ) = MONTH( CURDATE( ) ) AND DAYOFMONTH(deathdatetr) = DAYOFMONTH(CURDATE()) ORDER BY DeathYear"); ?> <table border="0" cellspacing="0" cellpadding="0"> <tr> <td valign="top"> <? while ($row = mysql_fetch_array($query2) ) { echo "<span class=\"smaller\"><a href=\"getperson.php?personID=" . $row["personID"] . "&tree=" . $row["gedcom"] . "\">" . $row["firstname"] . " " . $row["lastname"] . "</a> - <i>" . $row["DeathYear"] . "</i></span><br>"; } echo "</td></tr></table>"; //} else { // echo "<div align=\"center\"><span class=\"smaller\">Happy New Year.<br>No listings today.</span></div>"; //} ?>
todaydeaths.php ( 1.26k )
Number of downloads: 302This post has been edited by theKiwi: Apr 29 2006, 05:21 AM |
| beun.net |
Sep 12 2006, 03:55 AM
Post
#2
|
|
Advanced Member Group: Members Posts: 91 Joined: 31-August 06 From: The Netherlands Member No.: 1,312 |
|
| theKiwi |
Sep 13 2006, 07:30 AM
Post
#3
|
|
Advanced Member Group: Administrators Posts: 1,799 Joined: 20-February 03 From: Caledonia, Michigan, USA Member No.: 67 |
I've updated the file a little bit to show "No Deaths Today" if there are no death events on this date.
Roger Attached File(s)
todaydeaths.php ( 1.22k )
Number of downloads: 199 |
| theKiwi |
Nov 29 2006, 05:18 PM
Post
#4
|
|
Advanced Member Group: Administrators Posts: 1,799 Joined: 20-February 03 From: Caledonia, Michigan, USA Member No.: 67 |
Here's a new version of the file that I know works under PHP 5.2.0. The previous one wouldn't as it started with
<? instead of <?php Roger
todaydeaths.php ( 1.23k )
Number of downloads: 299 |
| clarkkent93 |
Apr 21 2007, 11:10 AM
Post
#5
|
|
Advanced Member Group: Members Posts: 53 Joined: 2-April 07 From: Missoula, MT Member No.: 2,722 |
Would it be possible to have the number of years right after the name and date? Example:
Bessie - 2005 (2) |
| davidboy |
Jan 19 2008, 02:53 PM
Post
#6
|
|
Member Group: Members Posts: 12 Joined: 11-January 08 Member No.: 6,076 |
Hi All,
Found this by accident and glad I did, but as I am a complete novice novice could I ask where the code would be placed as I have no idea where it would go.... Thanks DavidBoy (IMG:style_emoticons/default/icon_redface.gif) |
| theKiwi |
Jan 19 2008, 10:48 PM
Post
#7
|
|
Advanced Member Group: Administrators Posts: 1,799 Joined: 20-February 03 From: Caledonia, Michigan, USA Member No.: 67 |
Decide where on your page you want it to appear, and then at that place use a little block of PHP code like
<?php include("todaydeaths.php"); ?> and the result of that will appear in that place on your page. Roger |
| davidboy |
Jan 20 2008, 08:11 AM
Post
#8
|
|
Member Group: Members Posts: 12 Joined: 11-January 08 Member No.: 6,076 |
Hi Roger,
Thanks for the reply, but I have no idea of where to place the code as it took me long enough get where I am now. Does the code go in the index.php or elsewhere. If you can take a quick look my site is dryals.com. Thanks again Decide where on your page you want it to appear, and then at that place use a little block of PHP code like <?php include("todaydeaths.php"); ?> and the result of that will appear in that place on your page. Roger |
| theKiwi |
Jan 20 2008, 03:15 PM
Post
#9
|
|
Advanced Member Group: Administrators Posts: 1,799 Joined: 20-February 03 From: Caledonia, Michigan, USA Member No.: 67 |
Yes, you would put it in index.php. Find this block of code
CODE </tr> </table> </td> </tr> </table> <font face="Arial,Helvetica,sans-serif" size="2"> and add it after the </table> and it will draw the results of todaydeaths.php there - assuming that you have the file uploaded to your web site. Roger |
| CJE Culver |
Mar 10 2008, 01:46 AM
Post
#10
|
|
Member Group: Members Posts: 27 Joined: 31-May 07 From: Shanghai, China Member No.: 3,183 |
Hi, Roger: thanks for your work on this add-on. Sorry, I'm not a coder.
I'm using TNG 6.10, and I'm getting an error when I use your file. I uploaded it as-is to the root of my TNG site, then created this small file for testing: TESTING.PHP CODE <html> <body> <?php include("todaydeaths.php"); ?> </body> </html> When I load TESTING.PHP, I get the following: QUOTE Warning: session_register() [function.session-register]: Cannot send session cache limiter - headers already sent (output started at /home/jenandca/public_html/colverculvergenealogy/genealogy/testing.php:3) in /home/jenandca/public_html/colverculvergenealogy/genealogy/genlib.php on line 24 Anna - 1813 Maria Holley Cogswell - 1888 Arthur William Culver - 1945 Hattie Wisbrun - 1978 I've left TESTING.PHP on my server. Suggestions? CJ, Admin The Colver-Culver Family Genealogy Project |
| Mike Goodstadt |
Mar 10 2008, 06:52 AM
Post
#11
|
|
Advanced Member Group: Members Posts: 197 Joined: 14-January 06 From: Valencia, Spain Member No.: 758 |
I suspect that it is because you have leave out all the code which runs the TNG site!
CODE <?php include("begin.php"); include($cms[tngpath] . "genlib.php"); include($cms[tngpath] . "getlang.php"); include($cms[tngpath] . "$mylanguage/text.php"); tng_db_connect($database_host,$database_name,$database_username,$database_password) or exit; include($cms[tngpath] . "checklogin.php"); $flags[noicons] = true; $flags[noheader] = true; tng_header( $text[mnuheader], $flags ); ?> This is included at the start of the index file and makes the file run the php code behind a TNG site. As Roger mentioned above, the easiest way to test Roger's addon just add the lines into the index file. Roger: Am I correct in saying this? Good Luck, Mike |
| theKiwi |
Mar 10 2008, 07:37 AM
Post
#12
|
|
Advanced Member Group: Administrators Posts: 1,799 Joined: 20-February 03 From: Caledonia, Michigan, USA Member No.: 67 |
Hmmm - you've got me.
When I go to http://www.colverculvergenealogy.org/genea...todaydeaths.php that runs correctly on your site. And I created a file on my site exactly the same as you did, and that too works corrrectly. http://testing.lisaandroger.com/testscript.php The difference is presumably between TNG 6.1 and 6.2 - or did you do anything to alter the todaydeaths.php file? I've attached my current copy of it to this message - perhaps try that and see what happens. And try your include directly in your index.php file where you want it to be and see if that makes a difference. The test file doen't need all the lines Mike posted above - the script contains enough include_once lines to allow the script to work as a standalone file as noted above if you access the script directly on your site it works. Roger
todaydeaths.php ( 1.2k )
Number of downloads: 178 |
| CJE Culver |
Mar 10 2008, 02:48 PM
Post
#13
|
|
Member Group: Members Posts: 27 Joined: 31-May 07 From: Shanghai, China Member No.: 3,183 |
When I go to http://www.colverculvergenealogy.org/genea...todaydeaths.php that runs correctly on your site. And I created a file on my site exactly the same as you did, and that too works corrrectly. http://testing.lisaandroger.com/testscript.php I get the same thing. Going directly to my TODAYDEATHS.PHP works fine, and your TESTSCRIPT.PHP runs without error for me as well. But my TESTING.PHP throws an error. I haven't made any changes to TODAYDEATHS.PHP. QUOTE I've attached my current copy of it to this message - perhaps try that and see what happens. Done. I uploaded it to my site. The above links are to your newer version. Made no difference. QUOTE And try your include directly in your index.php file where you want it to be and see if that makes a difference. Also done. I copied my index.php to index_test.php and inserted just this code (lines 111-117, if you want to take a look): CODE <?php include("todaydeaths.php"); ?> Also no joy (IMG:style_emoticons/default/icon_sad.gif) CJ |
| theKiwi |
Mar 10 2008, 03:33 PM
Post
#14
|
|
Advanced Member Group: Administrators Posts: 1,799 Joined: 20-February 03 From: Caledonia, Michigan, USA Member No.: 67 |
What is the very first line in your index.php file?
It needs to be <?php If there's anything before that it will cause this problem according to messages from Darrin on the mail list that I've dug through looking for the solution to this. (Still doesn't explain why your test page won't work I don't think, since such a page works on my site no problems using PHP 5.2.5) Roger |
| Mike Goodstadt |
Mar 12 2008, 05:47 AM
Post
#15
|
|
Advanced Member Group: Members Posts: 197 Joined: 14-January 06 From: Valencia, Spain Member No.: 758 |
|
| theresel |
Sep 19 2008, 01:03 PM
Post
#16
|
|
Advanced Member Group: Members Posts: 37 Joined: 11-April 07 Member No.: 2,791 |
Hi,
I'm using your todaybirths and todaydeaths scripts on my site and find them very easy to implement and customize. Very good job. Any possibility that you do a script to display statistics too?? I currently use tndToday for statistics but find it very hard to customize. Don't even know how to have it switch languages..... with cust_text.php. Thanks for the great scripts. Thérèse |
| theKiwi |
Sep 19 2008, 01:41 PM
Post
#17
|
|
Advanced Member Group: Administrators Posts: 1,799 Joined: 20-February 03 From: Caledonia, Michigan, USA Member No.: 67 |
There is already a script as part of TNG that shows statistics and changes language etc etc
http://yourSite/browsetrees.php for example http://roger.lisaandroger.com/browsetrees.php Roger |
| theresel |
Sep 19 2008, 02:20 PM
Post
#18
|
|
Advanced Member Group: Members Posts: 37 Joined: 11-April 07 Member No.: 2,791 |
Yes, I know that, but I don't really want all this info to appear on my first page.
|
![]() ![]() |
|
Lo-Fi Version | Time is now: 3rd September 2010 - 05:07 AM |