We've been working with developing sub navigation in an admin template and we decided to use an include as the single file to keep all the navigation links and then use some conditional logic to display the appropriate code.
We needed something to trigger the right navigation to display, we decided to use the last folder name as the determining factor. The ColdFusion function getBaseTemplatePath() gives us the complete disk path...
DISK PATH
C:\\Inetpub\wwwroot\SiteFolder\someAdminFolder\someFolder\page.cfm
URL Path
http://domain.com/someAdminFolder/someFolder/page.cfm
We want to test the value of "someFolder" therefore, we need use the value of the last folder in the file path. For this example, we will use the ListLen() function to help us.
(ListLen(getBaseTemplatePath(),'')-1)
ListGetAt(getBaseTemplatePath(),(ListLen(getBaseTemplatePath(),'')-1),'')
using the slash as the delimiter and then subtracting one to get the current folder we are in... Next, we will use the ListGetAt function to give us the value of that position. Now we can construct a condition. We are going to set the current folder value to a local variable and add the conditions and we now show content based on the current folder.
<cfset local.currentfolder="ListGetAt(getBaseTemplatePath(),(ListLen(getBaseTemplatePath(),'')-1),'')">
<ul class="nav nav-tabs">
<cfif "someFolder" EQ LOCAL.currentFolder>
<li><a href="page.cfm">Do Something</a></li>
<cfif "otherfolder" EQ local.currentfolder>
<li><a href="page2.cfm">Do Something Else</li>
</cfif>
</ul>