从 ColdFusion 中的当前项目获取自定义属性?

getting a custom attribute from the current item in ColdFusion?

免责声明,我是 ColdFusion 新手...

我正在使用 Mura CMS 6,我有一个关于访问自定义属性的问题。

我的 contentRenderer.cfc 文件包含 Bootstrap 轮播的代码。我希望能够在轮播正在使用的文件上输出自定义属性的内容,但我不完全确定该怎么做。

我的自定义属性名为 'imageLink',但我不知道如何获取当前上下文才能将此属性的内容输出到屏幕。

下面的代码是轮播的代码(不是我写的)

        <cfsavecontent variable="local.str"><cfoutput>
        <!--- BEGIN: Bootstrap Carousel --->
        <!--- IMPORTANT: This will only output items that have associated images --->
        <cfset local.feed = variables.$.getBean('feed').loadBy(name=arguments.feedName)>
        <cfset local.iterator = local.feed.getIterator()>
        <cfif local.feed.getIsNew()>
            <div class="container">
                <div class="alert alert-info alert-block">
                    <button type="button" class="close" data-dismiss="alert"><i class="fa fa-remove"></i></button>
                    <h4>Ooops!</h4>
                    The <strong>#HTMLEditFormat(arguments.feedName)#</strong> Content Collection/Local Index does not exist.
                </div>
            </div>
        <cfelseif local.iterator.hasNext()>
            <div id="#arguments.cssID#" class="carousel slide" data-interval="#arguments.interval#">

                <!--- Indicators --->
                <cfif arguments.showIndicators>
                    <ol class="carousel-indicators">
                        <cfset local.iterator.reset()>
                        <cfset local.idx = 0>
                        <cfloop condition="local.iterator.hasNext()">
                            <cfset local.item=iterator.next()>
                            <cfif ListFindNoCase('jpg,jpeg,gif,png', ListLast(local.item.getImageURL(), '.'))>
                                <li data-target="###arguments.cssID#" data-slide-to="#idx#" class="<cfif local.idx eq 0>active</cfif>"></li>
                                <cfset local.idx++>
                            </cfif>
                        </cfloop>
                    </ol>
                </cfif>

                <!--- Wrapper for slides --->
                <div class="carousel-inner" role="listbox">
                    <cfset local.iterator.reset()>
                    <cfset local.idx = 0>
                    <cfloop condition="local.iterator.hasNext()">
                        <cfset local.item=iterator.next()>
                        <cfif ListFindNoCase('jpg,jpeg,gif,png', ListLast(local.item.getImageURL(), '.'))>
                            <div class="item<cfif local.idx eq 0> active</cfif>">
                                <img src="#local.item.getImageURL(argumentCollection=local.imageArgs)#" alt="#HTMLEditFormat(local.item.getTitle())#">
                                <cfif arguments.showCaption>
                                    <div class="container">
                                        <div class="carousel-caption">
                                            <h2><a href="#local.item.getURL()#" title="Click to view the news story">#HTMLEditFormat(local.item.getTitle())#</a></h2>
                    #local.item.getTitle()#
                                        <!--    <p><a class="btn btn-larg btn-primary" href="#local.item.getURL()#">Read More</a></p>-->
                                        </div>
                                    </div>
                                </cfif>
                            </div>
                            <cfset local.idx++>
                        </cfif>
                    </cfloop>
                </div>

                <cfif local.idx>
                    <!--- Controls --->
                    <cfif local.idx gt 1>
                        <a class="left carousel-control" href="###arguments.cssID#" data-slide="prev" role="button">
            <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
            <span class="sr-only">Previous</span>
          </a>
                        <a class="right carousel-control" href="###arguments.cssID#" data-slide="next" role="button">
            <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
            <span class="sr-only">Next</span>
          </a>
                        <!--- AutoStart --->
                        <cfif arguments.autoStart>
                            <script>jQuery(document).ready(function($){$('###arguments.cssID#').carousel({interval:#arguments.interval#});});</script>
                        </cfif>
                    </cfif>
                <cfelse>
                    <div class="alert alert-info alert-block">
                        <button type="button" class="close" data-dismiss="alert"><i class="fa fa-remove"></i></button>
                        <h4>Oh snap!</h4>
                        Your feed has no items <em>with images</em>.
                    </div>
                </cfif>
            </div>
        <cfelse>
            <div class="alert alert-info alert-block">
                <button type="button" class="close" data-dismiss="alert"><i class="fa fa-remove"></i></button>
                <h4>Heads up!</h4>
                Your feed has no items.
            </div>
        </cfif>
        <!--- // END: Bootstrap Carousel --->
    </cfoutput></cfsavecontent>

如何访问当前上下文以输出该属性?

这里是关于如何显示它们的文档。

http://docs.getmura.com/v6/back-end/class-extension-manager/displaying-extended-attributes/

您似乎在循环浏览一组内容,所以我相信这会奏效。

#local.item.get("imageLink")#

假设您在 cfloop 内和

行之后工作
<cfset local.item=iterator.next()>

您可以使用

获取自定义 imageLink 值
#local.item.getImageLink()#

#local.item.getValue('imageLink')#