How do I get the full HTML introtext of a Joomla article in the Articles Category module?
On the front page of a client's site, I'd like to display a few a开发者_Go百科rticle 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?
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>
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.
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) : '';
精彩评论