Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8234669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T18:33:39+00:00 2026-06-07T18:33:39+00:00

I am working on a dynamic blog/portfolio: Ref Link: http://www.andrewryan.me/ I have been working

  • 0

I am working on a dynamic blog/portfolio:

Ref Link: http://www.andrewryan.me/

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.

I have been working on a dynamic site structure and I would like to know a few things:

  1. Best practices’ for dynamic content.

    • I have the frame of the site in the root folder. This includes the index and styles.
      (along with the scripts folder, images folder and other misc file types..)

    • 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.
      (e.g: index.php?p=professional)

    • 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.
      (e.g: index.php?p=professional/thispost (idfk))

  2. How to create dynamic content inside of dynamic content.

    • Pages and SubPages then continue on down the chain within the personal folder. (e.g: index.php > index.php?p=personal)
  3. How to make updatable content that will file in once a page is uploaded to it’s respective folder.

    • 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.

Here’s my file structure:

root/   
  > images/  
    ||--> x.png   
  > pages/  
    ||--> personal.php  
    ||--> professional.php  
    ||--> contact.php   
    ||--> 404.php  
    ||--> contact.php 
    > personal/  
        |||--> personalposts.php  
    > professional
        |||--> professionalposts.php  
    > gallery/  
        |||--> galleryposts.php   
  > scripts  
    ||--> scripts.php/js/etc
  |--> .htaccess
  |--> index.php  
  |--> style.css    
  |--> robots.txt  
  |--> humans.txt

…and the code for dynamic pages:

<?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
    }
?>  

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T18:33:42+00:00Added an answer on June 7, 2026 at 6:33 pm

    First, you got to separate your site into pages (each page has a different layout). For example, to logout, you would have something like this: sitename.com/?action=logout

    To go home, you could go to sitename.com, if you try /?p=somethingThatDoesntExist then you still get to the homepage (or an error page)

    If you have access to something underneath your web root, then it’s much better. Then, you should keep all .php files in /root/content/ and only one index.php in /root/www/

    This code is what I use to give the player a page if he is logged in (and optionally if he is an admin)

    // Check if alternate page requested
    if (!empty($_GET["p"]) and !empty($_SESSION['id']))
    {
        $page = $_GET["p"];
        
        if (!empty($pages[$page]))
        {
            $page_array = $pages[$page];
            if ( (!empty($page_array['auth'])) && ($user['Auth'] < $page_array['auth']) )
            {
                $page_array = $pages['index'];
            }
        }
        else
        {
            $page = '';
        }
    }
    

    Then, you do your basic stuff:

    <!DOCTYPE html>
    <html xmlns="http://www.w3.org/1999/xhtml" lang='en'>  
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />  
            <title><? echo $page_array['title'] ?></title>
            
            <link rel="stylesheet" href="css/3p/reset.css" type="text/css"/>
            <link rel="stylesheet" href="css/3p/formalize.css" type="text/css"/>
    
            <link href="css/bootstrap.css" rel="stylesheet">
            <link href="css/main.css" rel="stylesheet">
            <link href="css/bootstrap-responsive.css" rel="stylesheet">
        </head>  
        <body>  
                <?php
                        require("../content/header.php");
                        require($page_array['require']);
                        require("../content/footer.php");
                ?>
        </body>
    </html>
    

    Here are the contents of page_array:

    $pages = Array();
    $pages['admin'] = Array(
        'auth' => 3,
        'require' => "../admin/index.php",
        'title' => "Administration - NPG CP"
    );
    
    $pages['index'] = Array(
        
        'require' => "../content/index.php",
        'title' => "Home - NPG CP"
    );
    
    $pages['friends'] = Array(
        
        'require' => "../content/index.php",
        'title' => "Friends - NPG CP"
    );
    
    $pages['pm'] = Array(
        
        'require' => "../content/index.php",
        'title' => "Messages - NPG CP"
    );
    
    $pages['stats'] = Array(
        
        'require' => "../content/index.php",
        'title' => "Statistics - NPG CP"
    );
    

    On my site, I only use one viewable file that handles everything else.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been working on a dynamic page http://www.euroworker.no/order and I want my lovely
Alright so i have been working on this Dynamic load of a spinner from
Im working on a dynamic paging website (Essentially clicking a link and it loads
So I've been working on a new blog system for my website, which I'm
I'm working with a dynamic DOM here, and have called the jQuery UI datepicker
I have a working dynamic TableLayout that holds user data. Clicking an Add Event
This is more of a theory question than a how-to question. I was working
I'm working on a dynamic website in Java and I'm interested in sticking with
I'm working on a ColdFusion dynamic website. For this website, there are a lot
I'm working on a site http://www.infinite-possibility.com/ which is currently having a problem with any

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.