Hier ist mein erste Module, ein Tags Clouds, basiert auf die MetaValue von die Seiten.
Es ist ein zwischen samlung von verschidienen Sachen. Testen nur auf 4.6.15 und in ein Sprach.
Temporäre Demo:
http://www.metadelic.com/new_cms/cms/front_content.php
Ich bin nicht ein Profit mit PHP und es bleibt ein Problem mit die Banned Words: es funktionniert einfach nicht.
Ideen?
Tags Clouds mit die MetaValue
- Inspire and adapted from: http://www.ayom.com/faq/tag-cloud-erstellen-a-748.html
- Comma seperated: wort1, wort2, mein wort
- Without space: wort1, wort2, mein wort >> wort1 wort2 meinwort
- Case sensitive
- Banned Words >> Dont work!!! Why?
TODO:
- Banned Words
- Search Pfad Integration
Module als XML:
> http://www.metadelic.com/upload/Tags_Cloud.xml
Output:
Code: Alles auswählen
<?php
$dbConnect = new DB_Contenido;
$query = "SELECT metavalue FROM ".$cfg['sql']['sqlprefix']."_meta_tag order by metavalue";
$dbConnect->query($query);
while ($dbConnect->next_record()) {
$data[] = $dbConnect->f("metavalue")."\n";
}
$data = str_replace (" ", "", $data);
$data = implode('',$data);
$words = preg_split("/[\s,]+/", $data);
$acv = array_count_values( $words );
$bannedwords = array('janvier');
$i = 0;
foreach($acv as $k=>$v) {
if (!array_search($k,$bannedwords) and eregi("[a-zA-Z]",$k) and $i<=200 and strlen($k)>2) {
if (isset($new_acv[$k] ))
$new_acv[$k] += $v;
else
$new_acv[$k] = $v;
$i++;
}
}
ksort( $new_acv );
echo "<div id=\"tags_cloud\">";
foreach( $new_acv as $k=>$v) {
$size = $v*1;
if ($size > 30) $size = 30;
$kurl = urlencode("$k");
echo "<a href=\"front_content.php?idcat=40&searchterm=$kurl\" class=\"tag{$size}\">$k</a> \n";
}
echo "</div>";
?>
Copy this into your CSS document:
Code: Alles auswählen
/* Start Tags Cloud CSS */
#tags_cloud {
padding:1px; text-align:left;
}
#tags_cloud a {
text-decoration:none;padding:0px;
}
a.tag1{
font-size:12px;
}
a.tag2, a.tag3 {
font-size:13px;
font-weight:200;
}
a.tag4 ,a.tag5, a.tag6 {
font-size:16px;
font-weight:300;
}
a.tag7, .tag8, a.tag9 {
font-size:20px;
font-weight:300;
}
a.tag10, a.tag11, a.tag12 {
font-size:24px;
font-weight:300;
}
a.tag13, a.tag14, a.tag15 {
font-size:28px;
font-weight:400;
}
a.tag16, a.tag17, a.tag18 {
font-size:30px;
font-weight:400;
}
a.tag19, a.tag20, a.tag21 {
font-size:32px;
font-weight:500;
}
a.tag22, a.tag23, a.tag24 {
font-size:34px;
font-weight:500;
}
a.tag25, a.tag26, a.tag27 {
font-size:36px;
font-weight:900;
}
a.tag28, a.tag29, a.tag30 {
font-size:38px;
font-weight:900;
}
/* End Tag Cloud CSS */
Dom