Copied to clipboard

Flag this post as spam?

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


  • Nick 19 posts 39 karma points
    Jun 26, 2012 @ 12:32
    Nick
    0

    Text on a rotation

    Hi all,

    I am needing some help with a feature on my website. I will be needing a pretty much, exact replica of the "LATEST" news rotation no the BBC news page seen here:

    http://www.bbc.co.uk/news/

    I'm not very experienced with umbraco, but I would understand this would be some kind of jquery and combination of xslt.

    If anyone could help me out with any information regarding the content ideas behind this and how to display it in such a manner would be great!

    I was thinking that it would be a content node in the backoffice, with a parent folder then inside, the items themselves. But I am stuck on how to get them to display in such a way.

    Cheers!

  • Nick 19 posts 39 karma points
    Jun 27, 2012 @ 11:59
    Nick
    0

    Shameless bump! 

  • Jan-Willem de Bruyn 17 posts 38 karma points
    Jun 27, 2012 @ 12:02
    Jan-Willem de Bruyn
    0

    Maybe you can take a look at : http://stackoverflow.com/questions/6184589/jquery-text-rotation They are doing it there with CSS, Just place it in a div and add CSS to it.

     

    Hope it helps, Jan-Willem

  • Nick 19 posts 39 karma points
    Jun 27, 2012 @ 12:07
    Nick
    0

    I'll have a look into it, I just need to think from my clients POV - I wonder how he will add the comments into the back office from this himself.

    Thanks Jan.

     

  • Jan-Willem de Bruyn 17 posts 38 karma points
    Jun 27, 2012 @ 12:11
    Jan-Willem de Bruyn
    0

    maybe I did understand you wrong, did you mean something like http://timeblockr.com/mogelijkheden on the top? you can add in the backend new things to that news rotator...

  • Nick 19 posts 39 karma points
    Jun 27, 2012 @ 12:13
    Nick
    0

    Exactly like that, how would I go about doing that?

    Thanks Jan :)

  • Jan-Willem de Bruyn 17 posts 38 karma points
    Jun 27, 2012 @ 12:27
    Jan-Willem de Bruyn
    0

    I made that one in Umbraco 5 (so cshtml) but it's easy to convert to xslt i'd think. the jquery is the jquery.elastislide from http://tympanus.net/codrops/2011/09/12/elastislide-responsive-carousel/ ;

    maybe something like this for the 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"

      exclude-result-prefixes="msxml umbraco.library">

     

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

     

        <xsl:param name="currentPage"/>

     

        <xsl:template match="/">

            <xsl:variable name="Folder" select="umbraco.library:GetXmlNodeById('ID')" />

            <xsl:variable name="items" select="$Folder/ancestor-or-self::* [@isDoc and @contentTypeAlias = 'ITEMTYPE']/* [@isDoc and string(umbracoNaviHide) != '1']"/>

     

     

            <xsl:if test="count($items) &gt; 0">

                <div id="carousel">

                    <div class="es-carousel">

                        <ul>

                            <xsl:for-each select="$items">

                                <li>

                                    <a href="{URL}">

                                        <img src="{umbraco.library:GetMedia(MEDIAPROPERTYALIAS, 0)/data [@alias = 'umbracoFile']}" alt=""></img>

                                    </a>

                                </li>

                            </xsl:for-each>

                        </ul>

                    </div>

                </div>

            </xsl:if>

     

        </xsl:template>

     

    </xsl:stylesheet>

     

     

    For that you create a sort of folder document type and a ITEMTYPE document type with a property URL and a media picker MEDIAPROPERTYALIAS , include the jquery extension, and fill in the id in the xslt (or some other way) where the folder variable is declared, use the macro somewhere and it would would work (I think)

     

    Greetings Jan-Willem

     

  • Nick 19 posts 39 karma points
    Jun 27, 2012 @ 12:30
    Nick
    0

    Hi Jan,

    Thanks for the hlep thus far, the jquery link you provided wasn't found though.

    Cheers

  • Jan-Willem de Bruyn 17 posts 38 karma points
    Jun 27, 2012 @ 13:05
    Jan-Willem de Bruyn
    0

    erm yea, there was something wrong with the url: http://tympanus.net/codrops/2011/09/12/elastislide-responsive-carousel/ is the correct one, does this one work?

    I forgot something to add, you also need to setup the plugin by

     

    $(function(){

    $('#carousel').elastislide({

    imageW: 133,

    minItems: 2,

    easing: '',

    margin: 50,

    border: 0

    });

    });

     

    in your page (this is javascript)

  • Nick 19 posts 39 karma points
    Jul 03, 2012 @ 10:19
    Nick
    0

    Hi Jan,

    Thanks for your help so far, I am just a little stuck with the XSLT part though. About making it so I can put the content in there. I just want some text, not media so I guess we can strip that bit out. 

    Ideally, I just want to be able to input 1 line (x5 for example) of text such as:

    "Nunc eros nisi purus habitasse habitasse eu dapibus sagittis! Lorem et purus magna magnis odio sagittis enim penatibus rhoncus velit lacus. Velit ridiculus rhoncus platea augue!"

    within a foreach <li></li>

    How could I go about selecting this from a folder?

    Thanks Jan :)

  • Nick 19 posts 39 karma points
    Jul 04, 2012 @ 14:08
    Nick
    0

    Bump :(

  • Jan-Willem de Bruyn 17 posts 38 karma points
    Jul 05, 2012 @ 08:43
    Jan-Willem de Bruyn
    0

    You can add a textstring to a umbraco document and then use something 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"

      exclude-result-prefixes="msxml umbraco.library">

     

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

     

        <xsl:param name="currentPage"/>

     

        <xsl:template match="/">

            <xsl:variable name="Folder" select="umbraco.library:GetXmlNodeById('ID')" />

            <xsl:variable name="items" select="$Folder/ancestor-or-self::* [@isDoc and @contentTypeAlias = 'ITEMTYPE']/* [@isDoc and string(umbracoNaviHide) != '1']"/>

     

     

            <xsl:if test="count($items) &gt; 0">

                <div id="carousel">

                    <div class="es-carousel">

                        <ul>

                            <xsl:for-each select="$items">

                                <li>

                                      <xsl:value-of select="TEXTSTRINGALIAS" />

                                </li>

                            </xsl:for-each>

                        </ul>

                    </div>

                </div>

            </xsl:if>

     

        </xsl:template>

     

    </xsl:stylesheet>

  • Nick 19 posts 39 karma points
    Jul 05, 2012 @ 11:35
    Nick
    0

    Hi Jan, thanks for your help so far.

    Below is how my content is structured. A parent folder which is just a "placeholder" for the items.

     

    Here is my macro:

      <umbraco:Macro Alias="RecentComment" runat="server"></umbraco:Macro>

     

    My XSLT, edited to which you provided:

    <?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"
     
      exclude-result-prefixes="msxml umbraco.library">
     
     
     
        <xsl:output method="xml" omit-xml-declaration="yes"/>
     
     
     
        <xsl:param name="currentPage"/>
     
     
     
        <xsl:template match="/">
     
            <xsl:variable name="Folder" select="umbraco.library:GetXmlNodeById('1955')" />
     
            <xsl:variable name="items" select="$Folder/ancestor-or-self::* [@isDoc and @contentTypeAlias = 'recent-comments']/* [@isDoc and string(umbracoNaviHide) != '1']"/>
     
     
     
     
     
            <xsl:if test="count($items) &gt; 0">
     
                <div id="carousel">
     
                    <div class="es-carousel">
     
                        <ul>
     
                            <xsl:for-each select="$items">
     
                                <li>
     
                                      <xsl:value-of select="recent-comment-item" />
     
                                </li>
     
                            </xsl:for-each>
     
                        </ul>
     
                    </div>
     
                </div>
     
            </xsl:if>
     
     
     
        </xsl:template>
     
     
     
    </xsl:stylesheet>

     

    But for some reason, it is not displaying anything. Even if I hard code some stuff into the XSLT between the <li>.

    Stumped!

     

  • Jan-Willem de Bruyn 17 posts 38 karma points
    Jul 05, 2012 @ 12:15
    Jan-Willem de Bruyn
    0

    I think it's because it checks if you items variable is higher then 0 so the problem could be in your 

    <xsl:variable name="items" select="$Folder/ancestor-or-self::* [@isDoc and @contentTypeAlias = 'recent-comments']/* [@isDoc and string(umbracoNaviHide) != '1']"/>

    I think it's becouse you're are getting the childs of the childs... maybe try this:

     

    <xsl:variable name="items" select="$Folder/ancestor-or-self::* [@isDoc and @contentTypeAlias = 'recent-comments' and string(umbracoNaviHide) != '1']]"/>
  • Nick 19 posts 39 karma points
    Jul 05, 2012 @ 12:18
    Nick
    0

    Getting an error when I try to save that when I replace it with the other line

     

    System.Xml.XmlException: The '=' character, hexadecimal value 0x3D, cannot be included in a name. Line 37, position 18. 
    at System.Xml.XmlTextReaderImpl.Throw(Exception e) 
    at System.Xml.XmlTextReaderImpl.ParseElement() 
    at System.Xml.XmlTextReaderImpl.ParseElementContent() 
    at System.Xml.Xsl.Xslt.XsltInput.ReadNextSiblingHelper() 
    at System.Xml.Xsl.Xslt.XsltInput.ReadNextSibling() 
    at System.Xml.Xsl.Xslt.XsltLoader.LoadInstructions(List`1 content, InstructionFlags flags) 
    at System.Xml.Xsl.Xslt.XsltLoader.LoadTemplate(NsDecl stylesheetNsList) 
    at System.Xml.Xsl.Xslt.XsltLoader.LoadRealStylesheet() 
    at System.Xml.Xsl.Xslt.XsltLoader.LoadDocument() 
    at System.Xml.Xsl.Xslt.XsltLoader.LoadStylesheet(XmlReader reader, Boolean include)

  • Jan-Willem de Bruyn 17 posts 38 karma points
    Jul 05, 2012 @ 13:23
    Jan-Willem de Bruyn
    0

    my mistake, try this

     

    <xsl:variablename="items"select="$Folder/ancestor-or-self::* [@isDoc and @contentTypeAlias = 'recent-comments' and string(umbracoNaviHide) != '1']" />
  • Nick 19 posts 39 karma points
    Jul 05, 2012 @ 13:34
    Nick
    0

    still get an error;

    replacing:

    <xsl:variable name="items" select="$Folder/ancestor-or-self::* [@isDoc and @contentTypeAlias = 'recent-comments']/* [@isDoc and string(umbracoNaviHide) != '1']"/> 

    with:

    <xsl:variablename="items"select="$Folder/ancestor-or-self::* [@isDoc and @contentTypeAlias = 'recent-comments' and string(umbracoNaviHide) != '1']" />

     

    is there meant to be a space between "variable name" ? just a thought looking at the old one you suggested

     

    System.Xml.XmlException: The '=' character, hexadecimal value 0x3D, cannot be included in a name. Line 36, position 20. 
    at System.Xml.XmlTextReaderImpl.Throw(Exception e) 
    at System.Xml.XmlTextReaderImpl.ParseElement() 
    at System.Xml.XmlTextReaderImpl.ParseElementContent() 
    at System.Xml.Xsl.Xslt.XsltInput.ReadNextSiblingHelper() 
    at System.Xml.Xsl.Xslt.XsltInput.ReadNextSibling() 
    at System.Xml.Xsl.Xslt.XsltLoader.LoadInstructions(List`1 content, InstructionFlags flags) 
    at System.Xml.Xsl.Xslt.XsltLoader.LoadTemplate(NsDecl stylesheetNsList) 
    at System.Xml.Xsl.Xslt.XsltLoader.LoadRealStylesheet() 
    at System.Xml.Xsl.Xslt.XsltLoader.LoadDocument() 
    at System.Xml.Xsl.Xslt.XsltLoader.LoadStylesheet(XmlReader reader, Boolean include)

     

     

  • Jan-Willem de Bruyn 17 posts 38 karma points
    Jul 05, 2012 @ 13:54
    Jan-Willem de Bruyn
    0

    May I ask, what umbraco version are you using? and is recent-comments your document type alias? then it should be

    <xsl:variable name="items" select="$Folder/ancestor-or-self::* [@isDoc and @nodeTypeAlias = 'recent-comments' and string(umbracoNaviHide) != '1']"/>

     

    and yes, there should be spaces in them

  • Nick 19 posts 39 karma points
    Jul 05, 2012 @ 13:56
    Nick
    0

    umbraco v 4.0.0 (Assembly version: 1.0.3317.32692)

    Should the document type alias be the parent folder or child alias?

    Thanks

  • Jan-Willem de Bruyn 17 posts 38 karma points
    Jul 05, 2012 @ 14:04
    Jan-Willem de Bruyn
    0

    Looks like I found the problem, you are using the legacy xslt scheme and I gave you the code for the new one...

    I'm not very familliar with it but maybo something 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"

     

      exclude-result-prefixes="msxml umbraco.library">

     

     

     

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

     

     

     

        <xsl:param name="currentPage"/>

     

     

     

        <xsl:template match="/">

     

            <xsl:variable name="Folder" select="umbraco.library:GetXmlNodeById('1955')" />

     

          <xsl:variable name="items" select="$Folder/ancestor-or-self::node [string(./data [@alias='contentTypeAlias']) = 'recent-comments']"/>

     

     

     

     

            <xsl:if test="count($items) &gt; 0">

     

                <div id="carousel">

     

                    <div class="es-carousel">

     

                        <ul>

     

                            <xsl:for-each select="$items">

     

                                <li>

     

                                      <xsl:value-of select="recent-comment-item" />

     

                                </li>

     

                            </xsl:for-each>

     

                        </ul>

     

                    </div>

     

                </div>

     

            </xsl:if>

     

     

     

        </xsl:template>

     

     

     

    </xsl:stylesheet>

  • Nick 19 posts 39 karma points
    Jul 06, 2012 @ 10:20
    Nick
    0

    Hi Jan, 

    Having a nightmare with this, could I get you on skype? my skype address is nick.rowe.sd1

    Thanks!

Please Sign in or register to post replies

Write your reply to:

Draft