A community in which webmasters can ask for help with topics such as PHP coding , MySQL , IT jobs, web design, IT security.
Current location:homephp forumphp talk in 2008 yearPHP - Find URL of script that included current document - page 1
User InfoPosts
PHP - Find URL of script that included current document#1
I have a template I made that sets variables that rarely change, call my headers, calls my banner and sidebar, loads a variable which shows the individual pages, then calls the footer. In one of my headers, I want the URL of the page in the user(s address bar. Is there a way to do this?

Currently:

<?php
$title = "MySite - Contacts";
include("header.php");
.
.
.
?>

posted date: 2008-12-31 09:16:00


Re: PHP - Find URL of script that included current document#2
I had made out the solution of this problem. click to view my topic...

hope that hepls.

posted date: 2008-12-31 09:16:01


Re: PHP - Find URL of script that included current document#3
It sounds like $_SERVER[(REQUEST_URI(] is what you(re after.

posted date: 2008-12-31 09:22:00


Re: PHP - Find URL of script that included current document#4
The main variables you(ll be intersted in is:$_SERVER[(REQUEST_URI(] Holds the path visited, e.g. /foo/bar$_SERVER[(PHP_SELF(] is the path to the main PHP file (NOT the file you are in as that could be an include but the actual base file)There are a ton of other useful variables worth remembering in $_SERVER, so either just:print_r($_SERVER);or just visit the doc at http://php.net/manual/en/reserved.variables.server.php

posted date: 2008-12-31 09:58:00


Re: PHP - Find URL of script that included current document#5
the Web address of the Page being called, can be obtained from the following function ::function curPageURL() { $pageURL = (http(; if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";} $pageURL .= "://"; if ($_SERVER["SERVER_PORT"] != "80") { $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"]; } else { $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; } return $pageURL;}I have been using this in many places, found on google.

posted date: 2011-06-13 09:55:00


select page: « 1 »
Copyright ©2008-2017 www.momige.com, all rights reserved.