Copied to clipboard

Flag this post as spam?

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


  • Nicklas Fagerkvist 6 posts 26 karma points
    Sep 21, 2010 @ 10:10
    Nicklas Fagerkvist
    0

    Nice URL 4.5 error

    Hi, guys!

    I am quite new top umbraco and I have have a problem with a url to file that its uploaded and pointed out with a content picker. I get the error:

    Value was either too large or too small for an Int32.

    The code looks like this:

    <xsl:for-each select="$currentPage/*[@isDoc and string(umbracoNaviHide) != '1']">

    <xsl:if test="current()/supplier_avtalstyp != ''">
          <a href="{umbraco.library:NiceUrl($currentPage/supplier_avtalsfil)}">Avtal</a>
      </xsl:if>

    Is there anyone who can help me?

    // Nicklas

  • Aaron Powell 1708 posts 3044 karma points c-trib
    Sep 21, 2010 @ 10:31
    Aaron Powell
    0

    You're passing in the XmlNode to NiceUrl, not the ID of the page, try this:

    <xsl:if test="current()/supplier_avtalstyp != ''">
          <a href="{umbraco.library:NiceUrl($currentPage/supplier_avtalsfil/@id)}">Avtal</a>
    </xsl:if>
  • Nicklas Fagerkvist 6 posts 26 karma points
    Sep 21, 2010 @ 10:35
    Nicklas Fagerkvist
    0

    Thanks, but it doesn´t help. Same error....

  • Aaron Powell 1708 posts 3044 karma points c-trib
    Sep 21, 2010 @ 10:39
    Aaron Powell
    0

    I just noticed that in the code the test statement is testing for a different element to the href is looking at. Was the original code meant to be like that?

  • Nicklas Fagerkvist 6 posts 26 karma points
    Sep 21, 2010 @ 10:45
    Nicklas Fagerkvist
    0

    The code look like this.

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

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

    <xsl:param name="currentPage"/>
    <xsl:variable name="documentTypeAlias" select="string('Leverantor')"/>
       
    <xsl:template match="/">

    <!-- The fun starts here -->
    <table width="500">

    <xsl:for-each select="$currentPage/*[@isDoc and string(umbracoNaviHide) != '1']">
        
    <tr>
      <td>
      -  <a href="{umbraco.library:NiceUrl(@id)}">
          <xsl:value-of select="@nodeName"/>
        </a>
      </td>
      <td>

      <xsl:if test="current()/supplier_prio != ''">
        <xsl:variable name="bild" select="umbraco.library:GetMedia(current()/supplier_prio, 'false')" />
        <img src="{$bild/umbracoFile}" />
      </xsl:if>
      </td>
    <td>
      
        <xsl:if test="current()/supplier_avtalstyp != ''">   
          <a href="{umbraco.library:NiceUrl($currentPage/supplier_avtalsfil/@id)}">Avtal</a>
      </xsl:if>

     </td>
      <td>
     
      <xsl:if test="current()/supplier_info!= ''">

      Information





        </xsl:if>
      </td>
      </tr>
      
      
     

    </xsl:for-each>
      
      </table>

    </xsl:template>

    </xsl:stylesheet>
  • Kim Andersen 1447 posts 2196 karma points MVP
    Sep 21, 2010 @ 10:50
    Kim Andersen
    0

    Hi Nicklas

    Where's the property called supplier_avtalsfil placed? On the current page or on the subpages that you are iteration through?

    /Kim A

  • Nicklas Fagerkvist 6 posts 26 karma points
    Sep 21, 2010 @ 10:53
    Nicklas Fagerkvist
    0

    The property supplier_avtalsfil is a content picker located on the subpage.

    The content picker point on a pdf-file thats uploaded into content tree.

  • Aaron Powell 1708 posts 3044 karma points c-trib
    Sep 21, 2010 @ 10:54
    Aaron Powell
    0

    Yeah there's a test happening against supplier_avtalalsfil but then reading out of something else, not using it on the next line anyway

  • Kim Andersen 1447 posts 2196 karma points MVP
    Sep 21, 2010 @ 10:59
    Kim Andersen
    0

    Could you try this if you are using a media picker for the supplier_avtalsfil:

    <xsl:if test="./supplier_avtalsfil != ''">   
          <a href="{umbraco.library:GetMedia(./supplier_avtalsfil,0)/umbracoFile}">Avtal</a>
      </xsl:if>

    And this if you are using a content picker:

    <xsl:if test="./supplier_avtalsfil != ''">   
          <a href="{umbraco.library:NiceUrl(./supplier_avtalsfil)}">Avtal</a>
      </xsl:if>

    If it's a media picker, you need to use the GetMedia-extension to get the filename of the file that you want to link to, and if you are linking to a page in the content tree, you can use the NiceUrl-extension.

    Does any of the above code work for you?

    /Kim A

  • Nicklas Fagerkvist 6 posts 26 karma points
    Sep 21, 2010 @ 11:03
    Nicklas Fagerkvist
    0

    Yes! That code for content picker worked!!!

    Thanks guys!!

    Now I´ve just have to figure out how to show the file, beacuse now it´s just a blank page! ;=)

  • Kim Andersen 1447 posts 2196 karma points MVP
    Sep 21, 2010 @ 11:41
    Kim Andersen
    0

    Glad it worked Nicklas.

    If you just want to link to a pdf-file that the users can download, I'd suggest that you upload those pdf-files to the media library, and then chooses the files from a mediapicker on your subpages.

    Then you can use the first snippet I provided above to render the link to the files.

    If you are usig the other method with NiceUrl, you'll get a link sending the users to a different page in the content tree. But of course it's all up to you :)

    /Kim A

     

  • Nicklas Fagerkvist 6 posts 26 karma points
    Sep 21, 2010 @ 11:56
    Nicklas Fagerkvist
    0

    But I want the pdf file to be protected with a login.  So I use the Public Access function to control this.

    Can I in the template for the page with the pdf -file call the url to file so the user wont need to click on a link?

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies