/ Published in: PHP
URL: none
This function gets the exact string that shows in the address bar. If you use it with no arguments, function will simply return the string, if you put TRUE as the argument, the function returns a html link to the current url. This works whether you are on a post or a page. It strips any other query information like searches.
Expand |
Embed | Plain Text
function url_is($showlink = FALSE) { if ($_GET['page_id']) $query = 'page_id=' . $_GET['page_id']; else $query = 'p=' . $_GET['p']; $urlis = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF'] . '?' . $query; if($showlink == TRUE) return '<a href="' . $urlis . '">' . $urlis . '</a>'; else return $urlis; }
Comments
Subscribe to comments
You need to login to post a comment.

This work only if you don't have Friendly URL, just return mypage.com/?id=aaa or something like that. [Bad Engrish?]