简体   繁体   中英

How to bring latest Articles in Joomla?

I'm new with joomla, just started leaning how to make a templates. 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. each in one div how to do that?

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.

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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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