Facebook  Twitter 

SMFHacks.com

+-

SMFHacks.com

+- User Information

Welcome, Guest.
Please login or register.
 
 
 
Forgot your password?

+- Forum Stats

Members
Total Members: 4255
Latest: andreios
New This Month: 3
New This Week: 1
New Today: 0
Stats
Total Posts: 43259
Total Topics: 7518
Most Online Today: 64
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 0
Guests: 67
Total: 67

Author Topic: Tagging system  (Read 3675 times)

0 Members and 1 Guest are viewing this topic.

Offline fatdaddy

  • Member
  • *
  • Posts: 38
    • View Profile
Tagging system
« on: January 03, 2015, 05:11:15 am »
Hi.
I have this installed and working on a 2.0.9 board.
I also have Tiny Portal.
I have a block that shows all the tags and reflects them in Alphabetical order as my main Tags page. The block responds to text size changes as I request.
The one thing I can't do is make the individual links in the block go to the individual tag, no matter which tag is clicked in the portal block you are taken to the main tag cloud and list of latest tags.
No one on the TP site can help.......................can you ?

thanks

Code: [Select]
global $scripturl, $smcFunc;

$result = $smcFunc['db_query']('', '
SELECT t.tag AS tag, l.id_tag, COUNT(l.id_tag) AS quantity
FROM {db_prefix}tags as t, {db_prefix}tags_log as l WHERE t.id_tag= l.id_tag
GROUP BY l.id_tag
ORDER BY t.tag LIMIT {int:limit}',
array('limit' => 100)
);

$tags = array();
$tags2 = array();

while ($row = $smcFunc['db_fetch_assoc']($result))
{
$tags[$row['tag']] = $row['quantity'];
$tags2[$row['tag']] = $row['id_tag'];
}

$smcFunc['db_free_result']($result);

if(count($tags2) > 0)
{
// change these font sizes if you will
$max_size = 100; // max font size in %
$min_size = 100; // min font size in %

// get the largest and smallest array values
$max_qty = max(array_values($tags));
$min_qty = min(array_values($tags));

// find the range of values
$spread = $max_qty - $min_qty;
if (0 == $spread)
{ // we don't want to divide by zero
$spread = 1;
}

// determine the font-size increment
// this is the increase per tag quantity (times used)
$step = ($max_size - $min_size)/($spread);

// loop through our tag array
$poptags = '';
$row_count = 1;
foreach ($tags as $key => $value)
{
$row_count++;
// calculate CSS font-size
// find the $value in excess of $min_qty
// multiply by the font-size increment ($size)
// and add the $min_size set above
$size = $min_size + (($value - $min_qty) * $step);
// uncomment if you want sizes in whole %:
// $size = ceil($size);

// you'll need to put the link destination in place of the #
// (assuming your tag links to some sort of details page)
$poptags .= '<a href="' . $scripturl . '?action=tags;id=' . $tags2[$key] . '" style="font-size: '.$size.'%"';
// perhaps adjust this title attribute for the things that are tagged
$poptags .= ' title="'.$value.' things tagged with '.$key.'"';
$poptags .= '>'.$key.'</a> ';
               
if ($row_count > 1)
{
$poptags .= '<br />';
$row_count =1;
}
}
}
echo  $poptags;

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 16436
    • View Profile
Re: Tagging system
« Reply #1 on: January 03, 2015, 08:47:10 am »
The code looks right. What is one of the links from the portal tags when clicked
Code: [Select]
$poptags .= '<a href="' . $scripturl . '?action=tags;id=' . $tags2[$key] . '" style="font-size: '.$size.'%"';
// perhaps adjust this title attribute for the things that are tagged
$poptags .= ' title="'.$value.' things tagged with '.$key.'"';
$poptags .= '>'.$key.'</a> ';
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline fatdaddy

  • Member
  • *
  • Posts: 38
    • View Profile
Re: Tagging system
« Reply #2 on: January 04, 2015, 03:38:39 am »
thanks.
if I click the tag in your tag cloud (which does bring up the relevant topic link)
Code: [Select]
http://dsdglobalsupport.com/index.php?action=tags;tagid=99
if i click the same tag in the portal block (which just takes me to your tag page
Code: [Select]
http://dsdglobalsupport.com/index.php?action=tags;id=99
hmm, I see the difference now !

Is there something I can change ?

edit: Yeh, you already pointed me where to look  :) thanks it works fine now  8)
« Last Edit: January 04, 2015, 03:41:29 am by fatdaddy »

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 16436
    • View Profile
Re: Tagging system
« Reply #3 on: January 04, 2015, 09:22:54 am »
Glad you have it figured out!
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

 

Related Topics

  Subject / Started by Replies Last post
[Mod] Tagging System

Started by SMFHacks « 1 2 ... 8 9 » Latest Mods

123 Replies
151164 Views
Last post January 13, 2021, 08:43:33 pm
by SMFHacks
0 Replies
3671 Views
Last post July 06, 2007, 09:06:45 pm
by GenoDemoN
5 Replies
6871 Views
Last post November 09, 2007, 06:39:44 pm
by cru
0 Replies
3738 Views
Last post January 27, 2008, 10:06:34 am
by falguni1
1 Replies
4032 Views
Last post February 04, 2013, 02:06:54 pm
by SMFHacks

+- Recent Topics

No thumbnails on new uploads by SMFHacks
March 27, 2024, 02:10:41 pm

Display the Contact Page for guests by SMFHacks
March 27, 2024, 10:55:43 am

is it possible to add support for odysee.com by fvlog19
March 21, 2024, 08:47:51 am

Request for admin notification by davejo
March 10, 2024, 01:31:59 am

I need help with torrent upload by Ineedsmfhelp
March 09, 2024, 10:01:13 pm

an idea for new mod (( content type with different display )) by SMFHacks
February 27, 2024, 01:36:27 pm

[Mod] RSS Feed Poster by SMFHacks
February 27, 2024, 11:57:18 am

find duplicate pictures by fvlog19
February 14, 2024, 02:22:40 pm

Error uploading video. by SMFHacks
February 08, 2024, 02:04:16 pm

Gallery icon as last added image by fvlog19
February 01, 2024, 01:04:56 pm

Powered by EzPortal