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

  • Home
  • SEARCH
  • 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 8737717
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:35:12+00:00 2026-06-13T10:35:12+00:00

I’m doing my first single-entry site and based on the result, I can’t see

  • 0

I’m doing my first single-entry site and based on the result, I can’t see the benefit.

I’ve implemented the following:

  • .htaccess redirects all requests to index.php at the root
  • Url is parsed and each /segment/ is stored as an element in an array
  • First segment indicates which folder to include (e.g. “users” » “/pages/users/index.php”).
  • index.php file of each folder parses the remaining elements in the segments array until array is empty.
  • content.php file of each folder is included if there are no more elements in the segments array, indicating that the destination file is reached

Sample

File structure ( folders in [] ):

  • [root]
    • index.php
    • [pages]
      • [users]
        • index.php
        • content.php
        • [profile]
          • index.php
          • content.php
          • [edit]
            • index.php
            • content.php
      • [other-page]
        • index.php
        • content.php

Request: http://mysite.com/users/profile/

  1. .htaccess redirects request to http://mysite.com/index.php

  2. URL is parsed and segments array contains: [1] users, [2] profile

  3. index.php maps [1] to “pages/users/index.php”, so includes that file

  4. pages/users/index.php maps [2] to pages/users/profile/index.php, so includes that file

  5. Since no other elements in the segments array, the contents.php file in the current folder (pages/users/profile) is included.


I’m not really seeing the benefit of doing this over having functions that include components of the site (e.g. include_header(), include_footer(), etc.), so I conclude that I’m doing something terribly wrong. I’m just not sure what it is.

  • 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-13T10:35:14+00:00Added an answer on June 13, 2026 at 10:35 am

    This version you have is lacking some functions and only works as a very simplistic front-controller pattern.

    Most systems don’t map the URL to a single PHP file that is the page – they map the URL path to a controller that knows how to build the page.

    In addition, not all URL’s need to map to a direct file. For example, look at github.com/[username]/[repo]. You can’t create millions of bob/ajaxstuff/index.php files – you need to use regex to tell a controller you want the write page for this project.

    $app->get('/:username/:repo', function ($username, $repo) {
        echo "Looking at $username's $repo";
    });
    

    To really grasp how this should be used correctly I recommend you use a full-featured routing system like the simple Slim Framework.

    If you want more information about routing design and theory I recommend reading php-router’s readme and the excellent URL Design post from warpspire.

    If any of those are too much, you can also look at klein and the super-simple ToroPHP library.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am doing a simple coin flipping experiment for class that involves flipping a
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
Does anyone know how can I replace this 2 symbol below from the string

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.