Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

All other Modules

Discuss all other Modules here.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

problem with sharethis module


Go to End
Reply

10 Posts   3154 Views

Avatar
danzzz

28 February 2009 at 3:56am (Last edited: 28 February 2009 3:59am), Community Member, 175 Posts

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

Avatar
danzzz

28 February 2009 at 4:44am Community Member, 175 Posts

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

Avatar
Jedateach

11 March 2009 at 7:00pm Forum Moderator, 227 Posts

Controller::curr()->URLSegment will do the same job.

Avatar
cnyaviary

17 March 2009 at 10:49am Community Member, 12 Posts

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

Avatar
cnyaviary

17 March 2009 at 10:51am (Last edited: 17 March 2009 2:03pm), Community Member, 12 Posts

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

Avatar
bunheng

20 October 2010 at 9:05pm Community Member, 78 Posts

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.

Avatar
Invader_Zim

31 October 2010 at 3:43am (Last edited: 31 October 2010 3:48am), Community Member, 141 Posts

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

Avatar
Willr

31 October 2010 at 12:41pm Forum Moderator, 5511 Posts

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();

Go to Top