• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

[cf8]custom tag outputs generatedContent twice

Guest
Sep 12, 2007 Sep 12, 2007

Copy link to clipboard

Copied

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

If I do this:

<cfelseif thistag.executionmode is "end">
<cfset thisTag.content = thisTag.generatedContent>
<cfset thisTag.generatedContent = "">

it seems to work, but is that a good work around? This never happened in mx7
TOPICS
Advanced techniques

Views

577

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 12, 2007 Sep 12, 2007

Copy link to clipboard

Copied

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]

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Sep 12, 2007 Sep 12, 2007

Copy link to clipboard

Copied

there is no code outside my if block.

there is only one place I output my generatedContent, and that's between the divs in the attached code. And that's in the if block. Also you'll note the output shows the code inside the if block is only run once, but the generated content is thrown in above it.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 12, 2007 Sep 12, 2007

Copy link to clipboard

Copied

ogre11 wrote:
> 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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Sep 12, 2007 Sep 12, 2007

Copy link to clipboard

Copied

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

Also even if this were an issue of running things in start and end mode, when exectutionmode is "start" generatedContent is an empty string, so foo wouldn't even be showing up!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Sep 12, 2007 Sep 12, 2007

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Sep 12, 2007 Sep 12, 2007

Copy link to clipboard

Copied

LATEST
no effect

add cfexit is just a habit, for when I make tags that end <cf_foo /> like that so they dont run twice

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation