MyBB Community Forums

Full Version: Pull all images from folder to display in template.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm looking to pull all images and filenames from a specific folder, and display them in a table along with the filename. My current php script pulls the images and filenames.

<?php  
$folder = 'registered/images/';
$filetype = '*.*';
$files = glob($folder.$filetype);
$count = count($files);
echo '<table>';
for ($i = 0; $i < $count; $i++) {
    echo '<tr><td>';
    echo '<a name="'.$i.'" href="#'.$i.'"><img src="'.$files[$i].'" /></a>';
    echo substr($files[$i],strlen($folder),strpos($files[$i], '.')-strlen($folder));
    echo '</td></tr>';
}
echo '</table>';
?> 


This leaves me with just a plain php page. How do I integrate this script into mybb theme?  

I would like something almost like the misc?action=smilies table.
You can create 2 templates (for whole table/page and single rows), then eval them and output the page.
http://docs.mybb.com/1.8/development/plu...arate-file