Support: Get config value

Discussion in 'aMember Pro v.4' started by lee_pro, Apr 17, 2013.

  1. lee_pro

    lee_pro New Member

    Joined:
    Mar 26, 2013
    Messages:
    26
    I have write plugin: misc/myplugin/myplugin.php
    PHP:
    <?php
    class Am_Plugin_Myplugin extends Am_Plugin{
     
        const 
    PLUGIN_STATUS self::STATUS_PRODUCTION;
        const 
    PLUGIN_REVISION '0.1';
        function 
    onSetupForms(Am_Event_SetupForms $event){
            
    $form = new Am_Form_Setup('myplugin');
            
    $form->setTitle('My plugin');
     
            
    $fr $form->addFieldset()->setLabel(___('MyPlugin Setting'));
            
    $fr->addText('site_url',array('size' => 50))->setLabel(___('Site Url'));
     
            
    $form->addFieldsPrefix('misc.myplugin.');
            
    $this->_afterInitSetupForm($form);
            
    $event->addForm($form);
        }
     
        function 
    getReadme()
        {
            return <<<CUT
    Required: input url home page.
    CUT;
     
        }
    }
    After active plugin. Site URL save to successfuly.
    • I create theme as documents aMember support (Link).
    In layout.phtml of theme. I want get Site URL value of Myplugin plugin. Please advice!​

    • On file misc/myplugin/myplugin.php. I want write a function get Site URL value. Please advice!

    Thanks you support!
  2. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    use this code to get site_url value:
    PHP:
    Am_Di::getInstance()->plugins_misc->loadGet('myplugin')->getConfig('site_url');
  3. lee_pro

    lee_pro New Member

    Joined:
    Mar 26, 2013
    Messages:
    26
    Thanks you advice!

Share This Page