Created
May 14, 2012 01:03
-
-
Save drmmr763/2691048 to your computer and use it in GitHub Desktop.
default.php joomla 2.5 latest news (with intro image support)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// no direct access | |
defined('_JEXEC') or die; | |
?> | |
<ul class="latestnews<?php echo $moduleclass_sfx; ?>"> | |
<?php foreach ($list as $item) : ?> | |
<li> | |
<a href="<?php echo $item->link; ?>"> | |
<?php echo $item->title; ?></a> | |
<?php //json decodes the image object and gets the intro image source. ?> | |
<img src="<?php echo json_decode($item->images)->image_intro; ?>" /> | |
</li> | |
<?php endforeach; ?> | |
</ul> |
Thanks for this, works with Joomla 3.5 too. One question: is there a way to add some "if image url empty then do not display" ? Right now I have articles with and without assigned intro images and those without image show a broken image icon. I'm a total PHP noob...
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
very helpful