mirror of
https://github.com/e107inc/e107.git
synced 2025-08-02 20:57:26 +02:00
Merge pull request #2945 from Jimmi08/tagcloud2
Templating tagcloud plugin #2944
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* e107 website system
|
* e107 website system
|
||||||
@@ -23,8 +24,11 @@ require_once('tagcloud_class.php');
|
|||||||
class tagcloud_menu
|
class tagcloud_menu
|
||||||
{
|
{
|
||||||
|
|
||||||
|
public $template = array();
|
||||||
|
|
||||||
function __construct()
|
function __construct()
|
||||||
{
|
{
|
||||||
|
$this->template = e107::getTemplate('tagcloud','tagcloud_menu','default');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,7 +69,17 @@ class tagcloud_menu
|
|||||||
|
|
||||||
$cloud->setHtmlizeTagFunction( function($tag, $size)
|
$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');
|
$cloud->setOrder('size','DESC');
|
||||||
@@ -78,7 +92,7 @@ class tagcloud_menu
|
|||||||
|
|
||||||
e107::getCache()->set('tagcloud', $text, true);
|
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;
|
return $text;
|
||||||
|
|
||||||
@@ -88,7 +102,7 @@ class tagcloud_menu
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* TODO: add template type as parm, now always default */
|
||||||
$tag = new tagcloud_menu;
|
$tag = new tagcloud_menu;
|
||||||
$text = $tag->render($parm);
|
$text = $tag->render($parm);
|
||||||
|
|
||||||
@@ -106,9 +120,14 @@ else
|
|||||||
$caption = LAN_PLUGIN_TAGCLOUD_NAME;
|
$caption = LAN_PLUGIN_TAGCLOUD_NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$var = array('TAGCLOUD_MENU_CAPTION' => $caption);
|
||||||
|
|
||||||
|
$caption = e107::getParser()->simpleParse($tag->template['caption'], $var);
|
||||||
|
|
||||||
e107::getRender()->tablerender($caption, "<div class='tagcloud-menu'>".$text."</div>", 'tagcloud_menu');
|
$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>';
|
||||||
|
*/
|
Reference in New Issue
Block a user