473,652 Members | 3,059 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

<cfinclude> error

5 New Member
In my main page, I use <cfinclude> tag to include my header and footer.

But I get error. "Context validation error for the cfif tag.
The start tag must have a matching end tag. An explicit end tag can be provided by adding </cfif>. If the body of the tag is empty, you can use the shortcut <cfif .../>. "

If I put the three files into one big file without using <cfinclde> tag, the page display with no error.

Here is my code:

Expand|Select|Wrap|Line Numbers
  1. <cfinclude template="copyrights_header.cfm">
  2. <!--- Start page content.  --->
  3. My Main Page
  4. <!--- end page content --->
  5. <cfinclude template="copyrights_footer.cfm">
  6.  
My header code:

Expand|Select|Wrap|Line Numbers
  1. <cfif isDefined("url.pageID")>
  2.     <cfset pageID=#url.pageID#>
  3. <cfelse>
  4.     <cfset pageID=0>
  5. </cfif>
  6.  
  7. <cfif isDefined("url.secID")>
  8.     <cfset secID=#url.secID#>
  9. <cfelse>
  10.     <cfset secID=0>
  11. </cfif>
  12.  
  13. <cfif isDefined("url.type")>
  14.     <cfset type="#type#">
  15. <cfelse>
  16.     <cfset type="page">
  17. </cfif>
  18.  
  19. <cfparam name="title" default="Copyrights">
  20.  
  21. <cfquery datasource="#application.DBSource#" name="getTopLevels">
  22.         SELECT *
  23.         FROM tbl_page
  24.         ORDER BY display_order
  25. </cfquery>
  26.  
  27. <cfif getTopLevels.RecordCount GT 0>
  28.  
  29.     <cfif pageID EQ 0>
  30.         <cfquery datasource="#application.DBSource#" name="getTitles">
  31.         SELECT * FROM tbl_page WHERE default_page ='Y'
  32.         </cfquery>
  33.     <cfelse>
  34.         <cfquery datasource="#application.DBSource#" name="getTitles">
  35.         SELECT * FROM tbl_page WHERE page_id = #pageID#
  36.         </cfquery>
  37.     </cfif>
  38.  
  39.     <cfif getTitles.RecordCount EQ 0>
  40.         <cfquery datasource="#application.DBSource#" name="getTitles">
  41.         SELECT * FROM tbl_page WHERE page_id = (Select min(page_id) FROM tbl_page)
  42.         </cfquery>
  43.     </cfif>
  44.  
  45.     <cfif getTitles.RecordCount GT 0>
  46.         <cfset pageTitle="Copyrights">
  47.     </cfif>
  48.  
  49.     <cfinclude template="#application.settings.layout#/top_layout.cfm">
  50.  
  51.  
  52. <cfif isDefined("btnSubmit")>
  53.     <cfif #pageID# EQ 0>
  54.         <cfquery name="getDefaultTab" datasource="#application.DBSource#">
  55.         SELECT page_id from tbl_page where default_page="Y"
  56.         </cfquery>
  57.         <cfset pageID=#getDefaultTab.page_id#>
  58.     </cfif>
  59.  
  60.     <cfquery name="feedBack" datasource="#application.DBSource#">
  61.         INSERT INTO tbl_feedback 
  62.         (page_id, rate, comments, section_id) 
  63.         VALUES 
  64.         (#pageID#, #form.rate#, '#form.comments#', #secID#)
  65.     </cfquery>
  66. </cfif>
  67.  
  68. <!--- Get first level of Site Map = Page Title --->
  69. <cfquery name="getPage" datasource="#application.DBSource#">
  70.     SELECT page_id, page_name_en, sitemap_en, display_order
  71.     FROM tbl_page
  72.     Order By Display_Order
  73. </cfquery>
  74.  
  75. <cfset msgMT = "This page is currently under construction">
  76.  
  77. <cfoutput>
  78.     <tr valign="top">
  79.     <td>
  80.         <table align="left" valign="top" border="0" width="100%" height="100%" cellpadding="0" cellspacing="0">
  81.         <tr valign="top">
  82.             <td align="left" valign="top" width="20%" bgcolor="##F0F0F0" rowspan="2">
  83.             <br>
  84.                 <cfinclude template="#application.settings.layout#/expand_menu.cfm">
  85.             </td>
  86.  
  87.               <td valign="top">&nbsp; 
  88.                 <!--- <cfinclude template="#application.settings.layout#/inc_search_breadcrumb.cfm"> --->
  89.                 <span class="breadcrumb">You are here: <a href="../index.cfm">Home</a> > </span>
  90.             </td>
  91.         </tr>
  92.             <tr valign="top">
  93.             <td align="left" valign="top">
  94.         <table cellpadding="5" cellspacing="5" border="0" width="100%" height="100%" align="left">
  95.         <tr valign="top">
  96.             <td align="left" valign="top">
  97.             <cfif type is "search">
  98.             <cfinclude template="#application.settings.search#/searchLIB.cfm">
  99.             </td>
  100.         </tr>
  101.             <cfelse>
  102.  
My footer code:

Expand|Select|Wrap|Line Numbers
  1.     </td>
  2.     </tr>
  3.             </cfif>
  4.     <tr align="center" valign="bottom">
  5.     <td>
  6.     <cfinclude template="#application.settings.layout#/inc_feedback_form.cfm">
  7.     </cfoutput>
  8.     <tr valign="top">
  9.     <td><tr align="center" valign="bottom">
  10.     <td>
  11.     <cfelse>
  12.     <B>The Site is currently under construction.  Please visit us later.  Thank you.</B>
  13. </cfif>
Feb 11 '08 #1
3 4070
acoder
16,027 Recognized Expert Moderator MVP
You can't split a cfif across two cfincludes. Each cfinclude should be self-contained, so it can be re-used.
Feb 11 '08 #2
YaoBao
5 New Member
Thank you very much!
Feb 11 '08 #3
acoder
16,027 Recognized Expert Moderator MVP
No problem, you're welcome.
Feb 11 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
3456
by: grabit | last post by:
Hi Peoples i have a search page with a form field "subject" on my results page i have a paging routine . the first page lists its 10 records no trouble but when i click the "next" link i get a error telling me "subject is not defined in form" How can i overcome this please. I will post the page down to the end of the paging routine coz its not very long anyway. <cfquery name="searchResults" datasource="#dsn#"> SELECT threadID, posttype,...
0
8367
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8279
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8811
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8703
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8467
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7302
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6160
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
2703
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1914
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.