Jump to:

3444 Posts in 1030 Topics by 871 members

Template Questions

SilverStripe Forums » Template Questions » Linking mode - always on problem

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 631 Views
  • Mackodlak
    Avatar
    Community Member
    95 Posts

    Linking mode - always on problem Link to this post

    Why is this always on? I am not on this page, and in navigation $LinkingMode always returns positive so it's "selected"
       <% if CurrentMember %>
          <li class="$LinkingMode"><a href="ForumMemberProfile/edit" title="Uredi svoj profil">Uređivanje profila</a></li>
       <% end_if %>

  • Willr
    Avatar
    Forum Moderator
    5502 Posts

    Re: Linking mode - always on problem Link to this post

    The issue for code is that your scope for the $LinkingMode is the page that you're on, so of course it'll always be selected since it's always the page your on. To get it working for that piece of code you'll need to compare the current $URLSegment..

    <% if CurrentMember %>
    <li class="<% if URLSegment = ForumMemberProfile %>active<% else %>link<% end_if %>"><a href="ForumMemberProfile/edit" title="Uredi svoj profil">Uređivanje profila</a></li>
    <% end_if %>

  • Mackodlak
    Avatar
    Community Member
    95 Posts

    Re: Linking mode - always on problem Link to this post

    Hey Willr,

    thank you for your answer, this helps somewhat, but not entirely. It is not correctly showing as link, and not section, when I'm on some other page, but then it also shows link when I am on profile edit page. I don't rly understand why, It should work imo...

    631 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.