Jump to content


Photo

vertical calendar listings


  • Please log in to reply
2 replies to this topic

#1 Leesa

Leesa
  • Members
  • Pip
  • Newbie
  • 2 posts

Posted 05 July 2004 - 11:49 PM

Hi,
I've been looking for a simplistic vertical calendar display. Don't mind paying for it.

I don't like the square calendar layouts where you have to click on a date to see what is listed in it or the ones that squash a lot of info into one square.

I'd like to find a vertical calendar listing (php/mysql) that sorts by month and then just does a simple listing of events. Skipping empty dates.

Hopefully it will only list the months/events for today to future and skip the ones that have already passed.


Any help in finding one would be greatly appreciated!!

#2 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 06 July 2004 - 01:42 AM

Here's the one I use. You can format the output as you see fit. And it only shows events that haven't passed. Database table construction should be evident from the code below (I hope).

<?
include("local_includes/top.php");

echo "<h1>Events Calendar</h1>";

// show what's new as a separate page - all data
$nodat = "<p>The \"<em>events</em>\" database is currently empty.</p>";
include("local_includes/db_conn.php");
$dbtable = "happening";
$today = date("Y-m-d");

mysql_connect($dbhost, $dblogin, $dbpass) or die ("Error: Unable to connect to the database."); 
mysql_select_db($dbname) or die ("Error: Unable to open the database."); 
$query = "SELECT * FROM $dbtable where ev_dat>'$today' order by ev_dat"; 
$result = mysql_query ($query);
$recs = mysql_num_rows($result); // any information in database?
if(!$recs) {
    echo $nodat;
}
else {
    while ($myrow = mysql_fetch_array($result)) // loop through all results
    { 
        echo "<h2>";
  $new_dt = strtotime($myrow['ev_dat']);
  echo date("l, F j, Y" , $new_dt);
  echo "</h2><p>";
        echo "Event: ". $myrow['ev_title']. "<br />Location: ". $myrow['ev_locn'];
  if ($myrow['ev_desc']!="") {
      echo "<br />Details: ". nl2br($myrow['ev_desc']);
  }	
  echo "</p><br />";
    }
}

include("local_includes/bottom.php");
?>
Database table:

CREATE TABLE happening (
  id smallint(4) NOT NULL auto_increment,
  ev_dat date NOT NULL default '0000-00-00',
  ev_locn varchar(60) NOT NULL default '',
  ev_title text NOT NULL,
  ev_desc text,
  PRIMARY KEY  (id)
) TYPE=MyISAM;


Legend has it that reading the manual never killed anyone.
My site

#3 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 06 July 2004 - 11:45 PM

BTW, this is a script I use on more than one client site, and there's a user-proof editor for it that allows those site owners to list, add, delete, and edit events from a protected admin area. Then again, maybe that's not what you were looking for.
Legend has it that reading the manual never killed anyone.
My site




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users