All the "Site" Nodes (ie, site1. site2) have their own domains ie Site1.MainDomain.Com If I type in my browser Site1.Main.Domain.Com/Contentpagename.aspx it all works , But I can't seem to get get my xslt to generate this url, instead it generates Domain/Areas/Area1/Site1/Contentpagename.aspx.
How do I get my xslt to generate the first example?
I have just tried this and instead of giving "Domain/Areas/Area1/Site1/Contentpagename.aspx" It gives "Domain/MAINSITE/Areas/Area1/Site1/Contentpagename.aspx"
Which does not work at all. Either way still not Domain/Contentpagename.aspx as I want.
<!-- Input the documenttype you want here --> <!-- Typically '1' for topnavigtaion and '2' for 2nd level --> <!-- Use div elements around this macro combined with css --> <!-- for styling the navigation --> <xsl:variable name="level" select="4"/>
-- <a href="{umbraco.library:NiceUrl(@id)}"> <xsl:if test="$currentPage/ancestor-or-self::node/@id = current()/@id"> <!-- we're under the item - you can do your own styling here --> <xsl:attribute name="style">font-weight: bold;</xsl:attribute> </xsl:if> <xsl:value-of select="@nodeName"/> </a> --
Well - as far as I can tell that should have worked - best solution I can offer is to have a custom bit of C# do it. If you don't want to make an xslt extension, then you can do it like this:
<!-- Input the documenttype you want here --> <!-- Typically '1' for topnavigtaion and '2' for 2nd level --> <!-- Use div elements around this macro combined with css --> <!-- for styling the navigation --> <xsl:variable name="level" select="4"/>
-- <a href="{script:NiceUrlDomain(@id)}"> <xsl:if test="$currentPage/ancestor-or-self::node/@id = current()/@id"> <!-- we're under the item - you can do your own styling here --> <xsl:attribute name="style">font-weight: bold;</xsl:attribute> </xsl:if> <xsl:value-of select="@nodeName"/> </a> --
Wow didn't know you could put inline code in XSLT... Have done an xslt extension, but not inline! If that actually works that gives so many possibilies! :D Keep forgetting I can use C# to do stuff if XSLT isn't doing what I want!
I will give this ago..! Thanks!
Umbraco is great, not long been using it but it's making my life so much easier!!
Ok, very cool! Inline code! Right it will work but now I need to know how to get the actual page name for the url:
string domain = System.Web.HttpContext.Current.Request.Url.Host.ToString() // returns the right bit return domain + umbraco.library.NiceUrl(nodeID); //this returns the full usl as previously
I have tried passing in @nodeName but this doesn't work because if my page is called "something and something" for the url umbraco renames this to "something-and-something.aspx" I know I can replace spaces with "-"'s but there may be other ways in which umbraco renames so it may not be fool proof. Does umbraco have a function that calls backe url page name?
Get Url with the sub domain, rather than long structured path.
Hi!
I have a site that is laid out as follows:
MainPage
-----Areas
-------Area1
-----------Site1
--------------Pages...
-----------Site2
--------------Pages...
-------Area2
-----------Site1
--------------Pages...
-----------Site2
--------------Pages...
All the "Site" Nodes (ie, site1. site2) have their own domains
ie Site1.MainDomain.Com
If I type in my browser Site1.Main.Domain.Com/Contentpagename.aspx it all works , But I can't seem to get get my xslt to generate this url, instead it generates Domain/Areas/Area1/Site1/Contentpagename.aspx.
How do I get my xslt to generate the first example?
Thanks
Becky
I'm going to have to guess here, but you probably want NiceUrlFullPath rather than NiceUrl
http://our.umbraco.org/wiki/reference/umbracolibrary/niceurlfullpath
If that's not the case, can you post your XSLT that is causing the problem
/Josh
Hi Josh
I have just tried this and instead of giving "Domain/Areas/Area1/Site1/Contentpagename.aspx" It gives "Domain/MAINSITE/Areas/Area1/Site1/Contentpagename.aspx"
Which does not work at all. Either way still not Domain/Contentpagename.aspx as I want.
My XSLT is as follows:
Any ideas?
Becky
Well - as far as I can tell that should have worked - best solution I can offer is to have a custom bit of C# do it. If you don't want to make an xslt extension, then you can do it like this:
Untested, but I reckon it might work :)
/Josh
Wow didn't know you could put inline code in XSLT... Have done an xslt extension, but not inline!
If that actually works that gives so many possibilies! :D Keep forgetting I can use C# to do stuff if XSLT isn't doing what I want!
I will give this ago..! Thanks!
Umbraco is great, not long been using it but it's making my life so much easier!!
Ok, very cool! Inline code!
Right it will work but now I need to know how to get the actual page name for the url:
string domain = System.Web.HttpContext.Current.Request.Url.Host.ToString() // returns the right bit
return domain + umbraco.library.NiceUrl(nodeID); //this returns the full usl as previously
I have tried passing in @nodeName but this doesn't work because if my page is called "something and something" for the url umbraco renames this to "something-and-something.aspx"
I know I can replace spaces with "-"'s but there may be other ways in which umbraco renames so it may not be fool proof.
Does umbraco have a function that calls backe url page name?
Bex
Incase anyone else is looking for this.. to get the page name as it would appear in the url I have used the following as found in the core code
is working on a reply...