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.

General Questions /

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

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

Global data


Go to End


5 Posts   1419 Views

Avatar
Rawbit

Community Member, 52 Posts

13 March 2009 at 2:44am

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

Community Member, 167 Posts

13 March 2009 at 4:40am

Avatar
Willr

Forum Moderator, 5523 Posts

13 March 2009 at 3:40pm

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

Community Member, 52 Posts

20 March 2009 at 7:58am

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

Community Member, 52 Posts

20 March 2009 at 8:49am

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.