Copied to clipboard

Flag this post as spam?

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


  • suzyb 474 posts 932 karma points
    Sep 04, 2012 @ 16:25
    suzyb
    0

    Selectable panels, allow usercontrols

    I need to do something like is mentioned in this thread, allow the right column of pages to be customised by adding different "panels" to it.

    I was going to do something like Matthias sugggested and have a folder with all the panels that can be chosen at the top level of the site.  These can then be selected on each page using the multi-node tree picker.

    I notice Matthias uses xslt in his solution.  However I will need to be able to have some panels that use user controls which afaik do not work when added using xslt.

    Is there another way of adding these panels onto a page.  Would a razor macro work.

  • Drew 165 posts 340 karma points
    Sep 04, 2012 @ 18:50
    Drew
    1

    You're right, one of the best ways to go about it is to create a 'Settings' or 'Boxes' section in your content tree and allow the various doctypes that your boxes use to be created there, then use MNTP to let users select the boxes they want to show on each page.

    Obviously you'll need a macro in XSLT or Razor that loops through the boxes assigned to that page and builds the HTML.

    For your boxes that use an ASCX, I'm not sure you can do this easily - in either XSLT or Razor you can look at using the 'RenderMacroContent' option if you create a separate macro to call each ASCX.

    @Html.Raw(umbraco.library.RenderMacroContent("<?UMBRACO_MACRO macroAlias=\"SuggestionBox\" />",Model.Id))

    Another option is to look at whether you need your ASCX control, can it be put into the Razor or XSLT script?

    Or can it be bundled into an XSLT extension or library method which generates the HTML - which you can then easily call from your Razor or XSLT.

     

    Cheers,
    Drew 

  • suzyb 474 posts 932 karma points
    Sep 06, 2012 @ 11:09
    suzyb
    0

    The panel I was thinking would need to be an ascx was a search form.  But thinking more about it that may not be necessary and may in fact make coding the search easier if it isn't.

Please Sign in or register to post replies

Write your reply to:

Draft