I'd like to get rid of the first element in this array (see script below). It outputs an initial list item I don't want, namely the filename
Code: Select all
..PHP
Code: Select all
<?php
// get template directory (wordpress)
$templateDir = get_bloginfo(template_directory);
// get current directory
getcwd();
// change to directory we want
chdir('wp-content\themes\ldexterldesign\images\logos\accreditors\hoverOff');
// make a variable of the path
$cwd = getcwd();
// get all the filenames
$files = scandir($cwd);
// count total files in directory
$totalFiles = count($files);
// get end directory from the $cwd
$endDirectory = explode('\\', $templateDir);
// spit out the filenames with img tag HTML
echo '<ul id="accreditors">';
for($i = 1; $i <= $totalFiles-1; $i++){
echo '<li>';
echo '<a href="#">';
echo '<img src="';
echo $templateDir;
echo '/images/logos/accreditors/hoverOff/';
echo $files[$i];
echo '"/>';
echo '</a>';
echo '</li>';
}
echo '</ul>';
?>Code: Select all
<ul id="accreditors">
[i] <li><a href="#"><img src="http://localhost/wordpress/wp-content/themes/ldexterldesign/images/logos/accreditors/hoverOff/.."/></a></li>[/i]
<li><a href="#"><img src="http://localhost/wordpress/wp-content/themes/ldexterldesign/images/logos/accreditors/hoverOff/ABBE.gif"/></a></li>
<li><a href="#"><img src="http://localhost/wordpress/wp-content/themes/ldexterldesign/images/logos/accreditors/hoverOff/BRE.gif"/></a></li>
<li><a href="#"><img src="http://localhost/wordpress/wp-content/themes/ldexterldesign/images/logos/accreditors/hoverOff/ECMK.gif"/></a></li>
<li><a href="#"><img src="http://localhost/wordpress/wp-content/themes/ldexterldesign/images/logos/accreditors/hoverOff/IBG.gif"/></a></li>
<li><a href="#"><img src="http://localhost/wordpress/wp-content/themes/ldexterldesign/images/logos/accreditors/hoverOff/thamesValley.gif"/></a></li>
</ul>Thanks to anyone that can help.
Cheers,
L