Current URL echo?

Permalink 1 user found helpful
I am making a template, and it will have a few social bookmarking buttons in it, how would I put the current URL into the bookmark link (string) (something like: <a href= "http://facebook.com/share/<?php echo $currentUrl ; ?>>) (probably totally wrong) thanks

Matt

MattGreyDesign
 
Mnkras replied on at Permalink Reply
Mnkras
<?=$this->url('')?>

that is the current url, so if your site is site.com

and you want the url to go to site.com/sitemap

you put it like this: <?=$this->url('/sitemap')?>

not sure if thats what you want
MattGreyDesign replied on at Permalink Reply
MattGreyDesign
Great, thanks
Mnkras replied on at Permalink Reply
Mnkras
or something like this:

<?php $URL = BASE_URL. $this->url($this->getCollectionObject()->cPath); ?>


<a href= "http://facebook.com/share/<? echo $URL; ?></a>
MattGreyDesign replied on at Permalink Reply
MattGreyDesign
I dont get that code, how do you point it at a certain page?
Mnkras replied on at Permalink Reply
Mnkras
what do you mean?
JimboJetset replied on at Permalink Reply
JimboJetset
That code will create a URL to whichever page the code is on...

The first code Mnkras gave you can be made to point at any page in your site from any other...

so.. if you wanted to create a list of links from one page to multiple other pages in your site then the first code will do... however if you simply want to create a link-back to the current page then the second code would be preferable.

Therefore for your purposes the second code snippet would be better.
Mnkras replied on at Permalink Reply
Mnkras
yea use the on i just selected as answer, the code tags are adding some stuff idk why
MattGreyDesign replied on at Permalink Reply
MattGreyDesign
I get it, thats fine, thanks
MattGreyDesign replied on at Permalink Reply
MattGreyDesign
why is the url wrapped in two href tags (<a href= "<a href="http://faceb..) does it work like that?
Mnkras replied on at Permalink Best Answer Reply
Mnkras
because the syntax highlighter is retarded :P here ya go

<?php $URL = BASE_URL. $this->url($this->getCollectionObject()->cPath); ?>

<a href= "http://facebook.com/share/<? echo $URL; ?></a>