Passing #iIF across pages
Hello,
I've tried many options and searched for many solutions but I just can't seem to get this to work. It's probably something minor that I'm missing.
I have a menu that is in a cfinclude file, the menu has the following code to trigger an active state dynamically:
<a href="../index.cfm" class="#iIF( thispage IS "index.cfm", DE( "nav-item nav-link px-3 active" ), DE( "nav-item nav-link px-3" ))#">Home</a>
When I call this menu from another page with <cfinclude> it works fine using the following code at the top of the page:
<cfset variables.thispage = GetFileFromPath(GetCurrentTemplatePath())/>
The template path would be 'index.cfm' and the active state would be triggered if I am on that page.
However, I have a template page that contains the header and footer of my site named front.cfm
Within the header portion of front.cfm, I call the menu with <cfinclude>. It works fine here.
In my index page, the template is called and here is where it breaks, I keep getting the following error code:
"Variable THISPAGE is undefined"
It is defined in the index.cfm page, but coldfusion keeps looking for it in the front.cfm page, so if I change the code on my menu to "#iIF( thispage IS "front.cfm..."
and set the variables.thispage on the front.cfm page, the active state is triggered in index.cfm.
After two days of experimenting and searching, I am still not able to get the variable 'thispage' to pass to front.cfm and from there to index.cfm where it is read.
Any help will bu much appreciated.
