Page 1 of 1

reciving the url withoguth the page name!

Posted: Sun Dec 21, 2003 1:25 am
by pelegk2
i want to recive the url but withogut the page name!
for example :
http://localhost/xxx/rrr/234.php
i want only :
http://localhost/xxx/rrr/

how do i do it?>

one idea..

Posted: Sun Dec 21, 2003 1:36 am
by Hurklefish
well, you could use a function to split your url into an array (of course, I don't remember the function.. in asp, it's 'split'.. is it 'explode()' in php?)

using the / as the seperator, then loop through the elements of the array one less the the total number of elements, building a new string that doesn't include the final element, 234.php

There's probably a less cumbersome method, but I'll be darned if I can think of it off the top of my head.

Posted: Sun Dec 21, 2003 1:39 am
by pelegk2
in js its like this :
window.location.toString().substring(0, window.location.toString().lastIndexOf('/')+1)


so i am sure there is something the same in php

Posted: Sun Dec 21, 2003 10:01 am
by DuFF