Copied to clipboard

Flag this post as spam?

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


  • Gerhard 7 posts 27 karma points
    Feb 05, 2013 @ 17:15
    Gerhard
    0

    Some advise on how to extend Umbraco in several ways

    I just recently made the move to Umbraco. So far I've completed the following tasks:

    • I've installed Umbraco
    • Created a basic website with multilanguage support
    • Created a few masterpages
    • Written some razor scripts, for example for the navigation (working per language)
    • Added two web user controls, that display twitter and Instagram data. (Still need to dive into MVC)

    So at this point the basic website is working. But I've got to implement more dynamic stuff, such as a blog with categories, a news page and a photo gallery with text per photo. And all this has to be multilanguage. How should I do this?

    What I'm working on now is still pretty simple. I've got to implement an accordion at a biography page. This is what it looks like:

    1995
    - a bit of text about 1995
    1996
    - a bit of text about 1996
    1997
    - a bit of text about 1997

    etc.
    So, when a user clicks on a date, the hidden div with the textual content of that year appears.

    Now, I need to create a table that stores the data, and a UI control where our client can input the data. And I have to embed this into Umbraco. I don't think that I can create something for that "out of the box", right? I need to extend Umbraco, right?

    So I red the following tutorial:

    http://www.geckonewmedia.com/blog/2009/8/3/how-to-create-a-custom-section-in-umbraco-4

    But I'd say that it would be more logical (and I don't know if this is possible) to create a custom tab for the biography page that loads a user control. Is something like this possible? And if so, should I create a custom data type to acomplish this?

    Concluding, it's still a bit overwhelming, and I don't know exactly what I can do and where I can find the required information. Can you guys please give me some good further reading material, and can you point out how I should implement something rather simple such as this accordeon?

    And one last question, I don't believe that are up to date books for current Umbraco versions?

    Thank you in advance,
    Gerhard.

  • Bo Damgaard Mortensen 719 posts 1207 karma points
    Feb 05, 2013 @ 21:51
    Bo Damgaard Mortensen
    1

    Hi Gerhard,

    I can't give you any reading material, but may I suggestion that you subscribe to umbraco.tv? :-) There's some video tutorials there to get kicked into the API, workflow with Umbraco and so on, so forth.

    About the accordion: I think it's worth considering what should be nodes and what shouldn't be nodes in the content tree. In my opinion, any user generated content should be put in custom database tables (such as comments, contest attendants etc etc) and any content that should be displayed/presented at the website should be nodes in the content tree (makes sense since it's easier to edit for the editor)

    So, considering your accordion: there's no user-generated data for that, so you could go for a node-based solution, which is easier to parse and easier for the editor to maintain. Consider the following structure in the content tree:

    - Biography accordion
    - 1995 (header: textstring, bodytext: textbox multiple)
     - 1996 (header: textstring, bodytext: textbox multiple) 
    - 1997 (header: textstring, bodytext: textbox multiple) 

    Ultimately, you could take it a step further and create a "folder" node for accordions to separate it a bit from the other content. Consider this structure:

    - Accordions
    - Biography accordion
    - 1995 (header: textstring, bodytext: textbox multiple)
      - 1996 (header: textstring, bodytext: textbox multiple) 
    - 1997 (header: textstring, bodytext: textbox multiple) 

    The above structure is a bit more long-term solution since you can have more accordions under the "Accordions" "folder" node.

    Now, let's pretend you need to develop a news section with a comment function for each news item in the news section. A news section in Umbraco is generally structured like this:

    - News
    - Year
    - Month
    - Day/date
    - News item (id: 1520)
     - News item  (id: 1240)

    Having a structure like this makes it easy for the editor to get an overview over the news items instead of having 200+ news item under one node: "News". For the comments function, you could aswell have a "folder" node under each News item node for the comments, like this:

    - News
    - Year
    - Month
    - Day/date
    - News item (id: 1520)
    - Comments
    - Comment1 by user1
    - Comment2 by user1
    - ....
     - News item  (id: 1240)

    However, imaging when the site grows and a news item gets 400+ comments a day, that makes for quite a bunch of nodes. Since the comments are user generated content, I prefer to create a database table for storing them there instead of nodes. A comment table *could* look like this:

    id
    nodeId
    author
    date
    commentText 

    Which is fairly basic. Note the "nodeId" field in the tabledesign. This is for creating a relation (not an actual DB relation, though) to the news item node which the comment should be "related to"

    The above solution then leads to another question: "What happens when an editor deletes a news item which has comments?" The comments will still remain in the custom table and thus be redundant data. However, we're able to hook up on Umbracos Document events (link: http://our.umbraco.org/wiki/reference/api-cheatsheet/using-applicationbase-to-register-events/overview-of-all-events) so whenever the Delete (when the node is deleted from the Recycle Bin!) we'll check on the NodeTypeAlias to see if it's a news item node. If it is, we'll grab it's node ID and start deleting the comments with the matching node id.

    Anyway, this was a lot of ramblin' and there's just as many ways of doing stuff in Umbraco as there's developers. Bottom line: I think it's important to consider what is actual content and what is "data" (for the lack of a better word)

    Let me know if any of the above is completely nonsense ;-)

    All the best,

    Bo

  • Gerhard 7 posts 27 karma points
    Feb 06, 2013 @ 20:15
    Gerhard
    0

    Thank you very much for your in-depth answer! It's highly appreciated.

    I now see what I *should* have done... But when trying to find my way around alone, I installed uComponents last night and used the datagrid-thingy to solve my accordion requirements, like this:



    However, I see your point and I definitely will try to set it up news in the provided structure. I also understand what you wrote about the comments table and deleting related data; I've made a few very complex databases and love to mess around with triggers, that trigger other triggers, even wrote a hook to .Net to delete filesystem stuff with TSQL triggers. Anyway ;) I guess I could do that for Embedded SQL as well, thought I'm not sure if it supports it, if not I will use the provided Events.

    I start liking Umbraco more and more :)

  • Gerhard 7 posts 27 karma points
    Feb 21, 2013 @ 20:53
    Gerhard
    0

    Last update:

    It's true what they say about the learing curve of Umbraco; it's steep indeed. And although the video's are nice; you've got to find all the other answers elsewhere since the documentation on Umbraco has only partially been done. Most of the time Stackoverflow is your friend, the forum has some answers and the website Nibble.be is really an excellent source of additional info. After a few weeks of wrestling with stuff, I really feel confident about what I am doing and how it should be done, the Umbraco way :)

    I'm now using datatypes and custom written datatypes all over the place; I have no problems rendering content in the frontend (the actual website) whatsover, and I've written my first event handlers to delete attached filesystem objects. I feel that I'm close to mastering Umbraco :)

    Thanks!

Please Sign in or register to post replies

Write your reply to:

Draft