Copied to clipboard

Flag this post as spam?

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


  • Matias Korn 30 posts 49 karma points
    May 13, 2012 @ 18:17
    Matias Korn
    0

    umbraco.library.TruncateString bug?

    Hello,

    i am using umbraco 4.7 and when i use the TruncateString method it wont accept it and generate an error.

    I am creating the code even through the wizard and the end result is:

    <xsl:value-of select="umbraco.library:TruncateString('newsCategoryItemContent', '200', '...')" disable-output-escaping="yes"/>

    I realy dont get it.

  • Chriztian Steinmeier 2798 posts 8788 karma points MVP 7x admin c-trib
    May 13, 2012 @ 21:24
    Chriztian Steinmeier
    0

    Hi Matias,

    Based on the snippet you've provided I'd say the only thing wrong is that newsCategoryItemContent has single quotes around it - which just means that *that* is the string that'll be truncated (although only at the 200th character but the string is not that long...)

    If the value you need truncated is in the newsCategoryItemContent property you need to omit the quotes and maybe you need $currentPage too, depending on the context, e.g.:

    <xsl:value-of select="umbraco.library:TruncateString(newsCategoryItemContent, 200, '...')" disable-output-escaping="yes" />

    You say that you get an error - what does it say?

    /Chriztian

  • Matias Korn 30 posts 49 karma points
    May 13, 2012 @ 21:29
    Matias Korn
    0

    there is still an error without single quotes.It just say that there is an error. I hate xslt for that, that there is no error msg.

  • Chriztian Steinmeier 2798 posts 8788 karma points MVP 7x admin c-trib
    May 13, 2012 @ 21:37
    Chriztian Steinmeier
    0

    Hi Matias,

    It's actually not XSLT's fault - it's more of an Umbraco thing that they've chosen not to display the error messages on a frontend facing page.

    You can try adding ?umbDebugShowTrace=True to the URL, which should give you a lot more information - if you scroll down you should see some text in red at some point; there should be some more information about the specific error.

    /Chriztian 

  • Matias Korn 30 posts 49 karma points
    May 13, 2012 @ 21:41
    Matias Korn
    0

    I know it is umbraco.. i have found the solution and the error msg was that umbraco.library wasn't defined, because i have made a variable.

    <xsl:stylesheet
            version="1.0"
            xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
            xmlns:umb="urn:umbraco.library">


    Which will make that command look like this:

    <xsl:value-of select="umb:TruncateString(newsCategoryItemContent, '800', '...')" disable-output-escaping="yes"/>

Please Sign in or register to post replies

Write your reply to:

Draft