<?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>FinalFrag.be &#187; tags</title>
	<atom:link href="http://finalfrag.be/blog/tag/tags/feed/" rel="self" type="application/rss+xml" />
	<link>http://finalfrag.be/blog</link>
	<description>De persoonlijke website van Massimo 'FinalFrag' Mertens</description>
	<lastBuildDate>Tue, 04 Aug 2009 07:08:07 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Een tagcloud&#160;maken</title>
		<link>http://finalfrag.be/blog/2009/04/een-tagcloud-maken/</link>
		<comments>http://finalfrag.be/blog/2009/04/een-tagcloud-maken/#comments</comments>
		<pubDate>Thu, 30 Apr 2009 10:04:10 +0000</pubDate>
		<dc:creator>FinalFrag</dc:creator>
				<category><![CDATA[Programmeren]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Smarty]]></category>
		<category><![CDATA[tags]]></category>

		<guid isPermaLink="false">http://finalfrag.be/blog/?p=110</guid>
		<description><![CDATA[Tijdens mijn stage ben ik deze week gestoten op iets dat ik nooit eerder heb gemaakt, een tagcloud. Dit klinkt heel simpel om te maken, maar uiteindelijk was het toch moeilijker om te maken dan verwacht. Door deze blogpost zal ik het maken van een tagcloud wat toelichten.
Wat is een tagcloud?
Een tagcloud is een verzameling [...]]]></description>
			<content:encoded><![CDATA[<p>Tijdens mijn stage ben ik deze week gestoten op iets dat ik nooit eerder heb gemaakt, een tagcloud. Dit klinkt heel simpel om te maken, maar uiteindelijk was het toch moeilijker om te maken dan verwacht. Door deze blogpost zal ik het maken van een tagcloud wat toelichten.</p>
<h3>Wat is een tagcloud?</h3>
<p>Een tagcloud is een verzameling van kernwoorden op een blog. Door het grote succes van tagclouds, worden ze ondertussen ook voor andere doeleinden gebruikt.<span id="more-110"></span>In mijn stageproject gebruik ik een &#8216;product-cloud&#8217;, een tagcloud die de producten bevat waarover de meeste reviews werden geschreven.</p>
<p>Een tagcloud kan je makkelijk herkennen doordat er grote en kleine woorden instaan. De grote woorden zijn belangrijker en worden dus groter getoond zodat ze beter opvallen. Een voorbeeld van een tagcloud kan je op deze blog in het rechter menu zien. Kernwoorden waarover ik het dikwijls heb in mijn posts worden groter getoond, terwijl minder vaak voorkomende tags kleiner worden afgebeeld.</p>
<h3>Een tagcloud maken</h3>
<p>Het makkelijkste deel van een tagcloud is de CSS. In dit voorbeeld zullen we gebruik maken van vier verschillende groottes. De CSS bevat dus vier klassen, één voor elke grootte.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.size1</span> <span style="color: #00AA00;">&#123;</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;">.size2</span> <span style="color: #00AA00;">&#123;</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;">.size3</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">36px</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;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">48px</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>

<p>Om dit voorbeeld zo simpel mogelijk te houden, zal ik de tags niet ophalen uit een database, maar zelf een array declareren. In een realistische situatie moet dit uiteraard wel gebeuren. Om een tagcloud samen te stellen hebben we nood aan twee gegevens. In mijn stageproject waren dit de naam van een product en het aantal reviews dat erover zijn geschreven. De naamgeving hangt af van het doel van de cloud. Om dit voorbeeld zo duidelijk mogelijk te maken, zullen we gegevens ‘naam’ en ‘aantal’ noemen. De gebruikte array ziet er dus als volgt uit:</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
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$tags</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span>
    <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span>
        <span style="color: #0000ff;">'naam'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Massimo'</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'aantal'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">5</span>
    <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span>
        <span style="color: #0000ff;">'naam'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Mertens'</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'aantal'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">9</span>
    <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span>
        <span style="color: #0000ff;">'naam'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'FinalFrag'</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'aantal'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">2</span>
    <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span>
        <span style="color: #0000ff;">'naam'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Website'</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'aantal'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">7</span>
    <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span>
        <span style="color: #0000ff;">'naam'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Blog'</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'aantal'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">1</span>
    <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span>
        <span style="color: #0000ff;">'naam'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Tagcloud'</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'aantal'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">8</span>
    <span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Uit deze array kunnen we al afleiden dat &#8216;Tagcloud&#8217; en &#8216;Mertens&#8217; het grootst gaan getoond worden met respectievelijk 8 en 9 als aantal. &#8216;Blog&#8217; en &#8216;FinalFrag&#8217; zullen klein worden getoond omdat ze maar 1 en 2 als aantal hebben.</p>
<p>De verwerking van deze array gaat in mensentaal als volgt. Eerst bepalen we het grootste en het kleinste aantal. Zo komen we te weten welke klein moeten getoond worden en welke groot. Uiteraard moeten ook de tussenliggende tags onderverdeeld worden in de vier CSS klassen die we eerder al hebben aangemaakt. In PHP ziet dit er als volgt uit:</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
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// Eerst initialiseren we de variabelen</span>
<span style="color: #666666; font-style: italic;">// die het kleinste en grootste aantal bevatten</span>
<span style="color: #000088;">$min</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$max</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Daarna overlopen we de array (by reference)</span>
<span style="color: #666666; font-style: italic;">// om het kleinste en grootste aantal op te slaan</span>
<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$tags</span> <span style="color: #b1b100;">as</span> <span style="color: #339933;">&amp;</span><span style="color: #000088;">$tag</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">// Indien er nog geen kleinste waarde is opgeslagen,</span>
    <span style="color: #666666; font-style: italic;">// is de eerste de kleinste</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$min</span> <span style="color: #339933;">===</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$min</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$tag</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'aantal'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// Hetzelfde voor de maximumwaarde</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$max</span> <span style="color: #339933;">===</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$max</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$tag</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'aantal'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// Als het huidige aantal kleiner is dan de opgeslagen</span>
    <span style="color: #666666; font-style: italic;">// minimumwaarde is dit de nieuwe minimumwaarde</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$tag</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'aantal'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">&lt;</span> <span style="color: #000088;">$min</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$min</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$tag</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'aantal'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// En weer hetzelfde voor de maximumwaarde</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$tag</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'aantal'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">&gt;</span> <span style="color: #000088;">$max</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$max</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$tag</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'aantal'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// De volgende stap is om de tags te verdelen over de vier klassen</span>
<span style="color: #666666; font-style: italic;">// Eerst moeten we de range bepalen waarin de tags zich bevinden</span>
<span style="color: #000088;">$range</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$max</span> <span style="color: #339933;">-</span> <span style="color: #000088;">$min</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Daarna bepalen we de grootte van elk van de vier delen</span>
<span style="color: #000088;">$partSize</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$range</span> <span style="color: #339933;">/</span> <span style="color: #cc66cc;">4</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Aan de hand van de grootte van elk deel,</span>
<span style="color: #666666; font-style: italic;">// kunnen we de maximumwaarde van elk deel bepalen</span>
<span style="color: #000088;">$part1Max</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$min</span> <span style="color: #339933;">+</span> <span style="color: #000088;">$partSize</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$part2Max</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$min</span> <span style="color: #339933;">+</span> <span style="color: #cc66cc;">2</span> <span style="color: #339933;">*</span> <span style="color: #000088;">$partSize</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$part3Max</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$min</span> <span style="color: #339933;">+</span> <span style="color: #cc66cc;">3</span> <span style="color: #339933;">*</span> <span style="color: #000088;">$partSize</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$part4Max</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$max</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Wanneer we bovenstaande code uitvoeren op de array die we hoger hebben aangemaakt, krijgen we volgend resultaat:</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="text" style="font-family:monospace;">$min = 1
$max = 9
&nbsp;
$range = 8 (9 – 1)
$partSize = 2 (8 / 4)
&nbsp;
$part1Max = 3 (1 + 2)
$part2Max = 5 (1 + 2 * 2)
$part3Max = 7 (1 + 3 * 2)
$part4Max = 9 ($max)</pre></td></tr></table></div>

<p>Het enige dat ons nu nog rest is om de array opnieuw te overlopen en de tags te verdelen over de aangemaakt klassen. Dit is makkelijk te realiseren als volgt:</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
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$tags</span> <span style="color: #b1b100;">as</span> <span style="color: #339933;">&amp;</span><span style="color: #000088;">$tag</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;">$tag</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'aantal'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">&lt;=</span> <span style="color: #000088;">$part1Max</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #666666; font-style: italic;">// Het aantal ligt tussen 1 en 3</span>
        <span style="color: #000088;">$tag</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'klasse'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$tag</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'aantal'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">&lt;=</span> <span style="color: #000088;">$part2Max</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #666666; font-style: italic;">// Het aantal ligt tussen 3 en 5</span>
        <span style="color: #000088;">$tag</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'klasse'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">2</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$tag</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'aantal'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">&lt;=</span> <span style="color: #000088;">$part3Max</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #666666; font-style: italic;">// Het aantal ligt tussen 5 en 7</span>
        <span style="color: #000088;">$tag</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'klasse'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">3</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">else</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #666666; font-style: italic;">// Het aantal ligt tussen 7 en 9</span>
        <span style="color: #000088;">$tag</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'klasse'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">4</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Nu is de array die we in het begin aangemaakt hebben uitgebreid met een extra veld, namelijk &#8216;klasse&#8217;. In deze variabele staat de CSS klasse waartoe die bepaalde tag hoort. Met behulp van Smarty (onze favoriete template engine) kunnen we deze array makkelijk omzetten in HTML zodat deze op de website kan getoond worden. Allereerst moeten we de array doorgeven aan Smarty en de juiste template aanroepen:</p>
</pre>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// Eerst geven we de tags array door aan Smarty</span>
<span style="color: #000088;">$smarty</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">assign</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'tags'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$tags</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// En daarna tonen we de tagcloud template</span>
<span style="color: #000088;">$smarty</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">display</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'tagcloud.tpl'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Deze template ziet er als volgt uit:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="smarty" style="font-family:monospace;"><span style="color: #009000;">&lt;div id=&quot;tagcloud&quot;&gt;</span>
    <span style="color: #D36900;">&#123;</span><span style="color: #0600FF;">foreach</span> <span style="color: #6A0A0A;">from</span><span style="color: #D36900;">=</span><span style="color: #00aaff;">$tags</span> <span style="color: #6A0A0A;">item</span><span style="color: #D36900;">=</span>tag<span style="color: #D36900;">&#125;</span>
        <span style="color: #009000;">&lt;span class=&quot;size{$tag.klasse}&quot;&gt;</span><span style="color: #D36900;">&#123;</span><span style="color: #00aaff;">$tag</span>.<span style="color: #006600;">naam</span><span style="color: #D36900;">&#125;</span><span style="color: #009000;">&lt;/span&gt;</span>
    <span style="color: #D36900;">&#123;</span><span style="color: #D36900;">/</span><span style="color: #0600FF;">foreach</span><span style="color: #D36900;">&#125;</span>
<span style="color: #009000;">&lt;/div&gt;</span></pre></td></tr></table></div>

<h3>Het resultaat</h3>
<p><a href="http://finalfrag.be/blog/wp-content/uploads/2009/04/tag_cloud_resultaat.png"  rel="shadowbox[post-110];player=img;"><img src="http://finalfrag.be/blog/wp-content/uploads/2009/04/tag_cloud_resultaat.png" alt="Het resultaat" title="Het resultaat" width="170" height="60" class="alignright size-thumbnail wp-image-181" /></a>Als je alle code die hierboven staat zou samenvoegen en uitvoeren, krijg je een 'mooie' tagcloud. Uiteraard kan dit met behulp van de juiste CSS regels veel beter gemaakt worden, maar daar gaat deze post niet over. Bepaalde stukken PHP code kunnen op een betere manier geschreven worden, bijvoorbeeld het deel dat beslist in welk deel een bepaalde tag hoort. In een productieomgeving moet dit gedaan worden met een switch. Het is dan ook niet aangeraden de code gewoon over te nemen wanneer je zelf een tagcloud wil maken. Er zijn op het internet heel wat voorbeelden te vinden van tagclouds met een mooie stijling.</p>
<p><a target="_blank" href="http://www.inventis.be/blog"  title="Inventis blog"><img src="http://finalfrag.be/blog/wp-content/uploads/2009/04/tag_cloud_voorbeeld1.png" alt="Inventis tagcloud" title="Inventis tagcloud" class="alignnone size-thumbnail wp-image-184" /></a></p>
<p><a target="_blank" href="http://chir.ag/projects/preztags/"  title="US presidential speeches tagcloud"><img src="http://finalfrag.be/blog/wp-content/uploads/2009/04/tag_cloud_voorbeeld2.png" alt="US presidential speeches tagcloud" title="US presidential speeches tagcloud" width="385" height="123" class="alignnone size-thumbnail wp-image-186" /></a></p>
<p><a target="_blank" href="http://www.webdesignerwall.com"  title="Webdesignerwall"><img src="http://finalfrag.be/blog/wp-content/uploads/2009/04/tag_cloud_voorbeeld3.png" alt="Webdesignerwall tagcloud" title="Webdesignerwall tagcloud" class="alignnone size-thumbnail wp-image-184" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://finalfrag.be/blog/2009/04/een-tagcloud-maken/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>
