22850 Posts in 9874 Topics by 2803 members
|Go to End|
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?
13 March 2009 at 4:40am
That would be a possibility indeed, see: http://doc.silverstripe.com/doku.php?id=recipes:example_of_quotes_on_a_page
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
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?
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.
|Go to Top|