Copied to clipboard

Flag this post as spam?

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


  • Neil Norpa 24 posts 44 karma points
    Apr 19, 2011 @ 23:15
    Neil Norpa
    0

    help with inline XSLT for a jQuery slider

    Hi i have created a some properties within a document type a media picker, a textstring and a richtext property.

    slide1image = media picker

    slide1hyperlink = textstring

    slide1caption = rich text.

    so

    in html the slider looks like this

    <div id="slider" class="nivoSlider">
    <a href="#"><img src="img/vision-feature1.jpg" alt="vision-feature1" title="This is an example of a caption one" /></a>
    <a href="#"><img src="img/vision-feature2.jpg" alt="vision-feature2" title="This is an slide 2 of a caption " /></a>
    <a href="#"><img src="img/vision-feature1.jpg" alt="vision-feature1" title="#htmlcaption"/></a>
    </div>

    so i wrote some inline xslt to see below which gets the img src section for each slide but also wrapped around the href pulling the url from the content (textstring)

    <a href="<umbraco:Item field="slide1hyperlink" runat="server"></umbraco:Item>">

    <umbraco:Item runat="server" field="slide1image" xslt="concat('&lt;img src=&quot;',umbraco.library:GetMedia({0}, true())/umbracoFile, '&quot; alt=&quot; alt text here &quot; title=&quot; caption text &quot; /&gt;')" xsltDisableEscaping="true"/></a>

    My problem is this the caption which is displayed in each slide is held within the richtext property but is fetched using the title of the img tag (see html).

    How do i add the umbrao item (slide1caption)to the inline code adding the page field property to the xslt within the title property.

    <umbraco:Item runat="server" field="slide1image" xslt="concat('&lt;img src=&quot;',umbraco.library:GetMedia({0}, true())/umbracoFile, '&quot; alt=&quot; alt text here &quot; title=&quot;1caption property slide &quot; /&gt;')" xsltDisableEscaping="true"/></a

     

    Any help would be appreciated, i have tried to use getitem but it failed, probably due to syntax.

    Regards

    Neil.

     

     

     

  • Nigel Wilson 944 posts 2076 karma points
    Apr 20, 2011 @ 00:35
    Nigel Wilson
    0

    Hi Neil

    Woud you not be better to have the caption field a textfield / textfield multiple. If it is a simple peice of text this will ensure it is just text - no html formatting as per a rich text editor.

    Then I would assume it would be a case of :

    <a href="<umbraco:Item field="slide1hyperlink" runat="server"></umbraco:Item>" title="<umbraco:Item field="slide1caption" runat="server"></umbraco:Item>">

    Cheers

    Nigel

  • Neil Norpa 24 posts 44 karma points
    May 22, 2011 @ 19:41
    Neil Norpa
    0

    The problemis that the caption is held as part of the image tag

     

    namely the title,as below

    <a href="#"><img asrc="img/vision-feature1.jpg" alt="vision-feature1" title="This is an example of a caption one" /></a>
  • Nigel Wilson 944 posts 2076 karma points
    May 22, 2011 @ 20:03
    Nigel Wilson
    0

    Sorry but I do not fully understand the issue.

    Personally I would be writing a simple XSLT for the output, and either calling it multiple times or using the variable '$currentPage' if possible.

    In my opinion this would prove easier to debug as the output html is more clearly defined, etc.

    Nigel

  • Petr Snobelt 923 posts 1535 karma points
    May 22, 2011 @ 21:17
    Petr Snobelt
    1

    I think you should use excelent XSLT Macro Engine http://www.screenr.com/Rf9 and you can write multiline inline xslt, which can solve your problem.

    Otherwise you can use something like this:

    <a href='<umbraco:Item field="slide1hyperlink" runat="server">'>
     <img src='<umbraco:Item runat="server" field="slide1image" 
        xslt="umbraco.library:GetMedia({0}, true())/umbracoFile" >'
        title='<umbraco:Item field="title property" runat="server">'/>
    </a>

    Petr

Please Sign in or register to post replies

Write your reply to:

Draft