Take the 2-minute tour ×

I was wondering if its possible to exclude data from an wraparound page footer based on which content is loaded into the index page in ColdFusion

Roughly it would be something like.

 IF (not = pageToBeExcluded)

     THEN {
     Show content

share|improve this question
What you've written would work. Did you try it? –  Matt Busche Jan 8 '13 at 17:25
Like this? <cfif neq 'URL.pageToBeExcluded.cfc'> Content..... </cfif> –  blarg Jan 8 '13 at 17:30
that's the gist of it, yes –  Matt Busche Jan 8 '13 at 17:44
The NEQ operator requires two things to compare - and is placed in the middle of the two: <cfif this NEQ that > –  Peter Boughton Jan 8 '13 at 17:50
As for identifying the page, there are various ways to do it - based on URLs (e.g. CGI.SCRIPT_NAME, CGI.PATH_INFO, etc), or for CFM/CFC templates (use getCurrentTemplatePath(), getBaseTemplatePath(), etc ), or using framework variables (e.g. rc.action, attributes.fuseaction, etc) - which one to use depends on what you're working with and precisely what you're trying to do. –  Peter Boughton Jan 8 '13 at 17:54

1 Answer 1

up vote 3 down vote accepted

There are any number of ways to do that.

The simplest is probably to key on the page address.

<cfif CGI.SCRIPT_NAME DOES NOT CONTAIN "someArbitraryPage.cfm">
  <!--- show this content --->

As mentioned, you might want to use getCurrentTemplatePath() or getBaseTemplatePath().

Personally, I would probably set a variable in the template where I want this to happen. The main benefit of this is that I don't need to keep changing my footer code every time I add (or remove) a file from my list of files where I want this.

<!--- in the template itself --->
<cfset request.suppressFooterContent = true>

Then, in the footer:

<cfparam name="request.suppressFooterContent" default="false">
<cfif NOT request.suppressFooterContent>
  <!--- display content here --->
share|improve this answer
Thank you, very informative post. I think setting a variable would be an easier solution. –  blarg Jan 9 '13 at 9:33

Your Answer


