Latest News + - Change display layout

Hi

I had been playing with the templates, and I just want to produce something like the screenshot attached.

The title of the articles are listing fine, but I have no much idea of PHP. How should I display the date beside the title on this code?

defined('_JEXEC') or die;
?>
<ul class="latestnews<?php echo $moduleclass_sfx; ?> mod-list">
<?php foreach ($list as $item) : ?>
	<li itemscope itemtype="https://schema.org/Article">
		<a href="/<?php echo $item->link; ?>" itemprop="url">
			<span itemprop="name">
				<?php echo $item->title; ?>
			</span>
		</a>
	</li>
<?php endforeach; ?>
</ul>
Resolved
The discussion has been resolved.
       
  • Replied by admin on Monday, January 06 2020, 05:30 AM · Hide· #1
    Hi you can try this one :
    <a href="/<?php echo $item->link; ?>" itemprop="url">
                <span itemprop="name">
                    <?php echo $item->title; ?> - 
    		<?php echo JHTML::_('date', htmlspecialchars( $item->created ),'l, F jS Y H:i', $offset); ?>	
                </span>
            </a>


    Anyway, we are going to release the new update for this module this week with some major improvements. Please stay tuned
    Please post rating at the Joomla! Extensions Directory - http://extensions.joomla.org/profile/profile/details/264
  •  
  • Replied by martiniturbide on Monday, January 06 2020, 08:42 PM · Hide· #2
    It seems it worked fine !!
    Thanks for your help. I will be looking forward for the updated module.

    Regards
  •  
  • Replied by martiniturbide on Tuesday, January 07 2020, 04:52 PM · Hide· #3
    Hi

    Just another quick question, since I'm very lousy with PHP.

    How should I limit the number of character displayed on the title of...
    "<?php echo $item->title; ?>"
    to only display the first 40 characters?

    Thanks in advance.
    Regards
  •  
  •  
    Replied by admin on Tuesday, January 07 2020, 10:36 PM · Hide· #4
    Hi, You can change that to :
    <?php echo JHtmlString::truncate(strip_tags($item->title), 40);  ?>
    Please post rating at the Joomla! Extensions Directory - http://extensions.joomla.org/profile/profile/details/264
Your Response
Please login first in order for you to submit comments