Jump to:

3429 Posts in 1057 Topics by 734 members

Data Model Questions

SilverStripe Forums » Data Model Questions » Inject controller action into menu

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

Page: 1
Go to End
Author Topic: 696 Views
  • r0nn1ef
    Avatar
    Community Member
    6 Posts

    Inject controller action into menu Link to this post

    I've been working with SS for awhile now, but for the life of me can not figure out how to inject a page controller action into the menu system.

    For example, I have a TeamPage with the url of /team that shows photos and info of the officers and squads. I also want to use the same page for the individuals' photos. So the URL for that page would actually be /team/individuals. I can create the page controller action fine, but getting it in the menu and labeled "Individuals" is where I'm running into problems. I've tried a virtual page and redirector page, but they don't let me choose actions from an existing page.

    Anyone have a place for me to start on this one?

    Thanks in advance.

  • martimiz
    Avatar
    Forum Moderator
    1067 Posts

    Re: Inject controller action into menu Link to this post

    Assuming StaffMember to be the DataObject for individual persons, you need is a Link() function in StaffMember that creates a unique link based on the Link of the page it belongs to. You can then use that link in a <% control StaffMembers %> loop within your menu.

    There's a nice tutorial on the subject here:

    http://www.ssbits.com/tutorials/2010/dataobjects-as-pages-part-1-keeping-it-simple/

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