I have code for a random image in the php section of my page
$imagesDir = 'images/eggs/';
$images = glob($imagesDir . '*.{jpg,jpeg,png,gif}', GLOB_BRACE);
$randomImage = $images[array_rand($images)];
it will display an image with this code
echo "<img src='$randomImage'>";
but when i try to do this in the body section of the page like this
<body>';
}
function template_body_above()
{
global $context, $settings, $options, $scripturl, $txt, $modSettings;
echo !empty($settings['forum_width']) ? '
<div id="wrapper" style="width: ' . $settings['forum_width'] . '">' : '', '
<div class="forest">
<div id="egg1"></div>
</div>
<div id="header"><div class="frame">
<div id="baloon1">
<img src="egg.php"/> //tried including seperate php code
<img src="<?php echo $randomImage ?>"> //php on same page
</div>
I am showing for the image source ...%3C?php... Any help on where I'm going wrong ?
Aucun commentaire:
Enregistrer un commentaire