...

View Full Version : get and use curent page URL



_user
04-25-2012, 09:08 PM
Hy
I wanna use the curent URL in pagination links.
Now I get : http://www.domain.com/title.php?page=2 (3,4,5...999) and I need to be something like this: http://www.domain.com/title.php?type=name&class=black&submit=Submit?page=2 (3,4,5...999)

Or how can I transform the current URL in simple http://www.domain.com/title.php.

I mention the URL is from a search query.

Here is my code




<?php
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;
}
?>



$curPageURL = curPageURL();


///this is the pagination code
if($pages >= 1 && $page <= $pages){
for ($x=1; $x<=$pages; $x++){
$pagination .= ($x == $page) ? '<strong>' . $x . '</strong> ' : '<a href="?page=' .$x. '"> ' . $x . '</a> ';
}

}





and if I use <a href="$curPageURL?page=' .$x. '"> I get something like this www.domain.com/$curPageURL?page=2 (3,4,5...999)


thank you



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum