Call me!
cell: 612-730-9540

PHP Include Test Page

Project Winter 2014:

Research PHP solutions on my website.

I created this page to test using PHP includes to make my site more modular and easier to maintain. The Projects side nav is a PHP include pulling in a PHP file called sidenav.php. I copied my projects.html page and renamed it projects.php. In order for this to function I needed a server that can run PHP - which I have - through Dataride (also known as Implex previously).

The Code Reveal:

First: The HTML


<nav id="side">
	<?php include("sidenav.php"); ?>
</nav>

The page needs to have the extension changed to .php. You can either run a local testing server (XXAMP offers free software to do this) or ftp the files to a server host that supports php - like Dataride which is local business for me (in the greater Minneapolis / St Paul area).

If you don't know the HTML5 <nav> tag then replace the words "nav" with "div" - this won't affect the CSS.

Next: The Include


<ul>
    <li><a href="page1.html">Page 1</a>
        <ul>
            <li><a href="page2.html">Page 2</a>
                <ul>
                    <li><a href="page3.html">Page 3</a></li>
                    <li><a href="page4.html">Page 4</a></li>
                </ul>
            </li>
            <li><a href="page5.html">Page 5</a>
                <ul>
                    <li><a href="page6.html">Page 6</a></li>
                </ul>
            </li>
            <li><a href="page7.html">Page 7</a>
                <ul>
                    <li><a href="page8.html">Page 8</a></li>
                </ul>
            </li>
            <li><a href="page9.html">Page 9</a>
                <ul>
                    <li><a href="page10.html">Page 10</a></li>
                </ul>
            </li>
            <li><strong>Not A Page</strong>
                <ul>
                    <li><a href="projects.php">PHP Include</a></li>
                </ul>
            </li>
        </ul>
    </li>
    <li><a href="page11.html">Page 11</a></li>
    <li><a href="page12.html">Page 12</a></li>
</ul>

This is inside a separate file called sidenav.php which rests on the same level in my directory as my projects.php file. This is all very simple and doesn't neeed anymore info.

Lastly: The CSS


#side { padding: 15px 0; }
    #side ul { margin: 0; padding: 0; list-style: none; }
        #side ul li { }
            #side ul a, #side ul a:visited { display: block; padding: 5px 15px; font-size: 1.18em; font-weight: bold; text-decoration: none; }
            #side ul a:hover, #side ul a:active, #side ul a:focus { color: #fff; background: #082a4d; }
            #side ul ul a, #side ul ul a:visited { padding: 5px 15px 5px 30px; }
            #side ul ul a:hover, #side ul ul a:active { color: #fff; background: #082a4d; }
            #side ul ul ul a, #side ul ul ul a:visited { padding: 5px 15px 5px 45px; }
            #side ul ul ul a:hover, #side ul ul ul a:active { color: #fff; background: #082a4d; }
            #side ul ul li strong { display: block; padding: 5px 15px 5px 30px; font-size: 1.18em; }

You can use any CSS you'd like. I'm just sharing mine so you can plug 'n' play this easier.

More PHP include testing of other elements to come.

Contact me

If you would like to speak with me more about my qualifications, experiences and what I can do for you please feel free to contact me.