Jump to content

vertical calendar listings


Recommended Posts

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!!

Link to comment
https://forums.phpfreaks.com/topic/1890-vertical-calendar-listings/
Share on other sites

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;

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.