Java in my header lists:
<script type="text/javascript">
function showDiv(idInfo) {
var sel = document.getElementById('divLinks').getElementsByTagName('div');
for (var i=0; i<sel.length; i++) {
sel[i].style.display = 'none';
}
document.getElementById('container'+idInfo).style.display = 'block';
}
</script>
<style type="text/css">
#container1, #user_elements {
display : none;
border : 0px solid blue;
height : 100%;
overflow : hidden;
}
</style>
I don't need a bunch of containers I am just using this to display the new link clicked in the main DIV.
This is my Links code:
<div id="linkDiv">
<?php
$dir = "./modules";
$folders = new DirectoryIterator($dir);
$i=1;
foreach ($folders as $item) {
if ($item->isDir() && !$item->isDot()){
?>
<a href="#" onclick="showDiv('<?php echo $i; ?>');return false"><?php echo $item->getFilename(); ?></a><br />
<?php
$i++;
}
}
?>
</div>
This is the display location:
<div id="divLinks">
<?php
$path = "./modules";
$dir = new DirectoryIterator($path);
foreach ($dir as $fileinfo) {
if ($fileinfo->isDir() && !$fileinfo->isDot()) {
echo $fileinfo->getFilename().'<br>';
}
}
?>
<!-- Increase container# by 1 for every foreach loop -->
<div id="container1"><?php $fileinfo->getFilename() ?></div>
</div>
<!-- So if $path = Directory1 and Directory2 then the output would look like: -->
<div id="divLinks">
<div id="container1">Container #1<p>$dir/Directory1/index.php</div>
<div id="container2">Container #2<p>$dir/Directory2/index.php</div>
</div>
So what I need to is while the
foreach ($dir as $fileinfo) {
Finds directories the Main or display container increases by 1