Reputation: 488
On the front page of a client's site, I'd like to display a few article samples with images and headers. Trouble is, the article object strips out all HTML from the introtext before displaying it in the Articles Category module.
Is there a way to display the module's introtext with all the HTML left in?
Upvotes: 5
Views: 7423
Reputation: 1
Make a copy of the module and rename it. Comment out or delete _cleanIntrotext, str_replace and strip_tags line in helper.php. You have to replace all files and instances of the original module name to your new module name. Add CSS for your renamed classes. May seem complicated, but logical thinking did it for me in about an hour or so. As it is now a third party module, it will not be overwritten by Joomla! updates.
Upvotes: 0
Reputation: 61
In version 3.2 you can bypass the _cleanIntrotext method by setting the introtext display option to "hide".
Create an alternate layout (or override default.php) in /templates/your_template/html/mod_articles_category and change
<?php if ($params->get('show_introtext')) :?>
<p class="mod-articles-category-introtext">
<?php echo $item->displayIntrotext; ?>
</p>
<?php endif; ?>
to
<p class="mod-articles-category-introtext">
<?php echo $item->introtext; ?>
</p>
Upvotes: 5
Reputation: 101
I modified the lines
$item->fulltext = $item->introtext;
$item->introtext = self::_cleanIntrotext($item->introtext);
and use fulltext for html an introtext for only text.
$item->displayIntrotext = $show_introtext ? self::truncate($item->introtext, $introtext_limit) : '';
$item->displayFulltext = $show_introtext ? self::truncate($item->fulltext, $introtext_limit) : '';
Upvotes: 1
Reputation: 488
I finally found an answer. Turns out on ~siteroot~/modules/mod_articles_category/helper.php
has a _cleanIntrotext
function that strips out most html from the introtext. Commenting out the str_replace
and strip_tags
lines fixed my problem right up.
It's not the greatest way to fix this, as I'll have to remember to reimplement this when I upgrade Joomla.
Upvotes: 2