Resurrecting this one for Umbraco 7.15 at least (yep I know U8 and U9 are out), and maybe U8 will work too. The "IsDocumentType()" method worked nicely for me.
if(childPage.IsDocumentType("doctype-1") ) {
//Do something here
}else if(childPage.IsDocumentType("doctype-1") ) {
//Do something here
}else{//blah}
Multi If Statement for Document Type Alias
Hi,
Im trying apply a navigation structure depending on the document type alias used.
Im checking if the pages have any children, and then the doc type alias.
Im running in to problems with duplicate nodes.
Any help would be grateful.
Martin
Hi Martin,
Could you try this code and see if it works like you wanted it to work.
Hope this helps,
/Dennis
Reformating your code for readability, you're probably getting the duplicates due to the 2 if statements
Now consider your doctype is DocType-1. That would satisfy TURE for the first IF
and also be rendered in the ELSE
Hence the double result.
Changing you're whole code block to this should fix things.
Also, the last else {} probably isn't needed. What would that render?
Thanks Ajay.
Resurrecting this one for Umbraco 7.15 at least (yep I know U8 and U9 are out), and maybe U8 will work too. The "IsDocumentType()" method worked nicely for me.
is working on a reply...