I have this PHP code which attempts to populate an HTML ul list.
I'm not sure how to put it together. Here is the PHP:
<?php
$type = 'c';
$imagesDir = '/prettyphoto/images/';
$images = glob($imagesDir . $type . '*[TYPE].{jpg,jpeg,png,gif}', GLOB_BRACE);
?>
<ul>
<?php foreach($images as $image): ?>
<li><a href="<?php echo str_replace('[TYPE]', 'F', $image); ?>"><img src="<?php echo str_replace('[TYPE]', 'T', $image); ?></a>" alt="" /></li>
<?php endforeach; ?>
</ul>
Here is the HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<?php
$type = 'N';
$imagesDir = '/prettyphoto/images/thumbnails';
$images = glob($imagesDir . $type . '*[TYPE].{jpg,jpeg,png,gif}', GLOB_BRACE);
?>
<ul>
<?php foreach($images as $image): ?>
<li><a href="<?php echo str_replace('[TYPE]', 'F', $image); ?>"><img src="<?php echo str_replace('[TYPE]', 'T', $image); ?>" alt="" /></a></li>
<?php endforeach; ?>
</ul>
</body>
</html>
Edit: This simplified script works for me:
<ul>
<?php
foreach (glob("N*T.jpg") as $image): ?>
<li>
<a href="<?php echo str_replace("T", "F", $image); ?>">
<img src="<?php echo "$image"; ?>">
</a>
</li>
<?php endforeach; ?>
</ul>