Welcome close

We've made some changes!

As you may have noticed, we've made some changes to the DevCenter to include the new Exchange site, a code community for Ektron developers. You may use the same username and password to login for both the Exchange and DevCenter. Your DevCenter profile has moved over to the Exchange site. You also may notice we have removed some profile functionality in favor of new functionality, including Activity Streams. We welcome your feedback about the site on the Exchange forum.

SEARCH : searchSite
This SectionSite Wide
esync 

RSS Feed Print Category View
Listsummary - no content message
mr
Posted: Thursday, January 28, 2010 3:09 PM
Joined: 1/12/2009
Posts: 10


Hi, I have a template with a listsummary control. There will be times that the folder the control uses won't contain any content. How can I generate a message on the webpage when there is no content?--something like "No current new articles. Please check back". Thanks for any help! We're using 7.6.6. SP2.
Carl
Posted: Thursday, January 28, 2010 8:42 PM
Joined: 1/16/2008
Posts: 230


mr

 

you can do this a couple of ways.

 

  1. XSLT. Are you using an XSLT with your list summary? If so you can add a few lines of code here to display this type of message.
  2. ASP Literal. In the code behind of your page you could inspect the EKItems property of the ListSummary, if its length is 0 then display the message using the literal.

If you're not using XSLT currently then go with #2.

 

Carl.


mr
Posted: Friday, January 29, 2010 12:56 PM
Joined: 1/12/2009
Posts: 10


Thanks, Carl, for the reply! I am actually using an xslt. Can you tell me which xsl element would be used to generate the message? I've been learning xml/xslt as I go, and this one really has me stumped! I'd really appreciate any pointers you can give! Mary
Rui @ Ektron
Posted: Friday, January 29, 2010 4:09 PM
Joined: 10/2/2006
Posts: 325


It would be something similar to this, which checks if the first content is empty, then display message.

 

<xsl:if test="Collection/Content != ''">There is no content</xsl:if>



Think outside the box.
Ektron CMS Smart Form XSLT = Great Design Idea w. Control


mr
Posted: Monday, February 1, 2010 12:57 PM
Joined: 1/12/2009
Posts: 10


Rui, this seems like the perfect fix!  But I'm still having some trouble.  I tried using the following:

<xsl:template match="/">
<xsl:for-each select="Collection/Content">
<xsl:choose>
<xsl:when test="Collection/Content != ''">
There is no content
<xsl:when>
<xsl:otherwise>
<xsl: value-of... [other fields]
</xsl:otherwise>
</xsl:choose>

If I have content in the folder it's displaying correctly; however, if there is no content, I'm not seeing the message.  Am I applying this correctly?


Carl
Posted: Monday, February 1, 2010 3:15 PM
Joined: 1/16/2008
Posts: 230


Hey Mary,

 

you have your test inside a for each Content item block, if there are no content blocks then this code will not be executed. Move your test outside the for each loop.

 

Hope this helps.

 

Carl


Rui @ Ektron
Posted: Monday, February 1, 2010 3:20 PM
Joined: 10/2/2006
Posts: 325


Here is the working XSLT

 

 

    <xsl:template match="/">
      <xsl:if test="count(Collection/Content) &lt; 1">
        There is no content
      </xsl:if>
      <xsl:for-each select="Collection/Content">
        <li>
          <xsl:value-of select="Title"></xsl:value-of>
        </li>
      </xsl:for-each>

    </xsl:template>



Think outside the box.
Ektron CMS Smart Form XSLT = Great Design Idea w. Control


mr
Posted: Tuesday, February 2, 2010 11:47 AM
Joined: 1/12/2009
Posts: 10


This works beautifully, and is exactly what I needed!  Thank you, Carl and Rui, for the explanation and for helping me to understand how to apply it!  Mary
 

Jump to different Forum... 






Register for Synergy 2010

Articles
Design without Borders, yet with Structure
CMS400.NET and Adobe Flex
GeoMapping
EkML Ektron Markup Language
Taxonomy

[First] [Previous] [Next] [Last]


See All Articles