Our Forum has Moved

This site is our old forum and is only here for achive until we get proper 301 redirects setup to make Google happy.

Please use our new community site - Our Umbraco - which contains an improved forum, documentation wiki, package repository and a member locator.

Go to Our Umbraco now

Learn everything about Umbraco
nodetypeName?! Options
devore_uk
Posted: Wednesday, June 03, 2009 7:06:30 PM
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!
ddrayne
Posted: Wednesday, June 03, 2009 7:14:05 PM

Rank: Aficionado

Joined: 7/28/2008
Posts: 159
Location: Edinburgh
ddrayne
Posted: Wednesday, June 03, 2009 7:15:18 PM

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
slace
Posted: Thursday, June 04, 2009 1:57:01 AM

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
bootnumlock
Posted: Thursday, June 04, 2009 5:21:15 AM

Rank: Addict

Joined: 10/9/2006
Posts: 534
Location: batavia, IL
just a point of curiosity, what would you need the human readable nodeType name for?

bootnumlock - aka bob baty-barr
http://packages.maliciousthinktank.com


Level 1 Certified!
hoehler
Posted: Thursday, June 04, 2009 9:40:54 AM

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.comblog.thoehler.com • Bad Homburg, Germany
devore_uk
Posted: Thursday, June 04, 2009 11:26:55 AM
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.
devore_uk
Posted: Thursday, June 04, 2009 11:59:39 AM
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 "&#x00A0;"> ]>
<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)

devore_uk
Posted: Thursday, June 04, 2009 12:38:30 PM
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.


Johnbear
Posted: Tuesday, July 28, 2009 8:39:48 AM
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

Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.