Hello,
I´ve got a working tagcloud script, I only need one who can modify it for joomla.
My idea is to make it work with the intregated "logSearch" function from joomla.
So the Tags will be generated from the most searchwords.
So what ive allready did is following:
Implented this to mtree.php
Quote:
function logSearch( $searchword )
{
global $mainframe;
$db =& JFactory::getDBO();
//$params = &JComponentHelper::getParams( 'com_search' );
//$enable_log_searches = $params->get('enabled');
$search_term = $db->getEscaped( trim( $searchword ) );
//if ( @$enable_log_searches )
//{
$db =& JFactory::getDBO();
$query = 'SELECT hits'
. ' FROM #__core_log_searches'
. ' WHERE LOWER( search_term ) = "'.$search_term.'"'
;
$db->setQuery( $query );
$hits = intval( $db->loadResult() );
if ( $hits ) {
$query = 'UPDATE #__core_log_searches'
. ' SET hits = ( hits + 1 )'
. ' WHERE LOWER( search_term ) = "'.$search_term.'"'
;
$db->setQuery( $query );
$db->query();
} else {
$query = 'INSERT INTO #__core_log_searches VALUES ( "'.$search_term.'", 1 )';
$db->setQuery( $query );
$db->query();
}
//}
}
|
and changed following:
Quote:
/* Search */
case "search":
search( $option );
# Search word
$searchword = mosGetParam($_REQUEST, 'searchword', '');
if ( strpos($searchword, "www") || strpos($searchword, ".de") || strpos($searchword, ".com") || strpos($searchword, ".net") || strpos($searchword, "http") ){
} else {
logSearch($searchword);
}
break;
|
As you can see, iam a newbie in php.
But now it lists and counts the searchwords from mtree.
Here is the part from the tagcloud, wich i cant modify for mtree because of my less knowledge in php:
Quote:
$abfrage = "SELECT search_term FROM #_core_log_searches";
$result = mysql_query($abfrage);
while ($row = mysql_fetch_array ($result))
{
$data[] = $row['search_term'];
}
$data = implode('',$data);
// Woerter splitten
$words = preg_split("/n/", $data);
$acv = array_count_values( $words );
// Nicht erwuenschte Woerter loeschen
$bannedwords = array('');
$i = 0;
foreach($acv as $k=>$v) {
if (!array_search(strtolower($k),$bannedwords) and eregi("[a-zA-Z]",$k) and $i<=40 and strlen($k)>2) {
if (isset($new_acv[strtolower($k)] ))
$new_acv[strtolower($k)] += $v;
else
$new_acv[strtolower($k)] = $v;
$i++;
}
}
// Alphabetisch sortieren
ksort( $new_acv );
// Clouds erstellen
foreach( $new_acv as $k=>$v) {
$size = $v*1;
$weight = $v*4;
if ($size > 4) $size = 4;
if ($weight > 50) $weight = 50;
$kurl = urlencode("$k");
echo "<a href=\"mtree.php?task=search&searchword=$kurl\" style=\"font-size: {$size}em; font-weight: {$weight}\">$k</a> ";
}
|
who can help me with that?