• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 336
  • Last Modified:

Can I Use <cfinclude> within a Dreamweaver Template?

I'm redeveloping my existing website, with the hopes of getting my users to help me keep the content of the site up to date through Macromedia Contribute.

I'm developing the site using Dreamweaver and Coldfusion and  I'm creating dreamweaver template pages for each division/department/user.  One thing that remains consistent on each of the pages is menu navigation, and I don't want my users to change this navigation on their individual pages.  If we go with templates, I very well could end up having over 50 different templates, because each department wants their own images.

I was hoping that I could create a seperate file with the just the header and footer information, and then have all my different templates call that through <cfinclude>, but it doesn't seem to be working, it isn't picking up the images that are in the header and footer files, so it looks like the path isn't working within the template.  

Is it possible to use <cfinclude> within the template pages.  I realize that templates act differently than include files, and I want the benefits of the templates by not allowing my users to change certain consistant features, but I also want to only have (1) menu that I can easily maintain throughout the entire site.

Any suggestions or help would be greatly appreciated.



0
kgarnto
Asked:
kgarnto
  • 3
  • 3
  • 2
2 Solutions
 
Ryan ChongCommented:
Do you have a sample on how you include your template using <cfinclude> in your html pages?

regards
0
 
kgarntoAuthor Commented:
Thanks for your response, ryancys.

Below is the code that I currently have.  I've also tried several other variations with putting the header and footer files in The Templates directory or in the Includes directory, but still haven't been successful.  The header.htm actually has all the information for creating the beginning html as well as the styles and javascript, and then the footer page closes the html.

The actual template itself is located at:  http://www.hgtc.org/templates/resp_pages.dwt.cfm, and you can see as a template alone it looks fine and the header menu and footer shows up fine.

A page that is using the template is located at:  http://www.hgtc.org/main/EdSrvs/Instrc/AHealth/RespTherapy/index.cfm  This page was created from the template, but can't seem to find the header images

<!--- Header Template Goes Here --->
<cfinclude template="../includes/header.htm">
<table width="100%"  border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="100%" colspan="2"><img src="../images/resp_top.jpg" width="780" height="46"></td>
</tr>
<tr>
<td colspan="2"><img src="../images/resp1.jpg" width="192" height="57"><img src="../images/resp2.jpg" width="320" height="57"><img src="../images/resp3.jpg" width="268" height="57"></td>
</tr>
<tr>
<td colspan="2"><img src="../images/resp_bottom.jpg" width="780" height="105" border="0" usemap="#Map"></td>
</tr>
<tr>
<td colspan="2"><img src="../images/blank_temp3_13.jpg" width="780" height="22"></td>
</tr>
<tr>
<td colspan="2" align="left" valign="top"><table width="780" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="538" align="left" valign="top"><img src="../images/resp_therapy.jpg" width="538" height="30"><br>
<table width="538" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="3"><img src="../images/r1.jpg" width="538" height="13"></td>
</tr>
<tr>
<td width="18" background="../images/r_l.jpg">&nbsp;</td>
<td width="484" bgcolor="#cc5c5c"><!-- TemplateBeginEditable name="EditRegion1" -->EditRegion1<!-- TemplateEndEditable --></td>
<td width="36" background="../images/r_r.jpg">&nbsp;</td>
</tr>
<tr>
<td colspan="3"><img src="../images/r_2.jpg" width="538" height="15"></td>
</tr>
</table></td>
<td width="242" align="left" valign="top"><img src="../images/links.jpg" width="242" height="30"><br>
<table width="241" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="3"><img src="../images/l_1.jpg" width="242" height="13"></td>
</tr>
<tr>
<td width="29" background="../images/l_l.jpg">&nbsp;</td>
<td width="189" bgcolor="#cc5c5c"><!-- TemplateBeginEditable name="EditRegion2" -->EditRegion2<!-- TemplateEndEditable --></td>
<td width="24" background="../images/l_r.jpg">&nbsp;</td>
</tr>
<tr>
<td colspan="3"><img src="../images/l_2.jpg" width="242" height="14"></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
<!--- footer information goes here --->
<cfinclude template="../includes/footer.htm">
0
 
JoshPowellCommented:
Yes, there is no reason you couldn't use <cfinclude>, however most likely Dreamweaver wont recognize it as an include(), so it will just treat it as invalid syntax and/or a comment.

You said you are having problems with the image's path?

Try the <base> tag to set the root path thats used for all relative images/links... it goes like so:

<base href="http://www.yoursite.com/whatever">

Just set that to wherever your images are stored.

Josh
0
Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

 
Ryan ChongCommented:
your images' path is not mapped correctly.. for a quick solution is try put your image source as full path, like change:

<a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('collprofile','','../images/m5_over.jpg',1)"><img src="../images/m5.jpg" alt="Click here to visit College Profile" name="collprofile" width="112" height="28" border="0"></a>

to:

<a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('collprofile','','http://www.hgtc.org/images/m5_over.jpg',1)"><img src="http://www.hgtc.org/images/m5.jpg" alt="Click here to visit College Profile" name="collprofile" width="112" height="28" border="0"></a>

Hope this helps
0
 
Ryan ChongCommented:
JoshPowell's suggestion is nice, but be careful to use it if the pages are interact with other sites ;-)
0
 
JoshPowellCommented:
ryancys,
Thats correct about the image path :)

You don't have to use absolute paths though, change the ../ to a ./ and it should work fine.. I try to use reletive paths as much as possible, just in case I have to switch domains or something.


Josh
0
 
kgarntoAuthor Commented:
Thanks to both ryancys and Josh.  

Both methods worked for me.
0
 
JoshPowellCommented:
You're welcome.. always glad to assist :) Glad you got it worked out


Josh
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 3
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now