<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Creating a Calendar in PHP</title>
	<atom:link href="http://www.ultramegatech.com/2009/01/creating-a-calendar-in-php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ultramegatech.com/2009/01/creating-a-calendar-in-php/</link>
	<description>Web development blog</description>
	<lastBuildDate>Wed, 11 Apr 2012 03:57:31 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: aman</title>
		<link>http://www.ultramegatech.com/2009/01/creating-a-calendar-in-php/comment-page-1/#comment-1919</link>
		<dc:creator>aman</dc:creator>
		<pubDate>Wed, 16 Nov 2011 14:54:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.ultramegatech.com/blog/?p=168#comment-1919</guid>
		<description>woww.. thanks a so  much..</description>
		<content:encoded><![CDATA[<p>woww.. thanks a so  much..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stino</title>
		<link>http://www.ultramegatech.com/2009/01/creating-a-calendar-in-php/comment-page-1/#comment-1912</link>
		<dc:creator>Stino</dc:creator>
		<pubDate>Wed, 09 Nov 2011 16:21:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.ultramegatech.com/blog/?p=168#comment-1912</guid>
		<description>i live in belgium and we start always on calendar from monday -&gt; sunday, 
what need i to change?</description>
		<content:encoded><![CDATA[<p>i live in belgium and we start always on calendar from monday -&gt; sunday,<br />
what need i to change?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave</title>
		<link>http://www.ultramegatech.com/2009/01/creating-a-calendar-in-php/comment-page-1/#comment-1795</link>
		<dc:creator>Dave</dc:creator>
		<pubDate>Thu, 12 May 2011 01:16:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.ultramegatech.com/blog/?p=168#comment-1795</guid>
		<description>Thanks! I hooked this to a mySQL db in order to show events. Works great, but I cannot figure out modifying the css in order to allow the height of a row of days to increase - if there are a bunch of events on that day...
tried setting overflow to auto, but then I get a scroll bar in the day to scroll the text vertically. Not ideal. Would just like the height to increase as necessary.</description>
		<content:encoded><![CDATA[<p>Thanks! I hooked this to a mySQL db in order to show events. Works great, but I cannot figure out modifying the css in order to allow the height of a row of days to increase &#8211; if there are a bunch of events on that day&#8230;<br />
tried setting overflow to auto, but then I get a scroll bar in the day to scroll the text vertically. Not ideal. Would just like the height to increase as necessary.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sven</title>
		<link>http://www.ultramegatech.com/2009/01/creating-a-calendar-in-php/comment-page-1/#comment-1783</link>
		<dc:creator>Sven</dc:creator>
		<pubDate>Tue, 26 Apr 2011 17:35:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.ultramegatech.com/blog/?p=168#comment-1783</guid>
		<description>sorry that last post stripped the code out!....  Standard XML format, with a root element of &#039;events&#039;, and a child element of &#039;event name=&quot;1&quot;&#039; You must include that name attribute, to insert properly into your calendar...</description>
		<content:encoded><![CDATA[<p>sorry that last post stripped the code out!&#8230;.  Standard XML format, with a root element of &#8216;events&#8217;, and a child element of &#8216;event name=&#8221;1&#8243;&#8216; You must include that name attribute, to insert properly into your calendar&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sven</title>
		<link>http://www.ultramegatech.com/2009/01/creating-a-calendar-in-php/comment-page-1/#comment-1782</link>
		<dc:creator>Sven</dc:creator>
		<pubDate>Tue, 26 Apr 2011 17:31:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.ultramegatech.com/blog/?p=168#comment-1782</guid>
		<description>For those that find this and would like to add events, I have figured it out and took it another step further.  I use an external XML file to store the events.  I then use simpleXML and php to load the XML file, loop through the elements of the XML and return an array for php to use.

Once I have the array, I simply insert the contents of the XML file to the proper day.
Here is a sample XML:[code]


      
	EVENTS 1!
      
      
	EVENTS 2!
       //... etc, throught 31 (for 31 days in a month)
[/code]

I then, in my php file, under where Steve declared his date variables, create a new variable and foreach loop:
Open the XML file
[code]$xml = simplexml_load_file( &#039;event.xml&#039; )
	or die ( &quot;Unable to load the May XML file.&quot; );[/code]
Loop through the XML &quot;Day&#039;s Events&quot;.  Please note, you NEED to have the Event element name attribute set to name=&quot;1&quot;, etc, so that when the loop creates the array, it will match the loop for creating the calendar days!
[code]foreach( $xml -&gt; event as $a =&gt; $b) {
	// Set array from XML
	$event[ (string) $b[ &#039;name&#039; ]] = ( string ) $b[0];
}[/code]

Lastly, I just simply insert and echo with the variables, into the  that is created for &#039;Today&#039; and &#039;Day&#039;:
[code]echo $event[$i];[/code]

This works great for a single month, but if you need to schedule events for several, you will need either a better way, or multiple XML files for each month.  Then you can create an if/elseif statement for the load fuction to call the right XML file for the right month.
[code]if( $first[ &#039;mon&#039; ] == 5 ) {
	$xml = simplexml_load_file( &#039;may_events.xml&#039; )
		or die ( &quot;Unable to load the May XML file.&quot; );
	} elseif( $first[ &#039;mon&#039; ] == 6 ) {
		$xml = simplexml_load_file( &#039;june_events.xml&#039; )
			or die ( &quot;Unable to load the June XML file.&quot; );
			} else {
			$xml = simplexml_load_file( &#039;july_events.xml&#039; )
				or die ( &quot;Unable to load the July XML file.&quot; );
	}[/code]

Then where you call the events into the calendar you could add something like:
[code]if( $first[ &#039;mon&#039; ] == 5 &#124;&#124; $first[ &#039;mon&#039; ] == 6 &#124;&#124; $first[ &#039;mon&#039; ] == 7 ) {
				echo $event[$i];
		} else {
	}[/code]

Hope that helps someone out in the future!  Happy Coding!

Sven</description>
		<content:encoded><![CDATA[<p>For those that find this and would like to add events, I have figured it out and took it another step further.  I use an external XML file to store the events.  I then use simpleXML and php to load the XML file, loop through the elements of the XML and return an array for php to use.</p>
<p>Once I have the array, I simply insert the contents of the XML file to the proper day.<br />
Here is a sample XML:[code]</p>
<p>	EVENTS 1!</p>
<p>	EVENTS 2!<br />
       //... etc, throught 31 (for 31 days in a month)<br />
[/code]</p>
<p>I then, in my php file, under where Steve declared his date variables, create a new variable and foreach loop:<br />
Open the XML file<br />
[code]$xml = simplexml_load_file( 'event.xml' )<br />
	or die ( "Unable to load the May XML file." );[/code]<br />
Loop through the XML &#8220;Day&#8217;s Events&#8221;.  Please note, you NEED to have the Event element name attribute set to name=&#8221;1&#8243;, etc, so that when the loop creates the array, it will match the loop for creating the calendar days!<br />
[code]foreach( $xml -&gt; event as $a =&gt; $b) {<br />
	// Set array from XML<br />
	$event[ (string) $b[ 'name' ]] = ( string ) $b[0];<br />
}[/code]</p>
<p>Lastly, I just simply insert and echo with the variables, into the  that is created for &#8216;Today&#8217; and &#8216;Day&#8217;:<br />
[code]echo $event[$i];[/code]</p>
<p>This works great for a single month, but if you need to schedule events for several, you will need either a better way, or multiple XML files for each month.  Then you can create an if/elseif statement for the load fuction to call the right XML file for the right month.<br />
[code]if( $first[ 'mon' ] == 5 ) {<br />
	$xml = simplexml_load_file( 'may_events.xml' )<br />
		or die ( "Unable to load the May XML file." );<br />
	} elseif( $first[ 'mon' ] == 6 ) {<br />
		$xml = simplexml_load_file( 'june_events.xml' )<br />
			or die ( "Unable to load the June XML file." );<br />
			} else {<br />
			$xml = simplexml_load_file( 'july_events.xml' )<br />
				or die ( "Unable to load the July XML file." );<br />
	}[/code]</p>
<p>Then where you call the events into the calendar you could add something like:<br />
[code]if( $first[ 'mon' ] == 5 || $first[ 'mon' ] == 6 || $first[ 'mon' ] == 7 ) {<br />
				echo $event[$i];<br />
		} else {<br />
	}[/code]</p>
<p>Hope that helps someone out in the future!  Happy Coding!</p>
<p>Sven</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sven</title>
		<link>http://www.ultramegatech.com/2009/01/creating-a-calendar-in-php/comment-page-1/#comment-1776</link>
		<dc:creator>Sven</dc:creator>
		<pubDate>Sat, 23 Apr 2011 18:40:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.ultramegatech.com/blog/?p=168#comment-1776</guid>
		<description>How would you then add content to the individual dates?  I have &#039;echo&#039;ed &quot;Test&quot;, but this shows up in all valid dates for the month.

I would like to show events for each day.</description>
		<content:encoded><![CDATA[<p>How would you then add content to the individual dates?  I have &#8216;echo&#8217;ed &#8220;Test&#8221;, but this shows up in all valid dates for the month.</p>
<p>I would like to show events for each day.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dan</title>
		<link>http://www.ultramegatech.com/2009/01/creating-a-calendar-in-php/comment-page-1/#comment-1203</link>
		<dc:creator>Dan</dc:creator>
		<pubDate>Tue, 20 Apr 2010 18:52:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.ultramegatech.com/blog/?p=168#comment-1203</guid>
		<description>Looks good! The only thing missing is the ability to view next and previous month!</description>
		<content:encoded><![CDATA[<p>Looks good! The only thing missing is the ability to view next and previous month!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: HGS</title>
		<link>http://www.ultramegatech.com/2009/01/creating-a-calendar-in-php/comment-page-1/#comment-1127</link>
		<dc:creator>HGS</dc:creator>
		<pubDate>Wed, 03 Feb 2010 10:20:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.ultramegatech.com/blog/?p=168#comment-1127</guid>
		<description>Too Good, Thank&#039;s a Ton</description>
		<content:encoded><![CDATA[<p>Too Good, Thank&#8217;s a Ton</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cavo789</title>
		<link>http://www.ultramegatech.com/2009/01/creating-a-calendar-in-php/comment-page-1/#comment-389</link>
		<dc:creator>cavo789</dc:creator>
		<pubDate>Tue, 13 Oct 2009 15:55:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.ultramegatech.com/blog/?p=168#comment-389</guid>
		<description>Thanks a lot !!!   I don&#039;t know yet if I&#039;ll use it but, nevermind, I&#039;ll keep this article in my favorites.</description>
		<content:encoded><![CDATA[<p>Thanks a lot !!!   I don&#8217;t know yet if I&#8217;ll use it but, nevermind, I&#8217;ll keep this article in my favorites.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

