How to get domain from config.php

I added this entry on the config file.
$Configuration['Garden']['Domain'] = 'http://localhost/mysite/';
How can I call it? Thanks
0
I added this entry on the config file.
$Configuration['Garden']['Domain'] = 'http://localhost/mysite/';
How can I call it? Thanks
Comments
Welcome to the community!
What version of Vanilla are you running?
You can access configurations in a plugin by using the
C()
method, e.g.C('Garden.Domain')
will return 'http://localhost/mysite/'.Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
If you want to bypass
config.php
you can use a nifty method of theGdn_Request
class calledDomain()
. It would look like this:Kasper Kronborg Isager (kasperisager) | Freelance Developer @Vanilla | Hit me up: Google Mail or Vanilla Mail | Find me on GitHub
@kasperisager method is more reliable
grep is your friend.
Thanks for the response. I tried kasperisager method but it only returns localhost. hgtonight's solution work tho. Thank you so much sir.