Jump to content

[SOLVED] Create a page location using $_SERVER['REQUEST_URI']


matbourne

Recommended Posts

I created a test page to try and create a page location depending on the current page using $_SERVER['REQUEST_URI'].

 

This works on a seperate test page and the code below gives me the desired result.

 

Desired result: ./path/foldername/currentpage.php

 

However, when using the same code in my live website the result is as below:

 

Undesired result: ./path/foldername/

 

Can anyone help me with this please as i am pulling out hair now!  :facewall: All help greatly appreciated

 

Forgive the vagueness of the code, i don't want to give too much away...

 

// Set $currentPage as current page
$currentPage = $_SERVER['REQUEST_URI'];

// Remove / from $currentPage
$currentPage = $str_replace("/", "", $currentPage);

$pageLocation = $path . "foldername" . $currentPage;

 

Thanks for the quick reply...

 

I'm sure I already checked that,  but just tried it again.

 

It works on my included pages but not on my main index.php page that contains all the site structure and includes...

 

:shrug:

 

I need this to work on my main index.php page and other main pages...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.