1

I want to remove the strip image function from mod_feed in the administrator area.

mod_feed/tmpl/default.php at line 118

// Strip the images.
$text = JFilterOutput::stripImages($text);
$text = JHtml::_('string.truncate', $text, $params->get('word_count', 0), true, false);
echo str_replace(''', "'", $text);

When I comment(//) the first $text the images don't show up.

When I comment(//) the second $text as well then the images are visible.

But can someone tell me what the true and false do that come after ('word_count', 0), true, false); And how should this be rewritten that it allows the images and still do the word count.

PS: I know editing a Joomla Module goes away after update. It is just learning for me.

PS2: Changing the last false to true makes the images show. But how to find out what it is pointed to.

1 Answer 1

2

The arguments for JHtmlString::truncate() are:

string   $text       The text to truncate.
integer  $length     The maximum length of the text.
boolean  $noSplit    Don't split a word if that is where the cutoff occurs (default: true).
boolean  $allowHtml  Allow HTML tags in the output, and close any open tags (default: true).

Change the last argument to true or omit it (it defaults to true) to allow HTML tags.

https://api.joomla.org/cms-3/classes/JHtmlString.html#method_truncate

1
  • Thank you very much for this clear answer. But especially thanks for the link I am a hundred percent sure this is going to help me a lot in the future. Cheers mate! Mar 13, 2020 at 19:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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