title: What can I do to better structure my File Directory?
body: <h1>I am working on a dynamic blog/portfolio:</h1>
  
  <p>Ref Link: <a href="http://www.andrewryan.me/" rel="nofollow">http://www.andrewryan.me/</a></p>
  
  <p>I have been working on my personal website for more than a month now. I keep modifying things because I feel like I am setting up this entire thing wrong. I know I am in some way or another and I am finally asking for help.  </p>
  
  <p>I have been working on a dynamic site structure and I would like to know a few things:</p>
  
  <ol>
  <li><p><strong>Best practices' for dynamic content.</strong>  </p>
  
  <ul>
  <li><p>I have the frame of the site in the root folder. This includes the index and styles.<br>
  <em>(along with the scripts folder, images folder and other misc file types..)</em>  </p></li>
  <li><p>The newest blog entries are pulled up on the index page. If they wanted to see all my professional posts/topics they'd just go to any given sub section.<br>
  <em>(e.g: index.php?p=professional)</em>  </p></li>
  <li><p>From there; If a user wanted to view a blog post in it's entirety, they'd just click on the post and then that's further-dynamically pulled up.<br>
  <em>(e.g: index.php?p=professional/thispost (idfk))</em></p></li>
  </ul></li>
  <li><p><strong>How to create dynamic content inside of dynamic content.</strong>   </p>
  
  <ul>
  <li>Pages and SubPages then continue on down the chain within the personal folder. <em>(e.g: index.php > index.php?p=personal)</em>  </li>
  </ul></li>
  <li><p><strong>How to make updatable content that will file in once a page is uploaded to it's respective folder.</strong>   </p>
  
  <ul>
  <li>Should I be looking into using a database or XML for this? And if so, can anyone point me to any good tutorials on making this type of website? No need to explain too much on this.     </li>
  </ul></li>
  </ol>
  
  <p><em>Here's my file structure:</em></p>
  
  <pre><code>root/   
    &gt; images/  
      ||--&gt; x.png   
    &gt; pages/  
      ||--&gt; personal.php  
      ||--&gt; professional.php  
      ||--&gt; contact.php   
      ||--&gt; 404.php  
      ||--&gt; contact.php 
      &gt; personal/  
          |||--&gt; personalposts.php  
      &gt; professional
          |||--&gt; professionalposts.php  
      &gt; gallery/  
          |||--&gt; galleryposts.php   
    &gt; scripts  
      ||--&gt; scripts.php/js/etc
    |--&gt; .htaccess
    |--&gt; index.php  
    |--&gt; style.css    
    |--&gt; robots.txt  
    |--&gt; humans.txt
  </code></pre>
  
  <p>...and the code for dynamic pages:</p>
  
  <pre><code>&lt;?php
      $pages_dir = 'pages'; //Scans the pages directory
  
      if (!empty($_GET['p'])) { //If not empty it will get the file
          $pages = scandir ($pages_dir, 0); //Sets up files as array
          unset ($pages[0], $pages[1]); //Unsets the first two. These are just dots.
          $p = $_GET['p'];
  
          if (in_array($p.'.php',$pages)) {
              include ($pages_dir.'/'.$p.'.php');
          } else {
          include($pages_dir.'/404.php'); //DENIED!
          }
      } else {
          include($pages_dir.'/blog.php'); //if it's the index page
      }
  ?&gt;  
  </code></pre>
  
  <p>I more or less want to know if I got the structure down right or if there's a better way to do this. I'd like to be able to make this website once and just auto-update it content-wise when needed.</p>