I want to set a variable in my XSLT file based upon which server the code is running on. Is there a way to look at and get the last three characters or the domain name? For example in psuedo code:
If server is www.abc.com then variable equals "com", else if server is www.abc.stg then variable equals "stg", else if server is www.abc.dev then variable equals "dev".
I did same job for business company websites. I can't release code. But I will give some hints that may help you.
I did for global footer, Global footer link should generate dynamically. for example. www.abc.dev, www.abc.staging or www.abc.production
.. I add custom attributes and value in web.config file.
<custom value ="dev" />web.config for development server
<custom value="staging" /> web.config for Staging server
In my content page. i just save "abc" without "www" and ".com" or other extensions.
I use c# to read custom value from web.config and append on the fly.
example :
Public string GetUrl( string shortName)
{
string environment = " this value should be read from web.config file."; // in my case i will read from <custom value="staging" /> so value will be staging
Jeevan, I see where you are going with this as it is similar to one of the packages. However, I went with a variation of Jan's idea which seems to work just fine (using in my main menu).
Get URL extension in XSLT
I want to set a variable in my XSLT file based upon which server the code is running on. Is there a way to look at and get the last three characters or the domain name? For example in psuedo code:
If server is www.abc.com then variable equals "com", else if server is www.abc.stg then variable equals "stg", else if server is www.abc.dev then variable equals "dev".
Hi Connie
Is this what you're after?
<xsl:variable name="url" select="substring-after(umbraco.library:RequestServerVariables('URL),'.')"/>
<xsl:variable name="domain" select="substring-after($url,'.')" />
<xsl:value-of select="$domain" />
/Jan
HI, connie Decinko.
I did same job for business company websites. I can't release code. But I will give some hints that may help you.
I did for global footer, Global footer link should generate dynamically. for example. www.abc.dev, www.abc.staging or www.abc.production
.. I add custom attributes and value in web.config file.
<custom value ="dev" />web.config for development server
<custom value="staging" /> web.config for Staging server
In my content page. i just save "abc" without "www" and ".com" or other extensions.
I use c# to read custom value from web.config and append on the fly.
example :
Public string GetUrl( string shortName)
{
string environment = " this value should be read from web.config file."; // in my case i will read from <custom value="staging" /> so value will be staging
return "http://www" + shortName + "envoronment ";
}
.......... hope it will help you
Jeevan, I see where you are going with this as it is similar to one of the packages. However, I went with a variation of Jan's idea which seems to work just fine (using in my main menu).
is working on a reply...