So I'm wondering if this is even possible. I have a wish that goes something like this.
My general thought is to use items for all that it is worth, and I would also like to reuse items inside other items.
I have three items, and the are setup like this.
- Banner Container
- Title (text)
- Banners (Item relation list <Banner>)
- Banner
- Text (Text)
- Image (File)
- Button (Item type <Button>)
- Button
- Text (Text)
- Link (Link)
This works out just fine, no problem with the setup. I have also created one template for "Banner Container" where I currently have all my code.
I loop through the list of banners, show them and also show my button. This actually is okay, but I want to improve this setup.
My issue is with the "Button". I would really like to use this item type in other items, and I would really like to maintain my code for the button in one place only.
So my thought was to create a new razor file for my button "Button.cshtml" where I put all my button specific code. Then I would like to use Include/IncludeFile where needed, ex. in my "Banner Container" template. I tried this, but it gave me a lot of issues with razor.
Does anyone have examples of how this can be done, pelase point me in the right direction :)