Include Config file ? beginner questions

Discussion in 'Customization & add-ons' started by dazzafact, May 28, 2015.

  1. dazzafact

    dazzafact New Member

    Joined:
    May 19, 2015
    Messages:
    14
    Hello,
    two questions for a Beginner:
    -How can i read files from configs/file.php in my class?
    -how i can add parameters in Backend->admin-setup to read them in my Class
  2. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    The best way is to create a plugin.
    From plugin file you can add tab to aMember CP -> Setup -> Plugin name
    Also you can access all amember hooks. Please have a look:
    http://www.amember.com/docs/API/HookManager
    Here is example of plugin which adds configuration tab into amember CP.
    PHP:
    <?php
    // within file am/application/default/plugins/misc/my.php
    class Am_Plugin_My  extends Am_Plugin
    {
        protected 
    $_configPrefix 'misc.';
        function 
    _initSetupForm(Am_Form_Setup $form)
        {
            
    $form->addText('testinput')->setLabel('Test Caption');
        }
        function 
    onMyCustomEvent(Am_Event $event
        { 
            
    $event->addReturn($event->getX() + 1); 
        }
    }


Share This Page