How to extract Data from URL bar
Moderator: General Moderators
- NewfieBilko
- Forum Contributor
- Posts: 189
- Joined: Sun Jun 06, 2004 6:45 pm
- Location: Newfoundland
- Contact:
How to extract Data from URL bar
Is there anyway to call apon the browser to check the address text in the URL bar? Have it passed to the php?
- NewfieBilko
- Forum Contributor
- Posts: 189
- Joined: Sun Jun 06, 2004 6:45 pm
- Location: Newfoundland
- Contact:
No, i mean the address in the address bar is made up of a few bits, eg
$_SERVER['HTTP_HOST'], $_SERVER['PHP_SELF'], $_SERVER['REQUEST_URI'] etc...
if you do a var_dump($_SERVER); it will show you all the information it has, and the info you want is in there, so just pick out the bits you want, eg if the url is index.php?foo=bar then you might just want the index.php bit without the ?foo=bar bit ... just depends on your needs. But $_SERVER has it all
$_SERVER['HTTP_HOST'], $_SERVER['PHP_SELF'], $_SERVER['REQUEST_URI'] etc...
if you do a var_dump($_SERVER); it will show you all the information it has, and the info you want is in there, so just pick out the bits you want, eg if the url is index.php?foo=bar then you might just want the index.php bit without the ?foo=bar bit ... just depends on your needs. But $_SERVER has it all
- NewfieBilko
- Forum Contributor
- Posts: 189
- Joined: Sun Jun 06, 2004 6:45 pm
- Location: Newfoundland
- Contact:
ahhh ok nice, so i can do that, var_dump($SERVER) and will get all info.... thats right, but i want to get the file name, no extensions or anything. If i just want the Filename I will:
???????
those 3 additional arrays, they reference the different parts of the url?
Code: Select all
var_dump($_SERVER['REQUEST_URI'])those 3 additional arrays, they reference the different parts of the url?
- NewfieBilko
- Forum Contributor
- Posts: 189
- Joined: Sun Jun 06, 2004 6:45 pm
- Location: Newfoundland
- Contact:
BTW, how do i just call apon
var_dump($_SERVER['REQUEST_URI'])
to display OUTput to an html?
Do i put it into my php and then call the function var_dump?
I am running smarty with PHP application background and Templates for my Presentation layer. Should i put var_dump($_SERVER['REQUEST_URI'])
in the template or the application.. Im guessing the application, then how do I display the "bits"?
var_dump($_SERVER['REQUEST_URI'])
to display OUTput to an html?
Do i put it into my php and then call the function var_dump?
I am running smarty with PHP application background and Templates for my Presentation layer. Should i put var_dump($_SERVER['REQUEST_URI'])
in the template or the application.. Im guessing the application, then how do I display the "bits"?
- NewfieBilko
- Forum Contributor
- Posts: 189
- Joined: Sun Jun 06, 2004 6:45 pm
- Location: Newfoundland
- Contact:
- NewfieBilko
- Forum Contributor
- Posts: 189
- Joined: Sun Jun 06, 2004 6:45 pm
- Location: Newfoundland
- Contact:
Pick which one you want:
Code: Select all
echo $_SERVER['PHP_SELF'];
echo basename($_SERVER['PHP_SELF']);
echo $_SERVER['REQUEST_URI'];
echo __FILE__;- NewfieBilko
- Forum Contributor
- Posts: 189
- Joined: Sun Jun 06, 2004 6:45 pm
- Location: Newfoundland
- Contact:
neat.
I am going to try and use this, so that I can dynamically pull in what page it is the enduser is viewing, so that I can then have a TREE, or ROOT structure which will be like HOME -> ADMIN-> USERS-> "CURRENT PAGE", calling in the current page as what it is they are on, then based on which page it is just fill in the rooting links...
I am going to try and use this, so that I can dynamically pull in what page it is the enduser is viewing, so that I can then have a TREE, or ROOT structure which will be like HOME -> ADMIN-> USERS-> "CURRENT PAGE", calling in the current page as what it is they are on, then based on which page it is just fill in the rooting links...
- NewfieBilko
- Forum Contributor
- Posts: 189
- Joined: Sun Jun 06, 2004 6:45 pm
- Location: Newfoundland
- Contact:
- NewfieBilko
- Forum Contributor
- Posts: 189
- Joined: Sun Jun 06, 2004 6:45 pm
- Location: Newfoundland
- Contact:
i've tried:
and then echoing it by refering to it in my html output:
{echo $smarty[mark]} and everything that looks like this but no go.. its ok, ill figure it out im sure lol
Code: Select all
$smarty->assign('basename($_SERVER['PHP_SELF'])',$mark);{echo $smarty[mark]} and everything that looks like this but no go.. its ok, ill figure it out im sure lol
*smack*
'basename($_SERVER['PHP_SELF'])' remove those outer single quotes, and i'm not sure that's the correct syntax to assign a smarty var, better double check at http://smarty.php.net
'basename($_SERVER['PHP_SELF'])' remove those outer single quotes, and i'm not sure that's the correct syntax to assign a smarty var, better double check at http://smarty.php.net
- NewfieBilko
- Forum Contributor
- Posts: 189
- Joined: Sun Jun 06, 2004 6:45 pm
- Location: Newfoundland
- Contact: