Copied to clipboard

Flag this post as spam?

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


  • Kurt Emch 44 posts 85 karma points
    Oct 13, 2012 @ 02:13
    Kurt Emch
    0

    Related Links not displaying 4.9

    I'm having some trouble with the Related Links data type. I can't get it to display the links in the template. From what I've read I need to use a macro, but I'm not sure.

    Here's what I've done:

    1. Created a Data Type and picked the Related Links data type. Called it RelatedSchoolLinks
    2. Created a new XSLT script file and Macro called RelatedSchoolLinks and chose the Related Links template. Left the file as is.
    3. Dropped the Macro into the template file.
    I have to be missing something but I can't tell what it is?

  • Ian 1 post 21 karma points
    Jan 15, 2013 @ 15:25
    Ian
    0

    Did you modify the propertyAlias in the xslt?

    see lines 15-16:

    <!-- Input the related links property alias here -->

     <xsl:variable name="propertyAlias" select="string('links')"/>

    I suspect you need <xsl:variable name="propertyAlias" select="string('RelatedSchoolLinks')"/> or whatever the alias is.

    Hope this helps

    Ian

  • Nigel Wilson 944 posts 2076 karma points
    Jan 16, 2013 @ 19:37
    Nigel Wilson
    0

    hi Kurt

    As suggested by Ian, make sure you get the alias of the property correct - typically it will be camel case, ie the first letter is lowercase, so in your case "relatedSchoolLinks".

    Cheers, Nigel

  • Charles Afford 1163 posts 1709 karma points
    Jan 26, 2013 @ 20:46
    Charles Afford
    0

    Kurt did you get this fixed?  Could you post the current XSLT you have and the property alias you have with the related links?  Charlie :)

  • Kurt Emch 44 posts 85 karma points
    Jan 27, 2013 @ 15:06
    Kurt Emch
    0

    By accident, we found the the built-in razro macro in the rich-text editor's pulldown. It was easy – worked just as expected provided the document type had the Related Links data and the its alias matched in the template.

    Not having any luck pasting code in here as you can see below!!

     

    @inherits umbraco.MacroEngines.DynamicNodeContext @{ if (Model.HasProperty("relatedLinks")) {
      @foreach (var link in @Model.RelatedLinks) { string target = link.newwindow == "1" ? " target=\"_blank\"" : "";
    • @if (link.type == "internal") { @link.title } else { @link.title }
    • }
    } } 
    
  • Charles Afford 1163 posts 1709 karma points
    Jan 27, 2013 @ 18:52
    Charles Afford
    0

    Hi Kurt, are you using Razor markup or XSLT?  I thought at the top of this thread you were using XSLT?  Charles.

  • Kurt Emch 44 posts 85 karma points
    Jan 27, 2013 @ 19:13
    Kurt Emch
    0

    Sorry for the confusion!

    When I first posted this question several months ago I was indeed trying to get it to work with XSLT. After I discovered the razor macro just worked, I abandoned putting anymore time into the XSLT option. Our developers prefer razor syntax anyway, so it was a win-win situation for us.

  • Charles Afford 1163 posts 1709 karma points
    Jan 27, 2013 @ 19:22
    Charles Afford
    0

    Glad you got it fixed.  Razor does seem to be more friendly as most .net devs use MVC thus Razor or XSLT.  Now i have been using XSLT a bit i dont find it so bad. Charlie.

Please Sign in or register to post replies

Write your reply to:

Draft