Copied to clipboard

Flag this post as spam?

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


  • W.Meints 1 post 21 karma points
    Sep 21, 2010 @ 19:28
    W.Meints
    0

    Resolve base type of a specific node

    Hi,

    It's all pretty new to me and I'm probably doing this the wrong way around. But here's what I'm trying to do.

    I have a home page that has several child pages, one set of these pages derive from ContentPage and another set derives from Element. The idea here is that a content-editor can create elements that get rendered in specific zones on the home page, depending on their type. The other pages are real content pages and should be part of the menu I'm rendering on the page.

    The elements part is working out pretty good. I can handle specific types of content, by selecting them from the XML tree using any of the following xpath queries: $currentPage/Highlight or $currentPage/Headline etc.

    The problem however lies in the menu. I want to be able to detect whether a node returned in the XML is derived from a ContentPage or an Element. The actual content may vary, but a NewsPage always derives from ContentPage.

    Is there a trick to get this working or do you have a different idea that helps me get the whole idea of having elements on a page working?

     

  • Sascha Wolter 615 posts 1101 karma points
    Sep 21, 2010 @ 20:07
    Sascha Wolter
    0

    Hi,

    if I understand you correctly then you want to check in your xsl script if a document type for a node has either the document type ContentPage or the document type Element as parent?

    If that is the case then I'm afraid there is no Umbraco function etc. which you can use here. The doc type inheritance is pretty much limited to the backend configuration and not as such meant to be of any impact on the frontend display. Yet you can make this work for you nevertheless: you would have to make the check yourself in the database, ie get the ids of your 2 parent doc types, then look up the doc type in question and see if they have either id in the parent column.

    You can get around this by creating the same kind of structure in the content as well, then you'd just have to check if the doc type of the parent content node is of a certain type or not. This means creating nodes in the content which just have organizing function. This should be okay for you as you won't associate a template to elements of a page anyway (otherwise you'd get ugly urls).

    Hope that helps,

    Sascha

Please Sign in or register to post replies

Write your reply to:

Draft