1

When you click a Tag you are directed to Tags results that are rendered by ../components/com_tags/tag/default_items.php. By overriding this file you can have your specific look. A serious issue with the above file is the rendering of the truncated text that has HTML tags and this can result in a breaking layout. For example, if you have an opening Unordered List tag without the closing tag, a usual issue, that breaks the whole layout.

The code (in Joomla 4) that displays the truncated text from the main article text is:

<?php echo HTMLHelper::_('string.truncate', $item->core_body, $this->params->get('tag_list_item_maximum_characters')); ?>

So, the question is: How can we modify the above code to strip HTML tags?

1 Answer 1

0

I'm not sure if this helps, but there's an option to strip tags. The allowHtml function's parameter set to false will strip tags I guess. I'm sure. https://api.joomla.org/cms-4/classes/Joomla-CMS-HTML-Helpers-StringHelper.html#method_truncate

2
  • Thank you for contributing, please take our tour.
    – mickmackusa
    Jul 30 at 22:27
  • any idea how to implement this on my specific code?
    – geoplous
    Aug 1 at 14:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.