Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Harry Spyrou 212 posts 604 karma points
    Aug 15, 2018 @ 11:49
    Harry Spyrou
    0

    All of the website's nested Content in a DocType and picking by tabs

    Hello!

    I have a website that has A LOT of nested content. So far what I was doing was creating DocTypes for everything I needed.

    This list is getting extremely big now that the site is expanding and I thought of a different solution.

    Migrate all of my Nested Content in a Nested Content docType and separate my fields by tabs. The problem is that I have duplicates e.g. first tab has a 'title' alias and second has another 'title' alias. That means I'm not allowed to save them.

    Right now I'm not using Custom controllers or Models or ModelsBuilder and I'm just accessing the property values with Model.GetPropertyValue<whatever>("alias") in views. The goal is at some point to move everything (one at a time) in custom models. The question here is this:

    Should I just rename the second 'title' field to something else and have different aliases for everything or just keep separate doctypes for my nested content?

    Any help appreciated.

    Thanks, Harry

  • Ben Palmer 176 posts 842 karma points c-trib
    Aug 15, 2018 @ 19:39
    Ben Palmer
    100

    Hi Harry,

    What I like to do with regards to the same field name in different tabs is simply keep the same name but manually update the alias. So for example, if you have a tab of Form and a tab of Promo Box and they both have a Title field, you'd change the aliases to formTitle and promoBoxTitle. That way, it's really clean in the CMS, let's you save and works really nicely with the models builder because the models are generated based on the alias, rather than the title.

    Having said that, I prefer to keep my nested content separate as when you begin to use models builder, it will generate clean models and it will make more sense in your code. If you have everything in one tab, you'll end up having a NestedContent model which isn't really readable.

    The only thing I'd do is create a Nested Content folder in the Document Types section to hold all of the document types. That will keep it clean and easy to use in the CMS.

    Hope that makes sense,

    Ben

  • Harry Spyrou 212 posts 604 karma points
    Aug 15, 2018 @ 20:15
    Harry Spyrou
    0

    Thanks Ben

    Having said that, I prefer to keep my nested content separate as when you begin to use models builder, it will generate clean models and it will make more sense in your code. If you have everything in one tab, you'll end up having a NestedContent model which isn't really readable.

    That's exactly what I was looking for. As the project is about to go into a more MVC kind of architecture I felt like the correct way is what you suggested which is I have a 'Nested Content' folder and I throw everything about it it in there, which also looks clean, but lets me save 'title' with everything.

    Cheers!

Please Sign in or register to post replies

Write your reply to:

Draft