Dynamic content and "advanced" output

Roar Ytre-Eide
Member since: 2007

I have a challenge. It's like a footnote in the text which will be a link to a comment further down on the page. I want to create dynamic content that handles this. Add new comment -> Insert footnotenumber -> insert comment..

Output: Footnumber (with link to comment) where the dynamic content is inserted. And in the bottom of the page, Comments (all). See example in bottom.

I think there is a way to override a method that writes out the fragments.

This is an example<sub>1</sub>
blah blah blah
blah blah blah
blah blah blah<sub>2</sub>


List of comments/footnotes:
Comment/footnote1: Example is a blaha blah
Comment/footnote2: ...

#26016 Nov 18, 2008 9:33
  • henriknystrom
    Member since: 2004

    To me that doesn't seem like a good candidate for Dynamic Content since it needs to be inserted at separate points and the inserted content as you describe it doesn't seem dynamic!

    However I think it should be a better match for a regular Editor plugin. There should be documentation on this site on how to create such a plugin.Please post back if you need some more pointers for this.


    #26020 Nov 18, 2008 10:52
  • Roar Ytre-Eide
    Member since: 2007

    Thank you. I see your point. Yes, if you have some pointers, please :)

    - Roar

    #26031 Nov 18, 2008 13:29
  • Anders Hattestad
    Member since: 1996


    I tend to disagre with Henrik. Dynamic content will be a good method of inserting comments marks and adding text bellow.

    Have made some code that actully does this :)

    The Comment class is the dynamic content implementation. This class will return a CommentControl that will check the parent control collection and find what number the comment is. It will also add the actully comment to the parent control collecction.


    The best part is that this code dosnt need any other stuff. It will just manipulate the parent's control collection

    #26050 Nov 18, 2008 22:48
  • henriknystrom
    Member since: 2004

    You are right Anders, that was a pretty clean solution. :)

    Can't really be sure what the parent is always though...

    #26052 Nov 19, 2008 2:26
  • Anders Hattestad
    Member since: 1996


    i have been thinking about contextes the parent would be null, but i cant think about any times this will occure. but some error handling would of course be an improvment to the codeSmile

    #26055 Nov 19, 2008 8:42
  • Roar Ytre-Eide
    Member since: 2007

    I agree with H.N. (first post) that this is not dynamic content. But I believe Dynamic Content is a nice way to do it, at least compared to how it is done today. Thank you both for your contributions, and especially Anders for his code contribution! Cool


    #26089 Nov 20, 2008 8:47
  • Anders Hattestad
    Member since: 1996

    I faiil to see why this isnt a good why of using dynamic content. The dynamic part of this is the numbering of the comments.

    If you want to make a editor plugin you have to store the points where the comments are placed inside the text, and you have to make a new property too render the content and place the comment text bellow the text.

    That is 2 places you have to make a change.

    #26093 Nov 20, 2008 10:12
  • Steve Celius
    Member since: 2001

    I think this is a good candidate for DynamicContent (DC).

    Scatter DC comment instances around your text, and when you render each one, add it to a comment collection in the HttpContext.Current.Items collection, so each comment will get is number in the collection (which you also use as a reference in the text.)

    When you get to the bottom, just iterate over the comment collection from the HttpContext.Current.Items["MyProp_Comments"] propert (which you of course have to create and handle.)

    This will give you two nice features:

    1. Each comment can be edited separately in the DC popup, and you can even add more information about the comment.

    2. You can insert new comments anywhere in the text, and all comments will be automatically re-numbered (as the number is not determined before the whole thing is rendered.)

    You could optionally add the comment renderer (the one at the bottom) as it's own DC, and not part of the page.


    #26158 Nov 24, 2008 9:50
  • Anders Hattestad
    Member since: 1996

    One problem with that solution is that the editor have to remeber to add the last DC. But the cool thing about it is that the count will be uniqe on the page so 2 properties mainbody and manbody2 would not share the comment number.

    Maybe you could combine Steve's method and mine http://paste2.org/p/103672


    #26160 Edited, Nov 24, 2008 10:03