简体   繁体   English

如何在Joomla中带来最新文章?

[英]How to bring latest Articles in Joomla?

I'm new with joomla, just started leaning how to make a templates. 我是joomla的新手,刚刚开始研究如何制作模板。 I have edited one template i know how to bring all the latest articles on that template by using module type component but i have 6 div tags and i want recent 6 articles to come between div tags. 我已经编辑了一个模板,我知道如何使用模块类型组件将所有最新文章带到该模板上,但是我有6个div标签,并且我希望最近6篇文章可以在div标签之间。 each in one div how to do that? 每个div怎么做?

You should use a dynamic template where you use a PHP foreach loop that iterates trough the articles (no matter how many) and places div-tags for each of them. 您应该使用动态模板,在其中使用PHP foreach循环来遍历文章(无论多少),并为每个文章放置div标签。

Like so: 像这样:

<ul class="latestnews<?php echo $moduleclass_sfx; ?>">
<?php foreach ($list as $item) : ?>
    <li>
        <h4><a href="<?php echo $item->link; ?>"><?php echo $item->title; ?></a></h4>
        <p><?php echo JHTML::_('string.truncate', (strip_tags($item->introtext, '<a><br />')), $item->params->get('readmore_limit')); ?></p>
    </li>
<?php endforeach; ?>
</ul>

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

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