Keyword

Hide some tags in K2 Tools module

  • STEPHAN HERBY
  • STEPHAN HERBY's Avatar Topic Author
  • Offline
  • Senior Member
More
2 months 2 weeks ago #168405 by STEPHAN HERBY
STEPHAN HERBY created the topic: Hide some tags in K2 Tools module
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.

More
2 months 2 weeks ago #168411 by Krikor Boghossian
Krikor Boghossian replied the 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.

IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

---
JoomlaWorks
www.joomlaworks.net/

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

  • STEPHAN HERBY
  • STEPHAN HERBY's Avatar Topic Author
  • Offline
  • Senior Member
More
2 months 1 week ago #168416 by STEPHAN HERBY
STEPHAN HERBY replied the 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.

More
2 months 1 week ago #168425 by Krikor Boghossian
Krikor Boghossian replied the 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 :)

IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

---
JoomlaWorks
www.joomlaworks.net/

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

  • STEPHAN HERBY
  • STEPHAN HERBY's Avatar Topic Author
  • Offline
  • Senior Member
More
2 months 1 week ago - 2 months 1 week ago #168427 by STEPHAN HERBY
STEPHAN HERBY replied the 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: 2 months 1 week ago by STEPHAN HERBY.

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

More
2 months 1 week ago #168434 by Krikor Boghossian
Krikor Boghossian replied the 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

IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

---
JoomlaWorks
www.joomlaworks.net/

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

Moderators: william white