Search code examples
phpurljoomlajoomla-template

Changinging Joomla template according to the url open in the browser, how?


I am asking if is it possible do the following thing using Joomla

I have 2 different URL, something like: www.stupidname.com and www.seriousname.com

If the user open stupidname.com by his browser will open the website having a stupid template If the user open seriusname.com by his browser will open the website having a serious template

The website and the content are the same...should only change the template according to the url open in the browser

Do you have some ideas about how to do this thing?

Thanks Andrea


Solution

  • I've done this before making elements of a template conditional based on the domain name, and that can work well. I suppose you could extend the same logic to change the template.

    Perhaps you could add a conditional to both template's index.php to change the template. Perhaps something like...

    if ( substr_count( $_SERVER['HTTP_HOST'], "silly") ) {
       $GLOBALS["mainframe"]->setTemplate = "silly_template_name";
    } else {
       $GLOBALS["mainframe"]->setTemplate = "serious_template_name";
    }
    

    ...I've not tested this, but I think in principle it should work fine, though it might depend on which Joomla version you have.

    There are, as saji89 pointed out, plenty of good multi-site extensions and that'd be an ok solution too.