There aren't any helper methods out-of-the-box that will get you the data-type's name. To be honest, since data-types are intended to be reusable across doc-types, it is unusual to want to display their name on the front-end of a website.
Regardless, we are here to help! :-)
If you install the uComponents package there is a helpful XSLT extension called: "ucomponents.cms:GetDataTypeById" which you can pass in the data-type Id and get back XML about it.
Thanks a lot! Just looked at the website, and there seems a lot of useful methods etc in there. Didn't even know it existed, only started with Umbraco last week!
You're welcome... there are a lot of goodies in uComponents - it is all community contributed code. We are planning to get some of the good stuff into Umbraco itself!
Display Data Type name as heading
Hi,
I am looking for a way to display the data type name as a heading.
<xsl:variable name="dataTypeId" select="/macro/dataTypeId"/>
<xsl:variable name="dataType" select="umbraco.library:GetPreValues($dataTypeId)"/>
<h3>####Data Type name here###</h3>
<ul>
<xsl:for-each select="$dataType//preValue">
<li>
<a>
<xsl:value-of select="current()"/>
</a>
</li>
</xsl:for-each>
</ul>
You can see from the code above I have some XSLT that displays a set of clickable links from a custom datatype checkbox.
The data type ID is passed in by a macro parameter. This in turn is then used to get the data type prevalue.
I can get the prevalues to display fine, but I'm a bit stuck as I want to display the data type name in the h3 tags.
Any help would be greatly appreciated!
Many Thanks!
Hi James, welcome to Our Umbraco!
There aren't any helper methods out-of-the-box that will get you the data-type's name. To be honest, since data-types are intended to be reusable across doc-types, it is unusual to want to display their name on the front-end of a website.
Regardless, we are here to help! :-)
If you install the uComponents package there is a helpful XSLT extension called: "ucomponents.cms:GetDataTypeById" which you can pass in the data-type Id and get back XML about it.
More documentation about the uComponents XsltExtensions can be found here: http://ucomponents.codeplex.com/wikipage?title=CMS&referringTitle=Documentation
Cheers, Lee.
Hey Lee,
Thanks a lot! Just looked at the website, and there seems a lot of useful methods etc in there. Didn't even know it existed, only started with Umbraco last week!
Thanks again,
James
Hi James,
You're welcome... there are a lot of goodies in uComponents - it is all community contributed code. We are planning to get some of the good stuff into Umbraco itself!
In the meantime, any questions, just ask!
Cheers, Lee.
is working on a reply...