Jump to:

23360 Posts in 18124 Topics by 2862 members

General Questions

SilverStripe Forums » General Questions » Global data

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1
Go to End
Author Topic: 791 Views
  • Rawbit
    Avatar
    Community Member
    52 Posts

    Global data Link to this post

    Let's say I had a set of quotes, and I wanted them to display randomly on most of the pages - but wanted a place for them to be managed, what's the best way to do this? Create a special code page called QuotesPageManager.php with a HasManyComplexTableField and remove all the tabs except one that is called 'Quotes Manager' - something like this?

  • SilverRay
    Avatar
    Community Member
    167 Posts

    Re: Global data Link to this post

  • Willr
    Avatar
    Forum Moderator
    5483 Posts

    Re: Global data Link to this post

    A HasMany or a ComplexTable field for editing would be the way to go - http://doc.silverstripe.com/doku.php?id=complextablefield. If you are planning on having 30 or 40 quotes then you might like to use a ModelAdmin interface but that would be over the top for managing 10 or 20 of them

  • Rawbit
    Avatar
    Community Member
    52 Posts

    Re: Global data Link to this post

    There likely won't be more than 10 items. I actually have a tab on every Page called 'RelatedLinks'. This is a DataObjectManager that lets each page have it's own <ul><li> of links that relate specifically to that page. However, now I need 'GlobalLinks' that appear the same on every page - to me it doesn't make sense to have a tab on every page called GlobalLinks. In my mind there should only be one place where the user goes to edit this.

    So do I create a GlobalLinks.php class and in GlobalLinksPage.php I remove all tabs but my DataObjectManager? Or, do I use modeladmin?

  • Rawbit
    Avatar
    Community Member
    52 Posts

    Re: Global data Link to this post

    I've tried ModelAdmin but I see this just won't do, because I need the ability to at least have ComplexTableField but Ideally to use DataObjectManager so that I can sort this items. My understanding now of modelAdmin after setting it up (with help from stuckinrealtime on IRC) is that it really is only a data manager and cannot control any view in the CMS.

    So it looks like the only option is to create a special page type called GlobalLinks.php and remove all of the tabs on it. Then make a function in Page.php that gets this data for use in my template.

    Any feedback welcome.

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