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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:06:41+00:00 2026-06-13T13:06:41+00:00

Is there a function I can use to extract a requested URL? I want

  • 0

Is there a function I can use to extract a requested URL?

I want to evaluate the path in a case statement to import my views/includes/etc so if anyone can point me in the direction of something I would be really grateful.

i was going to use something like this…

function curPageURL() {

    //create url prefix ie https://...etc
    $pageURL = 'http';

    if ($_SERVER["HTTPS"] == "on"){$pageURL .= "s";}

    $pageURL .= "://";

    //if not on port 80 find out which port were on
    if ($_SERVER["SERVER_PORT"] != "80") {        
        $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];        
    } else {
        $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
    }
//return full url string
return $pageURL;
}

variable = curPageURL();
  • 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-13T13:06:42+00:00Added an answer on June 13, 2026 at 1:06 pm

    Figured this one out.

    If anyone has this idea just set a variable value and sent it accorss the URL, a la…

    <li><a href="index.php?content=location">Locations</a></li>
    

    then intercept that in a controller (via an include on the main template, I use my own MVC with a nav controller), like this….

    if(isset ($_GET["content"])){   
        switch ($_GET["content"]){
            case 'home':
                $masterURL = 'views/contenthome.php';
                $div_id = "content_home";
            break;
            case 'courses':
    
                $masterURL = 'views/courses.php';
                $div_id = "content_courses";
            break;
    
        }//end switch
    }else{
        $masterURL = 'views/contenthome.php';
    }//end if
    

    Its simple and effective but I hope it helps somebody somewhere.

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

Sidebar

Related Questions

is there a wordpress function that I can use to detect pages? example of
Is there a php function that someone can use to automatically detect if an
Are there any opencv function like cvHoughCircles() that can use for square detection programming
I use plugin wp-type, there I can make costum pages, this plugin have function
Is there any javascript function that can encrypt data: For example i want to
Is there a PHP function which can accept the image path of a PNG-24
Is there a function that can extract two or more columns from a coeftest
One can use numpy 's extract function to match an element in an array.
I want to extract the return type of a function. Problem is, there are
Is there a function that can truncate or round a Double? At one point

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.