<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Amped about Web Standards &#187; linkedin</title>
	<atom:link href="http://www.ampedwebstandards.com/tag/linkedin/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ampedwebstandards.com</link>
	<description>Discussion, code examples, and tutorials on web standards and web programming.</description>
	<lastBuildDate>Tue, 23 Feb 2010 10:05:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Tutorial: Dynamic slideshow with PHP &amp; JQuery</title>
		<link>http://www.ampedwebstandards.com/2009/03/16/tutorial-dynamic-image-slideshow-with-php-jquery/</link>
		<comments>http://www.ampedwebstandards.com/2009/03/16/tutorial-dynamic-image-slideshow-with-php-jquery/#comments</comments>
		<pubDate>Mon, 16 Mar 2009 08:39:25 +0000</pubDate>
		<dc:creator>alan</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Examples]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[linkedin]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.ampedwebstandards.com/?p=95</guid>
		<description><![CDATA[When I set out to add database driven player info at NuggetsHoops.com, I knew that I wanted to include code that would display some of the many images that I had set aside for each NBA player. I also knew that I would continue to add new pictures. Application code that could easily display old [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.ampedwebstandards.com%2F2009%2F03%2F16%2Ftutorial-dynamic-image-slideshow-with-php-jquery%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.ampedwebstandards.com%2F2009%2F03%2F16%2Ftutorial-dynamic-image-slideshow-with-php-jquery%2F&amp;source=aswitzer&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>When I set out to add database driven player info at <a title="NuggetsHoops" href="http://nuggetshoops.com">NuggetsHoops.com</a>, I knew that I wanted to include code that would display some of the many images that I had set aside for each NBA player. I also knew that I would continue to add new pictures. Application code that could easily display old and new images, without additional effort for each added image would work best.</p>
<p>I had already written PHP code that could look at a folder and create a list of images to be displayed. When I ran across the powerful<a title="jQuery Cycle Plugin" href="http://jquery.malsup.com/cycle/"> jQuery Cycle Plugin</a>, I had found a great way to display them.</p>
<p>Let&#8217;s get coding. This tutorial depends on PHP 5, jQuery 1.2.3 or later, jQuery Cycle Plugin version 2.51 or later.
<ul>
<li>I&#8217;ll assume you already have <a href="http://apache.org/">Apache</a> and <a href="http://www.php.net/downloads.php">PHP</a> setup and running. Make sure you have a recent version of PHP 5.</li>
<li><a title="jQuery Homepage" href="http://jquery.com/">Download jQuery</a></li>
<li><a title="Download jQuery Cycle Plugin" href="http://jquery.malsup.com/cycle/download.html">Download jQuery Cycle Plugin</a></li>
</ul>
<p>Add the following Javascript to your PHP/HTML to enable and call the Cycle Plugin:</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="javascript"><div class="devcodeoverflow"><ol><li>&lt;script src=&quot;/scripts/jquery-1.3.2.min.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;</li><li>&lt;script src=&quot;/scripts/jquery.cycle.all.min.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;</li><li>&lt;script type=&quot;text/javascript&quot;&gt;</li><li>$(document).ready(function(){</li><li>	$('#myslides').cycle({</li><li>		fit: 1</li><li>	});</li><li>});</li><li>&lt;/script&gt;</li></ol></div></pre><!--END_DEVFMTCODE--></p>
<p>Note that there are <a href="http://www.malsup.com/jquery/cycle/options.html">many options</a> and <a href="http://www.malsup.com/jquery/cycle/browser.html">styles of animation</a> provided by the powerful Cycle plugin.</p>
<p>Add the following PHP to iterate over any folder and dynamically generate img tags using any images found in the folder:<br />
<!--DEVFMTCODE--><pre class="devcodeblock" title="php"><div class="devcodeoverflow"><ol><li>$directory = 'images/players/' . $row['imageName']; </li><li>try {&nbsp;&nbsp;&nbsp;&nbsp;</li><li>	// Styling for images</li><li>	echo &quot;&lt;div id=\&quot;myslides\&quot;&gt;&quot;;</li><li>	foreach ( new DirectoryIterator(&quot;../&quot; . $directory) as $item ) {			</li><li>		if ($item-&gt;isFile()) {</li><li>			$path = &quot;/&quot; . $directory . &quot;/&quot; . $item;</li><li>			echo &quot;&lt;img src=\&quot;&quot; . $path . &quot;\&quot; /&gt;&quot;;</li><li>		}</li><li>	}</li><li>	echo &quot;&lt;/div&gt;&quot;;</li><li>}</li><li>catch(Exception $e) {</li><li>	echo 'No images found for this player.&lt;br /&gt;';</li><li>}</li></ol></div></pre><!--END_DEVFMTCODE--></p>
<p>Any img tags within an HTML element of class &#8216;myslides&#8217; (or whatever you initialized the Cycle plugin with in the Javascript) will have the slideshow behavior added to it. The $row array on line 1 is referencing a database query result, but could be set in a number of ways for your specific needs. The DirectoryIterator reference on line 5 is a builtin class in PHP5.</p>
<p>Here&#8217;s the CSS to style the images being displayed in the slideshow:</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="css"><div class="devcodeoverflow"><ol><li>#myslides {</li><li>width: 340px;</li><li>float: right;</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;padding: 0;</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;margin:&nbsp;&nbsp;0 auto;</li><li>margin-top: 20px;</li><li>} </li><li>&nbsp;</li><li>#myslides img {</li><li>&nbsp;&nbsp;&nbsp;&nbsp;padding: 10px;</li><li>&nbsp;&nbsp;&nbsp;&nbsp;border:&nbsp;&nbsp;1px solid rgb(100,100,100);</li><li>&nbsp;&nbsp;&nbsp;&nbsp;background-color: rgb(230,230,230);</li><li>&nbsp;&nbsp;&nbsp;&nbsp;width: 320px;</li><li>&nbsp;&nbsp;&nbsp;&nbsp;top:&nbsp;&nbsp;0;</li><li>&nbsp;&nbsp;&nbsp;&nbsp;left: 0</li><li>}</li></ol></div></pre><!--END_DEVFMTCODE--></p>
<p>So, there&#8217;s a very quick walk thru a working example to generate a dynamic slideshow from any folder of images. If you&#8217;d like a full download of the code, or any further explanation, please leave a comment!</p>
<p>You can see this code in action by just clicking on any player&#8217;s name at the  <a href="http://www.nuggetshoops.com/roster.php">NuggetsHoops.com Roster page</a>.</p>
<h2>New &#8211; download the code for this Tutorial</h2>
<p><a class="downloadlink" href="http://www.ampedwebstandards.com/download/1" title="Version1.0 downloaded 884 times" >Code for Dynamic Image Slideshow with PHP and JQuery (884)</a></p>
<p><a href="http://www.ampedwebstandards.com/demos/dynamic-image-slideshow-php-jquery/">Demo</a><br />
<br/></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ampedwebstandards.com/2009/03/16/tutorial-dynamic-image-slideshow-with-php-jquery/feed/</wfw:commentRss>
		<slash:comments>37</slash:comments>
		</item>
		<item>
		<title>Progressive Enhancement with jQuery</title>
		<link>http://www.ampedwebstandards.com/2008/08/29/progressive-enhancement-with-jquery/</link>
		<comments>http://www.ampedwebstandards.com/2008/08/29/progressive-enhancement-with-jquery/#comments</comments>
		<pubDate>Fri, 29 Aug 2008 08:28:18 +0000</pubDate>
		<dc:creator>alan</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Examples]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[linkedin]]></category>
		<category><![CDATA[progressive enhancement]]></category>

		<guid isPermaLink="false">http://www.ampedwebstandards.com/?p=30</guid>
		<description><![CDATA[While I work on finishing up an overdue post on the amazing An Event Apart San Francisco conference I attended last week, I thought I would at least write about one of the many new concepts that was discussed. Progressive Enhancement (PE) is the concept of adding functionality or enhancements to the presentation and behavior [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.ampedwebstandards.com%2F2008%2F08%2F29%2Fprogressive-enhancement-with-jquery%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.ampedwebstandards.com%2F2008%2F08%2F29%2Fprogressive-enhancement-with-jquery%2F&amp;source=aswitzer&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p><span id="extlinks">While I work on finishing up an overdue post on the amazing An Event Apart San Francisco conference I attended last week, I thought I would at least write about one of the many new concepts that was discussed.</span><br />
<code><script src="/scripts/jquery.js" type="text/javascript"></script></code></p>
<p>Progressive Enhancement (PE) is the concept of adding functionality or enhancements to the presentation and behavior of a webpage, using modern technologies such as CSS and Javascript. The PE approach adds the additional features thru externally linked files in order to avoid forcing older/less capable browsers to process data they don&#8217;t understand or can&#8217;t handle. In other words, the strategy demands that the basic content always be available, then add the fancier layout and features for browsers that can show it.</p>
<p>I&#8217;m going to show a quick but usable example of PE using jQuery. In this example, I am going to show how you can dynamically add an &#8220;external link&#8221; icon &#8211; <img src="/images/external.png" border="0" alt="" /> to links inside a specific area of your webpage.</p>
<p>1. <a href="http://docs.jquery.com/Downloading_jQuery">download the current release of jQuery</a> (at this writing &#8211; 1.2.6) and add it to your webpage in the tag.</p>
<p>2. Next, we will utilize the jQuery approach of executing Javascript code when the Document is loaded and the DOM is ready to be manipulated.</p>
<p><code>$(document).ready(function() { <code>});</code></code></p>
<p>3. Now, if we want to add an image after each external link, we can use the jQuery filter function which will addall elements that match a specified expression.</p>
<p>In the <code>section above, we'll add:</code></p>
<p><code>$("a").filter(".selected")</code></p>
<p>4. The expression will be another function that tests the hostname property of the link to see if it is different that the current page&#8217;s hostname.</p>
<p>Try this:</p>
<p><code>function() { return this.hostname &amp;&amp; this.hostname !== location.hostname; })</code></p>
<p>5. Lastly, we&#8217;ll use jQuery to insert the image after the link that matches the test expression &#8211; namely an external link!</p>
<p><code>.after(' &lt;img src="/images/ext.png" alt="External Link"&gt;');</code></p>
<p>6. Let&#8217;s put it all together!</p>
<p>Here&#8217;s the sum of the Javascript that we&#8217;ve written:</p>
<p><code>$(document).ready(function() {<br />
$('#extlinks a').filter(function() {<br />
return this.hostname &amp;&amp; this.hostname !== location.hostname;<br />
}).after(' &lt;img src="/images/ext.png" alt="External Link"&gt;');<br />
});</code></p>
<p>put that code in a Javascript file and include it after your jQuery code in your page&#8217;s :</p>
<p><code><script src="/scripts/ext-links.js" type="text/javascript"></script></code></p>
<p>That&#8217;s it! Now go give it a try for yourself.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ampedwebstandards.com/2008/08/29/progressive-enhancement-with-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating microformat hCalendar events with PHP</title>
		<link>http://www.ampedwebstandards.com/2007/03/29/creating-microformat-hcalendar-events-with-php/</link>
		<comments>http://www.ampedwebstandards.com/2007/03/29/creating-microformat-hcalendar-events-with-php/#comments</comments>
		<pubDate>Thu, 29 Mar 2007 07:13:17 +0000</pubDate>
		<dc:creator>alan</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Microformats]]></category>
		<category><![CDATA[hCalendar]]></category>
		<category><![CDATA[linkedin]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.ampedwebstandards.com/2007/03/29/creating-microformat-hcalendar-events-with-php/</guid>
		<description><![CDATA[I&#8217;ve run an NBA fansite called NuggetsHoops.com since 1995. With equal passions for the Denver Nuggets and web design, I&#8217;ve poured a lot of time and effort into the website. Every month, there are more and more &#8220;blogs&#8221; dedicated to the Denver Nuggets, as their popularity has grown over the past few seasons with the [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.ampedwebstandards.com%2F2007%2F03%2F29%2Fcreating-microformat-hcalendar-events-with-php%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.ampedwebstandards.com%2F2007%2F03%2F29%2Fcreating-microformat-hcalendar-events-with-php%2F&amp;source=aswitzer&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>I&#8217;ve run an NBA fansite called <a title="NuggetsHoops.com - a Denver Nuggets fansite" href="http://nuggetshoops.com" target="_blank">NuggetsHoops.com</a> since 1995. With equal passions for the Denver Nuggets and web design, I&#8217;ve   poured a lot of time and effort into the website. Every month, there are more and more &#8220;blogs&#8221; dedicated to the Denver Nuggets, as their popularity has grown over the past few seasons with the additions of NBA superstars Carmelo Anthony and Allen Iverson to the roster. So, partly to be different, and partly to create interesting web development challenges, I usually focus my fansite on fun features that provide Nuggets fans with information presented in unique and hopefully useful ways.</p>
<p>One of those features is a fairly standard <a title="NuggetsHoops Schedule &#038; Results" href="http://www.nuggetshoops.com/schedule.php" target="_blank">Schedule &#038; Results</a> page that shows how the Nugget fared in every game of the season, along with the remaining games on the season&#8217;s schedule. What makes it currently unique is the fact that each remaining game on the schedule is an <a title="hCalendar Microformat Wiki" href="//microformats.org/wiki/hcalendar" target="_blank">hCalendar Microformat</a>. A future article will show you exactly how you can take advantage of this feature, but for now, I will assume you know how to utilize Microformats, and you are here to see how to create them as a web developer.</p>
<p>For this example, we are going to access a MySQL database with information about remaining games, then use PHP code to dynamically display it. At the same time we are outputting the dynamic schedule information, we are going to add the very useful hCalendar microformat. The purpose of this article is not to teach you <a title="PHP.net" href="http://php.net" target="_blank">PHP</a>, <a title="MySQL AB Developer Zone" href="http://www.mysql.org/" target="_blank">MySQL</a>, or even <a title="CSS from W3 Schools" href="http://www.w3schools.com/css/default.asp" target="_blank">CSS</a> &#8211; the focus here is a real world example that you can add microformat markup to.</p>
<p>First,  let&#8217;s perform some date logic to get the current date, then compare it with dates in a schedule database table to get the remaining games for the current season.</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="php"><div class="devcodeoverflow"><ol><li>&lt;?php</li><li>// Display Remaining games</li><li>$today = getdate();</li><li>$cmpDate = $today['year'] . '-' . $today['mon'] . '-' .</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $today['mday'] . ' ' .</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $today['hours'] . ':' . $today['minutes'];</li><li>$monthDisplayed = 0;</li><li>&nbsp;</li><li>$sql = &quot;SELECT * from schedule where start_date &gt; '&quot;.</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$cmpDate.&quot;'&quot;;</li><li>$result=db_query($sql);</li><li>?&gt;</li></ol></div></pre><!--END_DEVFMTCODE--></p>
<p>Now we have a list of rows to iterate over and display. This example is already in the middle of an HTML table, so we&#8217;re just going to create new tr tags for each remaining game.<br />
<!--DEVFMTCODE--><pre class="devcodeblock" title="php"><div class="devcodeoverflow"><ol><li>&lt;?php</li><li>while ($row = mysql_fetch_array($result)) {</li><li>&nbsp;&nbsp;$gameDate = date('D j', strtotime($row['start_date']));</li><li>&nbsp;&nbsp;$gameTime = date('g:i A', strtotime($row['start_date']));</li><li>&nbsp;&nbsp;$gameEnd = date('g:i A',</li><li>&nbsp;&nbsp;strtotime('+2 hours 30 minutes',</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;strtotime($row['start_date'])));</li><li>&nbsp;&nbsp;$month = date('F', strtotime($row['start_date']));</li><li>&nbsp;</li><li>&nbsp;&nbsp;$dtstartM = date('Y-m-dTG:i:sO',</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; strtotime($row['start_date']));</li><li>&nbsp;&nbsp;$dendM = date('Y-m-dTG:i:sO',</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;strtotime('+2 hours 30 minutes',</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;strtotime($row['start_date'])));</li><li>&nbsp;</li><li>&nbsp;&nbsp;if ($month != $currMonth)</li><li>&nbsp;&nbsp;&nbsp;&nbsp;$monthDisplayed = 0;</li><li>&nbsp;</li><li>&nbsp;&nbsp;// Check if we need to display a new month header row</li><li>&nbsp;&nbsp;if (!$monthDisplayed) {</li><li>&nbsp;&nbsp;&nbsp;&nbsp;$currMonth = $month;</li><li>&nbsp;&nbsp;&nbsp;&nbsp;$monthDisplayed = 1;</li><li>&nbsp;</li><li>&nbsp;&nbsp;&nbsp;&nbsp;echo '&lt;tr class=&quot;rowHeaderSchedule&quot;&gt;';</li><li>&nbsp;&nbsp;&nbsp;&nbsp;echo '&lt;td&gt;' . strtoupper($month) . '&lt;/td&gt;';</li><li>&nbsp;&nbsp;&nbsp;&nbsp;echo '&lt;td&gt;OPPONENT&lt;/td&gt;';</li><li>&nbsp;&nbsp;&nbsp;&nbsp;echo '&lt;td&gt;&lt;div align=&quot;left&quot;&gt;TIME (MT)&lt;/div&gt;&lt;/td&gt;';</li><li>&nbsp;&nbsp;&nbsp;&nbsp;echo '&lt;td colspan=&quot;2&quot;&gt;LOCAL TV&lt;/td&gt;';</li><li>&nbsp;&nbsp;&nbsp;&nbsp;echo '&lt;td width=&quot;6&quot;&gt;&lt;/td&gt;';</li><li>&nbsp;&nbsp;&nbsp;&nbsp;echo '&lt;td&gt;NAT TV&lt;/td&gt;';</li><li>&nbsp;&nbsp;&nbsp;&nbsp;echo '&lt;td&gt;NOTES&lt;/td&gt;';</li><li>&nbsp;&nbsp;&nbsp;&nbsp;echo '&lt;/tr&gt;';</li><li>&nbsp;&nbsp;}</li><li>?&gt;</li></ol></div></pre><!--END_DEVFMTCODE--></p>
<p>Let&#8217;s gather info about the current game for display to the webpage, and for the hCalendar microformat.<br />
<!--DEVFMTCODE--><pre class="devcodeblock" title="php"><div class="devcodeoverflow"><ol><li> &lt;?php</li><li>&nbsp;&nbsp;// Check if we are processing an away game</li><li>&nbsp;&nbsp;$subject = $row['subject'];</li><li>&nbsp;&nbsp;$patt = &quot;/.*(@|vs.)(.*)/&quot;;</li><li>&nbsp;&nbsp;preg_match($patt, $subject, $opp);</li><li>&nbsp;&nbsp;$opponent = '';</li><li>&nbsp;</li><li>&nbsp;&nbsp;if ($opp[1] == &quot;@&quot;) {</li><li>&nbsp;&nbsp;&nbsp;&nbsp;$opponent = 'at ';</li><li>&nbsp;&nbsp;&nbsp;&nbsp;$eventInfo = 'Denver Nuggets ';</li><li>&nbsp;&nbsp;&nbsp;&nbsp;// Do not current have this info in the database</li><li>&nbsp;&nbsp;&nbsp;&nbsp;$eventLocation = ' ';</li><li>&nbsp;&nbsp;}</li><li>&nbsp;&nbsp;else {</li><li>&nbsp;&nbsp;&nbsp;&nbsp;$eventInfo = 'Denver Nuggets vs. ';</li><li>&nbsp;&nbsp;&nbsp;&nbsp;$eventLocation =</li><li>&nbsp;&nbsp;&nbsp;&nbsp; 'Pepsi Center loc: 1000 Chopper Cir Denver, CO 80204';</li><li>&nbsp;&nbsp;}</li><li>&nbsp;</li><li>&nbsp;&nbsp;// Append the opponent team name</li><li>&nbsp;&nbsp;$opponent .= $opp[2];</li><li>&nbsp;</li><li>&nbsp;&nbsp;// Check if the current game is broadcast in HD</li><li>&nbsp;&nbsp;if ($row['hdtv'])</li><li>&nbsp;&nbsp;&nbsp;&nbsp;$hdTVimage = '&lt;img src=&quot;/images/hdtv_logo_sm.jpg&quot; width=&quot;24&quot; height=&quot;18&quot; alt=&quot;HDTV&quot; /&gt;';</li><li>&nbsp;&nbsp;else</li><li>&nbsp;&nbsp;&nbsp;&nbsp;$hdTVimage = '';</li><li>?&gt;</li></ol></div></pre><!--END_DEVFMTCODE--></p>
<p>Now its time to create each remaining row in the schedule &#8211; and finally we get to create an hCalendar microformat. First, I&#8217;ll show you the code, without the hCalendar markup, for comparison.<br />
<!--DEVFMTCODE--><pre class="devcodeblock" title="php"><div class="devcodeoverflow"><ol><li>&lt;?php</li><li>&nbsp;&nbsp;// Game - no hCalendar microformat</li><li>&nbsp;&nbsp;echo '&lt;tr class=&quot;rowRegularSchedule&quot;&gt;';</li><li>&nbsp;&nbsp;echo '&lt;td&gt;' . $gameDate . '&lt;/td&gt;';</li><li>&nbsp;&nbsp;echo '&lt;td&gt;' . $eventInfo . $opponent . '&lt;/td&gt;';</li><li>&nbsp;&nbsp;echo '&lt;td&gt;' . $gameTime . '&lt;/td&gt;';</li><li>&nbsp;&nbsp;echo '&lt;td&gt;&lt;a href=&quot;http://www.altitude.tv&quot; target=&quot;_blank&quot;&gt;'. $row['lbroadcast'].'&lt;/a&gt;&lt;/td&gt;';</li><li>&nbsp;&nbsp;echo '&lt;td&gt;'.$hdTVimage.'&lt;/td&gt;';</li><li>&nbsp;&nbsp;echo '&lt;td width=&quot;5&quot;&gt;&lt;/td&gt;';</li><li>&nbsp;&nbsp;echo '&lt;td&gt;'. $row['broadcast'] . '&lt;/td&gt;';</li><li>&nbsp;&nbsp;echo '&lt;td&gt;' .$eventLocation . '&lt;/td&gt;';</li><li>&nbsp;&nbsp;echo '&lt;/tr&gt;';</li><li>} // End while</li><li>?&gt; </li></ol></div></pre><!--END_DEVFMTCODE--></p>
<p>Pretty basic HTML, displaying our game information dynamically using PHP.</p>
<p>Finally, we&#8217;ll walk thru the microformat version. We start by creating a new row with the required class value of <em>vevent</em>. To give the event a name we use the <em>summary</em> class in a span element. Notice that I put a portion of the information within an abbr tag with the class of &#8220;mhide&#8221;. With CSS, I hide anything within an element using the mhide class from human eyes. I&#8217;ve recently read that the latest theory is to not hide any microformat information, because it looks like trickery to search engines like Google, and they may ding your page ranking for it. At this point, I&#8217;m not going to worry about that &#8211; I&#8217;d rather have a combination of usefulness and style &#8211; I want my microformat to provide event information without displaying more details than I need on the actual webpage. There may be a better way to handle this issue in the future, so I just wanted anyone following thru this example to be aware.<br />
<!--DEVFMTCODE--><pre class="devcodeblock" title="php"><div class="devcodeoverflow"><ol><li> &lt;?php</li><li>&nbsp;&nbsp;// microformat - hCalendar</li><li>&nbsp;&nbsp;echo '&lt;tr class=&quot;rowRegularSchedule vevent&quot;&gt;&lt;td&gt;' . $gameDate . '&lt;/td&gt;';</li><li>&nbsp;&nbsp;echo '&lt;td&gt;&lt;span class=&quot;summary&quot;&gt;&lt;abbr class=&quot;mhide&quot;&gt;' . $eventInfo . '&lt;/abbr&gt;' . $opponent . '&lt;/span&gt;&lt;/td&gt;';</li></ol></div></pre><!--END_DEVFMTCODE--></p>
<p>Now back to our partially defined microformat &#8211; so far we just have declared that we have an event and we&#8217;ve given it a title. Next, we&#8217;ll define the event&#8217;s start time and end time, which are the <em>dtstart</em> and <em>dtend </em>classes. We&#8217;ll display the start time and hide the end time since I don&#8217;t want to display that on the webpage. The abbr element has a useful title property where we will put the special date/time format that the microformat requires. (i.e. March 30th, 2007 at 8:00 MT is formatted as &#8220;2007-03-30T20:00-07:00&#8243;. The -07:00 provides the timezone information because it is the offset from Universal Time for the Mountain timezone)  Then the part we want to display simply goes within the abbr element itself.<br />
<!--DEVFMTCODE--><pre class="devcodeblock" title="php"><div class="devcodeoverflow"><ol><li></li><li>&nbsp;&nbsp;echo '&lt;td&gt;&lt;abbr class=&quot;dtstart&quot; title=&quot;' . $dtstartM .'&quot;&gt;' . $gameTime . '&lt;/abbr&gt;&lt;abbr class=&quot;mhide dtend&quot;';</li><li>&nbsp;&nbsp;echo 'title=&quot;' . $dendM . '&quot;&gt;' . $gameEnd . '&lt;/abbr&gt;&lt;/td&gt;';</li><li>&nbsp;&nbsp;echo '&lt;td&gt;&lt;a href=&quot;http://www.altitude.tv&quot; target=&quot;_blank&quot;&gt;'. $row['lbroadcast'].'&lt;/a&gt;&lt;/td&gt;&lt;td&gt;'.$hdTVimage.'&lt;/td&gt;';</li><li>&nbsp;&nbsp;echo '&lt;td width=&quot;5&quot;&gt;&lt;/td&gt;&lt;td&gt;'. $row['broadcast'].'&lt;/td&gt;';</li></ol></div></pre><!--END_DEVFMTCODE--></p>
<p>The last property of the hCalendar microformat that I will make use of in this example is <em>location</em>. Then, once the tr element is closed, the hCalendar implementation is completed.<br />
<!--DEVFMTCODE--><pre class="devcodeblock" title="php"><div class="devcodeoverflow"><ol><li></li><li>&nbsp;&nbsp;echo '&lt;td&gt;&lt;span class=&quot;mhide location&quot;&gt;'.$eventLocation.'&lt;/span&gt;&lt;/td&gt;';</li><li>&nbsp;&nbsp;echo '&lt;/tr&gt;';</li><li>&nbsp;&nbsp;&nbsp;&nbsp;// End hCalendar Microformat</li><li>} // End while</li><li>?&gt;</li><li></li></ol></div></pre><!--END_DEVFMTCODE--></p>
<p>There you have it. Embedded hCalendar events for each game, that are both human and machine readable, output as valid HTML.</p>
<p>If you found this useful and would like me to make the source code available for download, just leave a comment.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ampedwebstandards.com/2007/03/29/creating-microformat-hcalendar-events-with-php/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>
