Jump to content

Need help modifying existing calendar


3dshader05

Recommended Posts

Hello,

 

I am using a modified version of this AJAX calendar:

http://www.bmgadg.com/super_ajax_calendar.php

 

Everything works perfectly for what I need.  BUT my client just requested that the admin be able to choose a category for any new event that is created, and based on that event's category, display a certain badge on the day that it occurs.

 

For example, in creating a new event, the user wants to specify it as a "dinner" event.  So I need a dropdown box displaying the categories.  Then, when you look at the actual calendar, a little symbol is on that date signifying "dinner" (knife and fork maybe). Then, if they add another event on that date, say a golf outing, there would be a second symbol on the calendar signifying that.  Make sense?

 

Below is the code for the calendar itself:

<? 
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT" ); 
header("Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . "GMT" ); 
header("Cache-Control: no-cache, must-revalidate" ); 
header("Pragma: no-cache" );
header("Content-Type: text/xml; charset=utf-8");

//////////////////////////////////////
// set these variables for your MySQL
$dbhost = 'localhost';	// usually localhost
$dbuser = 'root';		// database username
$dbpass = 'root';		// database password
//////////////////////////////////////

$db = @mysql_connect($dbhost, $dbuser, $dbpass) or die ("<?xml version=\"1.0\" ?><response><content><![CDATA[<span class='error'>Database connection failed.</span>]]></content></response>");
mysql_select_db('calendar');

$xml = '<?xml version="1.0" ?><response><content><![CDATA[';

if($_GET['event'] != '') {
$fields = explode("-",$_GET['event']);
$result = mysql_query("SELECT *,DATE_FORMAT(`date`,'%b %e, %Y at %l:%i%p') as thedate,DATE_FORMAT(`date`,'%c') as themonth,DATE_FORMAT(`date`,'%Y') as theyear FROM `events` WHERE YEAR(`date`) = ".$fields[0]." AND MONTH(`date`) = ".$fields[1]." AND DAYOFMONTH(`date`) = ".$fields[2]." ORDER BY `num` ASC");

$i = 0;
while($row = mysql_fetch_array($result)) {
	$xml .= "<div id='event'";
	if($i < (mysql_num_rows($result)-1)) $xml .= " style='border-bottom:none'";
	$xml .= "><div class='heading'><div class='title'>".$row['heading']."</div><div class='posted'>".$row['thedate']."</div>";
	if($i == 0) $xml .= "<div class='back'><a href='javascript:navigate(".$row['themonth'].",".$row['theyear'].",\"\")'>Return to calendar</a></div>";
	$xml .= "</div><div class='line'>".$row['body']."</div></div>";
	$i++;
}

} else {
$month = $_GET['month'];
$year = $_GET['year'];

if($month == '' && $year == '') { 
	$time = time();
	$month = date('n',$time);
    $year = date('Y',$time);
}

$date = getdate(mktime(0,0,0,$month,1,$year));
$today = getdate();
$hours = $today['hours'];
$mins = $today['minutes'];
$secs = $today['seconds'];

if(strlen($hours)<2) $hours="0".$hours;
if(strlen($mins)<2) $mins="0".$mins;
if(strlen($secs)<2) $secs="0".$secs;

$days=date("t",mktime(0,0,0,$month,1,$year));
$start = $date['wday']+1;
$name = $date['month'];
$year2 = $date['year'];
$offset = $days + $start - 1;

if($month==12) { 
	$next=1; 
	$nexty=$year + 1; 
} else { 
	$next=$month + 1; 
	$nexty=$year; 
}

if($month==1) { 
	$prev=12; 
	$prevy=$year - 1; 
} else { 
	$prev=$month - 1; 
	$prevy=$year; 
}

if($offset <= 28) $weeks=28; 
elseif($offset > 35) $weeks = 42; 
else $weeks = 35; 

$xml .= "<table class='cal' cellpadding='0' cellspacing='1'>
		<tr>
			<td colspan='7' class='calhead'>
				<table>
				<tr>
					<td>
						$name $year2
					</td>
					<td align='right'>
						<a href='javascript:navigate($prev,$prevy,\"\")' style='border:none'><img src='http://localhost:8888/super_ajax_calendar/calendar/images/calLeft.gif' alt='prev' /></a> <a href='javascript:navigate(\"\",\"\",\"\")' style='border:none'><img src='http://localhost:8888/super_ajax_calendar/calendar/images/calCenter.gif' alt='Today' /></a> <a href='javascript:navigate($next,$nexty,\"\")' style='border:none'><img src='http://localhost:8888/super_ajax_calendar/calendar/images/calRight.gif' alt='next' /></a>
					</td>
				</tr>
				</table>
			</td>
		</tr>
		<tr class='dayhead'>
			<td>Sun</td>
			<td>Mon</td>
			<td>Tue</td>
			<td>Wed</td>
			<td>Thu</td>
			<td>Fri</td>
			<td>Sat</td>
		</tr>";

$col=1;
$cur=1;
$next=0;

for($i=1;$i<=$weeks;$i++) { 
	if($next==3) $next=0;
	if($col==1) $xml.="\n<tr class='dayrow'>"; 
  	
	$xml.="\t<td valign='top' onMouseOver=\"this.className='dayover'\" onMouseOut=\"this.className='dayout'\">";

	if($i <= ($days+($start-1)) && $i >= $start) {
		$xml.="<div class='day'><b";

		if(($cur==$today[mday]) && ($name==$today[month]) && ($year2==$today[year])) $xml.=" style='color:#C00'";

		$xml.=">$cur</b></div>";

		$result = mysql_query("SELECT DATE_FORMAT(`date`,'%Y-%m-%e') FROM `events` WHERE MONTHNAME(`date`)='$name' AND DAYOFMONTH(`date`)=$cur AND YEAR(`date`)=$year2");
		if(mysql_num_rows($result) > 0) {
			$row = mysql_fetch_row($result);
			$xml.="<div class='calevent'><a href='javascript:navigate(\"\",\"\",\"".$row[0]."\")'><img src='http://localhost:8888/super_ajax_calendar/calendar/images/cap.png' alt='View Events' /></a></div>";			
		}

		$xml.="\n\t</td>\n";

		$cur++; 
		$col++; 

	} else { 
		$xml.=" \n\t</td>\n"; 
		$col++; 
	}  
	    
    if($col== { 
	    $xml.="\n</tr>\n"; 
	    $col=1; 
    }
}

$xml.="<tr>
		<td colspan='7' class='calfoot'><a href='super_calendar_admin.php'>ADD EVENT</a></td>
		</tr>
		</table>";
  
}

$xml .= "]]></content></response>";
echo $xml;

?>

 

And now the code for the calendar admin page:

<?
//////////////////////////////////////
// add and remove users here
$vu = array('root' => 'root'); 
//////////////////////////////////////

function doAuth() {
header('WWW-Authenticate: Basic realm="Protected Area"');
    header('HTTP/1.0 401 Unauthorized');
    echo 'Valid username / password required.';
    exit;	
}

function checkUser() {
global $vu;
$b = false;
if($_SERVER['PHP_AUTH_USER']!='' && $_SERVER['PHP_AUTH_PW']!='') {
	if($vu[$_SERVER['PHP_AUTH_USER']] == $_SERVER['PHP_AUTH_PW']) $b = true;
}
return $b;
}

if(!checkUser()) doAuth();

//////////////////////////////////////
// set these variables for your MySQL
$dbhost = 'localhost';	// usually localhost
$dbuser = 'root';		// database username
$dbpass = 'root';		// database password
//////////////////////////////////////

$f = ($_GET['f'] != '')? $_GET['f']:$_POST['f'];
$sf = ($_GET['sf'] != '')? $_GET['sf']:$_POST['sf'];

if($f == 'cal') {
$output = '';
$month = $_GET['month'];
$year = $_GET['year'];

if($month == '' && $year == '') { 
	$time = time();
	$month = date('n',$time);
    	$year = date('Y',$time);
}

$date = getdate(mktime(0,0,0,$month,1,$year));
$today = getdate();
$hours = $today['hours'];
$mins = $today['minutes'];
$secs = $today['seconds'];

if(strlen($hours)<2) $hours="0".$hours;
if(strlen($mins)<2) $mins="0".$mins;
if(strlen($secs)<2) $secs="0".$secs;

$days=date("t",mktime(0,0,0,$month,1,$year));
$start = $date['wday']+1;
$name = $date['month'];
$year2 = $date['year'];
$offset = $days + $start - 1;

if($month==12) { 
	$next=1; 
	$nexty=$year + 1; 
} else { 
	$next=$month + 1; 
	$nexty=$year; 
}

if($month==1) { 
	$prev=12; 
	$prevy=$year - 1; 
} else { 
	$prev=$month - 1; 
	$prevy=$year; 
}

if($offset <= 28) $weeks=28; 
elseif($offset > 35) $weeks = 42; 
else $weeks = 35; 

$output .= "
<table class='cal' cellspacing='1'>
<tr>
	<td colspan='7' style='padding:0px'>
		<table class='calhead'>
		<tr>
			<td align='left'>
				<a href='javascript:navigate($prev,$prevy)'><img src='http://localhost:8888/super_ajax_calendar/calendar/images/calLeft.gif'></a> <a href='javascript:navigate(\"\",\"\")'><img src='http://localhost:8888/super_ajax_calendar/calendar/images/calCenter.gif'></a> <a href='javascript:navigate($next,$nexty)'><img src='http://localhost:8888/super_ajax_calendar/calendar/images/calRight.gif'></a>
			</td>
			<td align='right'>
				<div>$name $year2</div>
			</td>
		</tr>
		</table>
	</td>
</tr>
<tr class='dayhead'>
	<td>Sun</td>
	<td>Mon</td>
	<td>Tue</td>
	<td>Wed</td>
	<td>Thu</td>
	<td>Fri</td>
	<td>Sat</td>
</tr>";

$col=1;
$cur=1;
$next=0;

for($i=1;$i<=$weeks;$i++) { 
	if($next==3) $next=0;
	if($col==1) $output.="<tr class='dayrow'>"; 
  	
	$output.="<td valign='top' onMouseOver=\"this.className='dayover'\" onMouseOut=\"this.className='dayout'\">";

	if($i <= ($days+($start-1)) && $i >= $start) {
		$m = ($month<10)? "0".$month:$month;
		$d = ($cur<10)? "0".$cur:$cur;
		$output.="<a href=\"javascript:loadDate('".$year2."-".$m."-".$d."')\" class=\"day\"><b";

		if(($cur==$today[mday]) && ($name==$today[month])) $output.=" style='color:#C00'";

		$output.=">$cur</b></a></td>";

		$cur++; 
		$col++; 

	} else { 
		$output.=" </td>"; 
		$col++; 
	}  
	    
    if($col== { 
	    $output.="</tr>"; 
	    $col=1; 
    }
}

$output.="</table>";
  
echo $output;
exit;
}

$db = @mysql_connect($dbhost, $dbuser, $dbpass) or die ('Could not connect to the database.');
mysql_select_db('calendar');

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<title>AJAX PHP Calendar Admin Tool</title>
<meta name="keywords" content="linkable ajax calendar, free ajax calendar, website calendar, ajax script, ajax calendar, php calendar" />
<meta name="description" content="Free Super PHP AJAX Calendar for your website. Includes an admin tool for ease of use!" />
<style type="text/css">
body {
background: #CCC;
text-align: center;
color: #FFF;
font-family: Arial,sans-serif;
}

#main {
margin: 0 auto;
background: #444;
border: 2px solid #FFF;
width: 760px;
}

#top, #bottom {
text-align: left;
width: 740px;
padding: 10px;
}

#top {
position: relative;
height: 40px;
line-height: 40px;
background: transparent url('http://localhost:8888/super_ajax_calendar/calendar/images/calIcon.gif') no-repeat 10px 9px;
font-weight: bold;
border-bottom: 1px solid #EEE;
}

#top h3 {
padding: 0;
margin: 0;
margin-left: 55px;
}

#top .menu {
position: absolute;
top: 10px;
right: 10px;
height: 30px;
line-height: 30px;
font-size: 12px;
}

#top .menu a {
font-size: 12px;
font-weight: bold;
text-decoration: none;
color: #FFF;
padding: 5px;	
}

#top .menu a:hover {
text-decoration: underline;
}

#bottom {
background: #676767;
overflow: auto;
}

#bottom h3 {
margin-top: 0;
padding-top: 0;
}

#bottom a {
color: #FFF;
font-size: 11px;
font-weight: bold;
}

#fields {	
width: 100%;
height: 100%;
overflow: auto;
}

.field, #fields div {
padding-top: 10px;
clear: both;
}

.label {
width: 125px;
}

.label, .box {
float: left;
}

#calendar td {
padding: 3px;
}

#calwin {
width: 230px;
position: absolute;
top: 100px;
left: 50%;
margin-left: -150px;
display: none;
background: transparent;
}

.bar {
text-align: right;
background: url('http://localhost:8888/super_ajax_calendar/calendar/images/calBar.gif') no-repeat top left;
}

.bar img {
border: none;
}

.bar a {
margin-right: 5px;
}

#calback {
width: 100%;
background: #FFF url('http://localhost:8888/super_ajax_calendar/calendar/images/calWaiting.gif') no-repeat center center;
}

#calendar {
width: 100%;
height: 100%;
opacity: 0;
filter: alpha(opacity=0); 
-moz-opacity: 0;
}

.cal {
background: #444;
width: 100%;
}

.calhead {
width: 100%;
font-weight: bold;
color: #FFF;
font-size: 14px;
}

.calhead td {
padding: 0px;
}

.calhead img {
border: none;
}

.dayhead {
height: 18px;
background: #EEE;
}

.dayhead td {
font-size: 11px;
text-align: center;
color: #000;
}

.dayrow {
background: #FFF;
height: 20px;
}

.dayrow td {
width: 14%;
color: #000;
font-size: .7em;
text-align: right;
}

.day {
text-decoration: none;
color: #000;
display: block;
width: 100%;
height: 100%;
}

.dayover {
background: #EEE;
}

.dayout {
background: #FFF;
}
</style>
<script type="text/javascript">
var req;

function showCal() {
getObject("calwin").style.display = "block";
navigate('','');
}

function hideCal() {
getObject("calwin").style.display = "none";
}

function navigate(month,year) {
setFade(0);
var url = "super_calendar_admin.php?f=cal&month="+month+"&year="+year;
if(window.XMLHttpRequest) {
	req = new XMLHttpRequest();
} else if(window.ActiveXObject) {
	req = new ActiveXObject("Microsoft.XMLHTTP");
}
req.open("GET", url, true);
req.onreadystatechange = callback;
req.send(null);
}

function callback() {        
obj = getObject("calendar");
if(req.readyState == 4) {
	response = req.responseText;
	obj.innerHTML = response;
	setFade(100);
}
}

function setFade(amt) {
obj = getObject("calendar");

amt = (amt == 100)?99.999:amt;
  
// IE
obj.style.filter = "alpha(opacity:"+amt+")";
  
// Safari<1.2, Konqueror
obj.style.KHTMLOpacity = amt/100;
  
// Mozilla and Firefox
obj.style.MozOpacity = amt/100;
  
// Safari 1.2, newer Firefox and Mozilla, CSS3
obj.style.opacity = amt/100;
}

function getObject(obj) {
var o;
if(document.getElementById) o = document.getElementById(obj);
else if(document.all) o = document.all.obj;	
return o;	
}

function loadDate(d) {
document.f.date.value = d;
hideCal();
}
</script>
</head>
<body>
<div id="main">
<div id="top">
	<h3>AJAX Calendar Admin</h3>
	<div class="menu">
		<a href="?f=new&sf=list">New Event</a> | <a href="?f=edit&sf=list">Edit / Delete Event</a>
	</div>
</div>
<div id="bottom">
<?

if($f == '') {
$f = 'new';
$sf = 'list';
}


if($f == 'new') {
echo "<h3>New Event</h3>";
$time = $_POST['date']." ".$_POST['hour'].":".$_POST['min'].":00";

if($sf == 'save') {	
	$query = "INSERT INTO `events` (`date`,`heading`,`body`) VALUES ('".$time."','".$_POST['heading']."','".$_POST['event']."')";
	mysql_query($query);

	if(mysql_error() != '') $err .= mysql_errno().": ".mysql_error()."<br />";

	if($err!='') {
		echo "<img src=\"http://localhost:8888/super_ajax_calendar/calendar/images/calError.gif\" /> Sorry, a database error occured.<br />".$err;
	} else {
		echo "<img src=\"http://localhost:8888/super_ajax_calendar/calendar/images/calSuccess.gif\" /> The event was stored successfully";
	}

} else if($sf == 'list') {
?>	
	<form name="f" method="post" action="?f=new&sf=save">
	<div id="fields">
		<div class="field"><span class="label">Date / Time:</span><span class="box"><input type="text" name="date" /> <a href="javascript:showCal('','')"><img src="http://localhost:8888/super_ajax_calendar/calendar/images/calFunc.gif" style="border:none" /></a><p style="margin: 4px 0px 0px 0px"><select name="hour">
<?			
	for($i=0;$i<24;$i++) {
		$out = ($i < 10)? "0".$i:$i;
		echo "<option value=\"".$out."\">".$out."</option>";
	}
?>			
		</select> : <select name="min">
<?		
	for($i=0;$i<60;$i++) {
		$out = ($i < 10)? "0".$i:$i;
		echo "<option value=\"".$out."\">".$out."</option>";
	}
?>
		</select></p></span></div>
		<div class="field"><span class="label">Heading:</span><span class="box"><input type="text" size="50" name="heading" /></span></div>
		<div class="field"><span class="label">Event:<br /><span style="font-size:9px">(HTML is OK)</span></span><span class="box"><textarea name="event" cols="50" rows="6"></textarea></span></div>
	</div>
	<br />
	<div class="field"><span class="label"> </span><span class="box"><input type="submit" value="    Add Event    " /></span></div>
	</form>
<?
}

} else if($f == 'edit') {
echo "<h3>Edit / Delete Event</h3>";

if($sf == 'list') {
	$query = "SELECT `num`,`heading`,DATE_FORMAT(`date`,'%m-%d-%Y') as `fdate` FROM `events` ORDER BY `date` DESC";
	$result = mysql_query($query);

	while($row = mysql_fetch_array($result)) {
		$evtlist .= "<option value=\"".$row['num']."\">[ ";
		$evtlist .= $row['fdate']." ] ".substr($row['heading'],0,30);
		if(strlen($row['heading'])>30) $evtlist .= "...";
		$evtlist .= "</option>";
	}
?>
	<form name="f" method="post" action="?f=edit&sf=show">
	<div id="fields">
		<div class="field"><span class="label">Event:</span><span class="box"><select name="num"><option value=""></option><?=$evtlist;?></select> <input type="submit" value="    Edit Event    " /></span></div>
	</div>
	</form>

<?

} else if($sf == 'show') {
	$query = "SELECT `num`,`heading`,`body`,DATE_FORMAT(`date`,'%Y-%m-%d') as `date`,DATE_FORMAT(`date`,'%H') as `hour`,DATE_FORMAT(`date`,'%i') as `min` FROM `events` WHERE `num`=".$_POST['num']." LIMIT 1";
	$result = mysql_query($query);
	$row = mysql_fetch_array($result);		
?>
	<form name="f" method="post" action="?f=edit&sf=save">
	<input type="hidden" name="num" value="<?=$row['num'];?>" />
	<img src="http://localhost:8888/super_ajax_calendar/calendar/images/calDelete.gif" /> <a href="?f=delete&num=<?=$row['num'];?>" onClick="return confirm('Are you sure? This is permanent!')" style="color:#F26343;font-weight:bold">Delete Event</a>
	<div id="fields">
		<div class="field"><span class="label">Date / Time:</span><span class="box"><input type="text" name="date" value="<?=$row['date'];?>" /> <a href="javascript:showCal('','')"><img src="http://localhost:8888/super_ajax_calendar/calendar/images/calFunc.gif" style="border:none" /></a><p style="margin: 4px 0px 0px 0px"><select name="hour">
<?		
	for($i=0;$i<24;$i++) {
		$out = ($i < 10)? "0".$i:$i;
		echo "<option value=\"".$out."\"";
		if($row['hour'] == $out) echo " selected";
		echo ">".$out."</option>";
	}
?>
		</select> : <select name="min">
<?		
	for($i=0;$i<60;$i++) {
		$out = ($i < 10)? "0".$i:$i;
		echo "<option value=\"".$out."\"";
		if($row['min'] == $out) echo " selected";			
		echo ">".$out."</option>";
	}
?>
		</select></p></span></div>
		<div class="field"><span class="label">Heading:</span><span class="box"><input type="text" size="50" name="heading" value="<?=$row['heading'];?>" /></span></div>
		<div class="field"><span class="label">Event:<br /><span style="font-size:9px">(HTML is OK)</span></span><span class="box"><textarea name="event" cols="50" rows="6"><?=$row['body'];?></textarea></span></div>
	</div>
	<br />

	<div class="field"><span class="label"> </span><span class="box"><input type="submit" value="    Save Event    " /></span></div>
	</form>

<?

} else if($sf == 'save') {
	$time = $_POST['date']." ".$_POST['hour'].":".$_POST['min'].":00";		
	$query = "UPDATE `events` SET `date`='".$time."',`heading`='".$_POST['heading']."',`body`='".$_POST['event']."' WHERE `num`=".$_POST['num'];
	mysql_query($query);
	if(mysql_error() != '') $err .= mysql_errno().": ".mysql_error()."<br />";

	if($err!='') {
		echo "<img src=\"http://localhost:8888/super_ajax_calendar/calendar/images/calError.gif\" /> Sorry, a database error occured.<br />".$err;
	} else {
		$status = ($cur>0)? "currently active.":"not currently active.";
		echo "<img src=\"http://localhost:8888/super_ajax_calendar/calendar/images/calSuccess.gif\" /> The event was updated successfully.";
	}
}

} else if($f == 'delete') {
mysql_query("DELETE FROM `events` WHERE `num`=".$_GET['num']);
if(mysql_error() != '') $err .= mysql_errno().": ".mysql_error()."<br />";

if($err!='') {
		echo "<img src=\"http://localhost:8888/super_ajax_calendar/calendar/images/calError.gif\" /> Sorry, a database error occured.<br />".$err;
} else {
		echo "<img src=\"http://localhost:8888/super_ajax_calendar/calendar/images/calSuccess.gif\" /> The event was deleted successfully.";		
}
}	
?>	
</div>
</div>
<div id="calwin">
<div class="bar"><a href="javascript:hideCal()"><img src="http://localhost:8888/super_ajax_calendar/calendar/images/calClose.gif" alt="close" /></a></div>
<div id="calback">
	<div id="calendar"></div>
</div>
</div>
</body>
</html>

 

Any help would be greatly appreciated!

 

 

Link to comment
Share on other sites

you would have to add a category field to the calendar database table so that each event has a category classification. i would also make a category table which stores each possible category. that way, you can iterate through the category table to list the categories in a drop down menu and the only place you would need to add/delete/modify categories would be in the category table, not drop downs/html/etc.

Link to comment
Share on other sites

  • 2 weeks later...

you would have to add a category field to the calendar database table so that each event has a category classification. i would also make a category table which stores each possible category. that way, you can iterate through the category table to list the categories in a drop down menu and the only place you would need to add/delete/modify categories would be in the category table, not drop downs/html/etc.

 

I would also include a field to reference the image that should be displayed so you don't have to do any logic on the PHP side to determine what image to display.

Link to comment
Share on other sites

Thanks alot for the replies so far!  Adding database fields and all that makes sense to me.  However, I am not by any means a PHP guru.  Based on what's already there, is there some standard code that I could use to make this happen?  I just don't know how to tell it to pull from that database, and display multiple badges.  Right now, it just shows one image or text even if there are multiple events on the day.

Link to comment
Share on other sites

Ok, I actually got it to work.  The event categories show up no problem.  But now I am presented with a new problem.  The event badges won't link to the date's details, as with the original calendar.  Below is the snippet of original code:

$result = mysql_query("SELECT DATE_FORMAT(`date`,'%Y-%m-%e') FROM `events` WHERE MONTHNAME(`date`)='$name' AND DAYOFMONTH(`date`)=$cur AND YEAR(`date`)=$year2");
		if(mysql_num_rows($result) > 0) {
			$row = mysql_fetch_row($result);
			$xml.="<div class='calevent'><a href='javascript:navigate(\"\",\"\",\"".$row[0]."\")'>Event</a></div>";			
		}

 

And here is my version, which makes the multiple categories work:

$result = mysql_query("SELECT *,DATE_FORMAT(`date`,'%Y-%m-%e') FROM `events` WHERE MONTHNAME(`date`)='$name' AND DAYOFMONTH(`date`)=$cur AND YEAR(`date`)=$year2");
			$row = mysql_fetch_array($result);
			if ($row['category'] == "festival") {
			$xml.= "<div><div class='calevent'><a href='javascript:navigate(\"\",\"\",\"".$row[0]."\")'>Festival</a></div>";
			} $xml.= "</b>"; if ($row['category'] == "dinner") {
			$xml.= "<div class='calevent'><div class='calevent'><a href='javascript:navigate(\"\",\"\",\"".$row[0]."\")'>Dinner</a></div>";
			} $xml.= "</b>"; if ($row['category'] == "music") {
			$xml.= "<div class='calevent'><div class='calevent'><a href='javascript:navigate(\"\",\"\",\"".$row[0]."\")'>Music</a></div>";
			}

 

The switch to the date details page is triggered via javascript, and I set the link up the exact same way, but it doesn't lead anywhere.  Any ideas?

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.