Skip to content

Instantly share code, notes, and snippets.

@drmmr763
Created May 14, 2012 01:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save drmmr763/2691048 to your computer and use it in GitHub Desktop.
Save drmmr763/2691048 to your computer and use it in GitHub Desktop.
default.php joomla 2.5 latest news (with intro image support)
// 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>
@fitodac
Copy link

fitodac commented Jan 5, 2014

Thanks a lot!

@alexisaguilar
Copy link

very helpful

@xe-interactive
Copy link

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...

@12345678--
Copy link

2017-01-04_130157 copy

images)->image_intro; ?> images)->image_intro_alt; ?>

like this hoe to call the link marking the attach one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment