Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • aaronb 97 posts 116 karma points
    Apr 28, 2011 @ 17:00
    aaronb
    0

    Serve the same content but with different stylesheets to different urls?

    I've read up a bit on managing hostnames, and it kind of sounds like what I need to do but in reverse.

    I have one site (repository of support documents) but I need to have two different stylesheets, one themed for company A, one for company B. I want to avoid having two copies of everything to make maintenance easier.

    When you access companyA.supportsite.com I need it to show the content using their stylesheet, and when you access companyB.supportsite.com I need it to use the other stylesheet.

    This will have a search and users will be going up and down the content tree to find what they need.

    Is this possible to do, and if so please could anyone suggest what I should be looking into? I assume it's going to take a combination of server settings/redirects and umbraco.

  • Pasang Tamang 258 posts 458 karma points
    Apr 28, 2011 @ 17:27
    Pasang Tamang
    0

    Hi

    You can get the current hostname from umbraco.library:RequestServerVariables('HTTP_HOST'). So here is my suggestion

     

     

    <xsl:variable name="url" select="umbraco.library:RequestServerVariables('HTTP_HOST')"/>
    <xsl:choose>
    <xsl:when test="$url='your url'">
    <link href="/css/StyleA.css" rel="stylesheet" type="text/css" />
    </xsl:when>
    <xsl:otherwise>
    <link href="/css/StyleB.css" rel="stylesheet" type="text/css" />
    </xsl:otherwise>
    </xsl:choose>

     

    Create a macro which calls above xslt and use that macro within the head tag of your template.

    Thanks

    Pnima

     

  • aaronb 97 posts 116 karma points
    Apr 28, 2011 @ 17:48
    aaronb
    0

    Very nice, I'll give it a try. Thanks very much Pnima!

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies