Copied to clipboard

Flag this post as spam?

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


  • Owain Williams 481 posts 1413 karma points MVP 7x c-trib
    May 10, 2017 @ 14:08
    Owain Williams
    0

    create once, attach anywhere

    Hi, I'm looking for some help and guidance on a wee package / project I'm looking to start. I thought it was going to be as straight forward as creating a new document type but then I got thinking.

    The task:

    Display images / logos with alt tags on a page / all pages / specific pages in the footer of the page or where ever I want the banner to show.

    I want to add as many or as few images as I require.

    My thinking:

    Using a media picker I can pick a image and use a textbox to allow input of the alt text. But, I need to be able to add another image if I want but I don't want to have 5 media pickers when I might then need 6 or 7. So it has to be flexible. I would add a tickbox to my pages which would either enable or disable the selector from being shown on that specific page, as some pages may not need the option - alternatively, and this really is pushing my knowledge now, maybe create a new tab in the backoffice on the left hand side which I could then create options to display on specific pages. e.g.

    Image option 1, display on page 1,2,3 Image option 2, display on page 4,5,6

    As you can probably tell, I'm just thinking out loud but I think this could be a good side project for me, I just need a bit of help getting it started.

    Thanks,

  • David Hutson 48 posts 379 karma points
    May 10, 2017 @ 22:03
    David Hutson
    102

    Hi Owain,

    I have built a widget engine into my current project that allows for this type of thing that you are describing. It uses NuPicker, Nested Content to do the job. I believe you could also do it with archetype Nicholas Westby is a bit of wizard in Umbraco and his article is a great starting point for inspiration.

  • Owain Williams 481 posts 1413 karma points MVP 7x c-trib
    May 11, 2017 @ 08:27
    Owain Williams
    0

    Fantastic! This is exactly the sort of thing I was looking for. A good starting point where I can start to build something and then ask more specific questions if/when required. Thanks David!

  • David Hutson 48 posts 379 karma points
    May 11, 2017 @ 08:55
    David Hutson
    0

    Glad i could help. Below is the widget picker I have setup in Umbraco. It uses NuPicker for the property editor. My solution uses picked widgets that are pre-baked bits of logic or html. They live at the root of the site and act as reusable components. At present they are displayed in the right sidebar but could go anywhere it's just a partial view.

    enter image description here

    Widgets.cshtml

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage
    @using nuPickers
    
        @{
        var pickedItems = Model.Content.GetPropertyValue<Picker>("sidebarWidgets");
    
            foreach (var item in pickedItems.AsPublishedContent())
            {
               <div>@item.GetPropertyValue("widgetContent")</div>
            } }
    
Please Sign in or register to post replies

Write your reply to:

Draft