Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Template Questions /

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

Linking mode - always on problem


Go to End


3 Posts   2320 Views

Avatar
Mackodlak

Community Member, 95 Posts

1 October 2011 at 12:25am

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="//www.silverstripe.org/ForumMemberProfile/edit" title="Uredi svoj profil">Uređivanje profila</a></li>
<% end_if %>

Avatar
Willr

Forum Moderator, 5523 Posts

1 October 2011 at 4:42pm

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="//www.silverstripe.org/ForumMemberProfile/edit" title="Uredi svoj profil">Uređivanje profila</a></li>
<% end_if %>

Avatar
Mackodlak

Community Member, 95 Posts

3 October 2011 at 7:51pm

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...