Keyword

K2 Tag cloud does not work if a tag is a number

  • George Vouliakis
  • George Vouliakis's Avatar Topic Author
  • Offline
  • New Member
More
13 years 5 months ago #95844 by George Vouliakis
K2 Tag cloud does not work if a tag is a number was created by George Vouliakis
If a tag is a number (e.g. a year like 1973 or 2009) Tag Cloud function of mod_k2_tools does not work properly.

Please Log in or Create an account to join the conversation.

More
13 years 3 weeks ago #95845 by Sergey Zaika
Replied by Sergey Zaika on topic K2 Tag cloud does not work if a tag is a number
Hello.

Here is my dirty code to fix it.

File: /modules/mod_k2_tools/helper.php

Change this row around number 197:

 

$cloud = array_slice($cloud, 0, $params->get('cloud_limit'));

 

to this:

 

$cloud_keys = array_keys($cloud);      $counter = 0;      $temp_cloud = $cloud;      $cloud = array();      foreach ($temp_cloud as $cloudlet) {        if ($counter < $params->get('cloud_limit'))            $cloud[$cloud_keys[$counter]] = $cloudlet;            $counter++;        }

 

It would help.

Please Log in or Create an account to join the conversation.

  • George Vouliakis
  • George Vouliakis's Avatar Topic Author
  • Offline
  • New Member
More
13 years 3 weeks ago #95846 by George Vouliakis
Replied by George Vouliakis on topic K2 Tag cloud does not work if a tag is a number
@Sergey Zaika

 

Hello Sergey,

 

This is an old post! I managed to solve this issue but I forgot to post it here.

 

Try the following solution (which I think its better):

 

In the file helper.php in /modules/mod_k2_tools (/modules/mod_k2_tools/helper.php)at line 197 add true as last parameter to array_slice php function. The code at line 197 is:

$cloud = array_slice($cloud, 0, $params->get('cloud_limit'));

Add the true as last parameter of array_slice function:
$cloud = array_slice($cloud, 0, $params->get('cloud_limit'), true);
and remove your code.Anyway thanks for trying to solve the issue.Regards,George

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum