We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 26951
    • 41 Posts
    shaundiamonds Reply #1, 16 years ago
    Hi,

    Does anyone know how to extract the domain name from the config files?

    So from domain http://abc.com - I just want abc

    I can’t seem to do this from the config files below - I could hack around in php and write something to break up the string etc, but just wondering if there was a quicker way?

    Thanks

    MODx configuration

    $site_name=$modx->config[’site_name’];
    $site_url=$modx->config[’site_url’];
    $site_start=$modx->config[’site_start’];
    $error_page=$modx->config[’error_page’];
    $base_path=$modx->config[’base_path’];
    $base_url=$modx->config[’base_url’];
    $rb_base_dir=$modx->config[’rb_base_dir’];
    $rb_base_url=$modx->config[’rb_base_url’];
    $modx_charset=$modx->config[’modx_charset’];
      • 22303 MODX Staff
      • 10,725 Posts
      Please at least provide a version of MODx which you are referring to...
        • 26951
        • 41 Posts
        shaundiamonds Reply #3, 16 years ago
        Nice one. I am hereby referring to the great MODx Evolution 1.0.4.
          • 22303 MODX Staff
          • 10,725 Posts
          Not really anything in the config. Your best bet is to simply look at $_SERVER[’HTTP_HOST’] and remove the .tld portion yourself.