簡體   English   中英

如何在“文章類別”模塊中獲取 Joomla 文章的完整 HTML 簡介?

[英]How do I get the full HTML introtext of a Joomla article in the Articles Category module?

在客戶網站的首頁上,我想展示一些帶有圖像和標題的文章示例。 麻煩的是,文章 object 在文章類別模塊中顯示之前從介紹性文本中刪除了所有 HTML。

有沒有辦法在所有 HTML 中顯示模塊的介紹性文本?

在 3.2 版中,您可以通過將 introtext 顯示選項設置為“隱藏”來繞過 _cleanIntrotext 方法。

在 /templates/your_template/html/mod_articles_category 中創建替代布局(或覆蓋 default.php)並更改

<?php if ($params->get('show_introtext')) :?>
  <p class="mod-articles-category-introtext">
    <?php echo $item->displayIntrotext; ?>
  </p>
<?php endif; ?>

<p class="mod-articles-category-introtext">
  <?php echo $item->introtext; ?>
</p>

我修改了線條

$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) : '';

我終於找到了答案。 原來~siteroot~/modules/mod_articles_category/helper.php有一個_cleanIntrotext function 從introtext EZ7 中刪除大部分 ZFC35FDC70D5FC69D239883A8222C。 注釋掉str_replacestrip_tags行解決了我的問題。

這不是解決此問題的最佳方法,因為我必須記住在升級 Joomla 時重新實現它。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM