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.

General Questions

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

Global data


Reply

5 Posts   817 Views

Avatar
Rawbit

13 March 2009 at 2:44am Community Member, 52 Posts

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?

Avatar
SilverRay

13 March 2009 at 4:40am Community Member, 167 Posts

That would be a possibility indeed, see: http://doc.silverstripe.com/doku.php?id=recipes:example_of_quotes_on_a_page

Avatar
Willr

13 March 2009 at 3:40pm Forum Moderator, 5511 Posts

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

Avatar
Rawbit

20 March 2009 at 7:58am Community Member, 52 Posts

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?

Avatar
Rawbit

20 March 2009 at 8:49am Community Member, 52 Posts

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.