Copied to clipboard

Flag this post as spam?

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


  • matthewbeta 4 posts 24 karma points
    Jun 21, 2011 @ 14:59
    matthewbeta
    0

    Doctype Property inheritance (Newbie)

    Hello all, Newbie question,

    I'm setting up a site on Umbraco, I've created a Doctype called "Base Page" and added site wide properties to it, such as Site URL, Footer text etc which will be the same on every page of my site. I've also added properties which change on each page (like Page Title etc)

    I want the site wide properties to be editable for the user, on the top node of the content tree. The thing is that the properties are also available on all the child nodes. I've read that when I add the items in the template, I can make them recursive so the child node will look up the tree and pull the content from the master page. But doesn't this means I'll have lots of redundant text editors/media pickers etc on my child content nodes?

    I have a feeling I might have a fundamental misunderstanding of how this works...

    Thanks in advance

    Matt

     

     

     

  • Rich Green 2246 posts 4008 karma points
    Jun 21, 2011 @ 15:15
    Rich Green
    0

    Hey Matthew,

    Welcome to the forum :)

    You've almost grasped it perfect but missing a few points if I understand you correctly.

    Not all DocTypes will need the same properties, for example, there will only need to be one Site URL/Footer text, so don't add Site URL to  Base doc type, something like this set up.

    ------- Base Doc Types (properties that are needed for every page, like Page Title, umbracoNaviNide, Meta Tags etc.)

     -------------- Home Page    (only include fields relevant to Home Page or needed once, like Site URL, Footer Text)

    -------------- Content Page (only include fields relevant to Content Page)

    Hope this makes sense.

    Rich

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Jun 21, 2011 @ 15:17
    Dirk De Grave
    0

    Hi Matt,

    there's a few packages out there that may take care of hiding properties on child nodes if you only want to edit these properties on the root content node. Check out the project section, in particular http://our.umbraco.org/projects/backoffice-extensions/uhidesy and http://our.umbraco.org/projects/backoffice-extensions/attackmonkey-tab-hider

     

    Hope this helps.

    /Dirk

  • matthewbeta 4 posts 24 karma points
    Jun 21, 2011 @ 16:21
    matthewbeta
    0

    Hi guys. thanks for the quick replies.

    @Rich - I see what you're saying, however in that set up wouldn't the editors have to enter the footer text on each page?

    @ Dirk - Was unawre of the package route. I will go check it out and post back if I find the answer there.

     

    Cheers again both of you!

  • Rich Green 2246 posts 4008 karma points
    Jun 21, 2011 @ 16:27
    Rich Green
    0

    Hey Matthew,

    " I see what you're saying, however in that set up wouldn't the editors have to enter the footer text on each page?"

    No, as you said in your post you can just get the value 'recursively', so it just needs to be entered in the Home Page, in fact they can't put the text anywhere else as it's only on the homepage DocType!

    (Unless I'm mistaken footer text is global for the whole site right?)

    Rich

     

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Jun 21, 2011 @ 16:28
    Dirk De Grave
    0

    Rich's suggestion is ok, but could move the footer text property on the Base Doc Type so it becomes available on all child doc type documents, and it's convenient if you want to override the value from the default you specify in the Base Doc Type document. If overriding is not the case, move it to the Base Doc Type and hide it using one of the packages I've mentioned before

     

    Cheers,

    /Dirk

     

  • Rich Green 2246 posts 4008 karma points
    Jun 21, 2011 @ 16:41
    Rich Green
    0

    Agree with Dirk.

    Though it just comes down to if the value is global (ie Site Name) or could possibly change (ie Footer Text), this has nothing to do with Umbraco, just down to your site / needs.

    So, if it's global do not include it in the Base Doc Type, if it's per page or can be overridden put it in the base Doc Type.

    Rich

  • matthewbeta 4 posts 24 karma points
    Jun 21, 2011 @ 17:26
    matthewbeta
    0

     

    Hi again, thanks for the responses.

    @Rich, if I understand what you've written above, my content should look like the below:

    ------------------------------------

    Content

    -BasePage (Contains properties which need ot be updated on all pages)

    --Home Page (Contains properties - home page specific content, Any content repeated on each page [set to recursive=true] for example "footerText")

    --About Page (Contains page specific properties, calls umbraco item "footerText")

    --Contact Page (Contains page specific properties, calls umbraco item "footerText")

    -------------------------------------

    Will I be able to call the footer text from the other pages if they aren't child nodes of the home page?

    @Dirk, I had a look at the packages you mentioned. It is definitely a solution. I would rather achieve it without the use of a package though if possible. Just to have more of an understanding of how Umbraco works at its base level. Once I've worked out the limitations and best practice, I'll be more than happy to add extra packages : )

    Thanks again both for your help on this

     

  • Rich Green 2246 posts 4008 karma points
    Jun 21, 2011 @ 17:32
    Rich Green
    0

    Hey,

    All looks good to me.

    To answer this one "Will I be able to call the footer text from the other pages if they aren't child nodes of the home page?"

    Yes, as long as the page is a descendant of the Home page, which all content pages will be then you'll be able to grab the value recursively, it doesn't have to be a direct child, so:

    Content

    --- Home

    ------------ Content Page

    ------------------Other

    ------------Content Page 2

    ------------------Other 1

    ------------------Something else

    ------------------------Under something else

    All the above pages can get the value from the homepage.

    Rich


     

     

  • matthewbeta 4 posts 24 karma points
    Jun 22, 2011 @ 10:58
    matthewbeta
    0

    HI Both, I managed to get it working after sleeping on it. Thanks both for helping me not to lose my sanity!

    If anyone is interested, here's what I did:

    My fundemental misunderstandign was that Doctypes don't have to be nested. I created 2 seperate doctypes: 1 for a Site, 1 for a Page. My Site DT had properties like header text and Footer text which are global to the site and will be editable but the same on each page. My Page DT had page specific properties, such as welcome text, page title etc and set up the allowed child nodetypes for the Site DT to include the Page DT.

    I then made sure the Page Template was nested under the Site Template. Added my HTML and then my Umbraco Page Fields (like headerText etc) to the Site template, making sure I ticked the "Recursive" check-box. Then added the content placeholders to include my Page template. Then set up my Page template in the same way, ensuring the content placeholder IDs matched those on the Site template.

    When I created and published the content nodes they looked like this:

    Content
    -Site
    --Page

    I entered the information into my property fields, published both nodes and previewed the Page Node. Boom. Success. (My understanding is that I need to add a Umbraco Redirect property to the Site DT to allow it to point to the Node which will become my home page, but that's a fight for another day!)

    I strongly advise other newbies to get involved on the forum and not waste time looking online for already solved problems or documentation. I found the forum method much quicker than I expected and both Dirk and Rich were really helpful.

Please Sign in or register to post replies

Write your reply to:

Draft