Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ColdFusion / Advanced Techniques / September 2007



Tip: Looking for answers? Try searching our database.

[cf8]custom tag outputs generatedContent twice

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ogre11 - 12 Sep 2007 20:19 GMT
my custom tag is outputting the generatedContent twice.  but not anything in
the tag, just what was between the calling tags.

It runs the tag once, but before it outputs the stuff in the end portion, it
outputs just what was between the calling tags.

Im working in cf8 developer on my local

<!--- tag call -->
<cf_marketingcolumn>
 foo
</cf_marketingcolumn>

<!--- tag code --->
<cfif thistag.executionmode is "end">
    <cfoutput>
        <div class="marketing column" #thisTag.style#>
            <div class="copy" style="float: #attributes.align#;width:
#attributes.contentWidth#">
               
            </div>
        </div>
    </cfoutput>
        <cfexit method="exittag" />
</cfif>

<!--- outputs --->
foo
        <div class="marketing column" >
            <div class="copy" style="float: right;width: 50%">

               
                        foo
                   
            </div>
        </div>
Ian Skinner - 12 Sep 2007 20:32 GMT
That is documented behavior of a custom tag.  The code is run once at
the opening of the tag "<cf_marketingcolumn>" and once at the closing of
the tag "</cf_marketingcolumn>".

That is the purpose of the thistag.executionmode property.  It allows
you to designate when a given piece of the custom tag should be run.
The code you have outside your if block is going to be run both times
the custom tag is called.

This is throughly explained with examples in the documentation.  If you
do not have one the internet does.
[Stolen from I forget who without permission]
ogre11 - 12 Sep 2007 21:06 GMT
there is code outside my if block.
Ian Skinner - 12 Sep 2007 21:07 GMT
> there is code outside my if block.

And that code will be run twice as it is supposed to be.  If you do not
want it to be you need to use the features and functionality that allow
you to control this behavior.
ogre11 - 12 Sep 2007 21:32 GMT
sorry, I was coming to edit,

"there is code outside my if block." = "there isn't code outside my if block."

There is NO code outside my if block
Grizzly9279 - 12 Sep 2007 22:06 GMT
That's very strange that it wasn't a problem in CFMX 7, but that it is now a
problem in CFMX 8.  Could be a bug...

Have you tried removing the <cfexit method="exittag" />?
I don't see why that's necessary anyways...

Perhaps since you're prematurely short circuiting the tag with <cfexit>, the
supression of the "inner" content is disabled.  Just a thought.
ogre11 - 12 Sep 2007 22:38 GMT
no effect

add cfexit is just a habit, for when I make tags that end <cf_foo /> like that so they dont run twice
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.