Keyword

Hide some tags in K2 Tools module

  • STEPHAN HERBY
  • STEPHAN HERBY's Avatar Topic Author
  • Offline
  • Premium Member
More
6 years 4 months ago #168405 by STEPHAN HERBY
Hide some tags in K2 Tools module was created by STEPHAN HERBY
Hi, I'm trying to hide some tags I don't want to be shown in the K2 Tools module. I took the tags.php file and made an override. Then i took the original code :
<div id="k2ModuleBox<?php echo $module->id; ?>" class="k2TagCloudBlock<?php if($params->get('moduleclass_sfx')) echo ' '.$params->get('moduleclass_sfx'); ?>">
	<?php foreach ($tags as $tag): ?>
	<?php if(!empty($tag->tag)): ?>
	<a href="<?php echo $tag->link; ?>" style="font-size:<?php echo $tag->size; ?>%" title="<?php echo $tag->count.' '.JText::_('K2_ITEMS_TAGGED_WITH').' '.K2HelperUtilities::cleanHtml($tag->tag); ?>">
		<?php echo $tag->tag; ?>
	</a>
	<?php endif; ?>
	<?php endforeach; ?>
	<div class="clr"></div>
</div>
And change it to :
<div id="k2ModuleBox<?php echo $module->id; ?>" class="k2TagCloudBlock<?php if($params->get('moduleclass_sfx')) echo ' '.$params->get('moduleclass_sfx'); ?>">
	<?php foreach ($tags as $tag): ?>
		<?php if(!empty($tag->tag) || ($tag->id !== 539) || ($tag->id !== 540) || ($tag->id !== 541) || ($tag->id !== 542)) { ?>
			<a href="<?php echo $tag->link; ?>" style="text-transform: uppercase;" title="<?php echo $tag->count.' '.JText::_('K2_ITEMS_TAGGED_WITH').' '.K2HelperUtilities::cleanHtml($tag->tag); ?>">
				<?php echo $tag->tag; ?>&nbsp;(<?php echo $tag->count ?>) - 
			</a>
		<?php } else {} ?>
	<?php endforeach; ?>
	<div class="clr"></div>
</div>
But tags are still shown in the module. Does anybody have an advice to help me hiding this 4 tags from the cloud tag ?
Thanks in advance...

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
6 years 4 months ago #168411 by Krikor Boghossian
Replied by Krikor Boghossian on topic Hide some tags in K2 Tools module
Hello,

Just pointing out the obvious as a first solution,
Try clearing both Joomla!'s and the module's cache (set it to 0)
Also try printing directly the $tag->id just to make sure.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

  • STEPHAN HERBY
  • STEPHAN HERBY's Avatar Topic Author
  • Offline
  • Premium Member
More
6 years 4 months ago #168416 by STEPHAN HERBY
Replied by STEPHAN HERBY on topic Hide some tags in K2 Tools module
Hi Krikor,
Thanks for your suggestion.
Actually you were right by testing $tag->id.
When i changed :
<?php echo $tag->tag; ?>
with
<?php echo $tag->id; ?>
Nothing is printed. The page work but i get nothing is printed...
Actually I'm using that in a K2 item because i want this tag to be hidden on items, and it works there.
But here on the module iut does not.
Any suggestion to make it work in the module ?

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
6 years 4 months ago #168425 by Krikor Boghossian
Replied by Krikor Boghossian on topic Hide some tags in K2 Tools module
I think you missed a spot, I missed it too.
The id should not be 5xx AND the tag should not be empty :)

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

  • STEPHAN HERBY
  • STEPHAN HERBY's Avatar Topic Author
  • Offline
  • Premium Member
More
6 years 4 months ago - 6 years 4 months ago #168427 by STEPHAN HERBY
Replied by STEPHAN HERBY on topic Hide some tags in K2 Tools module
Hi Krikor,
I agree, but does not the syntax
!empty($tag->tag) || ($tag->id !== 539)
exactly correspond to your suggestion?
Sorry for that newbies question, i learn php on forum :-)
Last edit: 6 years 4 months ago by STEPHAN HERBY.

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
6 years 4 months ago #168434 by Krikor Boghossian
Replied by Krikor Boghossian on topic Hide some tags in K2 Tools module
First of all, congrats on your progress.
This is OR :) You the && operators php.net/manual/en/language.operators.logical.php
PS. You can also use in_array php.net/manual/en/function.in-array.php

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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


Powered by Kunena Forum