mirror of
https://github.com/e107inc/e107.git
synced 2025-06-03 09:25:27 +02:00
templating tagcloud plugin
This commit is contained in:
parent
2d9846272b
commit
732cf81101
@ -1,3 +1,4 @@
|
||||
|
||||
<?php
|
||||
/*
|
||||
* e107 website system
|
||||
@ -23,15 +24,18 @@ require_once('tagcloud_class.php');
|
||||
class tagcloud_menu
|
||||
{
|
||||
|
||||
public $template = array();
|
||||
|
||||
function __construct()
|
||||
{
|
||||
|
||||
$this->template = e107::getTemplate('tagcloud','tagcloud_menu','default');
|
||||
|
||||
}
|
||||
|
||||
function render($parm=null)
|
||||
{
|
||||
|
||||
$cloud = new TagCloud();
|
||||
|
||||
$cloud = new TagCloud();
|
||||
$sql = e107::getDb();
|
||||
|
||||
e107::getCache()->setMD5(e_LANGUAGE);
|
||||
@ -65,7 +69,17 @@ class tagcloud_menu
|
||||
|
||||
$cloud->setHtmlizeTagFunction( function($tag, $size)
|
||||
{
|
||||
return "<a class='tag' href='".$tag['url']."'><span class='size".$size."'>".$tag['tag']."</span></a> ";
|
||||
$tp = e107::getParser();
|
||||
$var = array('TAG_URL' => $tag['url'],
|
||||
'TAG_SIZE' => $size,
|
||||
'TAG_NAME' => $tag['tag'],
|
||||
'TAG_COUNT' => $tag['size'],
|
||||
);
|
||||
|
||||
$text = $tp->simpleParse($this->template['item'], $var);
|
||||
//$text = "<a class='tag' href='".$tag['url']."'><span class='size".$size."'>".$tag['tag']."</span></a> ";
|
||||
|
||||
return $text;
|
||||
});
|
||||
|
||||
$cloud->setOrder('size','DESC');
|
||||
@ -78,7 +92,7 @@ class tagcloud_menu
|
||||
|
||||
e107::getCache()->set('tagcloud', $text, true);
|
||||
|
||||
$text .= "<div style='clear:both'></div>";
|
||||
//$text .= "<div style='clear:both'></div>"; moved to $template['default']['end']
|
||||
|
||||
return $text;
|
||||
|
||||
@ -88,7 +102,7 @@ class tagcloud_menu
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* TODO: add template type as parm, now always default */
|
||||
$tag = new tagcloud_menu;
|
||||
$text = $tag->render($parm);
|
||||
|
||||
@ -106,9 +120,14 @@ else
|
||||
$caption = LAN_PLUGIN_TAGCLOUD_NAME;
|
||||
}
|
||||
|
||||
$var = array('TAGCLOUD_MENU_CAPTION' => $caption);
|
||||
|
||||
|
||||
e107::getRender()->tablerender($caption, "<div class='tagcloud-menu'>".$text."</div>", 'tagcloud_menu');
|
||||
$caption = e107::getParser()->simpleParse($tag->template['caption'], $var);
|
||||
|
||||
$start = $tag->template['start'];
|
||||
$end = $tag->template['end'];
|
||||
|
||||
e107::getRender()->tablerender($caption, $start.$text.$end, 'tagcloud_menu');
|
||||
|
||||
|
||||
|
||||
|
14
e107_plugins/tagcloud/templates/tagcloud_menu_template.php
Normal file
14
e107_plugins/tagcloud/templates/tagcloud_menu_template.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
$TAGCLOUD_MENU_TEMPLATE = array();
|
||||
|
||||
$TAGCLOUD_MENU_TEMPLATE['default']['caption'] = '{TAGCLOUD_MENU_CAPTION}';
|
||||
$TAGCLOUD_MENU_TEMPLATE['default']['start'] = '<div class="tagcloud-menu">';
|
||||
$TAGCLOUD_MENU_TEMPLATE['default']['item'] = "<a class='tag' href='{TAG_URL}'><span class='size{TAG_SIZE}'>{TAG_NAME}</span></a>";
|
||||
$TAGCLOUD_MENU_TEMPLATE['default']['end'] = '<div style="clear:both"></div></div>';
|
||||
|
||||
/* example for the same size tag
|
||||
$TAGCLOUD_MENU_TEMPLATE['default']['caption'] = '{TAGCLOUD_MENU_CAPTION}';
|
||||
$TAGCLOUD_MENU_TEMPLATE['default']['start'] = '<div class="tag-cloud">';
|
||||
$TAGCLOUD_MENU_TEMPLATE['default']['item'] = '<span class="badge"><a href="{TAG_URL}">{TAG_NAME}</a> ({TAG_COUNT})</span>';
|
||||
$TAGCLOUD_MENU_TEMPLATE['default']['end'] = '</div>';
|
||||
*/
|
Loading…
x
Reference in New Issue
Block a user