source

Below is the source code used to render my portfolio site. The script includes files to create the HTML header and footer as well as the navigation links. It also dynamically includes content files based on the contents of the page variable.
The highlight_file() function was used to generate the source code.

<?php
$page_request 
filter_input(INPUT_GET'page'FILTER_SANITIZE_STRING);
$page         $page_request $page_request 'main';

/* if ($page_request)
{
    $page = preg_replace('[a-zA-Z]', ' ', $page_request);
}
else
{
    $page = 'main';
} */

$fpage __DIR__ '/inc_' $page '.php';

include_once(
__DIR__ '/index_header.php');
include_once(
__DIR__ '/index_navi.php');
?>
<div id="content">
    <?php if (isset($page) && file_exists($fpage)) : ?>
        <?php include($fpage); ?>
    <?php else : ?>
        <?php include(__DIR__ '/inc_main.php'); ?>
    <?php endif; ?>
</div>
<?php include_once("index_footer.php"); ?>

Footer:

                    <div id="footer">
                        <p>&copy; herdyderp 2011-<?php echo date('Y'); ?></p>
                            <?php if (isset($page) && file_exists($fpage)) : ?>
                                <?php if ($page != 'source') : ?>
                                    <p>
                                        <a href="http://validator.w3.org/unicorn/check?ucn_uri=referer&amp;ucn_task=conformance" class="new-window">
                                            <img src="img/valid.png" width="165" height="15" alt="Valid XHTML1.1" title="Valid XHTML1.1 and CSS" />
                                        </a>
                                    </p>
                                <?php endif; ?>

                                <?php
                                $filename  
pathinfo($fpagePATHINFO_BASENAME);
                                
$sub_fpage substr($fpage6, -4) . ' page'//strip filetype and such from filename
                                
?>

                                <p><?php echo $filename?> last modified: <?php echo date('Y-m-d H:i:s'filemtime($fpage)); ?>.</p>
                        <?php endif; ?>
                    </div>
            </div>
    </body>
</html>