Skip to main content
Inspiring
May 12, 2014
Question

coldfusion 9 - Displaying different Headers & Footers for select pages

  • May 12, 2014
  • 0 replies
  • 259 views

I have an application.cfc. page that will display a header and footer on each page that is produced and viewed what i you like to do is to show a different header and footer on select webpages on the same site.

Here's my code:

<cfcomponent output="false">

<cfset this.datasource="store1975">

<cffunction name="OnRequestStart" returntype="boolean" output="true">

  <!---Any variable set here can be used by all out pages--->

        <cfset request.company = "Sisterhood of the Traveling Headpiece">

        <cfset request.filepath = "D:\home\travelingheadpiece.com\wwwroot\">

        <!---Display Header on every Page--->

        <cfinclude template="header.cfm">

        <cfreturn true>

  </cffunction>

   

    <cffunction name="OnRequestEnd" returntype="boolean" output="true">

        <!---Display Footer on every Page--->

        <cfinclude template="footer.cfm">

        <cfreturn true>

  </cffunction>

</cfcomponent>

In order to have different header/footer on select page will i have to create a different folder with another application.cfc like the one above. or could i incorporate an additional function name within the same application.cfc with the cfinclude pointing to another header/footer?

Any suggestion

    This topic has been closed for replies.