Jump to:

5450 Posts in 1672 Topics by 1197 members

Customising the CMS

SilverStripe Forums » Customising the CMS » Best way to set config variables

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

Page: 1
Go to End
Author Topic: 1168 Views
  • pingu
    Avatar
    Community Member
    75 Posts

    Best way to set config variables Link to this post

    What's the best way to set variables in your config file that can be used throughout your app?

    Currently I'm using a series of define statements:
    define('CUSTOMERGROUP',8);
    ...

    Is there a better way, or what other practices do you guys recommend?

  • Willr
    Avatar
    Forum Moderator
    5462 Posts

    Re: Best way to set config variables Link to this post

    Are these values going to be editable by the user at any point? If they are then SiteConfig is a good place to add then. For code (devs only) I do as like you with define() statements.

  • pingu
    Avatar
    Community Member
    75 Posts

    Re: Best way to set config variables Link to this post

    Thanks Willr - these are dev variables only to be used throughout the code in multiple places, and often differ in production and live enviornments.

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