Copied to clipboard

Flag this post as spam?

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


  • Pat 56 posts 147 karma points
    Jan 17, 2012 @ 10:43
    Pat
    0

    blog posts pulled through, how to get first few characters

    Hi,

    I have pulled through the latest 2 blog posts using uBlogsy to my homepage, they firstly by default just pull the title of the post in a listed format. How could I get them to :

    A) sit side by side, a few pixels apart  so to differentiate

    B) show the title and the content BUT just say the first 150chars of the content, not all of it

    and C) make it not be green font (it is green i think as the title is a hyperlink

  • Mike Chambers 636 posts 1253 karma points c-trib
    Jan 17, 2012 @ 11:27
    Mike Chambers
    0

    a and c would be alterations to the css and/or html structure of your xslt...

    b can be accomplished in the xslt, with a comination of umbraco.library:stripHtml and substring...

     eg...

    <xsl:variable name="strippedHTML" select="umbraco.library:StripHtml($YOURTITLE)"/> 
    <xsl:value-of select="substring($strippedHTML, 1, 150)" />

  • Pat 56 posts 147 karma points
    Jan 18, 2012 @ 21:25
    Pat
    0

    Hi

    Thanks for the reply. I am using uBlogsy, and that uses Scriping files (.cshtml), would the same work for that?

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Jan 18, 2012 @ 21:48
    Jeroen Breuer
    0

    In Razor it would look like this:

    using umbraco.MacroEngines.Library;
    @Library.Truncate(Model.rteContent,100)
    //or
    @Library.StripHTML(Model.rteContent)

    Have a look at this blogpost for more examples: http://umbraco.com/follow-us/blog-archive/2011/9/22/umbraco-razor-feature-walkthrough%E2%80%93part-8.aspx

    Jeroen

Please Sign in or register to post replies

Write your reply to:

Draft