简体   繁体   English

如何在joomla中分割内文?

[英]how to split introtext in joomla?

I developed a module which can display article details as newsfeed. 我开发了一个模块,可以将文章详细信息显示为新闻源。 By clicking that article title user can go to the full article link. 通过单击该文章标题,用户可以转到完整的文章链接。

this newsfeed display in main page. 此新闻源显示在主页上。 but it display the full content of the article. 但它显示了文章的全部内容。

I want to display only the first paragraph and if there are images it also. 我只想显示第一段,如果还有图像,也要显示。

I used here joomla content table introtext column data. 我在这里使用了joomla内容表内文字列数据。

But i want to only display first paragraph and images only. 但是我只想显示第一段和图像。

This is the code i used. 这是我使用的代码。

<?php
    $db = JFactory::getDBO();
    $db->setQuery("SELECT * FROM #__content WHERE catid = 8");
    $fullArticle = $db->loadObjectList(); ?>
    ..........
    <?php foreach($fullArticle as $article){ ?>
        <ul>
            <li>
            <h2><a href="<?php echo $article->alias;?>"><?php echo $article->title; ?></a></h2>
            <?php echo $article->introtext;?>
            </li>
        </ul>
        <?php } ?>

can anyone help me? 谁能帮我?

You need to put a readmore into the article itself, or joomla considers the entire article is introtext. 您需要在文章本身中添加一个readmore,或者joomla认为整篇文章都是前言。 This is where you'll find the read more button which you can split your articles with, in the article editor: 在这里,您可以在文章编辑器中找到“阅读更多”按钮,可以使用该按钮拆分文章:

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM