Jump to:

1835 Posts in 1139 Topics by 554 members

Blog Module

SilverStripe Forums » Blog Module » LinkingMode Functionality in Year Archive

Discuss the Blog Module.

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

Page: 1
Go to End
Author Topic: 647 Views
  • timwjohn
    Avatar
    Community Member
    98 Posts

    LinkingMode Functionality in Year Archive Link to this post

    Hi again,

    I've created a method in my page class that outputs a list of blog publication years for use in my navigation:

       public function getBlogYears()
       {
          $archivewidget = new ArchiveWidget();
          $archivewidget->DisplayMode = 'year';
          return $archivewidget->Dates();
       }

    In template:

       <ul class="nav">
          <% control BlogYears %>
             <li>
                <a href="$Link" class="$LinkingMode">$Date.Year</a>
             </li>
          <% end_control %>
       </ul>

    It's outputting the dates and linking them perfectly.

    I didn't expect $LinkingMode to work. How would I get that functionality in this case, so the selected year can be highlighted?

  • TomMiller
    Avatar
    Community Member
    26 Posts

    Re: LinkingMode Functionality in Year Archive Link to this post

    Hi timwjohn,
    i'm currently having the same issue with linkingmode. Have you found a solution?

    Tom

  • timwjohn
    Avatar
    Community Member
    98 Posts

    Re: LinkingMode Functionality in Year Archive Link to this post

    Hi Tom,

    No I abandoned this and used the vanilla archive widget. One thing that just sprung to mind is the use of InSection(). Not sure if it would work, but perhaps you could test InSection(Date.Year) or something like that?

    Let me know if you have any success.

    Tim

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