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

DataObjects Per Page Instance


Go to End


14 Posts   4466 Views

Avatar
martimiz

Forum Moderator, 1391 Posts

15 March 2011 at 7:00am

I would try and use the default DataObjectManager instead, as that will correctly define a direct relation between an individual Page and its DataObjects.

Hope that helps

Avatar
martimiz

Forum Moderator, 1391 Posts

15 March 2011 at 7:03am

OK - just saw your latest post fly in :-) If the correct PageID is set in the DataObject, then how are you retrieving your dataobjects for your Page in the frontend?

Avatar
Lazarus404

Community Member, 72 Posts

15 March 2011 at 8:45am

Not entirely sure. It's only showing the one, as I've not added new items yet. I think it may be because I haven't added any items for that particular page (or I'm hoping). Still, even if that side really works, I'm still getting ALL dataobjects in the admin. The items now have checkboxes, so I can choose what to include on the current page, but what I really want is to not see those items created in the other page at all. Do you think that's possible by filtering somehow in the getCMSPopup function?

Thanks,
Lee

Avatar
martimiz

Forum Moderator, 1391 Posts

15 March 2011 at 11:50am

Edited: 15/03/2011 11:51am

Still not absolutely clear about what you're asking. Is your question really about the way the dataobjects are shared among pages within the cms? In that case: did you try using the regular DataObjectManager instead of the hasmany variant? Cause the regular one will display only those DataObjects that belong to your page as I guess you want...

if its about the way they are displayed on your website, The answer most likely lies in the way your template is set up, but you didn't respond to that so I figure that's not the problem?

Avatar
Lazarus404

Community Member, 72 Posts

15 March 2011 at 12:28pm

Yes I mean CMS.

I tried changing it, but the same still held (albeit with a different look and feel). The objects need a HTML editor in the popup, so I really need the DataObjectManager module for these.

Thanks,
Lee

Avatar
martimiz

Forum Moderator, 1391 Posts

15 March 2011 at 10:34pm

I still think (in fact I'm sure) the problem lies in your (initial) use of the HasManyDataObjectManager. The following will indeed give you the same look and feel, but will limit the display of DataObjects to the page they belong to:

$contentTablefield = new DataObjectManager(
         $this,
         'PanelItems',
         'PanelContent',
         array(
            'Title' => 'Title',
            'Group' => 'Group Name',
            'Content' => 'Content'
         ),
         'getCMSFields_forPopup'
      ); 

Go to Top