Jump to:

23478 Posts in 18950 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » Director::BaseURL() in Template?

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1
Go to End
Author Topic: 7328 Views
  • Mo
    Avatar
    Community Member
    508 Posts

    Director::BaseURL() in Template? Link to this post

    Hey all,

    Anyone know id there is a template tag to retrieve Director::BaseURL() from a template? I can create a method like:

    public function getBaseUrl() {
    return Director::BaseURL();
    }

    But I was wondering if maybe there is something I can already use and not create duplicate code?

    Cheers,

    Mo

  • Mo
    Avatar
    Community Member
    508 Posts

    Re: Director::BaseURL() in Template? Link to this post

    Never mind, I found it: $BaseHref

  • house98
    Avatar
    Community Member
    31 Posts

    Re: Director::BaseURL() in Template? Link to this post

    Just an addition... if you're wanting to get the page's full URL inside a template for something like a Digg link.. you can do the following

    {$BaseHref}{$Top.URLSegment}

    Hope this helps others.

    [[Edited by Admin]]

    7328 Views
Page: 1
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.