Jump to:

10979 Posts in 2722 Topics by 1815 members

All other Modules

SilverStripe Forums » All other Modules » problem with sharethis module

Discuss all other Modules here.

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

Page: 1 2
Go to End
Author Topic: 3114 Views
  • danzzz
    Avatar
    Community Member
    175 Posts

    problem with sharethis module Link to this post

    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

  • danzzz
    Avatar
    Community Member
    175 Posts

    Re: problem with sharethis module Link to this post

    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

  • Jedateach
    Avatar
    Forum Moderator
    227 Posts

    Re: problem with sharethis module Link to this post

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

  • cnyaviary
    Avatar
    Community Member
    12 Posts

    Re: problem with sharethis module Link to this post

    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

  • cnyaviary
    Avatar
    Community Member
    12 Posts

    Re: problem with sharethis module Link to this post

    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

  • bunheng
    Avatar
    Community Member
    78 Posts

    Re: problem with sharethis module Link to this post

    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.

  • Invader_Zim
    Avatar
    Community Member
    141 Posts

    Re: problem with sharethis module Link to this post

    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

  • Willr
    Avatar
    Forum Moderator
    5497 Posts

    Re: problem with sharethis module Link to this post

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

    3114 Views
Page: 1 2
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.