I'm working on my latest project with Smarty, to make back-end and front-end easier to use.
Now i use in my webapp an directory iteration function to view existing folders.
I was hoping someone could 'fix' this code for me too work it correctly with Smarty too.
I can't use any echo's and the way i wanted to return the output also works kinda messy.
Hope anyone can help me, or know any good tips for me... This is my first time working with Smarty
function requestAccountFolderStructure($dir) {
echo '<ul class="list-folderstructure">';
$path = $dir;
foreach (new DirectoryIterator($path) as $file) {
if ($file->isDot())
continue;
if ($file->isDir()) {
echo '<li class="li-folderstructure" data-folderstructure="' . $file->getFilename() . '">';
echo '<a class="a-folderstructure"><span class="name-folderstructure">' . $file->getFilename() . '</span> <span class="glyphicon glyphicon-play"></span></a>';
if (is_dir($dir . '/' . $file)) {
requestAccountFolderStructure($dir . '/' . $file);
}
echo '</li>';
}
}
echo '</ul>';
}
Documentation: http://www.smarty.net/