CFINCLUDE and the magic table

Now, I have done this in ASP and I don't believe that I have had the same problems though it has been a while so bear with me.  So I have a simple master page like this...

<html>
<head>
<title>mjSoftware</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body topmargin="0" leftmargin="0">
<table width = "100%" height = "100%" >
  <tr height="50" bgcolor="#7ab3c0">
    <td colspan="3" height="50" valign="middle" border="2" bordercolor="#000000" >hello </td>
  </tr>
  <tr height="100%">
    <td width="110" bgcolor="#7ab3c0"></td>
    <td width="0"> </td>
    <td width="110" align="right" valign="top"><cfinclude template="nav2.htm"></td>
  </tr>
</table>
</body>
</html>

and the include is like this...

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
      <title>Untitled</title>
</head>

<body topmargin="0" leftmargin="0" bgcolor="#7AB3C0">
<img src="Images/Navigation/nav1.gif" width="110" height="25" alt="" border="0" align="right"><br><br>
<img src="Images/Rules/blackspacer.gif" width="110" height="2" alt="" border="0" align="right"><br>
<img src="Images/Navigation/nav2.gif" width="110" height="25" alt="" border="0" align="right">
</body>
</html>

...and no matter what I do, the right-most table column displays nothing but of course the nav2.cfm file will display properly by itself just fine.  I am sure there is some simple trick to how to use CFINCLUDE effectively that I am missing but having not used it before and really wanting to use this technique, I would love some guidance.
LVL 1
beregothAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

rod_nolanCommented:
Before I make any assumptions, I'll point out an obvious possibility. You call the file nav2.CFM in your explanation but in your master page code, it's nav2.HTM. So first, check to make sure that it's not something simple, like a mistyped filename. If that was the case though, you'd get the 404 Object Not Found error... and you would have posted that information along with your explanation, right? ;)
The reason I brought that up is because the error wouldn't have been visible at first glance in the browser or CF Studio's internal browser because you've set the table height to 100%.

If that's not the problem, read on...

You say that the rightmost table column in the master page displays nothing. Does that mean that there's literally nothing in the table cell or do you get broken images?

Just a tip for troubleshooting table problems: set the table border to 1 so you can see the cell boundaries and always view the source of the html page that CF produces to see if it does what you expected it to do. That'll help you determine whether the problem is with your CF code or your HTML code.

<CFINCLUDE> is just like a programmatic copy-paste. It simply inserts the contents of the included file into the calling file at run time. So the code in the included page assumes the directory of that calling page. If those pages are in different directories you'll get relative path resolution problems for your images and hyperlinks.

That's what it sounds like to me because you say that the nav page works ok on it's own but doesn't work when included in the master page.

Good Luck,
Rod
0
netdiscipleCommented:
ok, rod points out some obvious things that needed mention, like the filenaming prob, but what he failed to specify at the end was that the cfinclude tag explicitly adds the contents of the nav2.cfm file to the container file...meaning, you only write the code you really need into nav2.cfm. so get rid of the <HTML> and <BODY> declarations and only include code for the tables or  table cells you need to include in....

check <code> below


Example 1: container file
---

<html>
<body>
<table>
<cfinclude url="include_snip.txt">
</table>
</html>


Example 2: include_snip.txt
---


<tr><td>menu item 1</td></tr>
<tr><td>menu item 2</td></tr>
<tr><td>menu item 3</td></tr>

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
netdiscipleCommented:
you see, the included file doesnt even need to be a .cfm file.

anyhow...all you need to have is the container file named with a .cfm filename extention so the webserver knows to run it through CF. Essentially, <CFINCLUDE> is the allaire alternative to Server-Side Includes which tend to be very expensive in CPU cycles.  Not sure if CF helps this statistic any, but its a rather useful tag in my opinion.
0
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

Nathan Stanford SrSenior ProgrammerCommented:

It worked on my machine?

What browser are you useing?
I got two broken links for the two images.  I didn't get a broken link for the Spacer.  I added test to the top and bottom just to see what would happen.  
What resolution are you using?


<html>
<head>
<title>mjSoftware</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body topmargin="0" leftmargin="0">
<table width = "100%" height = "100%" > 
  <tr height="50" bgcolor="#7ab3c0">
    <td colspan="3" height="50" valign="middle" border="2" bordercolor="#000000" >hello </td>
  </tr>
  <tr height="100%">
    <td width="110" bgcolor="#7ab3c0"></td>
    <td width="0"> </td>
    <td width="110" align="right" valign="top"><cfinclude template="nav2.htm"></td>
  </tr>
</table>
</body>
</html>





<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
<title>Untitled</title>
</head>

<body topmargin="0" leftmargin="0" bgcolor="#7AB3C0">
test
<img src="Images/Navigation/nav1.gif" width="110" height="25" alt="" border="0" align="right"><br><br>
<img src="Images/Rules/blackspacer.gif" width="110" height="2" alt="" border="0" align="right"><br>
<img src="Images/Navigation/nav2.gif" width="110" height="25" alt="" border="0" align="right">
test
</body>
</html>


0
beregothAuthor Commented:
Sorry nathans but I am not sure what question you are answering.  The problem is not the content of the include file (ultimately I have found that it is though), specifically the graphics, it was the raw html content...the <HTML> and <BODY> tags were included and causing grief.
0
beregothAuthor Commented:
This was the clue I was looking for and it was really obvious once I looked at it.  Thanks to everyone for the commentary and assistance.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Servers

From novice to tech pro — start learning today.