AddConfigurationSetting

y2kbgy2kbg New
edited January 2007 in Vanilla 1.0 Help
Isnt there any documentation explaining this:
AddConfigurationSetting
how to save and get them?
maybe someone add it to the how to make extensions cause i want a straightforward, and proper, way to use this.

Comments

  • I'd be interested in a little tutorial on this...
  • Max_BMax_B New
    edited January 2007
    The code is pretty clear, this is a standard way to add a setting to the settings file, avoiding to mess it. Or did I misunderstood you question?function AddConfigurationSetting(&$Context, $SettingName, $SettingValue = '1') { $Context->Configuration[$SettingName] = ''; $SettingsManager = $Context->ObjectFactory->NewContextObject($Context, 'ConfigurationManager'); $SettingsFile = $Context->Configuration['APPLICATION_PATH'].'conf/settings.php'; $SettingsManager->DefineSetting($SettingName, $SettingValue, 1); $SettingsManager->SaveSettingsToFile($SettingsFile); }
  • y2kbgy2kbg New
    edited January 2007
    ok thanks that is exactly what i wanted.

    It will be a while before this is added to Friends 1.0 extension because i am trying to install a 500GB SATA...Windows hates my drive, it hates me... :-( I am now on a computer that has none of correct codeing tools nor and files that I had modded but not uploaded.
  • wait! is this an existing function that i can just use or do I add this function to my extension as well?
  • Its an existing function. Look through library/Framework/Framework.Functions.php and library/Vanilla/Vanilla.Functions.php for more useful functions.
  • ohh ok thanks!\
  • y2kbgy2kbg New
    edited January 2007
    well that works and i have an if statement to initialize the the intial values but how should i go about making the stored value make it checked or not. Also my submit mit button does absolutely nothing.

    *deleted old code* it was wasting space!
  • y2kbgy2kbg New
    edited January 2007
    hmm i got it displaying checked boxes correctly according to the default i intialized bt i cant get the submit button to do anything.
    *deleted more code as i was not using it anymore*
  • y2kbgy2kbg New
    edited January 2007
    well i guess i am changing courses with my settings tab, using announcements as base for it , as it seems that it is code better.
    Edit: ok now i got it working, saving the settings. The Friends extension update should be ready in a few hours. hopefully..
This discussion has been closed.