mirror of
https://github.com/e107inc/e107.git
synced 2025-03-14 17:39:46 +01:00
word limit per record added.
This commit is contained in:
parent
9163f907bf
commit
f5bb80607a
@ -21,6 +21,7 @@ if (!e107::isInstalled('tagcloud'))
|
||||
/**
|
||||
* @example {MENU: path=tagcloud&order=size,desc}
|
||||
* @example {MENU: path=tagcloud&order=tag,asc&limit=20}
|
||||
* @example {MENU: path=tagcloud&order=tag,asc&words=2}
|
||||
*/
|
||||
|
||||
require_once('tagcloud_class.php');
|
||||
@ -44,12 +45,18 @@ if(!class_exists('tagcloud_menu'))
|
||||
|
||||
$cloud = new TagCloud();
|
||||
$sql = e107::getDb();
|
||||
$words = 25; // Number of words to read from each record.
|
||||
|
||||
if(is_string($parm))
|
||||
{
|
||||
parse_str($parm,$parm);
|
||||
}
|
||||
|
||||
if(!empty($parm['words']))
|
||||
{
|
||||
$words = (int) $parm['words'];
|
||||
}
|
||||
|
||||
e107::getCache()->setMD5(e_LANGUAGE);
|
||||
|
||||
if ($text = e107::getCache()->retrieve('tagcloud', 5, false))
|
||||
@ -66,12 +73,20 @@ if(!class_exists('tagcloud_menu'))
|
||||
{
|
||||
|
||||
$tmp = explode(",", $row['news_meta_keywords']);
|
||||
$c = 0;
|
||||
foreach ($tmp as $word)
|
||||
{
|
||||
//$newsUrlparms = array('id'=> $row['news_id'], 'name'=>'a name');
|
||||
$url = e107::getUrl()->create('news/list/tag', array('tag' => $word)); // SITEURL."news.php?tag=".$word;
|
||||
$cloud->addTag(array('tag' => $word, 'url' => $url));
|
||||
|
||||
$c++;
|
||||
|
||||
if($c >= $words)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user