<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" version="2.0">

<channel>
	<title>Stefano Verna</title>
	
	<link>http://www.stefanoverna.com</link>
	<description>Just another WordPress weblog</description>
	<pubDate>Fri, 11 Sep 2009 15:41:10 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/stefanoverna" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="stefanoverna" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Site logo ripoff</title>
		<link>http://www.stefanoverna.com/uncategorized/site-logo-ripoff</link>
		<comments>http://www.stefanoverna.com/uncategorized/site-logo-ripoff#comments</comments>
		<pubDate>Tue, 07 Apr 2009 21:08:36 +0000</pubDate>
		<dc:creator>Stefano Verna</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[logo]]></category>

		<category><![CDATA[ripoff]]></category>

		<category><![CDATA[stefanoverna]]></category>

		<guid isPermaLink="false">http://www.stefanoverna.com/?p=594</guid>
		<description><![CDATA[Just a quick post to share with you a site I discovered that made me laugh. A lot. Let&#8217;s make a visual diff of these two headers..



I&#8217;m not that sure, but I kinda think somebody might have been stolen something from someone else.. lol. Well, I&#8217;ll take this ripoff as a recognition of the fact [...]]]></description>
			<content:encoded><![CDATA[<p>Just a quick post to share with you <a href="http://www.ciao.rs" title="logo ripoff">a site</a> I discovered that made me laugh. A lot. Let&#8217;s make a visual diff of these two headers..</p>

<div style="aligncenter"><img src="http://www.stefanoverna.com/wp-content/uploads/2009/04/ripoff.jpg" alt="ripoff" title="ripoff" width="459" height="236" class="aligncenter size-full wp-image-595" /></div>

<p>I&#8217;m not that sure, but I kinda think somebody might have been stolen something from someone else.. lol. Well, I&#8217;ll take this ripoff as a recognition of the fact that this site is starting to be a little more visible.</p>

<p>A big thanks to the super-vigilant eyes of Ivan Jankovic for this report. Did something like this ever happened to you? I&#8217;m quite curious about it :)</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/stefanoverna?a=2zcRfWbLrzk:0wfDyjK3x0M:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/stefanoverna?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/stefanoverna?a=2zcRfWbLrzk:0wfDyjK3x0M:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/stefanoverna?i=2zcRfWbLrzk:0wfDyjK3x0M:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/stefanoverna?a=2zcRfWbLrzk:0wfDyjK3x0M:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/stefanoverna?i=2zcRfWbLrzk:0wfDyjK3x0M:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/stefanoverna?a=2zcRfWbLrzk:0wfDyjK3x0M:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/stefanoverna?i=2zcRfWbLrzk:0wfDyjK3x0M:F7zBnMyn0Lo" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.stefanoverna.com/uncategorized/site-logo-ripoff/feed</wfw:commentRss>
		</item>
		<item>
		<title>Create a quick-and-dirty search engine for your custom PHP website</title>
		<link>http://www.stefanoverna.com/log/quick-easy-search-engine-php-website</link>
		<comments>http://www.stefanoverna.com/log/quick-easy-search-engine-php-website#comments</comments>
		<pubDate>Tue, 10 Mar 2009 21:02:13 +0000</pubDate>
		<dc:creator>Stefano Verna</dc:creator>
		
		<category><![CDATA[Log]]></category>

		<category><![CDATA[mysql]]></category>

		<category><![CDATA[php]]></category>

		<category><![CDATA[search engines]]></category>

		<guid isPermaLink="false">http://www.stefanoverna.com/?p=576</guid>
		<description><![CDATA[In more than one occasion I found myself in the need of a little, handy search engine for my custom, PHP-based websites. If the main content of our pages is stored in a database table (that is the case of all the CMS), than we just need to use some SQL queries to sort the [...]]]></description>
			<content:encoded><![CDATA[<p>In more than one occasion I found myself in the need of a little, handy search engine for my custom, PHP-based websites. If the main content of our pages is stored in a database table (that is the case of all the CMS), than we just need to use some SQL queries to sort the pages&#8230; but what if we&#8217;re building a very customized website from the scratch, and many of our pages are handled manually with a lot of custom PHP code?</p>

<p>There are obviously a lot of great search engines already out there that will be able to do the dirty indexing job for you. I&#8217;m particularly in love with Sphider, a lightweight PHP-MySQL web spider that in just 300KB features advanced stuff like word autocompletion, spelling suggestions, etc. </p>

<p>But what if we&#8217;d like to have a further simplified search engine, something to use with our simple 50 pages website and that</p>

<ul>
<li>Could be written in less then <strong>100 lines of code</strong></li>
<li>Could use a <strong>single database table</strong></li>
<li>Could preserve all the major functionalities, like <strong>natural language searches</strong>, <strong>common words removal</strong> and optional <strong>boolean search</strong>?</li>
</ul>

<p>Today I&#8217;d like to introduce you a super-easy technique that uses the <code>ob_get_contents()</code> PHP buffering function. I really don&#8217;t know if that&#8217;s a common solution or not, I tried to google about it but I couldn&#8217;t came up with anything quite similar. Let&#8217;s start. </p>

<h3>How does it work? The idea.</h3>

<p>Read this simple piece of code:</p>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">&lt;html&gt;
	&lt;head&gt;...&lt;/head&gt;
	&lt;body&gt;
		<span style="color: #000000; font-weight: bold;">&lt;?php</span>
			<span style="color: #990000;">ob_start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">?&gt;</span>
			&lt;h1&gt;Basic Page Example&lt;/h1
			&lt;p&gt;This is your custom page code, something with basic XHTML mixed with PHP:&lt;/p&gt;
			&lt;ul&gt;
			<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">&lt;</span><span style="color: #cc66cc;">100</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
				&lt;li&gt;List Item <span style="color: #000000; font-weight: bold;">&lt;?=</span> <span style="color: #000088;">$i</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/li&gt;
			<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endfor</span><span style="color: #339933;">;</span> <span style="color: #339933;">&gt;</span>
			<span style="color: #339933;">&lt;/</span>ul<span style="color: #339933;">&gt;</span>
		<span style="color: #000000; font-weight: bold;">&lt;?php</span>
			<span style="color: #000088;">$content</span> <span style="color: #339933;">=</span> <span style="color: #990000;">ob_get_contents</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #990000;">ob_end_flush</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">?&gt;</span>
	&lt;/body&gt;
&lt;/html&gt;</pre></td></tr></table></div>


<p>The result is that in the <code>$content</code> variable you&#8217;ll have the whole exploded page content. As you might be starting to guess, that&#8217;s a potentially perfect start for our website indexing process! 
If we take this text, we remove the tags not to be indexed (<code>&lt;script&gt;</code>, <code>&lt;object&gt;</code>, <code>&lt;form&gt;</code>, etc.), we strip all the remaining tags and we store the result in our database table, we&#8217;re already half way through the problem!</p>

<p>Let&#8217;s create our tag stripper function (that&#8217;s just a basic stub, it could be improved to handle useless whitespace removal, etc.):</p>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> removeTagWithContent<span style="color: #009900;">&#40;</span><span style="color: #000088;">$text</span><span style="color: #339933;">,</span> <span style="color: #000088;">$tags</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #000088;">$invert</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">FALSE</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #990000;">preg_match_all</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/&lt;(.+?)[s]*/?[s]*&gt;/si'</span><span style="color: #339933;">,</span> <span style="color: #990000;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$tags</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$tags</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$tags</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array_unique</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$tags</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">is_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$tags</span><span style="color: #009900;">&#41;</span> AND <span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$tags</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$invert</span> <span style="color: #339933;">==</span> <span style="color: #000000; font-weight: bold;">FALSE</span><span style="color: #009900;">&#41;</span>
      <span style="color: #b1b100;">return</span> <span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'@&lt;(?!(?:'</span><span style="color: #339933;">.</span> <span style="color: #990000;">implode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'|'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$tags</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span><span style="color: #0000ff;">')b)(w+)b.*?&gt;.*?&lt;/1&gt;@si'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #000088;">$text</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">else</span>
      <span style="color: #b1b100;">return</span> <span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'@&lt;('</span><span style="color: #339933;">.</span> <span style="color: #990000;">implode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'|'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$tags</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span><span style="color: #0000ff;">')b.*?&gt;.*?&lt;/1&gt;@si'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #000088;">$text</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$invert</span> <span style="color: #339933;">==</span> <span style="color: #000000; font-weight: bold;">FALSE</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'@&lt;(w+)b.*?&gt;.*?&lt;/1&gt;@si'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #000088;">$text</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #b1b100;">return</span> <span style="color: #000088;">$text</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> tagStripper<span style="color: #009900;">&#40;</span><span style="color: #000088;">$content</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$content</span> <span style="color: #339933;">=</span> removeTagWithContent<span style="color: #009900;">&#40;</span><span style="color: #000088;">$content</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;script&gt;&lt;embed&gt;&lt;form&gt;'</span><span style="color: #339933;">,</span> <span style="color: #000000; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$content</span> <span style="color: #339933;">=</span> <span style="color: #990000;">strip_tags</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$content</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$content</span> <span style="color: #339933;">=</span> <span style="color: #990000;">html_entity_decode</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$content</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">return</span> <span style="color: #000088;">$content</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>


<h3>The MySQL Table</h3>

<p>This is the basic SQL code you need to create a proper table to store all the indexed data:</p>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #ff0000;">`search_pages`</span> <span style="color: #66cc66;">&#40;</span>
  <span style="color: #ff0000;">`id`</span> bigint<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">20</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">AUTO_INCREMENT</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`page`</span> mediumtext <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`title`</span> mediumtext <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`content`</span> longtext <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`indexed`</span> timestamp <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span>
  <span style="color: #993333; font-weight: bold;">PRIMARY</span> <span style="color: #993333; font-weight: bold;">KEY</span>  <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`id`</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
  <span style="color: #993333; font-weight: bold;">UNIQUE</span> <span style="color: #993333; font-weight: bold;">KEY</span> <span style="color: #ff0000;">`page`</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`page`</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">255</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
  FULLTEXT <span style="color: #993333; font-weight: bold;">KEY</span> <span style="color: #ff0000;">`fulltext_title`</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`title`</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
  FULLTEXT <span style="color: #993333; font-weight: bold;">KEY</span> <span style="color: #ff0000;">`fulltext_content`</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`content`</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#41;</span> ENGINE<span style="color: #66cc66;">=</span>MyISAM;</pre></td></tr></table></div>


<p>As you can see, we added 2 different full-text indexes, one for the page title and one for the page content. This will allow us to have a finer grained control over in the MySQL sorting algorithm.</p>

<h3>Indexing the pages</h3>

<p>Everything is ready for our page indexing. Let&#8217;s create the functions to be called on every part of the page you want to perform indexing:</p>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$pagecontent</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$title</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> setIndexTitlePage<span style="color: #009900;">&#40;</span><span style="color: #000088;">$t</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #990000;">global</span> <span style="color: #000088;">$title</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$title</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$t</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> startIndexingContent<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>isIndexingEnabled<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">return</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #990000;">ob_start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> stopIndexingContent<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #990000;">global</span> <span style="color: #000088;">$pagecontent</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>isIndexingEnabled<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">return</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000088;">$text</span> <span style="color: #339933;">=</span> <span style="color: #990000;">ob_get_contents</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">ob_end_flush</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$pagecontent</span> <span style="color: #339933;">.=</span> tagStripper<span style="color: #009900;">&#40;</span><span style="color: #000088;">$text</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> storeIndexedContent<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #990000;">global</span> <span style="color: #000088;">$pagecontent</span><span style="color: #339933;">,</span> <span style="color: #000088;">$title</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>isIndexingEnabled<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">return</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// the page URL</span>
	<span style="color: #000088;">$page</span> <span style="color: #339933;">=</span> <span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'#?.*$#D'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'REQUEST_URI'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000088;">$link</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_connect</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'host'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'user'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'pass'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$sql</span> <span style="color: #339933;">=</span> <span style="color: #990000;">sprintf</span><span style="color: #009900;">&#40;</span>
		<span style="color: #0000ff;">&quot;INSERT INTO search_pages (page, title, content, indexed) VALUES ('<span style="color: #009933; font-weight: bold;">%s</span>', '<span style="color: #009933; font-weight: bold;">%s</span>', '<span style="color: #009933; font-weight: bold;">%s</span>', FROM_UNIXTIME(<span style="color: #009933; font-weight: bold;">%d</span>))&quot;</span><span style="color: #339933;">,</span>
		<span style="color: #000088;">$page</span><span style="color: #339933;">,</span>
		<span style="color: #000088;">$title</span><span style="color: #339933;">,</span>
		<span style="color: #000088;">$pagecontent</span><span style="color: #339933;">,</span>
		<span style="color: #990000;">time</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #339933;">,</span> <span style="color: #000088;">$link</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>


<p>So that you&#8217;ll have to wrap the relevant part of your pages between the <code>startIndexingContent()</code> and <code>stopIndexingContent()</code> functions. This is to avoid a repeated indexing of common parts like headers, sidebars, etc. At the end of your pages, you just have to call the <code>storeIndexedContent()</code> function to save it for later use.</p>

<h3>Wait! There&#8217;s something wrong here&#8230;</h3>

<p>Yep. That&#8217;s right. If we really do it in this way, then all the visits to <em>every</em> page of your website will cause a write in the DB. Which is not that good. We&#8217;ve to find out a way to know when it&#8217;s really the time to re-index the pages. This is obviously a quite website-specific task. I&#8217;m lefting this part out of the tutorial as it&#8217;s the only one that could cause a noticeable slow-down to your server if not setted up in the right way, but let me share some ideas about that:</p>

<ul>
<li><strong>Enable website re-indexing after a fixed amount of time, i.e. 2 days:</strong> Check the timestamp of the indexed version in the DB table, if it&#8217;s older that a specific amount of time, the update the row with the new content.</li>
<li><strong>Make a SHA1 hash of the content of the page</strong>, if it differs from the one stored in the db, then store the new version!</li>
<li>If your site is SVNd, than just <strong>use the SVN revision number</strong> to find out if the page stored in the db needs to be refreshed.</li>
<li>Disable the indexing everytime, except when the page is being called by a <strong>specific cron task</strong> you made to spider the content (it&#8217;s just a matter of calling a recursive retrieval of pages using wget).</li>
</ul>

<p>I&#8217;m open to other suggestions, also.</p>

<h3>Last but not least: the searching functions!</h3>

<p>All the work is done within MySQL: you just need to use the full-text specific syntax <code>MATCH (...) AGAINST (... IN BOOLEAN MODE)</code> to perform a full text search to some table fields.</p>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">SELECT</span> 
	<span style="color: #66cc66;">*,</span> 
	<span style="color: #cc66cc;">0.6</span> <span style="color: #66cc66;">*</span> MATCH<span style="color: #66cc66;">&#40;</span>title<span style="color: #66cc66;">&#41;</span> AGAINST<span style="color: #66cc66;">&#40;</span>%s <span style="color: #993333; font-weight: bold;">IN</span> <span style="color: #993333; font-weight: bold;">BOOLEAN</span> MODE<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">+</span> <span style="color: #cc66cc;">0.9</span> <span style="color: #66cc66;">*</span> MATCH<span style="color: #66cc66;">&#40;</span>content<span style="color: #66cc66;">&#41;</span> AGAINST<span style="color: #66cc66;">&#40;</span>%s <span style="color: #993333; font-weight: bold;">IN</span> <span style="color: #993333; font-weight: bold;">BOOLEAN</span> MODE<span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">AS</span> rank 
<span style="color: #993333; font-weight: bold;">FROM</span> 
	search_pages 
<span style="color: #993333; font-weight: bold;">WHERE</span> 
	MATCH<span style="color: #66cc66;">&#40;</span>title<span style="color: #66cc66;">&#41;</span> AGAINST<span style="color: #66cc66;">&#40;</span>%s <span style="color: #993333; font-weight: bold;">IN</span> <span style="color: #993333; font-weight: bold;">BOOLEAN</span> MODE<span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">OR</span> MATCH<span style="color: #66cc66;">&#40;</span>content<span style="color: #66cc66;">&#41;</span> AGAINST<span style="color: #66cc66;">&#40;</span>%s <span style="color: #993333; font-weight: bold;">IN</span> <span style="color: #993333; font-weight: bold;">BOOLEAN</span> MODE<span style="color: #66cc66;">&#41;</span> 
<span style="color: #993333; font-weight: bold;">ORDER</span> <span style="color: #993333; font-weight: bold;">BY</span> 
	rank <span style="color: #993333; font-weight: bold;">DESC</span></pre></td></tr></table></div>


<p>As you can see, thanks to the two separate fulltext indexes instead of a single one, we are now able to weight the title tag in a different way than the content of the page. The query will return us the the rows sorted by the <code>rank</code> field.</p>

<h3>Conclusions</h3>

<p>This is a super-quick search engine implementation. It cannot be used for big sites with tons of pages, nor it can provide advanced features like keyword suggestion. But it&#8217;s really 90 lines of code to implement, if you know what I mean. I&#8217;m using it in a 20 pages big website, and it works surprisingly well. And the search results are incredibly good, too. </p>

<p>It could certainly be useful to some of you. Or, at least, it might have been useful to let you understand the super powers that MySQL has in terms of full-text searches.</p>

<p>Hope to have some feedback/suggestions about this one.. :)</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/stefanoverna?a=YRM7JwpBVQQ:SlFYWJc-_nY:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/stefanoverna?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/stefanoverna?a=YRM7JwpBVQQ:SlFYWJc-_nY:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/stefanoverna?i=YRM7JwpBVQQ:SlFYWJc-_nY:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/stefanoverna?a=YRM7JwpBVQQ:SlFYWJc-_nY:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/stefanoverna?i=YRM7JwpBVQQ:SlFYWJc-_nY:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/stefanoverna?a=YRM7JwpBVQQ:SlFYWJc-_nY:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/stefanoverna?i=YRM7JwpBVQQ:SlFYWJc-_nY:F7zBnMyn0Lo" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.stefanoverna.com/log/quick-easy-search-engine-php-website/feed</wfw:commentRss>
		</item>
		<item>
		<title>Create astonishing iCal-like calendars with jQuery</title>
		<link>http://www.stefanoverna.com/log/create-astonishing-ical-like-calendars-with-jquery</link>
		<comments>http://www.stefanoverna.com/log/create-astonishing-ical-like-calendars-with-jquery#comments</comments>
		<pubDate>Tue, 27 Jan 2009 07:45:03 +0000</pubDate>
		<dc:creator>Stefano Verna</dc:creator>
		
		<category><![CDATA[Log]]></category>

		<category><![CDATA[calendar]]></category>

		<category><![CDATA[css]]></category>

		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://www.stefanoverna.com/?p=536</guid>
		<description><![CDATA[According to my web designer experience, one of the most common requests from clients when it comes to Wordpress personalization, is to add a basic event calendar to their website.

Finding a good place to position a big table like a calendar within your Wordpress template is always a taught work. In addition, the &#60;table&#62; tag [...]]]></description>
			<content:encoded><![CDATA[<p>According to my web designer experience, one of the most common requests from clients when it comes to Wordpress personalization, is to add a basic event calendar to their website.</p>

<p>Finding a good place to position a big table like a calendar within your Wordpress template is always a taught work. In addition, the <code>&lt;table&gt;</code> tag itself is often quite difficult to style in a good way.</p>

<p>One of the calendar solution that I came out with and that I&#8217;m particulary proud of is the one I built inside the freshly launched <a href="http://www.watsonforpresident.eu" title="Graham Watson President of European Parliament">Graham Watson for President</a> website. </p>

<p><img src="/wp-content/tutorials/ical_like_calendar/preview.jpg" alt="Calendar Preview" title="Calendar Preview" class="center"/></p>

<div class="wpmarkitup_download">
 <div class="box">
  <a href="http://www.stefanoverna.com/wp-content/tutorials/ical_like_calendar/">View the online Demo!</a>
 </div>
 <br class="clear" />
</div>

<p>I wanted it to be similar to the iPhone Calendar application (or, if you want, to the little calendar on the left bottom corner in iCal). And I also wanted to keep the code as little and sweet as possible (we don&#8217;t like maintenance, do we?).</p>

<p>Here&#8217;s the simple HTML code I used, the simplest you could ever come up with:</p>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>table cellspacing<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;0&quot;</span><span style="color: #339933;">&gt;</span>
	<span style="color: #339933;">&lt;</span>thead<span style="color: #339933;">&gt;</span>
		<span style="color: #339933;">&lt;</span>tr<span style="color: #339933;">&gt;</span>
			<span style="color: #339933;">&lt;</span>th<span style="color: #339933;">&gt;</span>Mon<span style="color: #339933;">&lt;/</span>th<span style="color: #339933;">&gt;&lt;</span>th<span style="color: #339933;">&gt;</span>Tue<span style="color: #339933;">&lt;/</span>th<span style="color: #339933;">&gt;&lt;</span>th<span style="color: #339933;">&gt;</span>Wed<span style="color: #339933;">&lt;/</span>th<span style="color: #339933;">&gt;</span>
			<span style="color: #339933;">&lt;</span>th<span style="color: #339933;">&gt;</span>Thu<span style="color: #339933;">&lt;/</span>th<span style="color: #339933;">&gt;&lt;</span>th<span style="color: #339933;">&gt;</span>Fri<span style="color: #339933;">&lt;/</span>th<span style="color: #339933;">&gt;&lt;</span>th<span style="color: #339933;">&gt;</span>Sat<span style="color: #339933;">&lt;/</span>th<span style="color: #339933;">&gt;</span>
			<span style="color: #339933;">&lt;</span>th<span style="color: #339933;">&gt;</span>Sun<span style="color: #339933;">&lt;/</span>th<span style="color: #339933;">&gt;</span>
		<span style="color: #339933;">&lt;/</span>tr<span style="color: #339933;">&gt;</span>
	<span style="color: #339933;">&lt;/</span>thead<span style="color: #339933;">&gt;</span>
	<span style="color: #339933;">&lt;</span>tbody<span style="color: #339933;">&gt;</span>
		<span style="color: #339933;">&lt;</span>tr<span style="color: #339933;">&gt;</span>
			<span style="color: #339933;">&lt;</span>td <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;padding&quot;</span> colspan<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;3&quot;</span><span style="color: #339933;">&gt;&lt;/</span>td<span style="color: #339933;">&gt;</span>
			<span style="color: #339933;">&lt;</span>td<span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">&lt;/</span>td<span style="color: #339933;">&gt;</span>
			<span style="color: #339933;">&lt;</span>td<span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">2</span><span style="color: #339933;">&lt;/</span>td<span style="color: #339933;">&gt;</span>
			<span style="color: #339933;">&lt;</span>td<span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">3</span><span style="color: #339933;">&lt;/</span>td<span style="color: #339933;">&gt;</span>
			<span style="color: #339933;">&lt;</span>td<span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">4</span><span style="color: #339933;">&lt;/</span>td<span style="color: #339933;">&gt;</span>
		<span style="color: #339933;">&lt;/</span>tr<span style="color: #339933;">&gt;</span>
		<span style="color: #339933;">&lt;</span>tr<span style="color: #339933;">&gt;</span>
			<span style="color: #339933;">&lt;</span>td<span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">5</span><span style="color: #339933;">&lt;/</span>td<span style="color: #339933;">&gt;</span>
			<span style="color: #339933;">&lt;</span>td<span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">6</span><span style="color: #339933;">&lt;/</span>td<span style="color: #339933;">&gt;</span>
			<span style="color: #339933;">&lt;</span>td<span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">7</span><span style="color: #339933;">&lt;/</span>td<span style="color: #339933;">&gt;</span>
			<span style="color: #339933;">&lt;</span>td<span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">8</span><span style="color: #339933;">&lt;/</span>td<span style="color: #339933;">&gt;</span>
			<span style="color: #339933;">&lt;</span>td <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;today&quot;</span><span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">9</span><span style="color: #339933;">&lt;/</span>td<span style="color: #339933;">&gt;</span>
			<span style="color: #339933;">&lt;</span>td<span style="color: #339933;">&gt;</span><span style="color: #cc66cc;">10</span><span style="color: #339933;">&lt;/</span>td<span style="color: #339933;">&gt;</span>
			<span style="color: #339933;">&lt;</span>td<span style="color: #339933;">&gt;</span><span style="color: #cc66cc;">11</span><span style="color: #339933;">&lt;/</span>td<span style="color: #339933;">&gt;</span>
		<span style="color: #339933;">&lt;/</span>tr<span style="color: #339933;">&gt;</span>
		<span style="color: #339933;">&lt;</span>tr<span style="color: #339933;">&gt;</span>
			<span style="color: #339933;">&lt;</span>td<span style="color: #339933;">&gt;</span><span style="color: #cc66cc;">12</span><span style="color: #339933;">&lt;/</span>td<span style="color: #339933;">&gt;</span>
			<span style="color: #339933;">&lt;</span>td <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;date_has_event&quot;</span><span style="color: #339933;">&gt;</span>
				<span style="color: #cc66cc;">13</span>
			<span style="color: #339933;">&lt;/</span>td<span style="color: #339933;">&gt;</span>
			<span style="color: #339933;">&lt;</span>td<span style="color: #339933;">&gt;</span><span style="color: #cc66cc;">14</span><span style="color: #339933;">&lt;/</span>td<span style="color: #339933;">&gt;</span>
			<span style="color: #339933;">&lt;</span>td<span style="color: #339933;">&gt;</span><span style="color: #cc66cc;">15</span><span style="color: #339933;">&lt;/</span>td<span style="color: #339933;">&gt;</span>
			<span style="color: #339933;">&lt;</span>td<span style="color: #339933;">&gt;</span><span style="color: #cc66cc;">16</span><span style="color: #339933;">&lt;/</span>td<span style="color: #339933;">&gt;</span>
			<span style="color: #339933;">&lt;</span>td<span style="color: #339933;">&gt;</span><span style="color: #cc66cc;">17</span><span style="color: #339933;">&lt;/</span>td<span style="color: #339933;">&gt;</span>
			<span style="color: #339933;">&lt;</span>td<span style="color: #339933;">&gt;</span><span style="color: #cc66cc;">18</span><span style="color: #339933;">&lt;/</span>td<span style="color: #339933;">&gt;</span>
		<span style="color: #339933;">&lt;/</span>tr<span style="color: #339933;">&gt;</span>
		<span style="color: #339933;">&lt;</span>tr<span style="color: #339933;">&gt;</span>
			<span style="color: #339933;">&lt;</span>td<span style="color: #339933;">&gt;</span><span style="color: #cc66cc;">19</span><span style="color: #339933;">&lt;/</span>td<span style="color: #339933;">&gt;</span>
			<span style="color: #339933;">&lt;</span>td<span style="color: #339933;">&gt;</span><span style="color: #cc66cc;">20</span><span style="color: #339933;">&lt;/</span>td<span style="color: #339933;">&gt;</span>
			<span style="color: #339933;">&lt;</span>td<span style="color: #339933;">&gt;</span><span style="color: #cc66cc;">21</span><span style="color: #339933;">&lt;/</span>td<span style="color: #339933;">&gt;</span>
			<span style="color: #339933;">&lt;</span>td <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;date_has_event&quot;</span><span style="color: #339933;">&gt;</span>
				<span style="color: #cc66cc;">22</span>
			<span style="color: #339933;">&lt;/</span>td<span style="color: #339933;">&gt;</span>
			<span style="color: #339933;">&lt;</span>td<span style="color: #339933;">&gt;</span><span style="color: #cc66cc;">23</span><span style="color: #339933;">&lt;/</span>td<span style="color: #339933;">&gt;</span>
			<span style="color: #339933;">&lt;</span>td<span style="color: #339933;">&gt;</span><span style="color: #cc66cc;">24</span><span style="color: #339933;">&lt;/</span>td<span style="color: #339933;">&gt;</span>
			<span style="color: #339933;">&lt;</span>td<span style="color: #339933;">&gt;</span><span style="color: #cc66cc;">25</span><span style="color: #339933;">&lt;/</span>td<span style="color: #339933;">&gt;</span>
		<span style="color: #339933;">&lt;/</span>tr<span style="color: #339933;">&gt;</span>	
		<span style="color: #339933;">&lt;</span>tr<span style="color: #339933;">&gt;</span>
			<span style="color: #339933;">&lt;</span>td<span style="color: #339933;">&gt;</span><span style="color: #cc66cc;">26</span><span style="color: #339933;">&lt;/</span>td<span style="color: #339933;">&gt;</span>
			<span style="color: #339933;">&lt;</span>td<span style="color: #339933;">&gt;</span><span style="color: #cc66cc;">27</span><span style="color: #339933;">&lt;/</span>td<span style="color: #339933;">&gt;</span>
			<span style="color: #339933;">&lt;</span>td<span style="color: #339933;">&gt;</span><span style="color: #cc66cc;">28</span><span style="color: #339933;">&lt;/</span>td<span style="color: #339933;">&gt;</span>
			<span style="color: #339933;">&lt;</span>td<span style="color: #339933;">&gt;</span><span style="color: #cc66cc;">29</span><span style="color: #339933;">&lt;/</span>td<span style="color: #339933;">&gt;</span>
			<span style="color: #339933;">&lt;</span>td<span style="color: #339933;">&gt;</span><span style="color: #cc66cc;">30</span><span style="color: #339933;">&lt;/</span>td<span style="color: #339933;">&gt;</span>
			<span style="color: #339933;">&lt;</span>td<span style="color: #339933;">&gt;</span><span style="color: #cc66cc;">31</span><span style="color: #339933;">&lt;/</span>td<span style="color: #339933;">&gt;</span>
			<span style="color: #339933;">&lt;</span>td <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;padding&quot;</span><span style="color: #339933;">&gt;&lt;/</span>td<span style="color: #339933;">&gt;</span>
		<span style="color: #339933;">&lt;/</span>tr<span style="color: #339933;">&gt;</span>
	<span style="color: #339933;">&lt;/</span>tbody<span style="color: #339933;">&gt;</span>
	<span style="color: #339933;">&lt;</span>tfoot<span style="color: #339933;">&gt;</span>
		<span style="color: #339933;">&lt;</span>th<span style="color: #339933;">&gt;</span>Mon<span style="color: #339933;">&lt;/</span>th<span style="color: #339933;">&gt;&lt;</span>th<span style="color: #339933;">&gt;</span>Tue<span style="color: #339933;">&lt;/</span>th<span style="color: #339933;">&gt;&lt;</span>th<span style="color: #339933;">&gt;</span>Wed<span style="color: #339933;">&lt;/</span>th<span style="color: #339933;">&gt;</span>
		<span style="color: #339933;">&lt;</span>th<span style="color: #339933;">&gt;</span>Thu<span style="color: #339933;">&lt;/</span>th<span style="color: #339933;">&gt;&lt;</span>th<span style="color: #339933;">&gt;</span>Fri<span style="color: #339933;">&lt;/</span>th<span style="color: #339933;">&gt;&lt;</span>th<span style="color: #339933;">&gt;</span>Sat<span style="color: #339933;">&lt;/</span>th<span style="color: #339933;">&gt;</span>
		<span style="color: #339933;">&lt;</span>th<span style="color: #339933;">&gt;</span>Sun<span style="color: #339933;">&lt;/</span>th<span style="color: #339933;">&gt;</span>
	<span style="color: #339933;">&lt;/</span>tfoot<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>table<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>


<p>All the magic takes place with some ninja CSS:</p>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
</pre></td><td class="code"><pre class="css" style="font-family:monospace;">table <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">border-collapse</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">separate</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#9DABCE</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">border-width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">0px</span> <span style="color: #933;">0px</span> <span style="color: #933;">1px</span> <span style="color: #933;">1px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span> <span style="color: #993333;">auto</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
td<span style="color: #00AA00;">,</span> th <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">81px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">81px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">center</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">vertical-align</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">middle</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">../img/cells.png</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#444</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">relative</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
th <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">30px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">font-weight</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">bold</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">14px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
td<span style="color: #3333ff;">:hover</span><span style="color: #00AA00;">,</span> th<span style="color: #3333ff;">:hover </span><span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">background-position</span><span style="color: #00AA00;">:</span> <span style="color: #933;">0px</span> <span style="color: #933;">-81px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#222</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
td<span style="color: #6666ff;">.date_has_event</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">background-position</span><span style="color: #00AA00;">:</span> <span style="color: #933;">162px</span> <span style="color: #933;">0px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">white</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
td<span style="color: #6666ff;">.date_has_event</span><span style="color: #3333ff;">:hover </span><span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">background-position</span><span style="color: #00AA00;">:</span> <span style="color: #933;">162px</span> <span style="color: #933;">-81px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
td<span style="color: #6666ff;">.padding</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">../img/calpad.jpg</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
td<span style="color: #6666ff;">.today</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">background-position</span><span style="color: #00AA00;">:</span> <span style="color: #933;">81px</span> <span style="color: #933;">0px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">white</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
td<span style="color: #6666ff;">.today</span><span style="color: #3333ff;">:hover </span><span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">background-position</span><span style="color: #00AA00;">:</span> <span style="color: #933;">81px</span> <span style="color: #933;">-81px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>


<p>Please note a couple of things here, as it&#8217;s the trickiest part:</p>

<ul>
<li><strong>Make your images seamless.</strong> Draw only the top and right border of the cells inside the image: neighbour cells will continue the pattern. Then add the bottom and left border to the table via CSS to complete the work.</li>
<li><strong>Use a single image for all the graphics</strong> whenever is possible to decrease the download speed time (just a single TCP three-way-handshake to manage, a single Apache request to be answered by your server, a single PNG header overhead to be downloaded).</li>
</ul>

<p>In addition to the plain calendar structure, we obviously also want the events description to show up on mouse hover. To do that, just add this block inside the calendar cells:</p>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>td <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;date_has_event&quot;</span><span style="color: #339933;">&gt;</span>
	<span style="color: #cc66cc;">13</span>
	<span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;events&quot;</span><span style="color: #339933;">&gt;</span>
		<span style="color: #339933;">&lt;</span>ul<span style="color: #339933;">&gt;</span>
			<span style="color: #339933;">&lt;</span>li<span style="color: #339933;">&gt;</span>
				<span style="color: #339933;">&lt;</span>span <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;title&quot;</span><span style="color: #339933;">&gt;</span>Event <span style="color: #cc66cc;">1</span><span style="color: #339933;">&lt;/</span>span<span style="color: #339933;">&gt;</span>
				<span style="color: #339933;">&lt;</span>span <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;desc&quot;</span><span style="color: #339933;">&gt;</span>Lorem ipsum dolor sit amet<span style="color: #339933;">,</span> consectetu adipisicing elit<span style="color: #339933;">.&lt;/</span>span<span style="color: #339933;">&gt;</span>
			<span style="color: #339933;">&lt;/</span>li<span style="color: #339933;">&gt;</span>
			<span style="color: #339933;">&lt;</span>li<span style="color: #339933;">&gt;</span>
				<span style="color: #339933;">&lt;</span>span <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;title&quot;</span><span style="color: #339933;">&gt;</span>Event <span style="color: #cc66cc;">2</span><span style="color: #339933;">&lt;/</span>span<span style="color: #339933;">&gt;</span>
				<span style="color: #339933;">&lt;</span>span <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;desc&quot;</span><span style="color: #339933;">&gt;</span>Excepteur sint occaecat cupidatat non proident<span style="color: #339933;">,</span> sunt in culpa qui officia deserunt mollit anim id est laborum<span style="color: #339933;">.&lt;/</span>span<span style="color: #339933;">&gt;</span>
			<span style="color: #339933;">&lt;/</span>li<span style="color: #339933;">&gt;</span>
		<span style="color: #339933;">&lt;/</span>ul<span style="color: #339933;">&gt;</span>
	<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>td<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>


<p>And use the beautiful, handy, lightweight Coda-like effect for jQuery to bring it to life (how I love jQuery?)</p>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.date_has_event'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #006600; font-style: italic;">// options</span>
		<span style="color: #003366; font-weight: bold;">var</span> distance <span style="color: #339933;">=</span> <span style="color: #CC0000;">10</span><span style="color: #339933;">;</span>
		<span style="color: #003366; font-weight: bold;">var</span> time <span style="color: #339933;">=</span> <span style="color: #CC0000;">250</span><span style="color: #339933;">;</span>
		<span style="color: #003366; font-weight: bold;">var</span> hideDelay <span style="color: #339933;">=</span> <span style="color: #CC0000;">500</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #003366; font-weight: bold;">var</span> hideDelayTimer <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #006600; font-style: italic;">// tracker</span>
		<span style="color: #003366; font-weight: bold;">var</span> beingShown <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
		<span style="color: #003366; font-weight: bold;">var</span> shown <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #003366; font-weight: bold;">var</span> trigger <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #003366; font-weight: bold;">var</span> popup <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.events ul'</span><span style="color: #339933;">,</span> <span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'opacity'</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #006600; font-style: italic;">// set the mouseover and mouseout on both element</span>
		$<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#91;</span>trigger.<span style="color: #660066;">get</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> popup.<span style="color: #660066;">get</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">mouseover</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #006600; font-style: italic;">// stops the hide event if we move from the trigger to the popup element</span>
			<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>hideDelayTimer<span style="color: #009900;">&#41;</span> clearTimeout<span style="color: #009900;">&#40;</span>hideDelayTimer<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #006600; font-style: italic;">// don't trigger the animation again if we're being shown, or already visible</span>
			<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>beingShown <span style="color: #339933;">||</span> shown<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				<span style="color: #000066; font-weight: bold;">return</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
				beingShown <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span>
&nbsp;
				<span style="color: #006600; font-style: italic;">// reset position of popup box</span>
				popup.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
					bottom<span style="color: #339933;">:</span> <span style="color: #CC0000;">20</span><span style="color: #339933;">,</span>
					left<span style="color: #339933;">:</span> <span style="color: #339933;">-</span><span style="color: #CC0000;">76</span><span style="color: #339933;">,</span>
					display<span style="color: #339933;">:</span> <span style="color: #3366CC;">'block'</span> <span style="color: #006600; font-style: italic;">// brings the popup back in to view</span>
				<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>
&nbsp;
				<span style="color: #006600; font-style: italic;">// (we're using chaining on the popup) now animate it's opacity and position</span>
				.<span style="color: #660066;">animate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
					bottom<span style="color: #339933;">:</span> <span style="color: #3366CC;">'+='</span> <span style="color: #339933;">+</span> distance <span style="color: #339933;">+</span> <span style="color: #3366CC;">'px'</span><span style="color: #339933;">,</span>
					opacity<span style="color: #339933;">:</span> <span style="color: #CC0000;">1</span>
				<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> time<span style="color: #339933;">,</span> <span style="color: #3366CC;">'swing'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
					<span style="color: #006600; font-style: italic;">// once the animation is complete, set the tracker variables</span>
					beingShown <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
					shown <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span>
				<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">mouseout</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #006600; font-style: italic;">// reset the timer if we get fired again - avoids double animations</span>
			<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>hideDelayTimer<span style="color: #009900;">&#41;</span> clearTimeout<span style="color: #009900;">&#40;</span>hideDelayTimer<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #006600; font-style: italic;">// store the timer so that it can be cleared in the mouseover if required</span>
			hideDelayTimer <span style="color: #339933;">=</span> setTimeout<span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				hideDelayTimer <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">;</span>
				popup.<span style="color: #660066;">animate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
					bottom<span style="color: #339933;">:</span> <span style="color: #3366CC;">'-='</span> <span style="color: #339933;">+</span> distance <span style="color: #339933;">+</span> <span style="color: #3366CC;">'px'</span><span style="color: #339933;">,</span>
					opacity<span style="color: #339933;">:</span> <span style="color: #CC0000;">0</span>
				<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> time<span style="color: #339933;">,</span> <span style="color: #3366CC;">'swing'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
					<span style="color: #006600; font-style: italic;">// once the animate is complete, set the tracker variables</span>
					shown <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
					<span style="color: #006600; font-style: italic;">// hide the popup entirely after the effect (opacity alone doesn't do the job)</span>
					popup.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'display'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'none'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> hideDelay<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>


<p>This is the CSS code used to style the popup div:</p>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
</pre></td><td class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.events</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">relative</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.events</span> ul <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">absolute</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">z-index</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">1000</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">15px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#E7ECF2</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">../img/popup.png</span><span style="color: #00AA00;">&#41;</span> <span style="color: #993333;">no-repeat</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">white</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> <span style="color: #993333;">white</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">15px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">200px</span><span style="color: #00AA00;">;</span>
	-moz-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">3px</span><span style="color: #00AA00;">;</span>
	-khtml-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">3px</span><span style="color: #00AA00;">;</span>
	-webkit-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">3px</span><span style="color: #00AA00;">;</span>
	-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">3px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">list-style</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#444444</span><span style="color: #00AA00;">;</span>
	-webkit-box-shadow<span style="color: #00AA00;">:</span> <span style="color: #933;">0px</span> <span style="color: #933;">8px</span> <span style="color: #933;">8px</span> <span style="color: #cc00cc;">#333</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.events</span> li <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">padding-bottom</span><span style="color: #00AA00;">:</span> <span style="color: #933;">5px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.events</span> li span <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">block</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">12px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">justify</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#555</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.events</span> li span<span style="color: #6666ff;">.title</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">font-weight</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">bold</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#222</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>


<p>Please note how nice the box-shadow CSS property is when applied to the popup&#8230; unfortunately, this CSS3 property is still only implemented in WebKit browsers (Safari, Google Chrome), but more of them are about to support it.</p>

<div class="wpmarkitup_download">
 <div class="box">
  <a href="http://www.stefanoverna.com/wp-content/tutorials/ical_like_calendar/demo.zip"><img src="http://www.stefanoverna.com/wp-content/themes/v1.0/imgs/zip_icon.jpg" alt="ZIP Icon"/> Download the source files!</a>
 </div>
 <br class="clear" />
</div>

<p>And&#8230; that&#8217;s it. Simple and sweet, as we wanted. Obviously, you&#8217;ll have to properly configure your preferred Wordpress plugin to output a code like the one I showed you, but that&#8217;s the boring part of the lesson and I&#8217;ll skip it :) Instead, let me just add a note&#8230;</p>

<h3>Choosing the right Wordpress Plugin</h3>

<p>There are plenty of pretty good Wordpress calendar plugins around to facilitate your backend work. I can tell you I tried them all, and the one that convinced me the most was <a href="http://wpcal.firetree.net/" title="Event Calendar Plugin for Wordpress">Event Calendar</a>.</p>

<p>With Event Calendar you can add a countless number of events to any post or page directly within the New and Edit page, there&#8217;s a lot of great functions you can use to freely tweak the event-browsing experience within your PHP template &#8212; but some work still should be done in this direction &#8212; it&#8217;s AJAX ready and the plugin itself is already localized in 19 languages.</p>

<p>Hope you&#8217;ve enjoyed the tut! I&#8217;ll try to reply to your question in my free time :)</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/stefanoverna?a=H0BZAHxHdYc:GgkLiYJ8DUs:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/stefanoverna?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/stefanoverna?a=H0BZAHxHdYc:GgkLiYJ8DUs:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/stefanoverna?i=H0BZAHxHdYc:GgkLiYJ8DUs:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/stefanoverna?a=H0BZAHxHdYc:GgkLiYJ8DUs:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/stefanoverna?i=H0BZAHxHdYc:GgkLiYJ8DUs:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/stefanoverna?a=H0BZAHxHdYc:GgkLiYJ8DUs:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/stefanoverna?i=H0BZAHxHdYc:GgkLiYJ8DUs:F7zBnMyn0Lo" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.stefanoverna.com/log/create-astonishing-ical-like-calendars-with-jquery/feed</wfw:commentRss>
		</item>
		<item>
		<title>WP-MarkItUp! v1.3.3</title>
		<link>http://www.stefanoverna.com/uncategorized/wp-markitup-v133</link>
		<comments>http://www.stefanoverna.com/uncategorized/wp-markitup-v133#comments</comments>
		<pubDate>Wed, 17 Dec 2008 12:36:11 +0000</pubDate>
		<dc:creator>Stefano Verna</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[Add new tag]]></category>

		<category><![CDATA[wordpress plugin]]></category>

		<category><![CDATA[wp markitup]]></category>

		<guid isPermaLink="false">http://www.stefanoverna.com/?p=524</guid>
		<description><![CDATA[Just a quick update to let you know that the new version of WP-MarkItUp! &#8212; already committed to the Wordpress Plugin Repository &#8212; should fix all the problems you may experiencing with WordPress 2.7, “Coltrane”.

Upgrade it now!
]]></description>
			<content:encoded><![CDATA[<p>Just a quick update to let you know that the new version of WP-MarkItUp! &#8212; already committed to the Wordpress Plugin Repository &#8212; should fix all the problems you may experiencing with WordPress 2.7, “Coltrane”.</p>

<p>Upgrade it now!</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/stefanoverna?a=IGRm9WTDhQU:1m5MjzHuTvo:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/stefanoverna?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/stefanoverna?a=IGRm9WTDhQU:1m5MjzHuTvo:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/stefanoverna?i=IGRm9WTDhQU:1m5MjzHuTvo:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/stefanoverna?a=IGRm9WTDhQU:1m5MjzHuTvo:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/stefanoverna?i=IGRm9WTDhQU:1m5MjzHuTvo:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/stefanoverna?a=IGRm9WTDhQU:1m5MjzHuTvo:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/stefanoverna?i=IGRm9WTDhQU:1m5MjzHuTvo:F7zBnMyn0Lo" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.stefanoverna.com/uncategorized/wp-markitup-v133/feed</wfw:commentRss>
		</item>
		<item>
		<title>Monthly Update</title>
		<link>http://www.stefanoverna.com/log/monthly-update</link>
		<comments>http://www.stefanoverna.com/log/monthly-update#comments</comments>
		<pubDate>Thu, 23 Oct 2008 18:47:40 +0000</pubDate>
		<dc:creator>Stefano Verna</dc:creator>
		
		<category><![CDATA[Log]]></category>

		<category><![CDATA[update]]></category>

		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://www.stefanoverna.com/?p=521</guid>
		<description><![CDATA[Hi guys. As you might have guessed from the drastically reduced posts per week ratio, this has been a really challenging month for me, in a positive way.
I&#8217;m currently working on four different website projects at the same time, three of which starting totally from scratch. It has been a great opportunity to measure my [...]]]></description>
			<content:encoded><![CDATA[<p>Hi guys. As you might have guessed from the drastically reduced posts per week ratio, this has been a really challenging month for me, in a positive way.<br />
I&#8217;m currently working on four different website projects at the same time, three of which starting totally from scratch. It has been a great opportunity to measure my design &amp; php coding skills, and I think you can imagine the pleasure of starting to actually see the first great results slowly coming out from the initial prototyping phases.
The silly thing is that I had been contacted also by a couple of other clients in this period, so that I had to refuse their proposal due to lack of time (darmn it, university).</p>

<p>I don&#8217;t want to say more about it, but I will surely update my online portfolio with all these great pieces of net as soon as they&#8217;ll be stable online.</p>

<p>In the meantime I can tell you that the updated FlickrRSS Wordpress plugin is almost done, we now just need to rewrite the documentation. Stay tuned!</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/stefanoverna?a=ady2vs52tJY:nMeEw5ka948:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/stefanoverna?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/stefanoverna?a=ady2vs52tJY:nMeEw5ka948:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/stefanoverna?i=ady2vs52tJY:nMeEw5ka948:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/stefanoverna?a=ady2vs52tJY:nMeEw5ka948:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/stefanoverna?i=ady2vs52tJY:nMeEw5ka948:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/stefanoverna?a=ady2vs52tJY:nMeEw5ka948:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/stefanoverna?i=ady2vs52tJY:nMeEw5ka948:F7zBnMyn0Lo" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.stefanoverna.com/log/monthly-update/feed</wfw:commentRss>
		</item>
		<item>
		<title>WP-MarkItUp! v1.3</title>
		<link>http://www.stefanoverna.com/log/wp-markitup-v13</link>
		<comments>http://www.stefanoverna.com/log/wp-markitup-v13#comments</comments>
		<pubDate>Wed, 24 Sep 2008 17:50:26 +0000</pubDate>
		<dc:creator>Stefano Verna</dc:creator>
		
		<category><![CDATA[Log]]></category>

		<guid isPermaLink="false">http://www.stefanoverna.com/?p=514</guid>
		<description><![CDATA[An updated version of WP-MarkItUp! should be available in the very next minutes from the wordpress.org plugin archive. It features the Dutch localization of the plugin (a big thanks to pw-web please!), and it fixes some problems related to the useless inclusion of the wp-config.php file.
I really think this plugin can become a must-have for [...]]]></description>
			<content:encoded><![CDATA[<p>An updated version of WP-MarkItUp! should be available in the very next minutes from the wordpress.org plugin archive. It features the Dutch localization of the plugin (a big thanks to <a href="http://www.pw-web.nl/">pw-web</a> please!), and it fixes some problems related to the useless inclusion of the <code>wp-config.php</code> file.
I really think this plugin can become a must-have for a lot of Wordpress installations.. it&#8217;s an awesome tool to speed up your daily posting.</p>

<p>PS. I just got added to the prestigious <a href="http://csscreme.com/gallery/stefano_verna/" title="">Css Creme</a> web design gallery, and the <a href="http://css-design-yorkshire.blogspot.com/2008/09/stefano-verna.html" title="">CSS Design Yorkshire</a> web gallery also! That&#8217;s cool man!</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/stefanoverna?a=QEtbAer3I30:p3_DAnq9WRA:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/stefanoverna?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/stefanoverna?a=QEtbAer3I30:p3_DAnq9WRA:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/stefanoverna?i=QEtbAer3I30:p3_DAnq9WRA:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/stefanoverna?a=QEtbAer3I30:p3_DAnq9WRA:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/stefanoverna?i=QEtbAer3I30:p3_DAnq9WRA:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/stefanoverna?a=QEtbAer3I30:p3_DAnq9WRA:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/stefanoverna?i=QEtbAer3I30:p3_DAnq9WRA:F7zBnMyn0Lo" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.stefanoverna.com/log/wp-markitup-v13/feed</wfw:commentRss>
		</item>
		<item>
		<title>FlickrRSS will soon be upgraded…</title>
		<link>http://www.stefanoverna.com/log/flickrrss-will-soon-be-upgraded</link>
		<comments>http://www.stefanoverna.com/log/flickrrss-will-soon-be-upgraded#comments</comments>
		<pubDate>Sat, 13 Sep 2008 21:41:17 +0000</pubDate>
		<dc:creator>Stefano Verna</dc:creator>
		
		<category><![CDATA[Log]]></category>

		<category><![CDATA[flickr]]></category>

		<category><![CDATA[flickrrss]]></category>

		<category><![CDATA[wordpress plugin]]></category>

		<guid isPermaLink="false">http://www.stefanoverna.com/?p=504</guid>
		<description><![CDATA[&#8230; and guess what? It will have something that will closely remind you my Advanced FlickrRSS patch.

That&#8217;s right folks, let me tell you officially: Dave Kellam &#8212; the developer of the official FlickRSS plugin &#8212; and I are already working to patch the current 4.0 version with a huge number of improvements, from better caching [...]]]></description>
			<content:encoded><![CDATA[<p>&#8230; and guess what? It will have something that will closely remind you my Advanced FlickrRSS patch.</p>

<p>That&#8217;s right folks, let me tell you officially: <a href="http://eightface.com/about/" title="Dave Kellam About Page">Dave Kellam</a> &mdash; the developer of the official FlickRSS plugin &mdash; and I are already working to patch the current 4.0 version with a huge number of improvements, from better caching to more costumization of the image gallery, passing through an improved settings user interface and a more manageable source code. Uh, and preserving backward compatibility.<br />
Those changes are already available in the trunk of the FlickrRSS subversion repository, and after a couple of days of massive testing will be released to the public audience.</p>

<p>Isn&#8217;t it great news? Stay tuned!</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/stefanoverna?a=ccMw-5WLvPU:3YImKi6VeTQ:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/stefanoverna?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/stefanoverna?a=ccMw-5WLvPU:3YImKi6VeTQ:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/stefanoverna?i=ccMw-5WLvPU:3YImKi6VeTQ:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/stefanoverna?a=ccMw-5WLvPU:3YImKi6VeTQ:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/stefanoverna?i=ccMw-5WLvPU:3YImKi6VeTQ:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/stefanoverna?a=ccMw-5WLvPU:3YImKi6VeTQ:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/stefanoverna?i=ccMw-5WLvPU:3YImKi6VeTQ:F7zBnMyn0Lo" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.stefanoverna.com/log/flickrrss-will-soon-be-upgraded/feed</wfw:commentRss>
		</item>
		<item>
		<title>WP+Fancybox+FlickrRSS? Wohaa!</title>
		<link>http://www.stefanoverna.com/log/fancybox-flickrss-wordpress</link>
		<comments>http://www.stefanoverna.com/log/fancybox-flickrss-wordpress#comments</comments>
		<pubDate>Fri, 05 Sep 2008 17:35:23 +0000</pubDate>
		<dc:creator>Stefano Verna</dc:creator>
		
		<category><![CDATA[Log]]></category>

		<guid isPermaLink="false">http://www.stefanoverna.com/?p=411</guid>
		<description><![CDATA[After receiving some great comments about the cute Flickr thumbnails and the associated popup effect in the About section, I thought I could share some tips on how a similar effect can be replicated inside a fresh Wordpress installation. Well, that&#8217;s not difficult to achieve, at all, but before start let me show you what [...]]]></description>
			<content:encoded><![CDATA[<p>After receiving some great comments about the cute Flickr thumbnails and the associated popup effect in the <a href="http://www.stefanoverna.com/about" title="Stefano Verna: About Me">About section</a>, I thought I could share some tips on how a similar effect can be replicated inside a fresh Wordpress installation. Well, that&#8217;s not difficult to achieve, at all, but before start let me show you what we&#8217;re talking about (and don&#8217;t forget to click the thumbs, or you&#8217;ll miss half of the fun).</p>

<div class="flickrcontainer"><div class="flickr_gallery"><div class="flickrimage"><a href="http://farm5.static.flickr.com/4064/4418726451_62ef23bdc2.jpg" title="Hiding in the Garden" rel="flickrgroup" style="background-image: url(http://farm5.static.flickr.com/4064/4418726451_62ef23bdc2_m.jpg)"></a></div><div class="flickrimage"><a href="http://farm3.static.flickr.com/2698/4417596273_9ee87d33d2.jpg" title="Gotas de hierba" rel="flickrgroup" style="background-image: url(http://farm3.static.flickr.com/2698/4417596273_9ee87d33d2_m.jpg)"></a></div><div class="flickrimage"><a href="http://farm5.static.flickr.com/4031/4410467287_495e545da7.jpg" title="ziggy olha para a bola." rel="flickrgroup" style="background-image: url(http://farm5.static.flickr.com/4031/4410467287_495e545da7_m.jpg)"></a></div><div class="flickrimage"><a href="http://farm3.static.flickr.com/2718/4410339842_0a309e224a.jpg" title="Tree" rel="flickrgroup" style="background-image: url(http://farm3.static.flickr.com/2718/4410339842_0a309e224a_m.jpg)"></a></div><div class="flickrimage"><a href="http://farm3.static.flickr.com/2728/4408503848_7952c11b30.jpg" title="photo of the day 23/1/10  - Rosie &amp; Lou by the sea" rel="flickrgroup" style="background-image: url(http://farm3.static.flickr.com/2728/4408503848_7952c11b30_m.jpg)"></a></div><div class="flickrimage"><a href="http://farm5.static.flickr.com/4004/4399683049_70dd3272f7.jpg" title="madi" rel="flickrgroup" style="background-image: url(http://farm5.static.flickr.com/4004/4399683049_70dd3272f7_m.jpg)"></a></div><div class="flickrimage"><a href="http://farm5.static.flickr.com/4052/4400450550_6467a590c0.jpg" title="madison" rel="flickrgroup" style="background-image: url(http://farm5.static.flickr.com/4052/4400450550_6467a590c0_m.jpg)"></a></div><div class="flickrimage"><a href="http://farm5.static.flickr.com/4040/4400450948_c0000ce055.jpg" title="madi" rel="flickrgroup" style="background-image: url(http://farm5.static.flickr.com/4040/4400450948_c0000ce055_m.jpg)"></a></div><div class="flickrimage"><a href="http://farm5.static.flickr.com/4062/4399377349_f6317e0259.jpg" title="Down at the river" rel="flickrgroup" style="background-image: url(http://farm5.static.flickr.com/4062/4399377349_f6317e0259_m.jpg)"></a></div></div><br class="clear"/></div>

<h3>The Recipe&#8230;</h3>

<p>First of all, you need to download the latest version of <a href="http://fancy.klade.lv/" title="FancyBox">Fancybox</a>, the jQuery lightbox-like plugin, and the <a href="http://jquery.andreaseberhard.de/pngFix/" title="pngFix jQuery plugin">pngFix plugin</a> for IE6. Finally, download the <a href="http://www.stefanoverna.com/log/advanced-flickrss" title="Advanced FlickrRSS for Wordpress">Advanced FlickrRSS plugin for Wordpress</a> I posted yesterday.</p>

<p>Ok, so now what we&#8217;re basically going to do is put these tools in a large bowl, add 2 cups of ninja CSS and mix them until they&#8217;re combined well.</p>

<h3>Gorgeous CSS Decorated Galleries? Yuhm!</h3>

<p>To build our terrific Flickr gallery we&#8217;ll make use of this wonderful tutorial by the Web Designer Wall about <a href="http://www.webdesignerwall.com/tutorials/css-decorative-gallery/" title="CSS Decorative Gallery">CSS Decorative Galleries</a>: hot stuff, isn&#8217;t it? :)<br />
It basically builds up a simple HTML structure like this one:</p>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;flickr_gallery&quot;</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;flickr_thumb&quot;</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">span</span>&gt;</span> <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">span</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;image&quot;</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;image.jpg&quot;</span> <span style="color: #000066;">title</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;My Flickr Image&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
  <span style="color: #808080; font-style: italic;">&lt;!-- other images here... --&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></td></tr></table></div>


<p>Where the empty <code>&lt;span/&gt;</code> tag is the one that does the trick: if you set <code>position: relative</code> to the <code>.flickr_thumb</code>, you are able put the <code>&lt;span/&gt;</code> box over the <code>&lt;img/&gt;</code> using the <code>position: absolute</code> property. Then you just need to give to the <code>&lt;span/&gt;</code> a PNG background image representing some kind of pretty frame. The Flickr image will appear underneath the transparent parts of the frame image.<br />
That&#8217;s the basic concept, obviously. Web Designer Wall offers far more detailed instructions about the various effects that can be obtained with this simple but effective CSS tecnique and dozens of different demo galleries to learn/copy from.</p>

<p>For our Flickr gallery, this is the HTML code we&#8217;ll use:</p>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;flickr_gallery&quot;</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;flickr_thumb&quot;</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">span</span>&gt;</span> <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">span</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span> <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;background-image: url(image_thumb.jpg)&quot;</span></span>
<span style="color: #009900;">    &gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
  <span style="color: #808080; font-style: italic;">&lt;!-- other images here... --&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;clear&quot;</span><span style="color: #66cc66;">/</span>&gt;</span></pre></td></tr></table></div>


<p>You might notice that I did not put the Flickr photo inside an <code>&lt;img/&gt;</code> tag like in the previous example, but I used it as a CSS background. This is a simple trick to remember when you need to trim a photo at a desidered size without making any editing. You can then decide which part of the image will be cut out with the <code>background-position</code> CSS property.<br />
The reason why I used an <code>&lt;a/&gt;</code> tag instead of a default <code>&lt;div/&gt;</code> will be clear later.</p>

<p>Here&#8217;s the complete CSS stylesheet related to the above code:</p>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
</pre></td><td class="code"><pre class="css" style="font-family:monospace;">body <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span> Georgia<span style="color: #00AA00;">,</span><span style="color: #993333;">sans-serif</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">14px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#333</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">center</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #6666ff;">.flickr_gallery</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">40px</span> <span style="color: #993333;">auto</span> <span style="color: #933;">5px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">415px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #6666ff;">.flickr_thumb</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">transparent</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">imgs/polaroid.jpg</span><span style="color: #00AA00;">&#41;</span> <span style="color: #993333;">no-repeat</span> <span style="color: #993333;">scroll</span> <span style="color: #933;"><span style="color: #cc66cc;">50</span>%</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">inline</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">125px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">15px</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">center</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">116px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">relative</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #6666ff;">.flickr_thumb</span> a <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">block</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">relative</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">8px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">background-position</span><span style="color: #00AA00;">:</span> <span style="color: #933;"><span style="color: #cc66cc;">50</span>%</span> <span style="color: #933;"><span style="color: #cc66cc;">50</span>%</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #6666ff;">.flickr_thumb</span> span <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">transparent</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">imgs/tape.png</span><span style="color: #00AA00;">&#41;</span> <span style="color: #993333;">no-repeat</span> <span style="color: #993333;">scroll</span> <span style="color: #933;"><span style="color: #cc66cc;">50</span>%</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">25px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">absolute</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">:</span> <span style="color: #933;">-10px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">77px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">z-index</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">10</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #6666ff;">.clear</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">clear</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">both</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>


<h3>May I introduce you FancyBox?</h3>

<p>We now want to add that awesome FancyBox zooming effect to our gallery. To do that, add a link to the jQuery library, the FancyBox plugin and the pngFix plugin just before the closing tag of your <code>&lt;body&gt;</code> Wordpress template (you&#8217;ll probably find it on footer.php). Then, just after, add the code needed to setup Fancybox:</p>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;">    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;js/jquery-1.2.3.js&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;js/jquery.pngFix.js&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;js/jquery.fancybox.js&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;</span>
      $(document).ready(function(){
        $(&quot;.flickr_gallery .flickr_thumb a&quot;).fancybox();
      });
    <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">body</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">html</span>&gt;</span></pre></td></tr></table></div>


<p>We just have to add a couple of attributes more to our HTML thumbnails (<code>rel</code> to group the different images inside a single Fancybox gallery and <code>title</code> to add a caption to the photos) and the work is done:</p>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;flickr_gallery&quot;</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;flickr_thumb&quot;</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">span</span>&gt;</span> <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">span</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;image_big.jpg&quot;</span> </span>
<span style="color: #009900;">       <span style="color: #000066;">title</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;My Flickr Image Title&quot;</span> </span>
<span style="color: #009900;">       <span style="color: #000066;">rel</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;FlickrGallery&quot;</span></span>
<span style="color: #009900;">       <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;background-image: url(image_thumb.jpg)&quot;</span></span>
<span style="color: #009900;">    &gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
  <span style="color: #808080; font-style: italic;">&lt;!-- other images here... --&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;clear&quot;</span><span style="color: #66cc66;">/</span>&gt;</span></pre></td></tr></table></div>


<p>Please remember also to <strong>add a link to the Fancybox stylesheet</strong> into the <code>&lt;head&gt;</code> of your template, or the final result will be quite weird!</p>

<h3>Let&#8217;s get dynamic: FlickrRSS!</h3>

<p>Since we want a dynamic Flickr gallery, we now need to install the modified WP plugin FlickrRSS I posted yesterday. Once done, just <strong>go to the FlickrRSS Settings page</strong>, choose the photos to show, then fill the HTML Builder Form with the following values:</p>

<ul>
<li><strong>Before List:</strong></li>
</ul>


<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;flickr_gallery&quot;</span>&gt;</span></pre></div></div>


<ul>
<li><strong>Item HTML:</strong></li>
</ul>


<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;flickr_thumb&quot;</span>&gt;</span>
 <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">span</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">span</span>&gt;</span>
 <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span> </span>
<span style="color: #009900;">   <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;%image_medium%&quot;</span></span>
<span style="color: #009900;">   <span style="color: #000066;">title</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;%title%&quot;</span></span>
<span style="color: #009900;">   <span style="color: #000066;">rel</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;FlickrGallery&quot;</span></span>
<span style="color: #009900;">   <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;background-image: url(%image_square%)&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>


<ul>
<li><strong>After List:</strong></li>
</ul>


<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;clear&quot;</span><span style="color: #66cc66;">/</span>&gt;</span></pre></div></div>


<p>Great! Now, you just have to add the FlickrRSS widget on your sidebar, or, if you prefer, add the following PHP code where you want your gallery to appear:</p>


<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
  get_FlickrRSS<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>


<h3>Working Demo</h3>

<p>We&#8217;re done. Your damn cute Flickr gallery should be ready for primetime. I prepared a <a href="http://www.stefanoverna.com/wp-content/tutorials/beautiful_flickr_galleries_wordpress.html" title="">working example page</a> of the gallery we built together, just in case you need it. If you have any questions/suggestions, please let me know!</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/stefanoverna?a=HeUdo0B6m8w:o7WdXM05OzA:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/stefanoverna?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/stefanoverna?a=HeUdo0B6m8w:o7WdXM05OzA:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/stefanoverna?i=HeUdo0B6m8w:o7WdXM05OzA:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/stefanoverna?a=HeUdo0B6m8w:o7WdXM05OzA:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/stefanoverna?i=HeUdo0B6m8w:o7WdXM05OzA:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/stefanoverna?a=HeUdo0B6m8w:o7WdXM05OzA:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/stefanoverna?i=HeUdo0B6m8w:o7WdXM05OzA:F7zBnMyn0Lo" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.stefanoverna.com/log/fancybox-flickrss-wordpress/feed</wfw:commentRss>
		</item>
		<item>
		<title>An Advanced WP FlickrRSS plugin</title>
		<link>http://www.stefanoverna.com/log/advanced-flickrss</link>
		<comments>http://www.stefanoverna.com/log/advanced-flickrss#comments</comments>
		<pubDate>Thu, 04 Sep 2008 14:25:48 +0000</pubDate>
		<dc:creator>Stefano Verna</dc:creator>
		
		<category><![CDATA[Log]]></category>

		<category><![CDATA[flickr]]></category>

		<category><![CDATA[flickrss]]></category>

		<category><![CDATA[plugin]]></category>

		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.stefanoverna.com/?p=446</guid>
		<description><![CDATA[If you&#8217;ve already used FlickrRSS in your life, you probably remember it as a good, loyal Wordpress plugin. I agree with you: it can show you sets, groups pool, public photos, it handles caching of photos.
Unfortunately it lacks of some advanced costumization options:


You cannot personalize the code to show up for each photo (e.g. you [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;ve already used <a href="http://eightface.com/wordpress/flickrrss/" title="FlickrRSS plugin">FlickrRSS</a> in your life, you probably remember it as a good, loyal Wordpress plugin. I agree with you: it can show you sets, groups pool, public photos, it handles caching of photos.
Unfortunately it lacks of some advanced costumization options:</p>

<ul>
<li>You cannot personalize the code to show up for each photo (e.g. you want to link the Flickr square thumbnail to the original image, and not to the Flickr page containing the photo). </li>
<li>What if I want to cache both the square thumb and the large image?</li>
<li>Also, the parameters to pass to the plugin function are quite dirty (we don&#8217;t like long list of unexplained parameters, do we?)</li>
</ul>

<p>Well, I modified the FlickrRSS plugin to satisfy the above needs and as soon as possible I&#8217;ll try to contact <a href="http://eightface.com/about/" title="Dave Kellam About page">Dave Kellam</a>, the original FlickrRSS author, to let him know about this modified version, so hopefully these will be soon included to the trunk. In the meantime, you can download the modified source code here, as we&#8217;ll need it to continue the tutorial.</p>

<div class="wpmarkitup_download">
 <div class="box">
  <a href="http://www.stefanoverna.com/downloads/advFlickrRSS.zip"><img src="http://www.stefanoverna.com/wp-content/themes/v1.0/imgs/zip_icon.jpg" alt="ZIP Icon"/> Download Advanced FlickrRSS for Wordpress! (about 8KB)</a>
 </div>
 <br class="clear" />
</div>

<p>Here you have all the params you can pass to your reborn FlickRSS plugin. Please note that all of them are optional, just like the original plugin, but they are passed as an associative array, so you don&#8217;t have to remember the correct order and fill the call with all those ugly <code>null</code> parameters. Please note that if you do not specify them, the default values setted up the plugin Settings page will be used instead.</p>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$settings</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">/*== Content params ==*/</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// What Flickr images you want to show? Possible values: 'user', 'favorite', 'set', 'group', 'public'</span>
  <span style="color: #0000ff;">'type'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'public'</span><span style="color: #339933;">,</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// Optional: To be used when type = 'user' or 'public'</span>
  <span style="color: #0000ff;">'tags'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'sunflowers'</span><span style="color: #339933;">,</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// Optional: To be used when type = 'set' </span>
  <span style="color: #0000ff;">'set'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// Optional: Your Group or User ID. To be used when type = 'user' or 'group'</span>
  <span style="color: #0000ff;">'id'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span>
&nbsp;
  <span style="color: #0000ff;">'do_cache'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000000; font-weight: bold;">false</span><span style="color: #339933;">,</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// What are the image sizes we want to cache locally? Possible values: 'square', 'thumb', 'small', 'medium' or 'large', provided within an array</span>
  <span style="color: #0000ff;">'cache_sizes'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'square'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">/*== Presentational params ==*/</span>
&nbsp;
   <span style="color: #666666; font-style: italic;">// The number of thumbs you want</span>
  <span style="color: #0000ff;">'num_items'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">4</span><span style="color: #339933;">,</span>
&nbsp;
   <span style="color: #666666; font-style: italic;">// the HTML to print before the list of images</span>
  <span style="color: #0000ff;">'before_list'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'&lt;div class=&quot;flickr_gallery&quot;&gt;'</span><span style="color: #339933;">,</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// the code to print out for each image. Meta tags available:</span>
  <span style="color: #666666; font-style: italic;">// - %flickr_page%</span>
  <span style="color: #666666; font-style: italic;">// - %title%</span>
  <span style="color: #666666; font-style: italic;">// - %image_small%, %image_square%, %image_thumb%, %image_medium%, %image_large%</span>
  <span style="color: #0000ff;">'html'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'&lt;a href=&quot;%flickr_page%&quot;&gt;&lt;img src=&quot;%image_square%&quot; /&gt;&lt;/a&gt;'</span><span style="color: #339933;">,</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// the default title</span>
  <span style="color: #0000ff;">'default_title'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;Untitled Flickr photo&quot;</span><span style="color: #339933;">,</span> 
&nbsp;
  <span style="color: #666666; font-style: italic;">// the HTML to print after the list of images</span>
  <span style="color: #0000ff;">'after_list'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'&lt;/div&gt;'</span>
&nbsp;
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>


<p>If you have any problems with it, please report them here! In a couple of days I&#8217;ll post a tutorial on how to use this modified version of FlickrRSS plugin to create your own, beautiful, Fancyboxed, polaroid Flickr galleries inside Wordpress.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/stefanoverna?a=jxAhmoTy2kU:c9GutQ5wQGY:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/stefanoverna?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/stefanoverna?a=jxAhmoTy2kU:c9GutQ5wQGY:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/stefanoverna?i=jxAhmoTy2kU:c9GutQ5wQGY:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/stefanoverna?a=jxAhmoTy2kU:c9GutQ5wQGY:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/stefanoverna?i=jxAhmoTy2kU:c9GutQ5wQGY:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/stefanoverna?a=jxAhmoTy2kU:c9GutQ5wQGY:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/stefanoverna?i=jxAhmoTy2kU:c9GutQ5wQGY:F7zBnMyn0Lo" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.stefanoverna.com/log/advanced-flickrss/feed</wfw:commentRss>
		</item>
		<item>
		<title>WP MarkItUp v0.1 now available!</title>
		<link>http://www.stefanoverna.com/log/wp-markitup-now-available-to-download</link>
		<comments>http://www.stefanoverna.com/log/wp-markitup-now-available-to-download#comments</comments>
		<pubDate>Thu, 14 Aug 2008 07:19:53 +0000</pubDate>
		<dc:creator>Stefano Verna</dc:creator>
		
		<category><![CDATA[Log]]></category>

		<category><![CDATA[wordpress plugin]]></category>

		<category><![CDATA[wp markitup]]></category>

		<guid isPermaLink="false">http://www.stefanoverna.com/?p=304</guid>
		<description><![CDATA[I&#8217;m happy to announce that a beta version of WP MarkItUp! is now ready to be downloaded!

I finally solved the CSS problems that were present a couple of days ago (it was all WP fault..), completed the localization, made some adjustments to the toolbars, added all the MarkItUp! default skins and created a new one [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m happy to announce that a beta version of WP MarkItUp! is now <a href="http://wpmarkitup.stefanoverna.com" title="WP MarkItUp!">ready to be downloaded</a>!</p>

<p>I finally solved the CSS problems that were present a couple of days ago (it was all WP fault..), completed the localization, made some adjustments to the toolbars, added all the MarkItUp! default skins and created a new one fitted for the WP administration area. I think that the final result is quite good.</p>

<p>Now it&#8217;s your turn. Download it, install it, test it. </p>

<p>If you find any problems/bugs/annoyances, or if you feed like something really important is missing, than please let me know. I&#8217;m going to release it also on the Wordpress Plugin website as soon as it will be somehow stable. In the meantime, spread the world. The more people will try this, the more it will be solid. Thanks in advance for the support.</p>

<p>Now what you&#8217;re waiting for? <a href="http://wpmarkitup.stefanoverna.com" title="WP MarkItUp!">Go download it!</a> :)</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/stefanoverna?a=uBcAH4o288Y:WhxvPRF9S80:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/stefanoverna?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/stefanoverna?a=uBcAH4o288Y:WhxvPRF9S80:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/stefanoverna?i=uBcAH4o288Y:WhxvPRF9S80:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/stefanoverna?a=uBcAH4o288Y:WhxvPRF9S80:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/stefanoverna?i=uBcAH4o288Y:WhxvPRF9S80:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/stefanoverna?a=uBcAH4o288Y:WhxvPRF9S80:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/stefanoverna?i=uBcAH4o288Y:WhxvPRF9S80:F7zBnMyn0Lo" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.stefanoverna.com/log/wp-markitup-now-available-to-download/feed</wfw:commentRss>
		</item>
	</channel>
</rss>
