Copied to clipboard

Flag this post as spam?

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


  • Frederik T 241 posts 372 karma points
    Aug 17, 2011 @ 11:00
    Frederik T
    0

    Help tidying up and fixing errors with a List Rotator

    I hope the help i need is simple enough, but im still green with xstl and umbraco, and this is quite the project ive been hired to help with, so please forgive me for asking for help all the time.

    Its relativly simple, just requires some explanation.

    The main page of the site im working on, has a rotator that showcases featured articles.
    This is the one we are using: http://codecanyon.net/item/jquery-list-style-rotator/133870

    At first it just displayed items hardcoded into an xstl, which worked fine (i can show you that if anyone wants to, shows its structure before i messed with it).

    The point of it is, the main document every document inherits from, has two boolean properties, one is if should be listed in the rotator on the main front page, or if it should be listed on the rotator in its respective sub-section.

    After i modified it, it looks for ALL articles (documents) that has just one of the boolean properties set to true and lists them (with this, it shows all the articles thats supposed to be featured on the frontpage, even in the sub-sections)
    It also shows the articles picture in the list, but NOT in the background when its selected. Text works also and linking.

     

    <?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" xmlns:PS.XSLTsearch="urn:PS.XSLTsearch"
      exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets PS.XSLTsearch ">


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

    <xsl:param name="currentPage"/>

    <xsl:template match="/">

    <!-- start writing XSLT -->
      
    <div class="g640p10 none">   
      <div class="container">
        <div class="l-rotator">
          
          <div class="screen">
            <noscript>
              <!-- when javascript is off -->
              <p>Javascript er ikke slĂ„et til.</p>
            </noscript>
          </div>
          
        <div class="thumbnails">
        <ul>
          <!-- "articleFontpageLink" is a document template boolean property, checks if its true. Decides wether it should be listed or not-->
          <xsl:for-each select="$currentPage/descendant::*[@isDoc][not(umbracoNaviHide = 1)][string(articleFrontpageLink) = '1']">
          
            <li>
              <div class="thumb">
                <!-- Thumbnail for listed item -->
                <xsl:if test="count(current()/outputPictures) > 0">
                <img src="/ImageGen.ashx?image={current()/outputPictures[position()=1]/DAMP[@fullMedia]/mediaItem/Image/umbracoFile}&amp;width=64&amp;height=64"/>
                </xsl:if>
                <p>
                  <span class="title">
                    <xsl:value-of select="@nodeName"/>
                  </span>
                    <br/>
                  <!-- Text from listed item, to appear in the list itself -->
                  <!-- <xsl:value-of select="umbraco.library:TruncateString(artikel-Teasertekst,70,'...')"/> -->
                </p>
              </div>
              <!-- Background image for highlighted item-->
              <a href="/ImageGen.ashx?image={DAMP[@fullMedia]/mediaItem/Image/umbracoFile}&amp;width=600&amp;height=300"><xsl:value-of select="normalize-space('')"/></a>  
              <a href="{umbraco.library:NiceUrl(@id)}"><xsl:value-of select="normalize-space('')"/></a>
              <div style="top:5px; left:5px; width:325px; height:0;">
                <h1><xsl:value-of select="@nodeName"/></h1>
                <!-- Text excerpt from article-->
                <xsl:value-of select="umbraco.library:TruncateString(article-Manchet,160,'...')"/>
              </div>    
            </li>
          
          </xsl:for-each>
        </ul>
          </div>
        
        </div> <!-- End .l-rotator -->
      </div> <!-- End .container -->  
    </div> <!-- End g640p10 -->
      

    </xsl:template>
        
        <!-- Template for thumbnail image, currently not in use -->
        <xsl:template match="outputPictures">
            <img src="/ImageGen.ashx?image={DAMP[@fullMedia]/mediaItem/Image/umbracoFile}&amp;width=600&amp;height=300"/>
        </xsl:template>

    </xsl:stylesheet>

    Ive tried to make sensible code comments.
    The template in the bottom is me trying to tidy up the code but not succesful so far.

     

    I really hope the wall of text didnt scare anyone away, i hope the help i need is easy enough, as it stems from me not knowing enough. If any questions or other information is needed i will reply ASAP.

Please Sign in or register to post replies

Write your reply to:

Draft