<?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/"
xmlns:series="http://unfoldingneurons.com/"
> <channel><title>Comments on: Add Controls to the PHP&#160;Calendar</title> <atom:link href="http://davidwalsh.name/php-calendar-controls/feed" rel="self" type="application/rss+xml" /><link>http://davidwalsh.name/php-calendar-controls</link> <description>Legendary scribbles about JavaScript, HTML5, AJAX, PHP, CSS, and ∞.</description> <lastBuildDate>Wed, 23 May 2012 19:56:08 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.2</generator> <item><title>By: luke mersh</title><link>http://davidwalsh.name/php-calendar-controls#comment-29065</link> <dc:creator>luke mersh</dc:creator> <pubDate>Mon, 06 Feb 2012 20:34:25 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=3214#comment-29065</guid> <description>Hi there I love your calendar script, i copied all out with the additional controls , but I would like to know how to get the controls to operate the calendar??</description> <content:encoded><![CDATA[<p>Hi there I love your calendar script, i copied all out with the additional controls , but I would like to know how to get the controls to operate the calendar??</p> ]]></content:encoded> </item> <item><title>By: Candy</title><link>http://davidwalsh.name/php-calendar-controls#comment-27936</link> <dc:creator>Candy</dc:creator> <pubDate>Thu, 15 Dec 2011 15:12:08 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=3214#comment-27936</guid> <description>I&#039;ve placed the calender controls in a private function within a calendar class that I built previously, and included a reference to this function where I actually build the calendar.  The controls show up fine, however the calendar itself wont actually change when the controls are used, is there something that I&#039;m doing wrong?&lt;code&gt;
public function buildCalendar()
{
/*
* Determine the calendar month and create an array of
* weekday abbreviations to label the calendar columns
*/
$cal_month = date(&#039;F Y&#039;, strtotime($this-&gt;_useDate));
$weekdays = array(&#039;Sun&#039;, &#039;Mon&#039;, &#039;Tue&#039;,
&#039;Wed&#039;, &#039;Thu&#039;, &#039;Fri&#039;, &#039;Sat&#039;);
/*
* Add a header to the calendar markup
*/
$html = &quot;\n\t$cal_month&quot;.$this-&gt;_buildCalendarControls();
for ( $d=0, $labels=NULL; $d&lt;7; ++$d )
{
$labels .= &quot;\n\t\t&quot; . $weekdays[$d] . &quot;&quot;;
}
$html .= &quot;\n\t&quot;
. $labels . &quot;\n\t&quot;;
/*
* Load events data
*/
$events = $this-&gt;_createEventObj();
/*
* Create the calendar markup
*/
$html .= &quot;\n\t&quot;; // start a new unordered list
for ($i=1, $c=1, $t=date(&#039;j&#039;), $m=date(&#039;m&#039;), $y=date(&#039;Y&#039;);
$c_daysInMonth; ++$i )
{
/*
* Apply a &quot;fill&quot; class to the boxes occuring before
* the first of the month
*/
$class = $i_startDay ? &quot;fill&quot; : NULL;
/*
* Add a &quot;today&quot; class if the current date matches
* the current date
*/
if ( $c==$t &amp;&amp; $m==$this-&gt;_m &amp;&amp; $y==$this-&gt;_y )
{
$class = &quot;today&quot;;
}
/*
* Build the opening and closing list item tags
*/
$ls = sprintf(&quot;\n\t\t&quot;, $class);
$le = &quot;\n\t\t&quot;;
/*
* Add the day of the month to identify the calendar box
*/
if ( $this-&gt;_startDay_daysInMonth&gt;=$c)
{
/*
* Format events data
*/
$event_info = NULL; // clear the variable
if ( isset($events[$c]) )
{
foreach ( $events[$c] as $event )
{
$link = &#039;&lt;a&gt;id . &#039;&quot;&gt;&#039; . $event-&gt;title
. &#039;&lt;/a&gt;&#039;;
$event_info .= &quot;\n\t\t\t$link&quot;;
}
}
$date = sprintf(&quot;\n\t\t\t&lt;strong&gt;%02d&lt;/strong&gt;&quot;, $c++);
}
else { $date=&quot;&#160;&quot;; }
/*
* If the current day is a Saturday, wrap to the next row
*/
$wrap = $i!=0 &amp;&amp; $i%7==0 ? &quot;\n\t\n\t&quot; : NULL;
/*
* Assemble the pieces into a finished item
*/
$html .= $ls . $date . $event_info . $le . $wrap;
}
/*
* Add filler to finish out the last week
*/
while ( $i%7!=1 )
{
$html .= &quot;\n\t\t&#160;&quot;;
++$i;
}
/*
* Close the final unordered list
*/
$html .= &quot;\n\t\n\n&quot;;
/*
* If logged in, display the admin options
*/
$admin = $this-&gt;_adminGeneralOptions();
/*
* Return the markup for output
*/
return $html . $admin;
}
&lt;/code&gt;&lt;code&gt;
private function _buildCalendarControls()
{
/*
* date settings
*/
$month = (int) ($_GET[&#039;month&#039;] ? $_GET[&#039;month&#039;] : date(&#039;m&#039;));
$year = (int) ($_GET[&#039;year&#039;] ? $_GET[&#039;year&#039;] : date(&#039;Y&#039;));
/*
* Select month control
*/
$select_month_control = &#039;&#039;;
for($x = 1; $x &lt;= 12; $x++)
{
$select_month_control .= &#039;&#039;.date(&#039;F&#039;,mktime(0,0,0,$x,1,$year)).&#039;&#039;;
}
$select_month_control .= &#039;&#039;;
/*
* Select year control
*/
$year_range = 7;
$select_year_control = &#039;&#039;;
for($x = ($year-floor($year_range/2)); $x &lt;= ($year+floor($year_range/2)); $x++)
{
$select_year_control .= &#039;&#039;.$x.&#039;&#039;;
}
$select_year_control .= &#039;&#039;;
/*
* &quot;next month&quot; control
*/
$next_month_link = &#039;&lt;a href=&quot;$year + 1).&#039;&quot; rel=&quot;nofollow&quot;&gt; &gt;&gt; &lt;/a&gt;&#039;;
/*
* &quot;previous month&quot; control
*/
$previous_month_link = &#039;&lt;a href=&quot;$year - 1).&#039;&quot; rel=&quot;nofollow&quot;&gt; &lt;&lt; &lt;/a&gt;&#039;;
/*
* Bringing the controls together
*/
$controls = &#039;&#039;.$select_month_control.$select_year_control.&#039;&#160;
&#160;&#160;&#160;&#160;&#160;&#160;&#039;.$previous_month_link.&#039;&#160;&#160;&#160;&#160;&#160;&#039;.$next_month_link.&#039;
&#039;;
echo $controls;
}
&lt;/code&gt;Any help would be appreciated</description> <content:encoded><![CDATA[<p>I&#8217;ve placed the calender controls in a private function within a calendar class that I built previously, and included a reference to this function where I actually build the calendar.  The controls show up fine, however the calendar itself wont actually change when the controls are used, is there something that I&#8217;m doing wrong?</p><p><code><br
/> public function buildCalendar()<br
/> {<br
/> /*<br
/> * Determine the calendar month and create an array of<br
/> * weekday abbreviations to label the calendar columns<br
/> */</p><p> $cal_month = date('F Y', strtotime($this-&gt;_useDate));<br
/> $weekdays = array('Sun', 'Mon', 'Tue',<br
/> 'Wed', 'Thu', 'Fri', 'Sat');</p><p> /*<br
/> * Add a header to the calendar markup<br
/> */<br
/> $html = "\n\t$cal_month".$this-&gt;_buildCalendarControls();<br
/> for ( $d=0, $labels=NULL; $d&lt;7; ++$d )<br
/> {<br
/> $labels .= &quot;\n\t\t" . $weekdays[$d] . "";<br
/> }<br
/> $html .= "\n\t"<br
/> . $labels . "\n\t";</p><p> /*<br
/> * Load events data<br
/> */<br
/> $events = $this-&gt;_createEventObj();</p><p> /*<br
/> * Create the calendar markup<br
/> */<br
/> $html .= "\n\t"; // start a new unordered list<br
/> for ($i=1, $c=1, $t=date('j'), $m=date('m'), $y=date('Y');<br
/> $c_daysInMonth; ++$i )<br
/> {<br
/> /*<br
/> * Apply a "fill" class to the boxes occuring before<br
/> * the first of the month<br
/> */<br
/> $class = $i_startDay ? "fill" : NULL;</p><p> /*<br
/> * Add a "today" class if the current date matches<br
/> * the current date<br
/> */<br
/> if ( $c==$t &amp;&amp; $m==$this-&gt;_m &amp;&amp; $y==$this-&gt;_y )<br
/> {<br
/> $class = "today";<br
/> }</p><p> /*<br
/> * Build the opening and closing list item tags<br
/> */<br
/> $ls = sprintf("\n\t\t", $class);<br
/> $le = "\n\t\t";</p><p> /*<br
/> * Add the day of the month to identify the calendar box<br
/> */<br
/> if ( $this-&gt;_startDay_daysInMonth&gt;=$c)<br
/> {<br
/> /*<br
/> * Format events data<br
/> */<br
/> $event_info = NULL; // clear the variable<br
/> if ( isset($events[$c]) )<br
/> {<br
/> foreach ( $events[$c] as $event )<br
/> {<br
/> $link = '<a>id . '"&gt;' . $event-&gt;title<br
/> . '</a>';<br
/> $event_info .= "\n\t\t\t$link";<br
/> }<br
/> }<br
/> $date = sprintf("\n\t\t\t<strong>%02d</strong>", $c++);<br
/> }<br
/> else { $date="&nbsp;"; }</p><p> /*<br
/> * If the current day is a Saturday, wrap to the next row<br
/> */<br
/> $wrap = $i!=0 &amp;&amp; $i%7==0 ? "\n\t\n\t" : NULL;</p><p> /*<br
/> * Assemble the pieces into a finished item<br
/> */<br
/> $html .= $ls . $date . $event_info . $le . $wrap;<br
/> }</p><p> /*<br
/> * Add filler to finish out the last week<br
/> */<br
/> while ( $i%7!=1 )<br
/> {<br
/> $html .= "\n\t\t&nbsp;";<br
/> ++$i;<br
/> }</p><p> /*<br
/> * Close the final unordered list<br
/> */<br
/> $html .= "\n\t\n\n";</p><p> /*<br
/> * If logged in, display the admin options<br
/> */<br
/> $admin = $this-&gt;_adminGeneralOptions();</p><p> /*<br
/> * Return the markup for output<br
/> */<br
/> return $html . $admin;<br
/> }<br
/> </code></p><p><code><br
/> private function _buildCalendarControls()<br
/> {<br
/> /*<br
/> * date settings<br
/> */<br
/> $month = (int) ($_GET['month'] ? $_GET['month'] : date('m'));<br
/> $year = (int) ($_GET['year'] ? $_GET['year'] : date('Y'));</p><p> /*<br
/> * Select month control<br
/> */<br
/> $select_month_control = '';<br
/> for($x = 1; $x &lt;= 12; $x++)<br
/> {<br
/> $select_month_control .= &#039;'.date('F',mktime(0,0,0,$x,1,$year)).'';<br
/> }<br
/> $select_month_control .= '';</p><p> /*<br
/> * Select year control<br
/> */<br
/> $year_range = 7;<br
/> $select_year_control = '';<br
/> for($x = ($year-floor($year_range/2)); $x &lt;= ($year+floor($year_range/2)); $x++)<br
/> {<br
/> $select_year_control .= &#039;'.$x.'';<br
/> }<br
/> $select_year_control .= '';</p><p> /*<br
/> * "next month" control<br
/> */<br
/> $next_month_link = '<a
href="$year + 1).'" rel="nofollow"> &gt;&gt; </a>';</p><p> /*<br
/> * "previous month" control<br
/> */<br
/> $previous_month_link = '<a
href="$year - 1).'" rel="nofollow"> &lt;&lt; </a>';</p><p> /*<br
/> * Bringing the controls together<br
/> */<br
/> $controls = ''.$select_month_control.$select_year_control.'&nbsp;<br
/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.$previous_month_link.'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.$next_month_link.'<br
/> ';</p><p> echo $controls;<br
/> }<br
/> </code></p><p>Any help would be appreciated</p> ]]></content:encoded> </item> <item><title>By: Ash</title><link>http://davidwalsh.name/php-calendar-controls#comment-27684</link> <dc:creator>Ash</dc:creator> <pubDate>Mon, 21 Nov 2011 13:42:37 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=3214#comment-27684</guid> <description>I know no ones posted in a while but I do not understand where to place the controls in the calendar… if someone would like to send me their full code, they can email me @ &#101;ddy_&#101;&#100;m&#111;&#110;&#100;s&#111;n_&#064;h&#111;&#116;mai&#108;&#046;&#099;&#111;m</description> <content:encoded><![CDATA[<p>I know no ones posted in a while but I do not understand where to place the controls in the calendar… if someone would like to send me their full code, they can email me @ <a
href="m&#97;&#105;lt&#111;:&#101;&#100;&#100;&#121;_&#101;dmo&#110;&#100;&#115;&#111;n&#95;&#64;h&#111;&#116;&#109;&#97;i&#108;.c&#111;&#109;">e&#100;&#100;y&#95;ed&#109;on&#100;&#115;&#111;n&#95;&#64;&#104;&#111;tm&#97;&#105;l.c&#111;m</a></p> ]]></content:encoded> </item> <item><title>By: jamesbondinblack</title><link>http://davidwalsh.name/php-calendar-controls#comment-22961</link> <dc:creator>jamesbondinblack</dc:creator> <pubDate>Sat, 05 Mar 2011 17:21:34 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=3214#comment-22961</guid> <description>Thanks for the script.can anyone help me with high lighting the current day and adding events to the calendar?Thanks</description> <content:encoded><![CDATA[<p>Thanks for the script.</p><p>can anyone help me with high lighting the current day and adding events to the calendar?</p><p>Thanks</p> ]]></content:encoded> </item> <item><title>By: Alexander</title><link>http://davidwalsh.name/php-calendar-controls#comment-22694</link> <dc:creator>Alexander</dc:creator> <pubDate>Fri, 11 Feb 2011 02:57:57 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=3214#comment-22694</guid> <description>I do not understad where to place the controls in the calendar... if someone would like to send me their full code, they can email me @ a&#108;&#101;xpja&#064;&#103;m&#097;&#105;&#108;&#046;com.</description> <content:encoded><![CDATA[<p>I do not understad where to place the controls in the calendar&#8230; if someone would like to send me their full code, they can email me @ <a
href="&#109;&#97;i&#108;&#116;o:&#97;lexp&#106;a&#64;g&#109;a&#105;&#108;&#46;&#99;o&#109;">al&#101;x&#112;&#106;a&#64;&#103;m&#97;&#105;&#108;&#46;co&#109;</a>.</p> ]]></content:encoded> </item> <item><title>By: Jeff Salter</title><link>http://davidwalsh.name/php-calendar-controls#comment-22258</link> <dc:creator>Jeff Salter</dc:creator> <pubDate>Mon, 10 Jan 2011 06:18:23 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=3214#comment-22258</guid> <description>Sorry for the second post,  but I ment the header tags when I said brackets.
Is there any way you could send me the code for this calendar. I am trying to adapt it to a site I am working and I am experiencing a few minor glitches. ie: When I add the controls the month that is printed out in the  &lt;code&gt;&lt;code&gt; brackets does not correspond to the selected month.
Thanks for your help.</description> <content:encoded><![CDATA[<p>Sorry for the second post,  but I ment the header tags when I said brackets.<br
/> Is there any way you could send me the code for this calendar. I am trying to adapt it to a site I am working and I am experiencing a few minor glitches. ie: When I add the controls the month that is printed out in the <code></code><code> brackets does not correspond to the selected month.<br
/> Thanks for your help.</code></p> ]]></content:encoded> </item> <item><title>By: Jeff Salter</title><link>http://davidwalsh.name/php-calendar-controls#comment-22257</link> <dc:creator>Jeff Salter</dc:creator> <pubDate>Mon, 10 Jan 2011 05:38:13 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=3214#comment-22257</guid> <description>Is there any way you could send me the code for this calendar.  I am trying to adapt it to a site I am working and I am experiencing a few minor glitches.  ie: When I add the controls the month that is printed out in the  brackets does not correspond to the selected month.Thanks for your help.</description> <content:encoded><![CDATA[<p>Is there any way you could send me the code for this calendar.  I am trying to adapt it to a site I am working and I am experiencing a few minor glitches.  ie: When I add the controls the month that is printed out in the  brackets does not correspond to the selected month.</p><p>Thanks for your help.</p> ]]></content:encoded> </item> <item><title>By: lee</title><link>http://davidwalsh.name/php-calendar-controls#comment-21357</link> <dc:creator>lee</dc:creator> <pubDate>Sat, 20 Nov 2010 15:33:18 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=3214#comment-21357</guid> <description>I have the calendar working without the database.  I am trying to add the highlight today feature mentioned in some of the comments.  However, I am an intermediate php programmer and must not understand some of the shorthands used in the code snippets.  Does someone have the full calendar code with highlight today implemented, or at least the full code for the affected section?</description> <content:encoded><![CDATA[<p>I have the calendar working without the database.  I am trying to add the highlight today feature mentioned in some of the comments.  However, I am an intermediate php programmer and must not understand some of the shorthands used in the code snippets.  Does someone have the full calendar code with highlight today implemented, or at least the full code for the affected section?</p> ]]></content:encoded> </item> <item><title>By: Bo Gunnarson</title><link>http://davidwalsh.name/php-calendar-controls#comment-17727</link> <dc:creator>Bo Gunnarson</dc:creator> <pubDate>Thu, 20 May 2010 08:12:16 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=3214#comment-17727</guid> <description>Hello and thank you for some very good tutorials.
I have only one question, i&#039;m a bit new on programming in php, and i wondering how to get the controls to act with the calendag?Thanks in advance.</description> <content:encoded><![CDATA[<p>Hello and thank you for some very good tutorials.<br
/> I have only one question, i&#8217;m a bit new on programming in php, and i wondering how to get the controls to act with the calendag?</p><p>Thanks in advance.</p> ]]></content:encoded> </item> <item><title>By: William Rouse</title><link>http://davidwalsh.name/php-calendar-controls#comment-16954</link> <dc:creator>William Rouse</dc:creator> <pubDate>Mon, 12 Apr 2010 14:30:26 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=3214#comment-16954</guid> <description>@Cindy:
I found the error you described about July 2010 in my version of the code also.
In trying to update my code, I found syntax errors in your example:
$calendar.= &#039;’;
This produces a syntax error for me.
Would you be able to post your entire file somewhere for inspection?
Thanks!
WBR</description> <content:encoded><![CDATA[<p>@Cindy:<br
/> I found the error you described about July 2010 in my version of the code also.<br
/> In trying to update my code, I found syntax errors in your example:<br
/> $calendar.= &#8216;’;<br
/> This produces a syntax error for me.<br
/> Would you be able to post your entire file somewhere for inspection?<br
/> Thanks!<br
/> WBR</p> ]]></content:encoded> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced (User agent is rejected)
Database Caching 3/7 queries in 0.018 seconds using disk: basic
Object Caching 805/805 objects using disk: basic

Served from: davidwalsh.name @ 2012-05-23 16:05:47 -->
