1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Tutorial Using Configs

Discussion in 'Resources' started by Jack Noordhuis, Apr 24, 2017.

  1. Primus

    Primus Zombie Pigman

    Messages:
    749
    It's called nested values.
    PHP:
    Config::getNested('category1.category2');
     
    PiloudeDakar likes this.
  2. TestDevelopment

    TestDevelopment Spider Jockey

    Messages:
    41
    GitHub:
    non

    Better use this:
    PHP:
    // let's imagine there's a key in the config called join_message
    // and we search for JOIN_MESSAGE
    // if we set the second parameter to false, the exists function would return false thus the code inside the if statement won't run
    if(!$config->exists("JOIN_MESSAGE")){
        
    $this->getLogger()->info("key exists"); // it won't print "key exists" on the console
    }

    // let's try setting the second parameter to true
    if($config->exists("JOIN_MESSAGE")){
        
    $this->getLogger()->info("key exists"); // it will print "key exists" on the console
    }
     
  3. mmm545

    mmm545 Baby Zombie

    Messages:
    152
    GitHub:
    mmm545
    what? i was just explaining what the second parameter does
     
    Primus likes this.
  4. Phqzing

    Phqzing Spider

    Messages:
    8
    GitHub:
    phqzing
    How can I make it so instead if manually going to the .php file I can edit it through the config.yml?
     

    Attached Files:

  5. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
    You could try reading the post you're replying to...
     
    Primus likes this.
  6. GamingFR91

    GamingFR91 Spider Jockey

    Messages:
    29
    GitHub:
    kanekilechomeur
    Anyone could explain how to register an Array in the Config for people that doesn't understand how to do it
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.