Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

I'm not sure where to put a general purpose function.

edited October 2010 in Vanilla 2.0 - 2.8
In my website I need to have access to an ID number associated with the sub domain that the site is being accessed with. I have a MySQL table that holds a list of sub domains and their IDs. The function's logic is a simple MySQL query to find the appropriate ID, given the current sub domain in use. This function needs to be accessible to all parts of the Vanilla 2 application as well as any applications or plugins.

As for my question: given the explanation of my function, what would be the most appropriate class to add this in?

Thanks for your time.
Tagged:

Comments

  • Options
    Wouldn't it be easier to store this in the PHP, as a configuration parameter? Try looking at conf/config.php which contains the global variables of the forum.

    /cd
  • Options
    LincLinc Detroit Admin
    @CurtisB You should be able to just create a plugin and paste the function into it. As long as the plugin is enabled, everything else in the system will have access to it.

    Don't add it to a core file or you'll make upgrades painful.
  • Options
    LincLinc Detroit Admin
    edited October 2010
    <?php $PluginInfo['MyAwesome'] = array( 'Description' => 'Does awesome.', 'Version' => '1.0', 'Author' => "You" ); function myAwesomeFunction() { // does the stuff you mentioned }
    Paste into default.php in /plugins/MyAwesome and then enable in Dashboard.
Sign In or Register to comment.