Copied to clipboard

Flag this post as spam?

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


  • Maximilian Csuk 2 posts 22 karma points
    Aug 19, 2010 @ 15:40
    Maximilian Csuk
    0

    Parent/Child relationship: pages and content

    Hi there!

    I am pretty new to Umbraco, so bear with me. :-)

    Every CMS I've tried out so far made a distinction between a "page" and some form of "content". For example, in Typo3 you create a new page and add content, either using the ready-made content-types or your own. The content automatically shows up on the page when viewing it. Same goes for Joomla or whatever...

    Now I get that Umbraco does not make this distinction and it's completely up to you to define this type of hierarchy, right? And that's what I want to do... I think of it like this (please correct me if I am wrong in any aspect):

    I create a "content" document type which acts as a base for every other content. This doesn't need a template.
    I create several specialised content document types, like a "textContent" document type which has a property named "text", for example. These derive from the "content" document type. Each has it's own template which controls the rendering.
    I create a "page" document type which mimics the "page" I described above. How would I do that?!? It should basically loop through all sub-content-nodes (only the ones deriving from the "content" document type) and display each with the matching template.

    The content-creaters of the site can then just create a new "page" and add content by adding new "content" nodes as children of the "page" node.

    What I found was advices to loop through the sub-content-nodes and display them using XSLT, but I want to render  the various "content" document types using their associated templates. Wouldn't that be a lot clearer? If there was a new type of content (like imageContent or videoContent), I'd just create a new document type and template, again derive from "content" and each new content-item a site-maintainer adds would appear on the right page without touching any XSLT at all.

    Is this how one would do this? Or am I misunderstanding something fundametal?

    Thanks in advance,
    Maximilian Csuk

  • Sascha Wolter 615 posts 1101 karma points
    Aug 21, 2010 @ 01:43
    Sascha Wolter
    0

    Hi Maximillian,

    I think you are slightly off in your view, although it is not too far off to be honest. In general you define document types, which pretty much are the heart of the system and which usually do three things:

    - define the content which can be held on that type of document (e.g. a title as text, a date as date/time and some body text in a richtext editor0
    - define the template which is used to render this content
    - define the structure of the document types (e.g. that when you create a 'News' node it can only have nodes of doc type 'News item' as children)

    These doc types are basically the schema of the pages you can create - content and layout. They are obviously useless until you actually create a content node, which is done by creating a new node of a certain document type. With that you have already defined the Url for that node and thereby defined a specific page on your web site. So as you can see there is no realy distinction between content  and page in Umbraco: a content node defines at the same time the page on which the content will be shown.

    However you can mix things up a bit, which goes in the direction of what you are talking. Let's say you have a page with some introduction text and a photo gallery on it. No you can define a doc type 'Photo gallery' and a type 'Photo gallery image', the first one has a field with a richtext edior on it, the second one a Media picker (referencing an image in the media library) and short description or title of the image. Now you can create the nodes in the content like this:

    'My photo gallery'        | of type 'Photo gallery'
    - Image 1                     | of type 'Photo gallery image'
    - Image 2
    - Image 3
    - ...

    As you don't want to show just one image on a page you decide to not associate a template with the 'Photo galler image' document type. The url for these images is nevertheless created, e.g. '/my-photo-gallery/image-2.aspx', yet the page will just be blank (you can automatically redirect to the gallery by adding a rule to the UrlRewriting.config file). On the gallery page itself you would want to have the intro copy first, and then loop through all the Images, grab the media image and the title and display them for each image in a nice grid. In this case you could say that the image nodes are just content or data, however in the strong sense they aren't, they are still pages where you can browse to.

    Hope that sheds some light on your questions. Have a look at Umbraco.tv (at umbraco.org) for some more insights.

    Cheers,
    Sascha

  • Maximilian Csuk 2 posts 22 karma points
    Sep 22, 2010 @ 16:22
    Maximilian Csuk
    0

    Thank you for your very helpful post, that did indeed shed some light on the subject!

    But unfortunately it's not the answer I would've liked. This doesn't seem like a very clean way, but I am willing to try it out and maybe it does prove me wrong. Are there any tutorials describing how to loop through the sub-content-nodes and display them? I am new to XSLT as well, so a beginner tutorial would also be greatly appreciated. My boss doesn't (yet) want to pay for a umbraco membership so I can only access the free resources.

    Thanks again!

  • Sascha Wolter 615 posts 1101 karma points
    Sep 22, 2010 @ 19:07
    Sascha Wolter
    0

    Hi Maximillian,

    there are a couple of wiki pages that will help you get started, although they will mostly deal with general Xsl methods/elements they will get you into it quite fast. The best way to start off is probably to get your hands dirty right from the start: When you create a new Xslt you can choose a blank template or from a range of basic templates to start from, like a sub node listing.

    Hope that helps,

    Sascha

Please Sign in or register to post replies

Write your reply to:

Draft