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

CFIF question

Community Beginner ,
Oct 21, 2011 Oct 21, 2011

Copy link to clipboard

Copied

On a listing page, I'm trying to display Charts thumbnails and Thumb picture if there's one available in an article. So I need an CFIF statement similar to this: If there's a thumb, show it, otherwise show chart.

Here's what I got so far:

<cfif Len(Trim(ImageThumb))>

<div style="float:left; ">

<a href="#itemLink#" #sTarget# class="N#cfs##cst#">

<cfscript>

// deinfe argument structure

strArgs = StructNew();

//Application.DynamicTagGenerator

strArgs.sRelativePath = ImageThumb;

strArgs.sFileName = "";

strArgs.sAlternateImagePath = "#request.ImagePath#AcuCustom/#request.appTitle#/Icon/Thumbnail/";

strArgs.bEnforceDesignStyle = "#CurrentEnforceImageSizeYN#";

strArgs.sWidth = "#currentThumbWidth#";

strArgs.sHeight = "#currentThumbHeight#";

strArgs.sAltText = "#HTMLEditFormat(Title)#";

strArgs.bGenerateTag = 1;

sImageThumb = Application.DynamicTagGenerator.GetImageTag(argume ntCollection = strArgs);

</cfscript>

#sImageThumb#

</a>

</div>

<cfelse>

<!--- Container for the chart --->

<div id="chartStandardItemContainer#currentRow-1#" class="chartStandardItemContainer" style="width:170px; height:100px; margin-right:15px; margin-bottom:10px""></div>

</td>

</cfif>

It show the chart for those article that has it but when it comes to the thumb, it does appear but the statement wont run for the article below that.

Any suggestion?

Regards

TOPICS
Advanced techniques

Views

771

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

correct answers 1 Correct answer

Community Beginner , Oct 21, 2011 Oct 21, 2011

Its fixed now.

Here's the working code:

<!--- Container for the chart --->

                         <div id="chartStandardItemContainer#currentRow-1#" class="chartStandardItemContainer" style="width:170px; height:100px; margin-right:15px; margin-bottom:10px"></div>

                         <cfif Len(Trim(ImageThumb))>

                        

                                                                      <div>

                                                                      <a href="#ite

...

Votes

Translate

Translate
LEGEND ,
Oct 21, 2011 Oct 21, 2011

Copy link to clipboard

Copied

I troubleshoot if/else problems like this:

<cfif something is what I expect>

yes

<cfelse>

no

#what I actually received#

</cfif>

<cfabort>

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
Advocate ,
Oct 21, 2011 Oct 21, 2011

Copy link to clipboard

Copied

You have a <div>...</div>block in both but you also follow this with a </td> in the else block. Could this be your problem?

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
Community Beginner ,
Oct 21, 2011 Oct 21, 2011

Copy link to clipboard

Copied

Ignore the </td>. Its outside the <cfif> statement.

<cfif Len(Trim(ImageThumb))>

<div style="float:left; ">

<a href="#itemLink#" #sTarget# class="N#cfs##cst#">

<cfscript>

// deinfe argument structure

strArgs = StructNew();

//Application.DynamicTagGenerator

strArgs.sRelativePath = ImageThumb;

strArgs.sFileName = "";

strArgs.sAlternateImagePath = "#request.ImagePath#AcuCustom/#request.appTitle#/Icon/Thumbnail/";

strArgs.bEnforceDesignStyle = "#CurrentEnforceImageSizeYN#";

strArgs.sWidth = "#currentThumbWidth#";

strArgs.sHeight = "#currentThumbHeight#";

strArgs.sAltText = "#HTMLEditFormat(Title)#";

strArgs.bGenerateTag = 1;

sImageThumb = Application.DynamicTagGenerator.GetImageTag(argume ntCollection = strArgs);

</cfscript>

#sImageThumb#

</a>

</div>

<cfelse>

<!--- Container for the chart --->

<div id="chartStandardItemContainer#currentRow-1#" class="chartStandardItemContainer" style="width:170px; height:100px; margin-right:15px; margin-bottom:10px""></div>

</cfif>

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
Advocate ,
Oct 21, 2011 Oct 21, 2011

Copy link to clipboard

Copied

Does "#currentRow-1#" work? I have never coded it that way.I use a temporary variable or the evaluate or int functions.

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
Community Beginner ,
Oct 21, 2011 Oct 21, 2011

Copy link to clipboard

Copied

LATEST

Its fixed now.

Here's the working code:

<!--- Container for the chart --->

                         <div id="chartStandardItemContainer#currentRow-1#" class="chartStandardItemContainer" style="width:170px; height:100px; margin-right:15px; margin-bottom:10px"></div>

                         <cfif Len(Trim(ImageThumb))>

                        

                                                                      <div>

                                                                      <a href="#itemLink#" #sTarget# class="N#cfs##cst#">

                                                                      <cfscript>

                                                                                // deinfe argument structure

                                                                                strArgs = StructNew();

 

                                                                                //Application.DynamicTagGenerator

                                                                                strArgs.sRelativePath = ImageThumb;

                                                                                strArgs.sFileName = "";

                                                                                strArgs.sAlternateImagePath = "#request.ImagePath#AcuCustom/#request.appTitle#/Icon/Thumbnail/";

                                                                                strArgs.bEnforceDesignStyle = "#CurrentEnforceImageSizeYN#";

                                                                                strArgs.sWidth = "#currentThumbWidth#";

                                                                                strArgs.sHeight = "#currentThumbHeight#";

                                                                                strArgs.sAltText = "#HTMLEditFormat(Title)#";

                                                                                strArgs.bGenerateTag = 1;

 

                                                                                sImageThumb = Application.DynamicTagGenerator.GetImageTag(argumentCollection = strArgs);

                                                                      </cfscript>

                                                                      #sImageThumb#

                            </a>

                                                                      </div>

                                                                      <style>

                            ##chartStandardItemContainer#currentRow-1# {display:none}

                            </style>

                          </cfif>

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