Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
635 views
in Q2A Core by
edited by

Hack of file qa-base.php: 

    function qa_opt($name, $value=null)
/*
    Shortcut to get or set an option value without specifying database
*/
    {
        // *** q2apro hack for LANG switcher by subdomain, e.g. en.yourdomain.com
        $domainparts = explode(".", $_SERVER['HTTP_HOST']);
        $subdomain = array_shift($domainparts);
        if($subdomain=='en' && empty($value))
        {
            if($name=='site_language')
            {
                return 'en';
            }            
        }

        
        global $qa_options_cache;

        if ((!isset($value)) && isset($qa_options_cache[$name]))
            return $qa_options_cache[$name]; // quick shortcut to reduce calls to qa_get_options()

        require_once QA_INCLUDE_DIR.'app/options.php';

        if (isset($value))
            qa_set_option($name, $value);

        $options=qa_get_options(array($name));

        return $options[$name];
    }

Q2A version: 1.7+

1 Answer

0 votes
by
this is for language change by users? ..where can add this code ?
...