Jump to content

Putting URL to site on my page


ziola1039

Recommended Posts

I am trying to pass the url of a page actually on to the page and I was using this:

 

<?php echo print $PATH_INFO = str_replace("/", "-",  $_SERVER['REQUEST_URI']);?>

 

but I want to include this on an include file - so lets say that that code is on a page here: "/includes/page1.php"

 

and then on page2.php I have this:

 

<?php include('/page1.php'); ?>

 

what happens is the URL on my page is written on the page as like "-page1.php" but what I want is it to say "-page2.php"

 

anyone know how to do this?

Link to comment
https://forums.phpfreaks.com/topic/64135-putting-url-to-site-on-my-page/
Share on other sites

Actually u have that code in page1.php and that page is being included in page2.php, right? I tried it myself just to be sure and it is echoing -page2.php and thats normal. Page1 is being included and that code is being parsed as code of page2, so it will return the url of page2.

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.