I was wondering if it is possible to filter by template name, I have done by doctype alias before but have a project coming up where this would be interesting to have.
After reading this topic, I reviewed the uComponents code for the GetTemplateAlias method (in Cms XsltExtensions) ... and found that I could improve it's performance significantly. Seems that calling "Template.GetTemplate" uses a cached object, whereas I was previously using "new Template" which hits the database directly.
Latest code changes are committed (CodePlex link) ... these will be part of the v2.2 (RTM) release.
I'm porobably way of course here, but I know you can do something like this, where you can produce results based on the TemplateNodeId (which you can see from hovering over the template and looking at the Javascript result in yout browser status bar):
So for eaxmple: the template node ID for my "News" template is "1223",
filter by template name
I was wondering if it is possible to filter by template name, I have done by doctype alias before but have a project coming up where this would be interesting to have.
Hi Graeme
In the XML we don't have access to the template name, but only the template id. Don't know if this is enough for you or you need the template name.
If you do need to grab the template name from a node you could take look at the GetTemplateById-extension in the uComponents package.
I hope this can help you a bit.
/Kim A
Important to note that (as Kim mentions) this information is not available in the XML, therefore you'll be hitting the database for every call.
Rich
After reading this topic, I reviewed the uComponents code for the GetTemplateAlias method (in Cms XsltExtensions) ... and found that I could improve it's performance significantly. Seems that calling "Template.GetTemplate" uses a cached object, whereas I was previously using "new Template" which hits the database directly.
Latest code changes are committed (CodePlex link) ... these will be part of the v2.2 (RTM) release.
Cheers, Lee.
Hi,
I'm porobably way of course here, but I know you can do something like this, where you can produce results based on the TemplateNodeId (which you can see from hovering over the template and looking at the Javascript result in yout browser status bar):
So for eaxmple: the template node ID for my "News" template is "1223",
<xsl:if test="@template = 1223">
<li>
<a href="{umbraco.library:NiceUrl(@id)}"><xsl:value-of select="newsTitle"/></a>
</li>
</xsl:if>
Sorry if this is not what you are looking for.
is working on a reply...