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.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

All other Modules /

Discuss all other Modules here.

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

problem with sharethis module


Go to End


10 Posts   3938 Views

Avatar
danzzz

Community Member, 175 Posts

28 February 2009 at 3:56am

Edited: 28/02/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

Avatar
danzzz

Community Member, 175 Posts

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

Avatar
Jedateach

Forum Moderator, 238 Posts

11 March 2009 at 7:00pm

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

Avatar
cnyaviary

Community Member, 12 Posts

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

Avatar
cnyaviary

Community Member, 12 Posts

17 March 2009 at 10:51am

Edited: 17/03/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

Avatar
bunheng

Community Member, 78 Posts

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.

Avatar
Invader_Zim

Community Member, 141 Posts

31 October 2010 at 3:43am

Edited: 31/10/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

Avatar
Willr

Forum Moderator, 5523 Posts

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

Go to Top