Latest News + - Change display layout
- Posted by martini (8) Offline
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?
5 years 5 months ago #1
by martini
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>
Please Log in or Create an account to join the conversation.
- Posted by TemplatePlazza (5318) Offline
Hi you can try this one :
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
<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 Log in or Create an account to join the conversation.
- Posted by martini (8) Offline
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
Thanks for your help. I will be looking forward for the updated module.
Regards
Please Log in or Create an account to join the conversation.
- Posted by martini (8) Offline
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
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
Please Log in or Create an account to join the conversation.
- Posted by TemplatePlazza (5318) Offline
Hi, You can change that to :
5 years 5 months ago #5
by TemplatePlazza
<?php echo JHtmlString::truncate(strip_tags($item->title), 40); ?>
Please Log in or Create an account to join the conversation.