|
|
Rank: Newbie
Joined: 6/1/2009 Posts: 13
|
@nodeType gets me the ID @nodeTypeAlias the machine readable text
I would like the human readable "node type name". Anyone know how I get it?
Thanks in advance!
|
|
 Rank: Aficionado
Joined: 7/28/2008 Posts: 159 Location: Edinburgh
|
|
|
 Rank: Aficionado
Joined: 7/28/2008 Posts: 159 Location: Edinburgh
|
ahh, misread that won't work for this , not sure about that one tbh! Gecko New Media - twitter.com/allbutlost
|
|
 Rank: Enthusiast
Joined: 11/6/2008 Posts: 25 Location: Melbourne, Australia
|
As far as I'm aware the name of the DocType isn't stored in the XML cache. The only way you could do it would be to write a .NET XSLT extension to call out to from your XSLT file
The LINQ to Umbraco guy
|
|
 Rank: Addict
Joined: 10/9/2006 Posts: 534 Location: batavia, IL
|
|
|
 Rank: Addict
Joined: 7/19/2006 Posts: 634 Location: Bad Homburg, Germany
|
Something like that: Code:public static string GetDocTypeName(string alias) { return umbraco.cms.businesslogic.web.DocumentType.GetByAlias(alias).Text; }
• 2007/2008 MVP • www.thoehler.com • blog.thoehler.com • Bad Homburg, Germany
|
|
Rank: Newbie
Joined: 6/1/2009 Posts: 13
|
The site has a news section with different types of article inside. The styling for the index has the format:
Article type - Article title
I wanted to use the node type alias to hold the text for the "Article type" part.
Thanks for the responses. I'll try writing the .net XSLT extension.
|
|
Rank: Newbie
Joined: 6/1/2009 Posts: 13
|
hoehler wrote:Something like that: Code:public static string GetDocTypeName(string alias) { return umbraco.cms.businesslogic.web.DocumentType.GetByAlias(alias).Text; }
What's the correct way to add this? Can I add it inline into a macro? I've tried doing this: Code: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE xsl:Stylesheet [ <!ENTITY nbsp " "> ]> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxml="urn:schemas-microsoft-com:xslt" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:umbraco.library="urn:umbraco.library" xmlns:mycustomprefix="urn:mycustomprefix" exclude-result-prefixes="msxml umbraco.library mycustomprefix msxsl">
<xsl:output method="xml" omit-xml-declaration="yes"/>
<msxsl:script language="CSharp" implements-prefix="mycustomprefix"> <![CDATA[ public static string GetDocTypeName(string alias) { return umbraco.cms.businesslogic.web.DocumentType.GetByAlias(alias).Text; } ]]> </msxsl:script>
<xsl:param name="currentPage"/>
<xsl:variable name="aliasToTest" select="mycustomprefix: GetDocTypeName('casestudy')"/> <xsl:template match="/"> <!-- start writing XSLT --> <xsl:value-of select="$aliasToTest"/> </xsl:template> </xsl:stylesheet>
Which doesn't work at all. Am I just missing namespacing or is it just not possible to write something like this inline? (Clearly I am very new to xslt so please excuse my ignorance)
|
|
Rank: Newbie
Joined: 6/1/2009 Posts: 13
|
Ok got it working. Gave up on doing it inline and just wrote an extension using this tutorial xslt extension tut the reference you need is cms.dll not umbraco.cms.dll. If anyone knows it is possible to get the inline version working I'd still love to know how to do it.
|
|
Rank: Newbie
Joined: 7/28/2009 Posts: 5
|
So interesting. I like it personally and hope you'll bring us more amazing stuffs. just a point of curiosity, what would you need the human readable nodeType name for? South Park 1 dvd Cold Case dvd P90X dvd New Adventures Of Superman dvd MASH dvd
|
|
The forum has moved
This forum is no longer in use, so you can't reply to this message - please go to Our Umbraco
|
|
Guest |