在客户网站的首页上,我想展示一些带有图像和标题的文章样本。问题是,文章对象会在显示文章类别模块中的introtext之前剥离所有HTML标签。
是否有一种方法可以显示模块的introtext并保留所有HTML标签?
是否有一种方法可以显示模块的introtext并保留所有HTML标签?
<?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>
~siteroot~/modules/mod_articles_category/helper.php
中有一个_cleanIntrotext
函数,它会从introtext中删除大多数html标签。注释掉str_replace
和strip_tags
行就可以解决我的问题了。$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) : '';
复制模块并将其重命名。 在helper.php中注释或删除_cleanIntrotext、str_replace和strip_tags行。 您必须将所有文件和原始模块名称的实例替换为新模块名称。 为重命名的类添加CSS。 可能看起来很复杂,但逻辑思维让我在大约一个小时内完成了它。 由于现在是第三方模块,它不会被Joomla!更新覆盖。