1
0
mirror of https://github.com/php/web-php.git synced 2026-03-23 23:02:13 +01:00

Only render HTML for image when there is an image

Fix issue described in https://github.com/php/web-php/pull/321#issuecomment-621647915
This commit is contained in:
Sebastian Bergmann
2020-04-30 10:48:02 +02:00
committed by Christoph M. Becker
parent 64221f5e49
commit 640baa75da

View File

@@ -35,7 +35,11 @@ foreach($frontpage as $entry) {
$content .= '<div class="newsentry">';
$content .= '<h3 class="newstitle title"><a href="'. $MYSITE.$link .'" name="' . $id . '">' . $entry["title"] . '</a></h3>';
$content .= '<div class="newsimage">';
$content .= sprintf('<a href="%s"><img src="/images/news/%s"></a>', $entry["newsImage"]["link"], $entry["newsImage"]["content"]);
if (isset($entry["newsImage"])) {
$content .= sprintf('<a href="%s"><img src="/images/news/%s"></a>', $entry["newsImage"]["link"], $entry["newsImage"]["content"]);
}
$content .= '</div>';
$content .= '<div class="newscontent">';
$content .= $entry["content"];