<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>MaggsWeb:7 &#187; tag cloud</title>
	<atom:link href="http://www.maggsweb.com/tag/tag-cloud/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.maggsweb.com</link>
	<description>www.maggsweb.com</description>
	<lastBuildDate>Sat, 21 Aug 2010 20:50:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>MySQL query for a Tag Cloud</title>
		<link>http://www.maggsweb.com/miscellaneous/mysql-tag-cloud/</link>
		<comments>http://www.maggsweb.com/miscellaneous/mysql-tag-cloud/#comments</comments>
		<pubDate>Thu, 25 Feb 2010 12:58:52 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[tag cloud]]></category>

		<guid isPermaLink="false">http://www.maggsweb.com/?p=836</guid>
		<description><![CDATA[OK, I found this in WordPress. I am not sure exactly how it works, but I haven&#8217;t seen this functionality before in MySQL. I am pretty sure that it is used for passing an array of variables to MySQL for use in a Tag Cloud. INSERT INTO table ( id, term, order ) VALUES &#8221; [...]]]></description>
			<content:encoded><![CDATA[<p>OK, I found this in WordPress.  I am not sure exactly how it works, but I haven&#8217;t seen this functionality before in MySQL.  I am pretty sure that it is used for passing an array of variables to MySQL for use in a Tag Cloud.<br />
<span id="more-836"></span></p>
<p>INSERT INTO table (<br />
    id,<br />
    term,<br />
    order<br />
) VALUES &#8221; . join(&#8216;,&#8217;, $values) . &#8221; ON DUPLICATE KEY UPDATE order = VALUES(order);</p>
<p>Any help on this would be great.  I plan to use this very soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.maggsweb.com/miscellaneous/mysql-tag-cloud/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Head in the clouds? Tag yourself.</title>
		<link>http://www.maggsweb.com/php/head-in-the-clouds-tag-yourself/</link>
		<comments>http://www.maggsweb.com/php/head-in-the-clouds-tag-yourself/#comments</comments>
		<pubDate>Mon, 30 Jun 2008 12:21:21 +0000</pubDate>
		<dc:creator>chris</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[tag cloud]]></category>

		<guid isPermaLink="false">http://www.cmaggs.co.uk/?p=42</guid>
		<description><![CDATA[I have been looking for a &#8216;simple&#8217; tag cloud generator that will parse content from MySQL for ages and couldn&#8217;t find one. So I adapted &#8211; and heavily modified (reduced) &#8211; and CSS&#8217;d &#8211; the best one that I could find. It turned out nice and simple. ?View Code CSS .size9 &#123; color: #000; font-size: [...]]]></description>
			<content:encoded><![CDATA[<p>I have been looking for a &#8216;simple&#8217; tag cloud generator that will parse content from MySQL for ages and couldn&#8217;t find one.  So I adapted &#8211; and heavily modified (reduced) &#8211; and CSS&#8217;d &#8211; the best one that I could find.  It turned out nice and simple.<br />
<span id="more-273"></span></p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?" onclick="pageTracker._trackPageview('/outgoing/www.ericbess.com/ericblog/2008/03/03/wp-codebox/_examples?referer=');"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p273code3'); return false;">View Code</a> CSS</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p2733"><td class="code" id="p273code3"><pre class="css" style="font-family:monospace;">  <span style="color: #6666ff;">.size9</span> <span style="color: #00AA00;">&#123;</span>	<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#000</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;">26px</span><span style="color: #00AA00;">;</span>	 <span style="color: #00AA00;">&#125;</span>
  <span style="color: #6666ff;">.size8</span> <span style="color: #00AA00;">&#123;</span> 	<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#111</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;">24px</span><span style="color: #00AA00;">;</span>	 <span style="color: #00AA00;">&#125;</span>
  <span style="color: #6666ff;">.size7</span> <span style="color: #00AA00;">&#123;</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: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">22px</span><span style="color: #00AA00;">;</span>	 <span style="color: #00AA00;">&#125;</span>
  <span style="color: #6666ff;">.size6</span> <span style="color: #00AA00;">&#123;</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;">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>
  <span style="color: #6666ff;">.size5</span> <span style="color: #00AA00;">&#123;</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;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">18px</span><span style="color: #00AA00;">;</span>	<span style="color: #00AA00;">&#125;</span>
  <span style="color: #6666ff;">.size4</span> <span style="color: #00AA00;">&#123;</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: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">16px</span><span style="color: #00AA00;">;</span>	  <span style="color: #00AA00;">&#125;</span>
  <span style="color: #6666ff;">.size3</span> <span style="color: #00AA00;">&#123;</span>	<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#666</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>
  <span style="color: #6666ff;">.size2</span> <span style="color: #00AA00;">&#123;</span>	<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#777</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: #00AA00;">&#125;</span>
  <span style="color: #6666ff;">.size1</span> <span style="color: #00AA00;">&#123;</span>	<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#888</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;">8px</span><span style="color: #00AA00;">;</span>	  <span style="color: #00AA00;">&#125;</span>
  <span style="color: #6666ff;">.size0</span> <span style="color: #00AA00;">&#123;</span>	<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#999</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;">6px</span><span style="color: #00AA00;">;</span>	  <span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>

<p><br/></p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?" onclick="pageTracker._trackPageview('/outgoing/www.ericbess.com/ericblog/2008/03/03/wp-codebox/_examples?referer=');"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p273code4'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p2734"><td class="code" id="p273code4"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #000088;">$terms</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/array" onclick="pageTracker._trackPageview('/outgoing/www.php.net/array?referer=');"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$maximum</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/mysql_query" onclick="pageTracker._trackPageview('/outgoing/www.php.net/mysql_query?referer=');"><span style="color: #990000;">mysql_query</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SELECT word, count FROM [tablename] WHERE display = '1'&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// could add LIMIT, SORT, etc.. if required</span>
&nbsp;
<span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$row</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/mysql_fetch_array" onclick="pageTracker._trackPageview('/outgoing/www.php.net/mysql_fetch_array?referer=');"><span style="color: #990000;">mysql_fetch_array</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #666666; font-style: italic;">//create vars</span>
    <span style="color: #000088;">$word</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'word'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$count</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'count'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// set 'maximum' from counter</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$count</span> <span style="color: #339933;">&gt;</span> <span style="color: #000088;">$maximum</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$maximum</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$count</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//create array</span>
    <span style="color: #000088;">$elements</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/array" onclick="pageTracker._trackPageview('/outgoing/www.php.net/array?referer=');"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'word'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$word</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'count'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$count</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span>
<span style="color: #666666; font-style: italic;">//random</span>
<span style="color: #666666; font-style: italic;">//shuffle($elements);</span>
<span style="color: #666666; font-style: italic;">//alphabetical</span>
<a href="http://www.php.net/sort" onclick="pageTracker._trackPageview('/outgoing/www.php.net/sort?referer=');"><span style="color: #990000;">sort</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$elements</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$elements</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$e</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">// start looping through the tags</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// determine the popularity of this term as a percentage</span>
    <span style="color: #000088;">$percent</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/floor" onclick="pageTracker._trackPageview('/outgoing/www.php.net/floor?referer=');"><span style="color: #990000;">floor</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$e</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'count'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">/</span> <span style="color: #000088;">$maximum</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">*</span> <span style="color: #cc66cc;">100</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// determine the class for this term based on the percentage</span>
	<span style="color: #b1b100;">if</span> 	   <span style="color: #009900;">&#40;</span><span style="color: #000088;">$percent</span> <span style="color: #339933;">&gt;=</span> <span style="color: #cc66cc;">99</span><span style="color: #009900;">&#41;</span>		<span style="color: #000088;">$class</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">9</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$percent</span> <span style="color: #339933;">&gt;=</span> <span style="color: #cc66cc;">70</span><span style="color: #009900;">&#41;</span>		<span style="color: #000088;">$class</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">8</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$percent</span> <span style="color: #339933;">&gt;=</span> <span style="color: #cc66cc;">60</span><span style="color: #009900;">&#41;</span>		<span style="color: #000088;">$class</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">7</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$percent</span> <span style="color: #339933;">&gt;=</span> <span style="color: #cc66cc;">50</span><span style="color: #009900;">&#41;</span>		<span style="color: #000088;">$class</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">6</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$percent</span> <span style="color: #339933;">&gt;=</span> <span style="color: #cc66cc;">40</span><span style="color: #009900;">&#41;</span>		<span style="color: #000088;">$class</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">5</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$percent</span> <span style="color: #339933;">&gt;=</span> <span style="color: #cc66cc;">30</span><span style="color: #009900;">&#41;</span>		<span style="color: #000088;">$class</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">4</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$percent</span> <span style="color: #339933;">&gt;=</span> <span style="color: #cc66cc;">20</span><span style="color: #009900;">&#41;</span>		<span style="color: #000088;">$class</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">3</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$percent</span> <span style="color: #339933;">&gt;=</span> <span style="color: #cc66cc;">10</span><span style="color: #009900;">&#41;</span>		<span style="color: #000088;">$class</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">2</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$percent</span> <span style="color: #339933;">&gt;=</span> <span style="color: #cc66cc;">5</span><span style="color: #009900;">&#41;</span>		<span style="color: #000088;">$class</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">else</span>						<span style="color: #000088;">$class</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// output this term</span>
    <span style="color: #666666; font-style: italic;">//with links...</span>
    <span style="color: #666666; font-style: italic;">//echo &quot;&lt;span class=\&quot;$class\&quot;&gt;&lt;a href=\&quot;search.php?search=&quot; . urlencode($k['term']) . &quot;\&quot;&gt;&quot; . $k['term'] . &quot;&lt;/a&gt;&lt;/span&gt;\n &quot;;</span>
  <span style="color: #666666; font-style: italic;">//without links.../</span>
    <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;span class='word size&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$class</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;'&gt;&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$e</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'word'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;&lt;/span&gt;<span style="color: #000099; font-weight: bold;">\n</span> &quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span>
<span style="color: #666666; font-style: italic;">// for debugging....</span>
<span style="color: #666666; font-style: italic;">//echo &quot;&lt;hr /&gt;&quot;;</span>
<span style="color: #666666; font-style: italic;">//echo &quot;&lt;pre&gt;&quot;;</span>
<span style="color: #666666; font-style: italic;">//print_r($elements);</span>
<span style="color: #666666; font-style: italic;">//echo &quot;</span></pre></td></tr></table></div>

<p>&#8220;;<br />
?>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.maggsweb.com/php/head-in-the-clouds-tag-yourself/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
