Jump to:

1383 Posts in 492 Topics by 521 members

Themes

SilverStripe Forums » Themes » Dynamic Blocks depending the Parent

Discuss SilverStripe Themes.

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

Page: 1
Go to End
Author Topic: 882 Views
  • LokNessMobster
    Avatar
    Community Member
    1 Post

    Dynamic Blocks depending the Parent Link to this post

    I have searched and I don't see any mention of this, I may be searching for the wrong words too so sorry if this has been covered. I am a little weary of posting since I feel like someone would of wanted to know about this by now.

    Either way, I have basically two parents that have the same child pages beneath them, they are operating as store locations so they have their own blogs, events, etc.. My theme has two blocks in the header of each child page that contains the latest news and upcoming events. I made these blocks in the controller and have it returning what i need and it works how I want but I feel like their may of been an easier way and if not then this will maybe help someone else doing the same thing.

    Either way I got a DataObjectSet of the information I need by querying with a Where clause using the pages ParentID for the blog container. Only problem is that I had to manually make defines for each sections BlogHolder ID to use in the ParentID comparison. I feel like their might be a better way to get only the content I need from anywhere within the child pages that doesn't involve me having to make defines for the ID's. I know that it is unlikely that they will change but it seems wrong to have hand typed those.

    I switched to SS recently and loving it so far but before this I used primarily CodeIgniter, CakePHP, and Drupal so it might just be that i am used to building it from scratch myself and with Drupal I am used to everything being the way Drupal does it, which I don't particularly care for Either way, great CMS and I can see what the community is growing over here.

    Any ideas or suggestions would be appreciated.

    Thanks
    Tom

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