External images within the article should also be viewable.
Thanks

Moderator: General Support Moderators
Code: Select all
<?php $show_images = LayoutHelper::render('joomla.content.intro_image', $this->item); ?>
<?php if(!isset($images->image_intro) || empty($images->image_intro)) { ?>
<div class="no-image">
<?php } ?>
<?php $texthtml=$this->item->text;
preg_match('/<img.+src=[\'"](?P<src>.+?)[\'"].*>/i', $texthtml, $image);
$imgfirst=$image['src'];
echo '<img src="' . $imgfirst. ' ">'
?>
<?php if(!isset($images->image_intro) || empty($images->image_intro)) { ?>
</div>
<?php } ?>
Code: Select all
if (empty($images->image_intro)) {
return;
}
Hi. You're right. You need to write a condition in which the first image will be shown. But before writing the code, you must solve this logical problem in the mind and draw a block scheme.sanal wrote: ↑Mon Jun 05, 2023 5:34 pmMaybe the condition is this code.
Code: Select all
if (empty($images->image_intro)) { return; }