Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Shawn 8 posts 28 karma points
    Oct 08, 2010 @ 20:34
    Shawn
    0

    How do I display all the News Items?

    Hi there, I'm a total newbie in Umbraco, so please bear with my quesion :)

    I was creating News by following one of the Umbraco TV episodes,

    XSLT in Umbraco 4.0 - Creating a News List

    Everything worked perfectly and I'm very happy about it.

    However, my concern is...it displays only 2 items (as I followed the video)

    I want to know how to display all the news item without setting the maximum number of display -

    and also, if I want to include "Read More" link after the teaser,

    what should I do? :'(

    can someone please help me out here? :)

    I included my XSLT and its page underneath.

    Thank you very much for reading this ! have a great day !

     

    here's the page:

    http://umbraco.5am.co/news.aspx

     

    and here's my XSLT:

     

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
    <xsl:stylesheet
      version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:msxml="urn:schemas-microsoft-com:xslt"
      xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets"
      exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets ">

    <xsl:output method="xml" omit-xml-declaration="yes"/>

    <xsl:param name="currentPage"/>

    <!-- News Associated XSLT -->
        <xsl:variable name="maxItems" select="/macro/maxItems"/>
        
    <xsl:template match="/">

    <!-- The fun starts here -->

    <xsl:for-each select="$currentPage/* [@isDoc and string(umbracoNaviHide) != '1']">
      
      
    <!-- News Associated XSLT -->
      <xsl:sort select="@createDate" order="descending" />
      <xsl:if test="position() &gt;= $maxItems">
        
    <!-- Title -->    
    <h3>
        <a href="{umbraco.library:NiceUrl(@id)}">
          <xsl:value-of select="@nodeName"/></a>
    </h3>

    <!-- Who Wrote? -->    
        
        <h6>
          Created at: <xsl:value-of select="umbraco.library:LongDate(@createDate)"/>
          by: <xsl:value-of select="@creatorName"/>
        </h6> <br />
        
    <!-- News Teaser -->
    <p><xsl:variable name="kICK-NewsContents" select="umbraco.library:StripHtml(./kICK-NewsContents)" />
      <xsl:value-of select="substring($kICK-NewsContents, 1, 255)" />...</p>   <br />  
        
        
      </xsl:if>
        
    </xsl:for-each>


    </xsl:template>

    </xsl:stylesheet>

  • Fernando 9 posts 30 karma points
    Oct 08, 2010 @ 21:37
    Fernando
    0

    If I understand your question correctly... you don't want the "maxItems" parameter, and always show all the news, right?

    Just remove the following from your code:

    <xsl:variable name="maxItems" select="/macro/maxItems"/>

      <xsl:if test="position() &gt;= $maxItems">

    For the latest, also remove the corresponding </xsl:if>

    For your “Read more” link, just add the HTML before the </xsl:for-each>, and in the href for the A tag, specify:

    "{umbraco.library:NiceUrl(@id)}"

     

     

  • Shawn 8 posts 28 karma points
    Oct 09, 2010 @ 01:21
    Shawn
    0

    thank you so much for your direction ! Everything works like a Charm now !

Please Sign in or register to post replies

Write your reply to:

Draft