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>
5 years 5 months ago #1 by martini

Please Log in or Create an account to join the conversation.

  • Posted by TemplatePlazza (5318) Offline
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
5 years 5 months ago #2 by TemplatePlazza

Please Log in or Create an account to join the conversation.

It seems it worked fine !!
Thanks for your help. I will be looking forward for the updated module.

Regards
5 years 5 months ago #3 by martini

Please Log in or Create an account to join the conversation.

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
5 years 5 months ago #4 by martini

Please Log in or Create an account to join the conversation.

  • Posted by TemplatePlazza (5318) Offline
Hi, You can change that to :
<?php echo JHtmlString::truncate(strip_tags($item->title), 40);  ?>
5 years 5 months ago #5 by TemplatePlazza

Please Log in or Create an account to join the conversation.

Powered by Kunena Forum