10387 Posts in 2198 Topics by 1712 members
| Go to End | Next > | |
| Author | Topic: | 2697 Views |
-
problem with sharethis module

28 February 2009 at 3:56am Last edited: 28 February 2009 3:59am
hi there,
i just installed the sharethis module [v0.1]. installing went good, i did all steps from the README file.
i also have the sharethis checkbox on my pages in the backend. if i put the $ShareThis variable into my template and load the page
i get this error:Fatal error: Call to undefined method Director::currenturlsegment() in /var/www/xxx/sharethis/code/ShareIcons.php on line 97
my ss version = SilverStripe 2.3.0
bye,
daniel -
Re: problem with sharethis module

28 February 2009 at 4:44am
hi again,
i think i found a solution, more a temp. solution for me until i dont know why this was ...
i added the missing method to Director.php:
static function currentURLSegment() {
return self::$urlSegment;
}does anybody know anything more about it?
bye,
daniel -
Re: problem with sharethis module

11 March 2009 at 7:00pm
Controller::curr()->URLSegment will do the same job.
-
Re: problem with sharethis module

17 March 2009 at 10:49am
I tried this and this is what I am seeing
$page_url = Director::absoluteBaseURL() . Controller::curr()->Link();
My site is locate at http://localhost/SilverStripe/ and if the page is about-us then the $page_url is showing up as
http://localhost/SilverStripe//SilverStripe/about-us/
I am assuming Director::absoluteBaseURL() is http://localhost/SilverStripe/
and Controller::curr()->Link() is /SilverStripe/about-us/This is not obviously correct, is it something simple that I am missing?
Any help would be appreciated.
George
-
Re: problem with sharethis module

17 March 2009 at 10:51am Last edited: 17 March 2009 2:03pm
Please do not mind my above post....
I correctly put the code as
$page_url = Director::absoluteBaseURL() . Controller::curr()->URLSegment;
And it worked as it should....
Guess I am tired at the end of the day here.... Sorry Guys.
George
-
Re: problem with sharethis module

20 October 2010 at 9:05pm
Hi,
I having problem with sharethis module on URL. My local testing url is http://localhost/study, while I completed installation of sharethis, I saw the url set to http://localhost//study/content/ could anyone solve me this problem.
Thanks.
-
Re: problem with sharethis module

31 October 2010 at 3:43am Last edited: 31 October 2010 3:48am
Hi bunheng,
go to sharethis/code/ShareIcons.php and change line 111 from this:
$page_url = Director::absoluteBaseURL() . Controller::curr()->Link();
to this:$page_url = Director::absoluteBaseURL() . Controller::curr()->URLSegment;
(i assume you are using sharethis-trunk-r81298 build)Btw, i made a patch for this. But i can't find the module in the bug-tracker and i am a little bit unsecure where to post it
Any help would be appreciated.Cheers,
Christian -
Re: problem with sharethis module

31 October 2010 at 12:41pm
You should actually be using Link() because URLSegment will only return the last chunk of the url i.e blog/foo URLSegment on foo will return foo, where as link will return the full blog/foo link.
Haven't tested this myself but considering ShareThis is a decorator on SiteTree you could try having something like
$page_url = $this->owner->Link();
Or if you need absolute
$page_url = $this->owner->AbsoluteLink();
| 2697 Views | ||
| Go to Top | Next > |





