Mango



Thread: cfimport template shows twice

Created on: 05/14/12 01:31 PM

New topic Reply    Page: 1  

Replies: 2
dbrannan


dbrannan's Gravatar
Joined: 05/14/12
Posts: 1

05/14/12 1:31 PM

I am trying to break up code into templates: head, header, footer, etc. to organize and avoid code reuse. However, when I use cfimport of my templates mango is displaying them twice. I tried clearing cache, but to no avail.

At the top of the index template in the skins directory mango has the following:

<cfimport prefix="mango" taglib="../../tags/mango">
<cfimport prefix="mangox" taglib="../../tags/mangoextras">
<cfimport prefix="template" taglib=".">

I import using the following:

<template:header />

The header.cfm page I want to import is in the root level of the skins directory with the following at it's top, too:

<cfimport prefix="mango" taglib="../../tags/mango">
<cfimport prefix="mangox" taglib="../../tags/mangoextras">
<cfimport prefix="template" taglib=".">

Any reason it would show up twice?
Link | Top | Bottom
visual28

Wizard
visual28's Gravatar
Joined: 05/18/08
Posts: 652

05/14/12 1:36 PM

I use cfinclude and it works fine for me.

-
Mark - www.visual28.com | www.mangowear.com
Link | Top | Bottom
Laura

Wizard
Laura's Gravatar
Joined: 01/29/05
Posts: 1521

05/14/12 1:37 PM

When custom tags have a closing tag (</>), they show once for the starting tag, once for the ending tag. You'd need to have a cfif in the custom tag (header.cfm):
<cfif thisTag.executionMode EQ "start">
</cfif>
or remove the ending tag: <template:header>
Link | Top | Bottom

New Post

Please login to post a response.