Jump to:

3393 Posts in 976 Topics by 852 members

Template Questions

SilverStripe Forums » Template Questions » How detect dev/live mode in template?

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

Page: 1
Go to End
Author Topic: 605 Views
  • vwd
    Avatar
    Community Member
    158 Posts

    How detect dev/live mode in template? Link to this post

    Hi,

    Is there a way to detect dev mode or live mode from within the template?

    I'm trying to disable Google Analytics (not include JS) when in dev mode. Am I correct in assuming that for this case, it is best (from MVC perspective) to do it at the controller level, not template? Eg.

    Director::isDev();
    Director::isTest();
    Director::isLive();

    Thanks.

    VWD.

  • swaiba
    Avatar
    Forum Moderator
    1769 Posts

    Re: How detect dev/live mode in template? Link to this post

    You'll just need to wrap then in a function in the controller

  • vwd
    Avatar
    Community Member
    158 Posts

    Re: How detect dev/live mode in template? Link to this post

    Of course - how simple!

    So there aren't any in-built template tags.

    Thanks Swaiba.

    605 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.