Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

coldfusion 9 - Displaying different Headers & Footers for select pages

Explorer ,
May 12, 2014 May 12, 2014

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

230
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
no replies

Have something to add?

Join the conversation
Resources