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 814189
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T01:28:47+00:00 2026-05-15T01:28:47+00:00

I dont know if this is a great idea…or a crap one. But I

  • 0

I dont know if this is a great idea…or a crap one. But I was thinking I may use one page to display all my pages using includes. Here is what my index.php would look like…on the functions include there is a function called “superSwitch” which will determine what requested page will be included….for instance

if I do a get ?a=a

it will goto the function superSwitch(a)
superSwitch will take it and associate it with (login.php)
then respond with such…

here is the code for the index.php…please let me know if this makes sense and might work, or should I just stick to long blocks of code (which is why I am trying this because I hate long pages full of code…)

of course as you can tell it is not actually including anything yet…the print is for debugging purposes. 🙂

Thanks,
Matt

<?php
//includes Functions
include_once('inc/func.inc.php');
//set superget variable
$superget = @$_GET['a'];
//check if superget is set or null
if (!$superget) 
{
    echo "Nothing Requested :)";
}
else
{
    //sanitizes the superget request
    $supergetr = supergetSanitize($superget);
    //uses the result "good" or "nogood" to determine what happens
    if ( $supergetr == "good" ) {
        //pulls superSwitch value of the request
        $ssresult = superSwitch($superget);
        print_r ($ssresult);
    }
    //if the sanitize is nogood
    else
    {
        //the superSwitch is instructed to respond with a 404 page
        $superget = "404";
        $ssresult = superSwitch($superget);
        print_r ($ssresult);
    }
}
?>
  • 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-05-15T01:28:47+00:00Added an answer on May 15, 2026 at 1:28 am

    You have just reinvented the front controller design pattern 🙂 In practice, you have one single page, which handles all the request. Usually, you will use apache rewrite rules to mask this, and have clean urls. This makes sense, and is a good idea, especially if you intend using the MVC pattern.

    The actual implementation is up to you. The one you are proposing is very simplicistic, but can be a good start. If you look at famous CMSes like Drupal, you’ll find this at the core. You may also want to take a look at the (too complex, IMHO) Zend Framework Page Controller.

    As a bonus, put this in your .htaccess, and you’ll have any page redirected to index.php?q=your/query/here. (E.g. http://www.yoursite.com/here/I/go?hi=1 will be passed to index.php?q=here/I/go&hi=1). Courtesy of Drupal.

    <IfModule mod_rewrite.c>
      RewriteEngine on
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
    </IfModule>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I dont know how doable this is but I'm working on a datatype for
i dont know if i should be asking this here (im now thinking maybe
sorry for this question, but i dont know where to search for it, or
I dont know if this is possible. In SSIS Derived column transformation, can you
First let me say i dont know if this is possible the way im
I dont know where my error is in this mysql query $sql = INSERT
I've got this as a homework question and dont know how I should go
I keep getting this error and I really dont know why. I have tried
I have read some different responses for this same question, so I dont know
Please, help me. I dont know what is wrong with this code: import android.appwidget.AppWidgetProvider;

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.