Copied to clipboard

Flag this post as spam?

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


  • Ariel Plon 14 posts 123 karma points
    Mar 12, 2015 @ 23:22
    Ariel Plon
    0

    Variable content rendering

    Hey guys, being new to Umbraco, I'm scratching my head again with this challenge (which BTW should be very simple to resolve).

    Let's say I need to create a home page with a carousel. If the amount of slides is fixed, then there is no problem, as I can add as many properties to the Document Type (image, text, etc.) as the number of slides I need.

    Now for the difficult part. If we do not know how many slides the carousel will carry, I cannot pre-determine the amount of slides (and I think it's not a good practice to add MANY properties, one for each potential slide, and let the content manager leave empty the ones they will not use). So what would be the est approach to creating a Document Type that can hold variable amount of repeatable data (the image, title and text)?

    We are using Umbraco 6.2.5 as Framework 4.5 is not yet approved. I saw that in Umbraco 7.X, you can choose a property to enable lists in the document type. What would be the way to achieve the same in Umbraco 6.2.5?

    On a further note, I found a blog that explained how to show the all the images from a "folder" in Umbraco, but I also find this solution to be less than "world class". The other problem with this approach, it's that you cannot insert text into the image (like an overlay), so this solution gets ruled out.

    Any ideas?

    Best regards, Ariel 

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Mar 12, 2015 @ 23:36
    Dennis Aaen
    100

    Hi Ariel,

    The approach I would use there is create a shared content folder document type, that is placed in the same level as your hompage. In there will make a document type called e,g slider container, and make another document type called slide item, The container items just holds the slider items, so you need to allow the slider item as childs for the slider container document type.

    On the slide item you could add the properties for pick the image (media picker or image cropper) and add fields so your user could type the text on each slides. Then you add the a multi node tree picker on the document type for the pages where the user should be able to add the slider. The user picks a container folder, and you will then loop through the slides items.

    By using the multi node tree picker the user can use the same slider on different pages, and you have the option to lock it down, so the user is only able to pick the slides container document type and you can set a minimum and maximum numbers of items.

    Try to see the documentation for the multi node tree picker here.https://our.umbraco.org/documentation/Using-Umbraco/Backoffice-Overview/Property-Editors/Built-in-Property-Editors/Multi-Node-Tree-Picker

    Hope this make sense, and helps,

    /Dennis

  • Ariel Plon 14 posts 123 karma points
    Mar 14, 2015 @ 15:46
    Ariel Plon
    0

    Thank you Dennis. I tried a "quick and dirty" approach with your techniche and could not make it work, so I'll have to study some more. In the mean time, I solved the problem by adding a child content type for the content type that displays the slider, where each content is 1 slide (image and text). However, I really do not like this solution and will definitely look and study further into your suggestion.

    Thaks again, Ariel

Please Sign in or register to post replies

Write your reply to:

Draft