Jump to:

1347 Posts in 439 Topics by 514 members

Themes

SilverStripe Forums » Themes » RightBar sontrolled by subdomains

Discuss SilverStripe Themes.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 604 Views
  • t00thy
    Avatar
    Community Member
    31 Posts

    RightBar sontrolled by subdomains Link to this post

    Hi
    i have this problem. I have website zetorbar.cz with two subdomains: brandys.zetorbar.cz and liberec.zetorbar.cz.
    I have different layout.css files for the subdomains and main domain. What I need is put different content in RightBar directly to subdomain.
    I have this code in HomePage.php:

    function PostersRight($num=5) {
       
          if ($_SERVER['HTTP_HOST']=="www.zetorbar.cz" || $_SERVER['HTTP_HOST']=="www.zetorbar.cz" )
             {
             $news = DataObject::get_one("ZetorPostersHolder");
             }
          elseif ($_SERVER['HTTP_HOST']=="liberec.zetorbar.cz" || $_SERVER['HTTP_HOST']=="liberec.zetorbar.cz" )
             {
             $news = DataObject::get_one("LiberecPostersHolder");
             }
          elseif ($_SERVER['HTTP_HOST']=="brandys.zetorbar.cz" || $_SERVER['HTTP_HOST']=="brandys.zetorbar.cz" )
             {
             $news = DataObject::get_one("BrandysPostersHolder");
             }
          else
             {
             $news = DataObject::get_one("ZetorPostersHolder");
             }

          return ($news) ? DataObject::get("Plakat", "ParentID = $news->ID", "", "", "") : false;
       }

    It says, that when I open:
    liberec.zetorbar.cz, i get LiberecPostersHolder on the RightBar. And its OK

    but when I open:
    brandys.zetorbar.cz i get ZetorPostersHolder, or
    www.zetorbar.cz i get BrandysPostersHolder

    In the CMS I have three HomePages. One for www.zetorbar.cz and zetorbar.cz, second for brandys.zetorbar.cz and third for liberec.zetorbar.cz

    I use SS 2.4.5

  • zenmonkey
    Avatar
    Community Member
    524 Posts

    Re: RightBar sontrolled by subdomains Link to this post

    Are you using the subsites module? http://silverstripe.org/subsites-module/

    It actually provides methods for detecting which sub-site you're on

    604 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.