From 170f157aaeb30c1cd412db6cd69bd4dd41094f77 Mon Sep 17 00:00:00 2001 From: Saiwal K Date: Wed, 23 Jul 2025 07:53:09 +0000 Subject: [PATCH] Add tpl for tagcloud and directory keyword cloud --- include/taxonomy.php | 26 +++++++++++++++----------- view/css/widgets.css | 5 +++++ view/tpl/dirtagcloud.tpl | 10 ++++++++++ view/tpl/tagcloud.tpl | 10 ++++++++++ 4 files changed, 40 insertions(+), 11 deletions(-) create mode 100644 view/tpl/dirtagcloud.tpl create mode 100644 view/tpl/tagcloud.tpl diff --git a/include/taxonomy.php b/include/taxonomy.php index 45287fa63..c0126d72c 100644 --- a/include/taxonomy.php +++ b/include/taxonomy.php @@ -483,11 +483,14 @@ function wtagblock($uid,$count = 0,$authors = '',$owner = '', $flags = 0,$restri intval($uid) ); - $o = '

' . t('Tags') . '

'; - foreach($r as $rr) { - $o .= '#'.$rr[0].' ' . "\r\n"; - } - $o .= '
'; + $channel = App::get_channel(); + $url = z_root() . '/channel/' . $channel['channel_address'].'/?f=&tag='; + $tpl = get_markup_template('tagcloud.tpl'); + $o .= replace_macros($tpl, [ + '$title' => t('Tags'), + '$baseurl' => $url, + '$tags' => $r, + ]); } return $o; @@ -563,13 +566,14 @@ function dir_tagblock($link,$r) { $r = App::$data['directory_keywords'] ?? []; if($r) { - $o = '

' . t('Keywords') . '

'; - foreach($r as $rr) { - $o .= ''.$rr['term'].' ' . "\r\n"; - } - $o .= '
'; + $url = $link . '/?f=&keywords='; + $tpl = get_markup_template('dirtagcloud.tpl'); + $o .= replace_macros($tpl, [ + '$title' => t('Keywords'), + '$baseurl' => $url, + '$tags' => $r, + ]); } - return $o; } diff --git a/view/css/widgets.css b/view/css/widgets.css index f722e3f11..fe2c79766 100644 --- a/view/css/widgets.css +++ b/view/css/widgets.css @@ -14,8 +14,13 @@ .tags { word-wrap: break-word; + display: flex; + justify-content: center; } +.tag { + margin-right: 0.3rem; +} .widget-nav-pills-icons { opacity: 0; float: right; diff --git a/view/tpl/dirtagcloud.tpl b/view/tpl/dirtagcloud.tpl new file mode 100644 index 000000000..9eb69d222 --- /dev/null +++ b/view/tpl/dirtagcloud.tpl @@ -0,0 +1,10 @@ +
+

{{$title}}

+
+ {{foreach $tags as $tag}} + #{{$tag['term']}} + {{/foreach}} +
+
+ + diff --git a/view/tpl/tagcloud.tpl b/view/tpl/tagcloud.tpl new file mode 100644 index 000000000..b2151fa18 --- /dev/null +++ b/view/tpl/tagcloud.tpl @@ -0,0 +1,10 @@ +
+

{{$title}}

+
+ {{foreach $tags as $tag}} + #{{$tag[0]}} + {{/foreach}} +
+
+ +