+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Custom Layout Widgets with Placeholders

Custom Layout Widgets with Placeholders

4 posts, 0 answered
  1. Kurt
    Kurt avatar
    11 posts
    Registered:
    25 Oct 2010
    14 Jun 2012
    Link to this post
    I am still trying find a way to accomplish #4 as mentioned in this Thread

    I don't know if the semantics are correct, but simply put, I would like to make my own layout widgets that are similar in function to the layout widgets when editing a page. You drag and drop a layout onto your page, then you can add a generic content widget inside it. This would work excellent when I want to wrap 'generic content' with unique markup.

    I believe the intended results are all the same, but depending on how people on the forums frame the problem, I am reading it's both possible and impossible. (A user control with a placeholder, a widget with a layout, etc.) 

    Is there any way to accomplish this?

      
  2. Jen Peleva
    Jen Peleva avatar
    568 posts
    Registered:
    10 Nov 2016
    14 Apr 2013
    Link to this post
    Hi Kurt,

    Please check the following thread and especially the reply of my colleague Stanislav Velikov about creating custom layout controls. I believe it suits your requirement:

    http://www.sitefinity.com/developer-network/forums/suggestions---/contentplaceholder-in-usercontrol

    All the best,
    Jen Peleva
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. AG
    AG avatar
    13 posts
    Registered:
    20 Aug 2013
    25 Oct 2013 in reply to Jen Peleva
    Link to this post
    Same question here as the OP. I followed the link posted by Jen, but the other thread doesn't really answer this specific question:
    How to create a custom layout widget with a placeholder that can be dragged and dropped into a page and allows to insert another Content block widget?

    The problem I have with how the tutorial describes building a custom layout widget is that the code output requires the use of sf_cols and other Sitefinity specific classes. Besides, it creates redundand code like this (as generated by Thunder):

    <div runat="server" class="sf_cols">
    <div runat="server" class="sf_colsOut sf_2cols_1_50 CustomClass1">
    <div runat="server" class="sf_colsIn sf_2cols_1in_50">
    </div>
    </div>
    <div runat="server" class="sf_colsOut sf_2cols_2_50 CustomClass2">
    <div runat="server" class="sf_colsIn sf_2cols_2in_50">
    </div>
    </div>
    </div>

    If I need a simple 1 column container, I can edit the above to make it into a 1 div container. However, it still involves using at least two div's since without a class of sf_colsIn, the placeholder associated with this layout widget doesn't display. As such, the custom layout is useless.

    Secondly, I'd like to use my own custom CSS classes without any instance of Sitefinity specific classes.

    And lastly, not every page construction requires layout widgets or content blocks that involves div's. I'd like to be able to create a custom layout for ex. a H1 element, or any other HTML elements. For ex:
    <h1 class="customClasshere">title</h1>
    That's the output I'd like to see from the CMS. No Sitefinity classes, no id's, nothing.

    Is this possible?

    Thanks,
  4. Ivan D. Dimitrov
    Ivan D. Dimitrov avatar
    310 posts
    Registered:
    26 Mar 2015
    30 Oct 2013
    Link to this post
    Hello Kurt,

     You are correct - our layout widgets cannot contain only one div tag. The classes are required in order for them to be able to contain widgets and other content. Our css classes are easily overwritten so you can just do so and apply your new style to the layout.

    I admit that there is a lot of markup generated when creating a Sitefinity page, but that is by design and that enables all of the functionality our CMS offers. By design you are not able to alter html elements such as h1 and so on. If you wish to do so you can always add raw html in our content widget and it will be displayed as such.

    Regarding the usefulness of the layout widgets - if you are not satisfied with them you can always create a page template and assign ContentPlaceHolders( these are not simple div tags) anywhere on the page you like. There you have controls over styles and classes as they do not use our Sitefinity classes.

    Regards,
    Ivan D. Dimitrov
    Telerik
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
4 posts, 0 answered