Copied to clipboard

Flag this post as spam?

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


  • Daniel 5 posts 25 karma points
    Oct 01, 2010 @ 10:24
    Daniel
    0

    How to add optional number of properties on a page?

    I'm kind of new to umbraco and have a few questions. I'm working on a template where I want to add optional number of 'things' to a page.

    First scenario, I wanna add quotes to a page and show them using jquery. The problem is that I don't know how many quotes. It can be anything from two to ten or even more. How can I add a property to a page that allows me to do this?


    Second scenario, in my right column I want to have optional number of "panels". Each panel should contain a textfield (title) and a html-editor (content). How can this be achieved?

    Appreciate any help! :)
    I have an account at umbraco.tv but I haven't been able to find a solution for what I'm looking for.

  • Daniel 5 posts 25 karma points
    Oct 01, 2010 @ 10:29
    Daniel
    0

    I tried to edit my post but I'm getting xsl parser error.

    Edit:
    First scenario, each quote consists of an image and two textfields. And it's the editor/customer that should be able to add this to a page.

  • Sascha Wolter 615 posts 1101 karma points
    Oct 05, 2010 @ 17:38
    Sascha Wolter
    1

    Hi Daniel,

    don't know if this is still an issue but here it goes:

    The most straightforward way to do this in Umbraco is to use sub nodes to populate this data. E.g. in your example your node structure for the page mentioned would be

    Page

    - Quotes

      - Quote 1

      - Quote 2

    - Panels

      - Panel 1

      - Panel 2

    On the page template you would then generate the output via a xslt script looping through the child nodes (there are a couple of examples how to do this in the Umbraco.tv section).

    Advantages:

    - you can have as many sub items as you like

    - the content is contained in the items themselves, e.g. if your quote consists of the quote text, author and date you would have these three properties on a quote item

    Disadvantages:

    - it might get a bit messy depending of the number of sub items/categories

    - you can't really re-use panels this way on multiple pages

    For the latter you might wish to create the panels outside of your page tree and then reference them from your pages e.g. by using the Ultimate Picker data type (or one of the more fancier packages where you can e.g. re-order the selected items).

    Hope that helps and gives you enough ideas to crack on,

    Sascha

  • Daniel 5 posts 25 karma points
    Oct 05, 2010 @ 22:17
    Daniel
    0

    Thank you very much Sascha!


    I will try to use the technique you described.

    Thanks again..

  • Petr Snobelt 923 posts 1535 karma points
    Oct 05, 2010 @ 23:20
    Petr Snobelt
    0

    Hi, Sascha solution is fine.

    If you don't want add much subnodes, you can try use repeatable-custom-content http://our.umbraco.org/projects/backoffice-extensions/repeatable-custom-content which enable similar solution without subnodes.

     

    Petr

  • Sascha Wolter 615 posts 1101 karma points
    Oct 06, 2010 @ 11:02
    Sascha Wolter
    0

    Thanks Petr, will definitely give that a shot in my next build. :)

Please Sign in or register to post replies

Write your reply to:

Draft