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
Matt
Great, thanks
or something like this:
<?php $URL = BASE_URL. $this->url($this->getCollectionObject()->cPath); ?>
<a href= "http://facebook.com/share/<? echo $URL; ?></a>
I dont get that code, how do you point it at a certain page?
what do you mean?
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.
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.
yea use the on i just selected as answer, the code tags are adding some stuff idk why
I get it, thats fine, thanks
why is the url wrapped in two href tags (<a href= "<a href="http://faceb..) does it work like that?
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>
<?php $URL = BASE_URL. $this->url($this->getCollectionObject()->cPath); ?>
<a href= "http://facebook.com/share/<? echo $URL; ?></a>
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