Hi;
I'm sure this is very simple, but I have serched the forums and documentation and can't seem to find the anser.
I need to create a hyperlink to the current page, and I don't want to have to hard code the page name, I guess what I need is the current page path.
I thought that a breadcrumb may do it, but it does not give me the full path.
What I need is Bookmark 1
assuming the current page to be index.php in the root folder:
index.php#bkmark1
Any ideas ??
Cheers
Current Page Path ::: SOLVED :::
-
- Forum Members
- Posts: 57
- Joined: Sun Mar 25, 2007 7:42 am
Current Page Path ::: SOLVED :::
Last edited by crankshaft on Tue Mar 27, 2007 12:02 pm, edited 1 time in total.
Re: Current Page Path
In the tag for "TellaFriend", is logic to pull the currentpage. There might be simpler/better methods, but that's one I've recently seen and changed (For my site I didn't want the current page, but the referring page indeed)
http://dev.cmsmadesimple.org/projects/tellafriend
Ronny
EDIT:
this post might give it faster.
http://forum.cmsmadesimple.org/index.ph ... l#msg47062
http://dev.cmsmadesimple.org/projects/tellafriend
Ronny
EDIT:
this post might give it faster.
http://forum.cmsmadesimple.org/index.ph ... l#msg47062
-
- Forum Members
- Posts: 57
- Joined: Sun Mar 25, 2007 7:42 am
Re: Current Page Path
Hey Ronny;
Thanks, I just tried that and unfortunately it does not return the page, but only as far as the cms root
i.e. it returns: www.mysite.com/cms
what I was looking for is www.mysite.com/cms?page=home
I thought there may be a pre-defined tag, but obviously not ?!
Thanks, I just tried that and unfortunately it does not return the page, but only as far as the cms root
i.e. it returns: www.mysite.com/cms
what I was looking for is www.mysite.com/cms?page=home
I thought there may be a pre-defined tag, but obviously not ?!
Re: Current Page Path
A little bit ugly, but it workscrankshaft wrote: What I need is Bookmark 1
Code: Select all
<a href="{root_url}/cms{$SCRIPT_NAME}?page={$page_alias}#bkmark1">Bookmark 1</a>
-
- Forum Members
- Posts: 57
- Joined: Sun Mar 25, 2007 7:42 am
Re: Current Page Path ::: SOLVED :::
Hi;
Thanks, but I have a solution:
create a UDT names getpageurl and add the following:
echo $_SERVER["PHP_SELF"] . ($_SERVER["QUERY_STRING"] != '' ? '?' .
$_SERVER["QUERY_STRING"] : '');
add the tag in your page:
this page
And that's it !!
Thanks, but I have a solution:
create a UDT names getpageurl and add the following:
echo $_SERVER["PHP_SELF"] . ($_SERVER["QUERY_STRING"] != '' ? '?' .
$_SERVER["QUERY_STRING"] : '');
add the tag in your page:
this page
And that's it !!
Re: Current Page Path
i chopped up some code from somewhere else awhile ago and came up with {whatsthispage}
$pageURL = "http";
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= "www.".$_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL .= "www.".$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
echo $pageURL;
return;
(edit or remove "www.". as needed. did it this way to force "www." on the output even if a page is requested without it)
$pageURL = "http";
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= "www.".$_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL .= "www.".$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
echo $pageURL;
return;
(edit or remove "www.". as needed. did it this way to force "www." on the output even if a page is requested without it)
Last edited by kermit on Tue Mar 27, 2007 12:11 pm, edited 1 time in total.
eternity (n); 1. infinite time, 2. a seemingly long or endless time, 3. the length of time it takes a frozen pizza to cook when you're starving.
4,930,000,000 (n); 1. a very large number, 2. the approximate world population in 1986 when Microsoft Corp issued its IPO. 3. Microsoft's net profit (USD) for the quarter (3 months) ending 31 March 2007.
CMSMS migration and setup services | Hosting with CMSMS installed and ready to go | PM me for Info
4,930,000,000 (n); 1. a very large number, 2. the approximate world population in 1986 when Microsoft Corp issued its IPO. 3. Microsoft's net profit (USD) for the quarter (3 months) ending 31 March 2007.
CMSMS migration and setup services | Hosting with CMSMS installed and ready to go | PM me for Info
-
- Forum Members
- Posts: 57
- Joined: Sun Mar 25, 2007 7:42 am
Re: Current Page Path ::: SOLVED :::
Thanx Kermit, but I solved it with this:
echo $_SERVER["PHP_SELF"] . ($_SERVER["QUERY_STRING"] != '' ? '?' .
$_SERVER["QUERY_STRING"] : '');
Cheers
echo $_SERVER["PHP_SELF"] . ($_SERVER["QUERY_STRING"] != '' ? '?' .
$_SERVER["QUERY_STRING"] : '');
Cheers
Re: Current Page Path ::: SOLVED :::
REQUEST_URI would do the trick as well, as it is relative to the current root-path.
Ronny
Ronny