<?php
$tools = true; // Robert's Custom Variable (Do Not Use)
include("{$_SERVER['DOCUMENT_ROOT']}/php/includes/header.php");
?>
<main>
<h2><?php echo $folder_name; ?>
<span><?php echo $file_name; ?></span>
</h2>
<?php
$assignments_directory_name = basename(getcwd());
?>
<h2><?php echo ucwords($assignments_directory_name); ?></h2>
<ul>
<?php
$assignments_directory_items = scandir(getcwd());
foreach ($assignments_directory_items as $item) {
if (preg_match('/^[\.]|^[\.\.]|^[x-]|index.php/', $item)) continue;
echo "\t<li><a href=\"/php/{$assignments_directory_name}/{$item}\">{$item}</a></li>\n";
}
?>
</ul>
<?php
chdir('../research-documentation');
$rd_directory_name = basename(getcwd());
?>
<h2><?php echo ucwords(str_replace("-", " ", $rd_directory_name)); ?></h2>
<ul>
<?php
$rd_directory_items = scandir(getcwd());
foreach ($rd_directory_items as $item) {
if (preg_match('/^[\.]|^[\.\.]|^[x-]|index.php/', $item)) continue;
echo "\t<li><a href=\"/php/{$rd_directory_name}/{$item}\">{$item}</a></li>\n";
}
chdir('../assignments');
?>
</ul>
<h2>Debug Code - Show Results of <a href="https://www.php.net/scandir"><code>scandir()</code></a></h2>
<pre class="line-numbers">
<code class="language-php">
<?php
echo '// print_r($assignments_directory_items);' . "\n";
print_r($assignments_directory_items);
echo '// print_r($rd_directory_items);' . "\n";
print_r($rd_directory_items);
?>
</code>
</pre>
</main>
<?php
include("{$_SERVER['DOCUMENT_ROOT']}/php/includes/sidebar.php");
include("{$_SERVER['DOCUMENT_ROOT']}/php/includes/footer.php");
?>